Map generator

Create a randomly-generated map and export it as JSON for use in Javascript (or any other) games.

Based on Gamedev Tuts and @McFunkypants' Random World Generator.

For a roguelike game I'm making in HTML5 I needed to create random maps each time the game started. I came across the cellular automata procedural generation article on Gamedev Tuts and adapted it to create levels from within the game.

I also created a standalone version which creates a JSON tilemap to be used in other projects. The standalone version includes a very basic visualisation with HTML5 canvas and allows generated maps to be downloaded in JSON format. There are also a variety of controls to alter the world - you can try changing the birth and death rates to see how the cellular automata algorithm alters the generated world. You can also smooth the generated map which helps make it look more naturally-created (so fewer blocky edges), or add randomly-placed treasure spots.

Have a look at the standalone version here, or find thecode on Github.