The simplest way to explore the maps is to click Random repeatedly. Try the various Island Shape, Point Selection, and View options.
Feel free to use these maps for any purpose, including commercial use. This is a map generator I wrote in 2010 for a game[4]; I’m not working on it anymore, but all the code is available so that you can download and modify it for your own needs. I also have an HTML5 version of mapgen2[5] that has slightly different features.
In a shape number like 85882-8
, 85882 chooses the overall island shape and 8 is the random number seed for the details (random points, noisy edges, rivers). You can type in a shape number and press Return to generate that map. The details will vary based on the other options you’ve selected.
I wrote an article describing the algorithms, and how you can use all or some of the parts in your own projects. I generate island maps with constant slopes here, but you can use the same ideas for many different styles of maps. Notes:
- Radial, Perlin, Square, Blob are about the island shape.
- Random, Relaxed, Square, Hex are about how the map is divided up into polygons.
- Using 4000 or 8000 points can be slow. I’ve tried 16,000 but Flash gets rather buggy so I didn’t put it in the demo.
- The PNG output is 2048x2048, and draws the selected mode (biomes, polygons, 2d slopes, etc.). It’s slow. I don’t include the noisy bitmap dots so that you can more easily use this in your own projects.
- The byte array output are a 2048x2048 height map, a 2048x2048 moisture map, and a 2048x2048 array of bit flags, which you can decipher by looking at
exportOverrideColors
inmapgen2.as
[8]. - The 3D slopes output is slow (I wrote this a long time ago, before GPU acceleration was generally available in browsers).
- There are lots better ways to render the maps, but I haven’t explored them. For this project I was focused on the generation of structured maps.
- I also implemented road and lava algorithms but didn’t include them in this demo.
- The watershed detection algorithm is unifnished. I was hoping it would be useful for assigning territorial control. I will revisit it when I want to procedurally generate towns, cities, nations, histories, etc.
The code is open source, using the MIT license (allows commercial use). I put it up on Github.[9] Sorry, it’s not designed to be easy to reuse. I focused instead on explaining the concepts in the article, so that you can implement the algorithms yourself. I did not implement the Voronoi algorithm; I used an existing library for this.
The original demo I posted in 2010 is here. Changes: I took out roads; I added PNG export; I added byte array output (e.g. height maps); I added control over the number of points; I added control over the distribution of points.