I’m making a pipe generation script that will generate a group of pipes on command. The pipes spawn connecting to another at pre determined connection points.
The problem is that I have not figured out how to avoid the generating pipes from overlapping one another. Pipes will spawn right over another pipe multiple times.
I tried adding a function to check if a new pipe will overlap an old one, however this only halted the generation. I believe the way to go about it is somehow checking a step or two ahead to see if the next few generated pipes will overlap another.
What are some possible solutions to the issue that I could use? Some sort of algorithm or method I could look into?
Thats building related, this is a scripting issue.
And honestly, haven’t figured this out myself. Only thing I can think of is to assign some kind of “grid” to pipes, where its like a position relative to the first pipe. So the first ever pipe is 0, 0, 0, then if it goes up or left or wherever, change its “grid position”. Then when generating, check if that grid is already taken.