Home

Awesome

No Maintenance Intended

After working on a Perlin-noise-based map generator I had wanted something with islands and rivers and volcanoes and lava. However, I had a lot of trouble getting that map generator to generate any more than what it did at first. This project was my exploration of several different techniques for map generation.

The goal is to make continent/island style maps (surrounded by water) that can be used by a variety of games. I had originally intended to write a reusable C++ library but ended up writing the code in Actionscript.

The most important features I want are nice island/continent coastlines, mountains, and rivers. Non goals include impassable areas (except for the ocean), maze-like structures, or realistic height maps. The high level approach is to

  1. Make a coastline.
  2. Set elevation to distance from coastline. Mountains are farthest from the coast.
  3. Create rivers in valleys, flowing down to the coast.

The implementation generates a vector map with roughly 1,000 polygons, instead of a tile/grid map with roughly 1,000,000 tiles. In games the polygons can be used for distinct areas with their own story and personality, places for towns and resources, quest locations, conquerable territory, etc. Polygon boundaries are used for rivers. Polygon-to-polygon routes are used for roads. Forests, oceans, rivers, swamps, etc. can be named. Polygons are rendered into a bitmap to produce the tile map, but the underlying polygon structure is still available.

The full process is described here.

History

Requirements

These third-party requirements have been added to the third-party directory:

Make sure you run git submodule update --init to check out the third-party libraries.

Compiling

To compile mapgen2.as to mapgen2.swf, use the following command:

mxmlc -source-path+=third-party/PM_PRNG -source-path+=third-party/as3delaunay/src -source-path+=third-party/as3corelib/src mapgen2.as