Procedural Generation - Separating Rooms
Every game with a dungeon needs a procedurally generated dungeon to be unique and replayable. A significant part I worked on in Slimegeon was a procedurally generated dungeon. To do this, I spawn Hierarchal Instanced Meshes at random locations with a randomly ranged size. Then I calculate connections to the rooms and map hallways between them.
A significant issue began when I started implementing more functionality. Doors themselves were being spawned as instanced meshes as well. That meant I couldn't access the mesh and had to rework this feature. I also had no control over the separate rooms. There was no accessibility to when the player entered, how many enemies were in a room, or where to spawn specific items and models.
To combat my main issue, I decided to work with box collisions. I made a component on the dungeon that would spawn an actor called "RoomTrigger" in the stored center of a room. After, I calculated the min and max of the room. I subtracted the maximum from the center to get the extent. However, I also added a scaling feature to the meshes, so I had to add the multiple of the scale by the size of the mesh * 0.5. I then accessed the box collision and set the box extent to the calculated area.
Having this done, I could create overlaps for all actors and components.
First, I got all tile locations within the bounds and added them to an array on RoomTrigger. I also got the begin/exit overlap of the player and enemies. Using this, I could close all the doors when the player enters the room and open all doors when all enemies are defeated. For the future, I would take these into account while making the generator or item itself. I would think about what ways to make what I'm creating as versatile and reusable as possible.
Slimegeon
Status | In development |
Author | zaklev |
More posts
- Finalizing the Skill Trees and the Missile TurtleMay 25, 2023
- Creating Modular UIMay 25, 2023
- Sword Reveal Over TimeMay 25, 2023
- Bug Fixes and CinematicsMay 25, 2023
- Fixing Pawn JittersMay 18, 2023
- Reworking the skill treesMay 18, 2023
- Reorder Save List by Date Last PlayedMay 18, 2023
- Possession, Lock-On Blips, and YetiMay 18, 2023
- Loading Screen and Lock On AdjustmentsMay 11, 2023
- Snowballs Destructive MeshMay 11, 2023
Leave a comment
Log in with itch.io to leave a comment.