I’ve been stuck on this for the past hours, but genuinely I just need some actual GOOD tips, advice, and videos. I dont consider myself an ultimate in coding so sometimes reading/watching videos on the subject with different coding languages stumps me even further.
Literally, All I want to do is generate a facility with random rooms that are prebuilt, and have them avoid collisions so its a clean generation all around.
Facility as in SCP:CB esque, or in a more homebrew method, think of DOORs or PRESSURE but with having alternate routes/branches off the main path/spinal path
I’ve spent the last few hours tackling this, Ive tried a grid system but I am genuinely stumped on how to approach a grid system, especially with premade rooms where I’d want rooms to have varying shapes and sizes.
Generating a path of rooms and then branching them out has done me some good but often the main path spirals into itself, making further extension and possibility of branching paths impossible.
While it doesn’t have a direct Roblox equivalent, check out the tool called “Dungeon Architect.” It’s for Unity/Unreal (and is quite expensive!), but the ideas in it should help you. You should probably be able to find some videos on it online.
I’ve investigated Dungeon Architect, and its by no means what Im trying to achieve. While it is a technical wonder that whole tool but its too complex, and im not going to try forking something completely unnative into Lua, like I said most videos on this exact problem do not cover premade rooms and or in foreign coding languages that can be hard to translate into Lua.
SIGHHH i just need some guidance on how to get the ideal situation, with tips and tricks and whatever else, i’ve already done most collision checks in the books, I just need a REAL pro to explain me some tactics to explore this fully.
i think you can generate a hitbox like area to check if it collides with an existing part of the dungeon, then delete it and the last dungeon part generated (maybe), i did that in a game and it worked well.
It looks like you got the base of it down already, so I won’t go on explaining that, but for your situation, I recommend breaking the generation into 2 parts.
The first part (Main Path Phase): just generate the blue path, don’t worry about actually generating any side paths yet, just mark down locations where you could generate the side paths.
The second part (Side Path Phase): using your marked down locations for possible side paths, brute force a bunch of rooms to see what fits (consider using workspace:GetPartBoundsInBox() for hitbox detection). Then expand the side paths to whatever length through the same method. If the brute force fails, then place a locked door / wall or something.
Anyways, hopefully you can see how breaking the generation into chunks helps. Good luck!
maybe if you dont count the clipping parts in a loop for example, and you want 10 rooms, you can generate the blue parts separately from the yellow ones using the same method
If you’re having trouble with a spirally main path, you could try introducing a heuristic (a score) for every possible room placement. With that in place, you can score rooms that lead further away from the start as higher. Choose the highest scoring position and tada! straighter paths.
You can always just offset the heuristic by a random value (the joys of having a very customizable score function), or even have rooms that only lead to the (relative) side, making it impossible to have straight lines.
you can try creating attachments that determine the starting and ending points of the rooms , and adjust/rotate some ending points when generating so that the next room is in another direction instead of always facing forwards, in a straight line.
Im away from my computer right now, but once I am I will try to go in more depth.
But luckily, Grid style is something I had approached pretty heavily on through my Plugin/module that I made
Basically, I created a 2d array and assigned a part to each grid to represent the physical aspect. Similar to those terrein generators.
So first I had set up some variables like:
Grid size, part size, path size, room min/max, etc
Then, instead of adjusting the height(which you also could do. ) I created a module script that uses a range of different maze like algorithims ported over into lua to assign each grid. In this instance, I assigned certain ‘types’ like walls to the parts as a attribute. Which I then broke down even further into different steps, so I would run a path algorithim that would assign the path. Then next I had assign the walls, then the objects, etc.
Once each grid has been assigned a different variable, I then looped through each grid and placed certain models/parts at the position of the grid parts that were initially generated.
I would take a look at the plugin as I have tried to make it pretty customizable. The one closest to the style you are looking for is using “room.” Which all the scripts are open and somewhat documented which may help you as well.