Water As A Resource


Turns Water into a non infinite resource. Water bodies get removed and replaced by solid ground. Offshore Drains allow water & oil to be put back into these depleted areas. 0.8.0 - 1.1 Factorio Compatibility, Multiplayer Multiple Forces Update, Krastorio2 Support, Reworked MapMarkers

9 months ago
0.16 - 1.1
1.96K

g Mod freezing game

1 year, 8 months ago

I have a save I can share with you, we've narrowed it down to 1 of 2 possibilities, both of which seem to be an edge case. 1 very small water resource was stuck at 100% and another larger resource was down to 3% but still fairly large.

1 year, 8 months ago

FWIW, I'm seeing the same thing (stalls of 60-180 seconds) the trigger seemed to be a larger resource down to ~20%.
All my other ones were either empty or near 100%.

1 year, 8 months ago

Save file: https://www.dropbox.com/s/3dbn817izpbv5kv/waar-hang.zip?dl=0

I've tracked down where the time is going it's in the function BackToFrontEdge, and the problem is that it is iterating over a gigantic WAArea array (54010 entries) and then each of the entries in there is doing a large loop, e.g. the for d = WAArea[c]["position"]["x"] .. WGA[a]["MaxX"] loop for y=-29 is going from -1024 to 1030. so that in total the mod goes through the innermost Outside/On the Boundary test 83 million times.

What's odd is the array looks like it has a ton of duplicates in it. The entry for y=-29 shows up at array[54009] then array[53987] for x=-1023 .. 1030; then array[53958] for x=-1022 .. 1030. That means that for long stretches of water, the mod is re-evaluating the same points repeatedly.

I'm wondering if there's a bug in the edge detection algorithm that kicks in when played on a ribbon world.

New response