Dungeon Generator for Dungeons and Dragons


The drunkard walk has ups and downs when it comes to realism. One of the better things is that the drunkard walk can typically generate compact layouts, which compliments organized structures. However, the drunkard walk can also generate in ways where layouts become very linear, which I don’t want with my sub requirements. To the players, this can look odd if it happens too often, so you need rules to the drunkard walk if you want consistency in realistic designs. It is also the reason I decided to always turn around whenever we go up, otherwise long designs will still happen. The reason I only go up is to make it more likely that the boss is generated further away from the entrance.

An issue with the drunkard walk is that typically it happens on a grid. This can be fine gameplay wise, but every single room being square gets boring quickly. This is a problem for my code specifically, because I refused to use an array for this. After reconsidering how to implement bigger rooms like a 2 by 2 rooms, I find it not the best idea to ignore using a two dimensional array. It would have saved me time and there should be little performance issues for this size at the very least.

Figure 13. More dungeon layouts that are somewhat realistically generated.
Figure 14. Examples of linear dungeons and thin parts where there is clearly one room leading to the next section. This happened frequently enough that it needed changing.

When it comes to the content of a room, you can easily get good results by separating objects to generate in the middle and side of the room. That is also the main solution for furniture in general, you’re likely not going to place a barrel holder in the middle of the room because that takes precious space. There are more methods, like symmetry, but placing things in the middle and the side were very common patterns when I was looking for examples.

The terrain generation has been a waste of time. There is no clear connectivity to the functions of the room. You can have damaging terrain in a kitchen, but you need some good reasons as to why that is happening. Adding furniture to the room was a better method to both add context and terrain features. It is also more convenient. A row of bookshelves in the middle of the room can serve as a wall, a stack of boxes can serve as a hiding spot for goblins and the tables serve as either movement reduction terrain when climbing them or cover when thrown over. This can serve as terrain itself and the other method is a feature that can be discarded.

When comparing my generator with Donjon, there are again positives and negatives. In Donjon, an entire structure of a dungeon is always a rectangle. It never generates an interesting building shape. My generator creates a little bit of different things every time. See figure 15 as an example. Can I still get those shapes though? Potentially, but not always which is better for variation. Another positive is that I have furniture placed, which Donjon rarely has and even then, you don’t see it on the map. Donjon has better path layouts, where as mine only has simple pathing. Donjon also has a bit better generation for the rooms themselves when it comes to placement. My dungeons always are placed in a grid like manner and that gets boring and unrealistic every time. Donjon doesn’t and rooms always feel like they are in different positions which makes sense. It also has doors, but that wasn’t a priority.

Figure 15. Donjon always generates a specific shape. In this example, it drew a rectangle on the left outlined in red. My generator generated something else on the right (d20 Random Dungeon Generator, sd).


If I were to continue my work, I’d first focus on the room shapes. The current method works, but when every room is square, there is a problem. Just removing some tiles doesn’t help. The terrain generation may need to be thrown out, it doesn’t help at all and actually gets in the way of furniture generation and generates impossible terrain.

After those are done, the furniture can get some more attention as this is a quantity task and just getting inspired by other people’s their (dungeon) maps.

The paths themselves also need some improvement and may need to be reworked.

Some testing would also help to see the reactions of the players, because while the dungeon master may like it, the players may not.

The social interactions and exploration part I’ve messed up. I tried multiple lists of ideas and combining them to create one good concept, but I lacked the creativity to do it properly. It also feels like you can get quickly through the lists and get repeated outcomes fast. I also failed to realize that you need to combine the pillars as much as you can. The combat is probably the most important part for my games though. Probably won’t continue with them and just hand craft them.


Boris. (2020, September 12). Dungeon Generation in Binding of Isaac. Retrieved from Boris the Brave: https://www.boristhebrave.com/2020/09/12/dungeon-generation-in-binding-of-isaac/

d20 Random Dungeon Generator. (n.d.). Retrieved from Donjon: https://donjon.bin.sh/d20/dungeon/

Daniel Karavolos, A. B. (2015, June 22). Mixed-Initiative Design of Game Levels: Integrating Mission and Space into Level Generation. Retrieved from HvA Research Database: https://research.hva.nl/en/publications/mixed-initiative-design-of-game-levels-integrating-mission-and-sp

Merwin, S. (2020, January 8). Let’s Design an Adventure: Encounters and the Three Pillars. Retrieved from D&D Beyond: https://www.dndbeyond.com/posts/693-lets-design-an-adventure-encounters-and-the-three

Toolkit, G. M. (2016, April 12). How (and Why) Spelunky Makes its Own Levels. Retrieved from YouTube: https://www.youtube.com/watch?v=Uqk5Zf0tw3o&t

Wizards of the Coast. (2014). Dungeon Master Guide. Wizards of the Coast.

Wizards of the Coast. (2014). Lost Mine of Phandelver. Wizards of the Coast.

Related Posts