Dev Update 23-Sept-2016
Hi guys! The geometry generation is stable now and I started working on adding actual gameplay to the generation process.
Adding gameplay object slots:
I figured that I will need a place where I can put any gameplay relevant object. The problem is that when you’re procedurally generating, you have to:
- Somehow be able to identfy valid spots to place your specific gameplay element.
- Make sure that you always have enough options to add all or at least a significant subset of the gameplay elements you want to have in your level.
In the previous step, I did not only generate the empty room but I already filled it with furniture.
So now I decided that I do not want to interfere there by placing logic during that step, but afterwards (mainly to keep the code and the process clean).
The way I do now is that I add slots to all the assets generated before (Floors, walls, furniture etc.) and put my gameplay objects in random valid slots:
The slots do also have types so I can not only place items but also replace a complete asset with a gameplay object, like replacing a wall with a vent where I can spawn enemies.
Before I started working on generation, I did already implement a locked doors and keys mechanic. Now I successfully integrated it in the generation process. This mechanic will help to motivate the player explore the level instead of rushing through. I do not only want to use keys and locked doors lateron but also lock areas in various other ways, like the player will need to flip a switch to restore power in an area, or opening airlocks to extinguish a fire.
To make sure that such mechanisms will always work, I generated the level from a tree structure like so:
The nodes represent rooms, the edges represent doors.
Now I can place the lock and key in a way it won’t break the level (key behind locked door problem):
Note that I locked two doors, as I identified two motivations for the player:
- Overall progress – lock the main branch to keep the player from finding the exit/mission objective early.
- Loot/Treasure – you will want to open this door. These are always leafs in the tree. It makes no sense to ask for a key when you already passed a door where you needed that specific key, so such a room is never beyond the main branch lock.
The locks mechanism can also be chained along the main branch.