
Watering dry lands
Based on a sparse, deterministic cellular simulation.
Pour water / edit terrain -> sparse fluid bricks (20hz updates) -> fall x4 -> spread -> pressure-rise -> ground soaking.
Then there is the water occupancy bitmap which gets stamped into the rendered voxel bricks and sampled by physics for swimming and buoyancy.
Each simulated voxel stores an integer water mass:
1024 units is one full voxel
Up to 4096 units CAN occupy a single cell. The excess represents pressure rather than visible extra volume.
At least 128 units (one eight of a cell) are required for the voxel to render as water. Thinner films remain conserved but invisible.
Bricks contain 8^3, so 512 cells and are allocated only where needed.
Why integers? Using integers makes closed basins conserve mass exactly and makes simulation results deterministic.
Every dry-world cell is classified as:
- Blocked (rock, wood, soil and similar solids)
- Open (air or vegetation through which water may flow, such as leaves)
- Sea which is generator-created ocean water and completely separate from the cellular simulation.
So the ocean is just a non-solid space below sea-level. If I were to simulate this voxel by voxel, my computer would likely burn down the house.
Simulated water falling into the ocean (or seas) is drained from the simulation.
Currently there is a hard ceiling of 8,192 active bricks, roughly 20 MiB of fluid data. If exceeded, the furthest bricks are frozen first, meaning their water is paused, not deleted.
... if you have any more questions, just shoot.
I am not happy with the performance at all and personally I prefer the look of what u/MGMishMash did with his water, but I wanted to try out something different first.