Software Used: Unity C#, Blender 2.8
Torchlife is a dark and scary first person dungeon exploration game. The player’s objective is to keep their torch lit at all times to avoid being trapped by lurking creatures. I created the dungeon system along with traps, and a boss called “Spikeman."
Procedural Dungeon Room Generation System
In Torchlife, the rooms and hallways are procedurally generated using an additive procedural generation system. A collision detection system was developed so the rooms do not intersect each other. Each room exit has a spawner to determine which room spawns next or, to seal off a dungeon wall when there no more rooms on the level.
A more detailed look on how rooms are generated.
This is a spawner object. It is responsible for spawning a room or a wall off of the exit of another room. It was created as a child object of the room to the right of it. If the spawner is inside of another room, then the spawner is destroyed because there is already a room in that location. If the spawner is inside of another spawner, then every spawner, except for one, is destroyed.
This is the sensor that is attached to the spawner in the first note. It is responsible for scanning in front of the spawner to determine what the maximum size is for spawning a room. If the sensor collides with another room, then only a single size room can be spawned. Else, a double sized room can be spawned. As larger room sizes are created in the future, more sensors will be added.
This is a spawner who’s sensor (see 4.) is inside of another room. The sensor sends back information to the spawner telling the spawner to limit generation options to only single size rooms.
This is a sensor which is inside of another room. Because of this, it will send information back to it’s spawner (see 3.) about the maximum size that a spawner can generate.