◆ SYSTEM LOG
BSP DUNGEON GENERATION
Recursive binary space partitioning for dungeon layouts that read as authored rather than random.
PLACEHOLDER COPY. This is the page shape, not the content. The interactive generator demo slots in below “Watch it run” once we build it.
The problem
Random room placement produces dungeons that are unpredictable but not interesting — you get overlapping rooms, dead space, and no sense of a floor plan. I wanted layouts with structure: a dungeon that looks like someone built it and something else moved in.
How binary space partitioning works
- Start with the full dungeon footprint as one rectangle.
- Split it — horizontally or vertically — into two child rectangles.
- Recurse on each child until the partitions are close to the target room size.
- Carve a room inside each leaf partition, inset by a random margin.
- Walk back up the tree, connecting sibling partitions with corridors.
The tree is what makes this work. Because siblings are always adjacent in space, connecting them bottom-up guarantees a fully connected dungeon with no pathfinding pass required.
Watch it run
(interactive generator — coming next)
Tuning knobs
| Parameter | Effect on the dungeon |
|---|---|
| Min partition size | Floor on room size; smaller values make warrens, larger make halls |
| Split ratio range | How lopsided a split can be; near-0.5 gives grid-like regularity |
| Room inset | Gap between room and partition edge; higher values mean more corridor |
| Max depth | Total room count, roughly 2^depth |
What broke
Where it goes next
Procedural GenerationAlgorithmsUnity