For my current game, I’m looking for a way to make procedural dungeons in a way like Binding of Isaac does, which is inspired by Zelda on the NES.
In case you don’t know any of those games, let me explain.
Each dungeon is created of rooms, which can have a door on the north, south, east or west wall, connecting it to the next room. In Zelda, these dungeons were pre-designed, so nothing too fancy here. In Binding of Isaac, those rooms were pre-designed “blocks”, which could be connected to one or more rooms, wether or not a room has spawned on any of the sides.
What I’m thinking is that I want to pre-design rooms within the editor and then sit a blueprint with a collider of the size of the full room on top of it that just grabs everything inside and “merges” it into one room. Basically it adds everything inside it as component. Not sure how this works though.
Right now, my idea about this needs two Blueprints (because I like to keep things seperate and better organized for myself to better adjust things later on and make it more complex as I go).
This Blueprint lays out the dungeon and draws lines in the length of a room, from one center to the next. It procedurally creates a path and specifies special rooms like start, end or bonus rooms for loot, secrets etc. After laying out the level, the Architect calls for a randomly selected Room to spawn in every position where a line has started from.
The Room Blueprint
After designing several rooms by hand, I will place one Room Blueprint over each one of them with the exact same size. This Blueprint grabs everything inside and merges it somehow, so I can place everything as one object. Now this Room gets called by the Architect, rotates randomly in 90° angles and spawns at the specified location. If any flags are turned on (secret, loot, end room etc), it will change some things about it and that’s it. Maybe I will create special secret rooms etc, so if the Architect needs one of them, it will grab specifically designed secret rooms, loot rooms etc. Not sure yet.
This is my basic idea.
Do you have any concerns with this idea? Could it work? What could cause problems?
My idea is to start by grabbing everything inside the Room Blueprint that overlaps the box collider component and somehow tag it or do something to make it merge together. When I move the room, everything inside should move with it and stay in the relative location to eachother and rotate according to the center of the room. If I rotate the entire room by 90°, every object inside should do the same and stay in it’s position. What would be a good way to do this?