Platformgen (for #procjam 2014)
A downloadable source code for Windows, Mac OS X, and Linux
This code procedurally generates maps for a 2D platform game. Each map is made by dividing the entire map space into distinct rooms, and connecting those rooms with stairways and ladders. An analysis pass identifies the walkable areas of the map that can be reached from the upper-left-most room.
Once a map has been generated, it is displayed in a GUI window.
Some additional goals for this generator were not achieved during #procjam:
- Saving the generated map
- Ensuring all areas of the map are reachable
- Placing level start and exit points and objectives
- Filling room backgrounds procedurally
This code is free software under the MIT license, so you may do pretty much whatever you want with it.
You can download the zip of the source code as it was at the end of #procjam 2014, or check it out from github, where further development will be made available.
You will need
Python 2.6 or later to run the generator. Generate a tile map by running
The generator currently generates the same level every time, to make debugging easier. To change this, edit gen_tilemap.py, remove the line that sets a specific seed, and uncomment the line that uses the time to set the seed.