Hello everyone! I want to make random path system where sometimes spawn walls. But I don’t know how. I want it to look something like this. Roads should also have distance between them which can be divided by specific number for example 25.
I’d start with one of the components, probably the paths as the walls are (seemingly) dependent on them.
You can do it in a few ways, but a pretty simple way might be to create a path asset that is the minimum size long (25 studs). Then to generate the actual path you pick a starting point. At every place it may randomly choose how many roads to split into (0 → 3).
What you do next is you add each of the directions (forward, left, right if it splits to 3) to a table. You can then choose if you want to branch out equally or follow a path to completion first, I’d probably do it equally as branches may, given the RNG, be near infinite.
After each decision to branch (and branches have been added to the list) pull out the first path and repeat the decision process. You can use workspace:GetPartsInBox() or something along those lines to decide if a path will intersect, if it does then you may handle that however you choose.
Note: Also create the paths in their respective directions when you add them to the list.
I have a question. How can I can I make it spread through entire area? Cause when I try to do this, pathes getting grouped on one big mess or it’s just a big line with some others.
Alright I found out the issue. It was in my script.