Solution: Use a while loop in the Event Graph.
That tutorial shows a lot of bad practices. Best suggestion would be to split code into separate functions, and use a while-loop instead of the loop he introduces.
Thanks for posting this, it helped me realize that I was not the only one. I both like and dislike this tutorial. It showed me a new way about thinking of PCG using collisions in an intuitive way, but introduces many bad practices. Especially when he does something and states “I don’t know why, I just did it like this and it worked.”
I’d suggest breaking the whole algorithm into logical functions.
For myself, I have the following:
- Event Graph: Sets the seed, spawns the first room, starts the timer, then USING A WHILE LOOP, spawns new rooms until the room count has been reached
My functions look like this: - Event Graph → Spawn New Room → Check For Overlap (& Get Overlapping Rooms)
Event Graph
Spawn New Room
Check For Overlap
Get Overlapping Rooms
I now go from 58 rooms generated (until infinite loop) to 1000+ with no infinite loop