Water is not infinite


Makes water a finite resource. Uses a depth map: each water tile has a depth based on its type. Pumps drain lakes; depleted tiles become land. Refill with outfall pipes and rain

Tweaks
26 days ago
2.0
1.18K
Environment Fluids Power

b Redistribution range

a month ago

It appears that water is only redistributed up to a range of 50 tiles?

I tapped into a lake that is maybe 50x the size of the starting lake, so was somewhat surprised when the pumps ran dry.

Also, when refilling the starting lake (see my other thread), a sand bar remained dry while the rest of the lake was over-full.

I presume performance issues are the reason for these limits, but this is Factorio; people like to build big (my factory is pretty small still). So this is probably something that should be fixed somehow.

Idea: calculate water level by chunk instead of by tile, doing an initial scan to get the area of each chunk covered by water but touching only chunks when redistributing water. You could still set thresholds at which tile appearances are updated for the chunk (i.e. update chunk tiles when the chunk water level hits -100, -200, -300, etc. with each tile having its own ground level).

a month ago

You're not the first to propose something like this and I personally agree that a similar approach of lumping water tiles together would be better (as this mod caused lots of lag for me and I had to turn it off).

a month ago
(updated a month ago)

Yes guys, that's a fair point. This mod works well only for small factories. Each pump affects water within a 50 tile radius, which is roughly up to 8,000 tiles in the worst case. And you're right, the reason is performance issues.

A quadtree could help, but tile-based / chunk-based simulation is basically doomed if we want it to scale well. I think the only approach that can give decent performance is to calculate per water body rather than per tile. Tooster proposed a way to do that here: https://mods.factorio.com/mod/water-is-not-infinite/discussion/68aa145c8bf9457738b9fde5

The downside is that we would likely have to say goodbye to dynamic recomputation of water bodies after landfill placement. Maybe it's not a very big problem, though :)

A quadtree would still be helpful for memory usage, especially on island-type terrain

New response