Just a short post to demo a map generation mechanism. Full source included, but no absolutely no support. Feel free to play around with it. The dungeon generator is very crude, I put it together in a couple of hours yesterday, and it has no concept of walls, walkable tiles etc, just pointers to graphic tiles.
Basically what it does is:
- takes a large rectangle
- randomly divide it horizontally / vertically
- keep doing this until each room left is considered small enough
- convert each room (a rectangle) into a 1 d array containing all rooms, rooms are converted by entering codes for the room into the array, such as TL (top left corner), T (top row), TR (top right etc).
- now that all the rooms are in the array we process each room, by giving it a door in a random location connecting it to another room (on some occassions we have a secret/magic unconnected room)
- finally the tile independent map is converted to a specific tileset. We put one together using the LostGarden indoor tileset again, which we manipulated into several large building blocks to make generating rooms much easier 😉
Basically that is all there is to it, on my pc it generates about 20000+ rooms in a second, on the iPad it takes a bit longer, but still manages a nice 50-60 fps without Starling (then again this is still very simple and basic without any interactivity).