One big problem with CPU usage issues right now is that liquid flows never "settle" - after infinite years, a magma vent that loses a tiny bit of magma still has a sole 6-depth square running around in it.
What i'd like to propose is a smoothing algorithm that makes the ripples go away after a certain amount of time.
1) define the body of the liquid.
Any tile that is adjacent to at least two contiguous solid objects that block flow (floodgates, cavern walls, constructions) is a liquid boundary.
Example:
code:
These are liquid boundaries.
xxx Lxx xLx
LCL LCL xCL
LLL LLL LLx These are not boundaries.
LxL xLx LxL
LCL LCL xCx
LxL LLL LxL
C= current tile
L= liquid
x= solid object
2)Handle depth changes/determine state of flux
Any time a depth change occurs at a liquid boundary, the surrounding liquid-containing tiles are examined for fluid depth. If there is a variation of 2 or more between the low depth and high depth in the 'block', liquid continues as per currently. If not, proceed to step 3.
3) Flow reduction.
Take the average depth of liquid in the block (floating point) and set the depth of each tile to that number the next "tick", rounding up >.5 and truncating otherwise.
I understand this may lead to undesirable results - draining a small portion of a reservoir would end up not decreasing its depth at all, but I think it would be nice to be able to have flows not chug processor cycles for ever and ever.
If you're really picky about having realistic fluid volume, just change the depth to be stored as floating-point and displayed as integer.
[ December 19, 2007: Message edited by: puffs ]