#you would tell them to update their

1 messages ยท Page 1 of 1 (latest)

worn sleet
#

apologies if i'm not understanding, but update them with what? if i've told them to consider themselves part of the same pipe previously (bc they're connected), then wouldn't they still believe they're part of the same pipe after the fact unless i did some sort of re-evaluation of the tilemap to see which tiles are still connected to which intake tiles?

regal otter
#

If you have one fullpipe and draw another one on top of it touching one segment, that segment would tell the other tiles, update yourself and check for neighbours. And iterating from their through all neighbours that are attached will generate the new full pipe. If you take away one tile then, it tells the nighbours again, update yourself and all tiles will check for neighbours again to create new smaller pipes

worn sleet
#

ok. that is sort of the strategy that i was going with, but just to be clear, are you suggesting i put each full pipe on a different tilemap? hmmm that's interesting. i already do have 3 tilemaps in use (water, ground, and now pipes) so i can't see why not. or am i misunderstanding again? XD

#

when you say paint on top..

regal otter
#

Not literally ๐Ÿ˜‰ just same depth but they intersect visually

worn sleet
#

ah so adjacent, i gotcha

regal otter
#

So like drawing a cross

worn sleet
#

on a pseudocode level, it would be like looking for neighbors of X pipe connecting piece, adding that to a list of tiles to look at after the loop, and basically just going through that list and doing the same thing?

#

making a list of total connected pipes and saving it to a class file or something associated with the intake valve

regal otter
#

If you have a grid you can just store each nighbours, add them up until none present and then finish pipe merging

worn sleet
#

sounds like a plan. thank you so much for the time. i just wanted to bounce this off someone who knows more than me (i'm pretty new to all this) before i spent like 2 weeks in the weeds lol

regal otter
#

Its not wasted time. Even if the code is not perfect you learn while writing and trying out ๐Ÿ™‚

#

And yw ๐Ÿ™‚

worn sleet
#

i'm gonna leave the thread open so i can reference it, but i'm gonna take a break. cheers!

regal otter
#

Happy coding ๐Ÿ™‚ im off to bed ๐Ÿ™‚

worn sleet
#

good night

worn sleet
#

just so you know i totally figured it out ๐Ÿ™‚ got my full pipes in a dict at least and are working as expected. if a pipe tile changes i can just rescan the whole map and it's not a big performance hit! thanks so much again for your time it really helped! i ended up using a method that basically uses a list as a perameter but then creates a list within it of neighbor tiles and feeds it back into itself if it's > 0. pretty simple little thing once it's all done. lol