I’ve been playing some roguelikes recently, so I wanted to try writing my own procedural dungeon generator. There are a lot of different ways to approach this problem, but I eventually decided to base mine off of TinyKeep’s algorithm, described here. I extended the algorithm to work in 3D, to create dungeons with multiple floors.
The code for this example available in this Github repo. I’m using Unity3D for this demonstration, but these concepts are, of course, usable in any game engine.