Dungeon Generator


A procedural dungeon generator which provides variety every play.

Dungeon Generator is a procedural dungeon crawler where no two runs look the same. Every playthrough, an algorithm builds a fresh layout of rooms, corridors, items, and coins from scratch, so exploring never feels repeated. I designed and built the entire project solo in Unity (C#), with the procedural generation system as the technical core the rest of the game was built around.

How I built it

The focus of this project, was the procedural generation algorithm. I took creating this on as my final year project in university where I spent roughly three months researching procedural generation before creating this project in a month.

Populating the dungeon with objects works the same way — I go through the list of floor tiles and roll the dice on each one to decide whether it gets an object. If it does, another roll picks which object from the pool gets placed there. Every object in the dungeon is destroyable and keeps track of its own health.

The generator’s foundation is a simple random walk: starting from a tile, it takes a series of random steps, and the trail it leaves behind becomes the dungeon’s layout. To create rooms instead of thin corridors, I repeat that walk multiple times from the same starting point — the overlapping paths naturally fill out into an open area. With the layout generated, I move on to rendering it: I collect every tile marked as floor and draw them first, then scan for all tiles adjacent to floor tiles and convert those into walls, complete with colliders for collision.

When generating a new dungeon, I first clear out the old one entirely — deleting all existing tiles, objects, and colliders — before running the generation process again from scratch.