‘dungeons’ is the 2D dungeon crawler I mentioned earlier. The main focus is on procedural generation of ‘levels’ with a number of randomly scattered features; rooms, keys, gold and enemies, for the moment.
At the moment, when a level is generated, the following events occur:
- Rooms are generated with a random size in random locations. Each room has a random number of doors cut into the walls.
- The each door is randomly connected to another randomly chosen door using a simple implementation of A* Pathfinding (inspired from this helpful article). After being connected, the door is marked as such, so that it cannot be chosen again. This has two downsides: 1 – There will always be a door that is the last one standing and permanently unconnected. This could be a room with one door. 2 – Paths cannot currently overlap, so it is somewhat messy.
- The middle start area of each level is created at the center. This contains the up and downstairs to the previous or next level. The top most level never has an upstairs, for obvious reasons.
- Gold is scattered around for points, keys are scattered around to unlock the trapdoor leading down to the next level. Both are spawned only within rooms, and having more than one key (currently up to five) combats the first disadvantage mentioned in point 2 above.
- The corridors and room walls are decorated, sort of Dungeon Keeper style. This is done by recognizing the ‘passability’ of tiles surrounding each tile and deciding on which type of layout it is. An example is a right hand corner.
- Finally, monsters are spawned. These are passed the current level tile data to decide where they can move, and move with a bias towards their current directions rather than turning, so are decorated like zombies for now.
When the player plays the level, all tiles are hidden except those they have just passed. These are revealed with a cardinal line of sight of 5, then forgotten on a tile by tile basis after five seconds, unless a torch item is placed down.
That’s all for now. I’ll release a playable version as soon as its a bit less buggy and a bit more interesting to play. If you want to play it now anyway, send me a tweet and I’ll get back to you soon.