procedural generated Dungeon Framework for First person shooter
This is a quick practice of procedural generated Dungeon, inspired by Rouge and 3D FPS games
Make a new PCG blueprint, rename it, drag and drop into the level map. Then create a trigger box and but it inside the PCG frame in world space. Tag the Trigger box to find it in PCG blueprint using the Get actor data.
First I created 2 different types of Tigger boxes to build the dungeon. one for the connection hallways, one for the room. And then I use the create spline note to create a spline connecting all the room that are randomly located. That's step one.
This is the code for room randomization
This is the code for Spline connection, I am adding another trigger box detection for more customization
The spline is connecting all the room together from the center point
Final result
Step two, create 4 side of the wall and floors similar to the building generator. "Self-trimming" the volume sampler points to get the lowest points of the building as the "ground level". Group all the points, merge windows point, column point, corner point separately.
The code for wall and floor
The code for density level to find the center of each room
The code for cutting holes on the floor to make stairs
Using distance note I was able to spawn actor or mesh at the center of each rooms
I am cutting holes on the floor to make room for stairs so player can navigate vertically
Final result
I've created a foundational system for setting up decorations in the dungeon. Just connect a mesh spawner, and it will automatically place meshes at any designated location within the dungeon.
Here are some examples of how this dungeon can be decorated, the possibilities are endless
Exterior landscape
physics simulated Interactable props
Glass on the top floor
Lights on the wall and floor
Random props around the walls, on the floor, and at the center of the room
player spawn point
This is my procedural generated Dungeon Framework for First person shooter, can be easily adapted to different style and environment. High customizing capability for complex 3D vertical space dungeon.
Final result