I'm attempting to rework the flow-mechanics of my system to be faster, more accurate, and more efficient. See the image below for an example of what i'm doing.
So the object stores a 'volume' and spreads its data to the cardinally adjacent tiles, losing a proportional amount of its volume in the process, until all accessible tiles have an equal volume. Simple enough.
I'm trying to find different and ideally more efficient ways to implement this. Keep in mind that there can be more than one 'hotspot' at once, and the collision of different 'hotspots' needs to be taken into consideration.
What are your ideas for handling this?
-----------------------------------------------------------------------
My current idea:
Have a main 'hotspot' controller object which stores both 'active' and 'inactive' tiles in two separate arrays/lists.
Active tiles are 'tiles adjacent to tiles of innequal volume'
Inactive tiles are 'tiles adjacent to tiles of equal volume OR black/wall tiles.'
For each process of the controller:
active tiles equalize with their adjacent tiles, and adjust their volume by (total adjacent tiles / total hotspot tiles * hotspot volume)
active tiles become inactive tiles, and adjacent tiles become active tiles.
inactive tiles adjust their volume by the same amount, but negative.
Upon collision with another hotspot, if the other hotspot is 'newer' it ignores it, and treats it as a wall. Otherwise it overtakes it as a normal 'adjacent' tile. If overtaking it splits the previous hotspot, it creates a new hotspot where it was split (for a total of 3 active hotspots)
When there are no more active tiles, the hotspot dies.
HOWEVER i still have the issue where the 'volume' of the inactive tiles changes even when it wouldn't make sense to change instantly.
The biggest issue i have right now is when it 'cuts' another active group into two, because as i understand, i have two options: Allow it to keep processing as though it's a single group. (BAD) or recalculate the group EVERY single time it's overtaken by another active group (ALSO BAD)