Creating Procedurally Generated Rooms
Thought I’d give some insight in how Gentrieve 2 generates random worlds, with a little visual aid. 🙂
First, we pick a random shaped room, and place the walls as needed:
Then, we pick door locations. Since Gentrieve 2 is in 3D, we can place doors on all 6 walls. Determining the number of doors needed depends on where in the world this room is being placed. If this is a boss room, it will likely only have 1 door. If this is a room on a path to a boss, it will likely have 2 doors. If this room will be used as a hub to other paths to other bosses, then it may have multiple doors. Secret rooms will also increase the door count (although these doors may be visibly hidden):
Now that we have doors placed, we can create random paths within the room to connect the doors together. The images below are shown in 2D to make it easier to understand, but the path is actually made in 3D, with vertical and horizontal deviations. If there were more doors, items in the room, or more special places the player should be able to go, more paths would be marked off.
Now we know the critical areas that the player must be able to traverse. Now we can mark areas to use for decorations, lava pits & more:
This information makes up the room. We can now use this information to build the room’s geometry. The room’s paths are scanned, and lengthy horizontal and vertical paths are put together. For example, the lower left horizontal path could start with a stationary platform, but the last 2 sections of the horizontal path could be filled in with a moving platform. The upper right horizontal path could require a jump. Rooms also will know what items you require to access this room — so if you already have the Double Jump powerup from an earlier boss battle, platforms could be placed farther apart.
Now we created a single room. However, a world is made up of lots of rooms interconnected. Each powerup will need its own path of rooms to a boss, that when defeated, will give you the powerup:
Now we have a room path for the first powerup, the Double Jump. Now we can pick an available room along this path to get the next powerup. It is important to make this new path only passable when equipped with the Double Jump powerup:
We can keep repeating this process to make sure all powerups and paths are created. This also allows for game customization (e.g. only create a world using the Double Jump and Missile powerups). Finally, we can find available rooms to attach secret rooms and other functional rooms:
Now you have a whole world with randomly generated interconnected rooms! Gentrieve 2 also features randomly generated textures, enemies & more, but we will leave that for another time!