{"id":13598043,"url":"https://github.com/amitp/mapgen2","last_synced_at":"2026-01-27T02:05:25.238Z","repository":{"id":41233287,"uuid":"734216","full_name":"amitp/mapgen2","owner":"amitp","description":"Map generator for games. Generates island maps with a focus on mountains, rivers, coastlines.","archived":false,"fork":false,"pushed_at":"2025-05-07T16:32:55.000Z","size":200,"stargazers_count":1327,"open_issues_count":2,"forks_count":211,"subscribers_count":111,"default_branch":"master","last_synced_at":"2025-05-07T17:39:43.019Z","etag":null,"topics":["maps","procedural","procgen"],"latest_commit_sha":null,"homepage":"http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/","language":"ActionScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amitp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-06-22T17:08:16.000Z","updated_at":"2025-05-07T16:32:59.000Z","dependencies_parsed_at":"2022-08-02T11:52:48.847Z","dependency_job_id":null,"html_url":"https://github.com/amitp/mapgen2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amitp/mapgen2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitp%2Fmapgen2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitp%2Fmapgen2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitp%2Fmapgen2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitp%2Fmapgen2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amitp","download_url":"https://codeload.github.com/amitp/mapgen2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitp%2Fmapgen2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28796962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T01:07:07.743Z","status":"online","status_checked_at":"2026-01-27T02:00:07.755Z","response_time":168,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["maps","procedural","procgen"],"created_at":"2024-08-01T17:00:46.827Z","updated_at":"2026-01-27T02:05:25.231Z","avatar_url":"https://github.com/amitp.png","language":"ActionScript","readme":"[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)\n\nAfter working on a [Perlin-noise-based map\ngenerator](http://simblob.blogspot.com/2010/01/simple-map-generation.html)\nI had wanted something with islands and rivers and volcanoes and\nlava. However, I had a lot of trouble getting that map generator to\ngenerate any more than what it did at first. This project was my\nexploration of several different techniques for map generation.\n\nThe goal is to make continent/island style maps (surrounded by water)\nthat can be used by a variety of games. I had originally intended to\nwrite a reusable C++ library but ended up writing the code in\nActionscript.\n\nThe most important features I want are nice island/continent\ncoastlines, mountains, and rivers. Non goals include impassable areas\n(except for the ocean), maze-like structures, or realistic height\nmaps. The high level approach is to\n\n  1. Make a coastline.\n  2. Set elevation to distance from coastline. Mountains are farthest from the coast.\n  3. Create rivers in valleys, flowing down to the coast.\n\nThe implementation generates a vector map with roughly 1,000 polygons,\ninstead of a tile/grid map with roughly 1,000,000 tiles.  In games the\npolygons can be used for distinct areas with their own story and\npersonality, places for towns and resources, quest locations,\nconquerable territory, etc.  Polygon boundaries are used for\nrivers. Polygon-to-polygon routes are used for roads. Forests, oceans,\nrivers, swamps, etc. can be named. Polygons are rendered into a bitmap\nto produce the tile map, but the underlying polygon structure is still\navailable.\n\nThe [full process is described here](http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/).\n\nHistory\n-------\n\n*   I started out with C++ code that used mountains, soil erosion, water flow, water erosion, water evaporation, volanoes, lava flow, and other physical processes to sculpt terrain expressed in a 2d array of tiles. However as described [in this blog post](http://simblob.blogspot.com/2010/06/teleological-vs-ontogenetic-map.html) I decided to abandon this approach.\n\n*   Since my initial approach failed, I wrote several small prototypes to figure out how to make rivers, coastlines, and mountains. These are the key features I want to support. I will then figure out how to combine them into a map.\n\n*   The voronoi_set.as prototype worked well and I continued adding to it (instead of converting to C++). It supports terrain types: ocean, land, beach, lake, forest, swamp, desert, ice, rocky, grassland, savannah. It has rivers and roads. I decided not to convert it to C++ for now. Instead, I've refactored it into the core map generation (Map.as), display and GUI (mapgen2.as), graph representation (graph/*.as), decorative elements (Roads.as, Lava.as), and noisy edge generation (NoisyEdges.as).\n\n\nRequirements\n------------\n\nThese third-party requirements have been added to the ``third-party`` directory:\n\n* [as3delaunay](https://github.com/nodename/as3delaunay) for the Voronoi algorithm\n* [as3corelib](https://github.com/mikechambers/as3corelib) for PNG export\n* The AS3 version of [de.polygonal.math.PM_PRNG.as](http://lab.polygonal.de/2007/04/21/a-good-pseudo-random-number-generator-prng/) for consistent random numbers\n\nMake sure you run ``git submodule update --init`` to check out the third-party libraries.\n\nCompiling\n---------\n\nTo compile ``mapgen2.as`` to ``mapgen2.swf``, use the following command:\n\n    mxmlc -source-path+=third-party/PM_PRNG -source-path+=third-party/as3delaunay/src -source-path+=third-party/as3corelib/src mapgen2.as -static-link-runtime-shared-libraries\n\n","funding_links":[],"categories":["ActionScript","Video Games"],"sub_categories":["Game Engine"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famitp%2Fmapgen2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famitp%2Fmapgen2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famitp%2Fmapgen2/lists"}