Procedural Level Generation
- Gary Yang
- Jan 1
- 1 min read
Updated: Mar 5
This is a basic 2D procedural level generator I made in Unity!
While quite basic on the surface. I'm very proud of how customizable it is from just the UI panel for the component. Everything to what spawns in each zone to the probabilities of different structure's and structure sizes is fully customizable.


Basic Setup
The procedural level generator operates on simple principles. It starts with an expansion point and picks a random direction, excluding the direction from which the node originated. Next, it attempts to create a corridor that aligns with the region parameters, followed by a room.
If at any point this process results in invalid generation—such as going out of bounds or overlapping with existing areas—the attempt stops, and the generator moves to the next try. If the generation is valid, the corridor and room are created, and new expansion points are added at various random spots along the room's edge.
This process continues until either the maximum attempt count is reached or a successful generation occurs. Once complete, a new expansion node is selected, and the cycle repeats.
Comments