The designer creates a collection of pre-built rooms. Each room includes the positions and directions of all its doorways. The generator creates the level in several steps:
- From the start room, create a list of all open doorways.
- For each doorway, pick a random room from the list. Attempt to connect the new room.
- If the new room does not have enough space to spawn, destroy it and block the doorway.
- If the new room does have enough space, spawn it. Add its open doorways to a new list.
- After the previous list of doorways is completed, repeat the process on the new list of open doorways.
- Once the level is large enough, stop spawning rooms and close all open doorways.