This tool is designed to streamline the creation of procedurally generated portions of levels for 3D games. It is focused on enhancing the workflow for generating connected room systems, such as dungeons. The tool should feature options for generating in an area, room placement, room adjustment, hall placement, staircase placement, and other adjustable values for how it generates. It’s mainly a tool to connect more major set pieces of level together through procedural dungeons rather than being a standalone dungeon itself.
The tool is intended for level designers and game developers working on procedurally generated environments in 3D games, particularly those working on 3D roguelike, dungeon crawler, or adventure genre games.
Making parts of a large and re-playable level can be difficult. This tool allows developers to generate connected, cohesive, and traversable dungeons procedurally without super extensive manual placement. This tool should simplify the process by providing intuitive features for dungeon generation, improving the speed and efficiency of level creation or allowing for dungeons to be rerolled at runtime.
This tool's vision is to create a modular, flexible, and intelligent way of procedurally generating a portion of a level. The design principles revolve around accessibility for non-programmers, ease of integration into existing projects, and adaptability/modularity for various game mechanics. The tool should allow for iterative adjustments and scalability for various game sizes and complexities.
Marked rooms for placement in a 3D grid structure, ensuring to also mark down door exit positions and check for placement validity.
Cited below, I utilized the Bowyer Watson Tetrahedralization algorithm, to generate a complete graph structure out of these positions nodes in 3D space.
Using Prim's Algorithm, I created a Minimum Spanning Tree out of the graph structure in order to simplify the number of dungeon connections.
Added back connections into the graph based on an adjustable value in the editor tool for dungeon connectivity.
In order to get an optimal path out of the graph, a Breadth First Search algorithm is run from the entrance node to the exit node and the paths are marked accordingly. This step was done in case any later tooling or additions wanted to add items such as signifiers or progression mechanics to that path.
Using a modified version of A* for either one tile wide or two tile wide staircases, paths are then created on the grid structure using the connections in the graph.
When specified, tiles are then loaded and spawned using weighted random and phase based tile selection.
The Custom Unity Editor offers many features for dungeon modification including regeneration on scene start, showing gizmos, spawning tiles, the dungeon's grid and axis sizes, phase generation settings, hall settings, room settings, seeding, and unit testing. Many features are dynamic and automatically adjust to other parameters, such as the room size maximums when the dungeon size is updated.
Gif showing an example traversable dungeon structure with the path gizmos enabled.
I implemented a custom telemetry unit test within Unity to gather data under specific generation settings: a dungeon size of 25x25x25 (15,625 tiles per grid), room sizes varying from 3-8 tiles in the X and Z directions and 1-2 tiles in the Y direction, a graph connectivity factor of 1/8, and 100 iterations for each stair mode. This data has been invaluable for optimizing the generator and addressing errors and edge cases within the algorithm.
This project was an exciting opportunity to combine technical problem solving with my passion for creating tools that empower other developers. I was able to focus on making a tool that’s flexible, intuitive, and easy for level designers to use, so that they can focus their creativity without getting too stuck in the technical complexity of procedural generation. With customizable options and debugging tools, this tool makes building modular dungeons efficient and easy to use.
©2024 All Rights Reserved By Corbyn LaMar