In this video I go over my approach to breaking down a large problem like procedural dungeon generation into an algorithm of smaller more simple steps. I follow the high-level steps outlined below to randomly create a top-down dungeon with various rooms, hallways and chambers. The tools I used to create this video are as follows.
Unity 3d
Visual Studio
POLYGON Art assets from Synty Studios
The algorithm can be broken down into three components, the dungeon, the room, and each opening within a room. Each component will follow a simple set of steps until the dungeon is finished being generated.
Dungeon’s Perspective
Step 1: Spawn a room
Step 2: Get the first available room that has unconnected openings
Step 3: Tell the room to spawn its’ adjacent chambers
Step 4: Wait until the room’s openings have spawned
Step 5: Add Created Rooms to the dungeon
Step 6: Repeat 2 – 6 until there are no more unconnected openings
Room’s Perspective
Step 1: Get all the room openings
Step 2: Iterate over each opening and spawn adjacent chamber
Step 3: Wait until all adjacent chambers are spawned and are in a valid state
Step 4: Notify dungeon new rooms are ready
Room Opening Level
Step 1: Get available pieces from the dungeon to spawn
Step 2: Spawn a connected piece
Step 3: Wait for the validation period to complete
Step 4: Mark the opening as connected and notify the
room that a connected chamber is ready
New Room Validation
A room becomes invalid if it intersects another room
If it becomes invalid then the room will destroy itself and notify the connection point to try a different piece.
If all the pieces are attempted and nothing will fit, then the connection point will close off the room with a wall instead.
Broken Knights Games
Web - https://www.brokenknights.com
Instagram - / brokenknightsgames
Twitter - @Broken_Knights
Credits:
Images obtained from www.textures4photoshop.com
Auf dieser Seite können Sie das Online-Video Dungeon Crawler Using Procedural Generation in Unity mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Broken Knights Games 01 Mai 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 58,722 Mal angesehen und es wurde von 1.3 tausend den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!