I’m currently working on a project that spawns rooms “procedurally” where I have a spawner that picks a random room within an array. What I need to be able to do is condition the spawning a little, to where if a specific “door” room spawns, it can’t be spawned anywhere else. As of right now I have a whole different set of rooms dedicated to being “door” rooms, but I’m wondering if there’s a better way of doing it.
There are also “key” rooms that spawn a key to open the door. However, I need to be able to spawn the key that corresponds to a specific door.
Essentially, I need to spawn a random door in a level and the key that spawns in the level needs to match it.
Is this for something like “The binding of Isaac” or “Temple Run” regarding the generation?
Because if it’s more like the binding of Isaac it’s probably worth to just do it via a form of maze algorithm in which it’s rather easy to place a door and then a key in the area in front of the door which references the door and just opens it on pick up (or at least triggers it somehow meaning it will open the next time you get near).
The advantage is simply that you have the whole maze in front of you while generating it making small modifications a lot easier especially with this kind of partial generation where you “just” pick rooms meaning it will be a decent experience regardless how exactly they are placed.
It generates whole segments. Each of those spawners spawn a 400x400 room, and the rooms generate the furniture locations at runtime. It’s essentially an escape the room-style game where the rooms are generated at random so it’s not the same exact puzzles over and over again.