Members - Reputation: 429
Posted 30 March 2012 - 08:07 AM
I am working on a simple method of generating dungeons for my game. So far, I have a system that will generate rooms in random places of random sizes but I need a way to connect them to eachother with corridors.
I read that the way in which I connect the rooms and make corridors will give the feeling of the dungeon, so I don't think that using a pathfinding algorithm that connects the midpoints of all the rooms would be very interesting. There is also the problem of making sure every place is reachable.
Can someone suggest how I could connect the rooms?
Members - Reputation: 465
Posted 30 March 2012 - 08:28 AM
I'd first by saying I'd consider having a tiled type map/grid where I give the generator 1000x1000 blocks to work with. Each room can consume a specific minimum/maximum number of blocks in my grid. Each room generated has both an entry point and an exit point that the generator uses to connect them after rendering the location and size of the room. The generator uses the grid to place the rooms somewhat adjacent to one another and after you know it's placement, the generator would use smaller blocks to create corridors between the rooms.
Another idea would be that your dungeons aren't randomly generated but part of the designer developed map. What actually becomes random would be the creatures that you want to have spawn in your dungeon as your players move through them. Another variety is you use a variety of static maps you design and with the use of "teleporters", the dungeon spawner determines which of the static maps are chained together and in what order and your players traverse the dungeon this fashion.
A few good examples of the later exist in the latest World of Warcraft model which adds some variety to the same dungeon while keeping it somewhat familiar and consist to the player when they return back to that dungeon.
Both all models would work well depending upon your intent.
Members - Reputation: 1058
Posted 30 March 2012 - 09:21 AM
However, I must say that having experimented with all of this before, getting truly random dungeons while maintaining good results (variety, consideration of other gameplay elements, etc.) can get very complicated very quickly.
Members - Reputation: 877
Posted 31 March 2012 - 09:49 AM
for natural caverns you could use somekind of brush that travels the map and paints the dungeon. I used a rectangle that represented tiles, make a random length for it to travel then check if there is room for it and travel that length while you adjust the width of the rectangle and "paint" each step. Make it so it sometimes overlaps already painted sections and when it gets close to the edge of the map it should prefer a opposite direction a couple of steps. This could end up in really long narrow caves with larger open area's.
Latest finished project Project