Dungeon Generator
A downloadable dungeon generator for Windows
This is a dungeon generator made with Unity and C# that was developed using Space Partitioning.
What is Space Partitioning (BSP)?
A space-partitioning algorithm yields a division of 2D or 3D space
into disjoint subsets, so that any point in the space lies in exactly
one of these subsets.
Space-partitioning algorithms often operate hierarchically: each
cell in a space partition is further subdivided by applying the same
algorithm recursively. This allows space partitions to be arranged
in a so-called space-partitioning tree.
The entire dungeon area is represented by the root node of the
BSP tree and is partitioned recursively until a terminating
condition is met (such as a minimum size for rooms). The BSP
algorithm guarantees that no two rooms will be overlapping, and
allows for a very structured appearance of the dungeon.
How to do?
- start with the entire dungeon area (root node of BSP tree)
- divide the area along a horizontal or vertical line
- select one of the two new partition cells
- if this cell is bigger than the minimal acceptable size: go to step 2 (using this cell as the area to be divided)
- select the other partition cell, and go to step 4
- After partitioning:
- for every partition cell: create a room within the cell by randomly choosing two points
- starting from the lowest layers, draw corridors to connect rooms corresponding to children of the same parent in the BSP tree
- repeat 2 until the children of the root node are connected
The code is available to see only for business inquiries.
Status | Released |
Platforms | Windows |
Author | António "Xpop" Barreiro |
Made with | Unity |
Tags | 3D, artificial-intelligence, Generator, Unity |
Comments
Log in with itch.io to leave a comment.
For anyone who wants more info on how this is done without a "business inquery": http://www.roguebasin.com/index.php?title=Basic_BSP_Dungeon_generation
https://gamedevelopment.tutsplus.com/tutorials/how-to-use-bsp-trees-to-generate-game-maps--gamedev-12268