top of page

Procedural Level Generation

These are sample level generations for my capstone multiplayer horror Unity game, "It's Dark". First, it utilizes a maze finding algorithm to produce a layout that ensures every room is accessible, then it harvests the state of each room to generate a half handcrafted and half randomized interior. This hybrid generation allows for each room to retain a unique identity even after players begin to identify the handcrafted component.

ProceduralLevelGenerationCombined.png
ModularEnvironmentHighResShot.png

Given the setting of our game, a dark underground lab, I had to find a level generating algorithm that would reflect an enclosed and ordered space. Eventually I happened upon the "Hunt-and-Kill" maze algorithm, which produces what is known as a "perfect maze" where all tiles on the grid are traversable. Adding doors augments this perfection by creating room separation and looping sections, great for when you're being chased by the monster.

ModularEnvironmentHighResShot2.png

In order to populate the rooms, I made an Environment Library which stores a collection of Room Interior prefabs that get assigned based on the room type as well as the number of open paths and their locations. The room types were designated as Office, Security, Research, and Hallway, each having their own designs and gameplay identities. The assignment of these rooms being done using the door spawning as a marker to swap to a new type.

ModularEnvironmentHighResShot3.png

The final step to the generation process is the socket system, special positions that the room designates as potential spawn locations for additional clutter or functional item spawns. The same room might spawn twice, but one can have a mop and bucket or a flipped office chair while the other spawns a medkit item. After instructing my teammates on how to create the room prefabs, we were able to quickly and easily produce dozens of layouts that seamlessly integrated into the full generation process. By seeding the algorithm at the start, the product is made synchronous across the multiple users.

bottom of page