Unity Procedural Dungeon Generator

A Tool Designed For Developers to Create Procedurally Generated Dungeons in Unity Using Custom Prefabs

About The Project

A versatile, general-purpose dungeon generation tool for developers of any discipline. This project provides a solid foundation for dungeon-crawler games allowing developers to expand and customise dungeons to suit the game's needs.



The features are the following:

Development

1. Layer-Based Dungeon Generation

The dungeon is generated one floor at a time. Each layer stores its walkable tiles as a HashSet<Vector2Int>, which ensures extremely fast lookups when placing walls or identifying ladder positions. Parent objects are created for each layer to keep the Unity hierarchy structured and readable.

Layer Generation

2. BSP Room Splitting

The dungeon begins as one large region which is recursively split into smaller sections using a Binary Space Partition (BSP) tree. Each leaf of the tree becomes a room, with size and offset randomised inside that region.

This method ensures rooms never overlap and creates naturally spaced layouts.

BSP Splitting Logic

3. Corridor Carving

Rooms are connected using simple corridors. The generator chooses whether to carve horizontally or vertically first, based on a “straightness” parameter, allowing both structured and more organic layouts depending on the configuration.

Corridor Carving

4. Wall Placement & Ladders

After floors and corridors are carved, walls are automatically generated by checking each tile for missing neighbours. Adjacent floors are compared to detect shared walkable tiles, which become valid ladder placement points to connect multiple layers.

Walls & Ladders

Full Code Available on Request

Download Project

Still in Active Development, Visit the Itch Page Below


Visit Itch Page