Umm, I don’t know how to word this, but I need a way to make sure tile structures don’t spawn on eachother. I’m making a procedurally generated world and I have trees made out of tiles. I don’t want the trees to spawn on eachother but don’t know how to make that without checking if EACH TILE AROUND IT IS EQUAL TO ONE OF THE BLOCKS IN THE TREE
An extension would be nice, but if there is some any other way that’s more efficient than what I said earlier, that would be okay as well!
I assume these are being placed with a random number. You could try using a different type of random number, for example placing them every 50 tiles and then offsetting them by 20 so they can never get close enough to eachother. Another way would to be making an array of the random numbers before placing the trees, and then check if any are too close to the others and nudge it away a little.
Depends how you’re generating terrain. If it’s side view 2D like Terraria and you generate left to right then I would just keep track of the right side X position of the most recent structure spawned and just make sure other structures aren’t spawning in a way that their left side X coordinate is less than the right side X of the last structure.
If you are doing something top down then it’s probably more complicated but if you fill an array with random positions you could then sort the array by X coordinate and then apply a similar logic.