Page 1 of 4

[MOD 0.12.x] Finite Water

Posted: Tue Aug 04, 2015 3:46 pm
by ljdp
Name: Finite Water
Description: Offshore pumps slowly drain lakes until they are removed entirely.
Licence: MIT
Version: 1.0.0
Last Release: 2015-08-04
Tested With Factorio: 0.12.1
Dependencies: Factorio 0.12.x
Tags: Enhancement, Water, Lakes, Finite
Download Link: https://github.com/perky/factorio-finitewater/releases
Updated download by db48x.

This mod adds functionality for finite water. Offshore pumps will slowly drain lakes, causing them to shrink until they disappear entirely. The more pumps at a single lake, the faster it's drained. Huge oceans aren't affected and are still infinite sources of water.

See a GIF of Finite Water in action. (Sped up for demonstration purposes)

If you want to change how fast the water is drained, perhaps to show it off in a spotlight, then in water_drain.lua you can change line 11: "local WATER_PER_TILE". Setting that to something small like 1 or 0.5 will cause lakes to drain really fast.

Re: [0.12.x] Finite Water

Posted: Tue Aug 04, 2015 6:03 pm
by Dawnzy
Looks interesting, could be quite nice for a hardcore playthrough :)

Re: [0.12.x] Finite Water

Posted: Tue Aug 04, 2015 8:06 pm
by Darloth
If it's possible to add a new ground texture, then a sandy ground texture that has almost no border with water, but a strongly defined border with grass/sand/other, would make it look like you're leaving a lake-bed behind.

I'm not sure it actually is possible to add new ground textures like this (they'd be a new biome, I assume, and I don't know how the graphics for in between biomes / terrain works) but it's a nice idea.

Regardless, good stuff, thanks!

Re: [0.12.x] Finite Water

Posted: Thu Aug 06, 2015 12:16 am
by ares0027
awesome one. but i was guessing maybe add some ore generation to it? (i have no idea if it is possible) but i dont know some stones, or if we are lucky other ores "generate" occasionally from water?

Re: [0.12.x] Finite Water

Posted: Thu Aug 06, 2015 9:42 am
by db48x
This is working well so far, but there's a bug that must be fixed before it'll run. The data.lua script loads prototypes/items.lua, but the file is actually called entities.lua. The easiest fix is to extract the contents of the zip file, then navigate into the prototypes directory and rename entities.lua to items.lua. Then go back and delete the zip file (Factorio won't start if it detects duplicate mods).

I can't say for sure how the balance is; this map I'm using has quite a large number of medium-sized ponds so I doubt I'll ever run out. It does work though. Our power generation is pumping from one of the smaller ponds in the starting area and it's gotten smaller as we played. It's slow enough that you have to pay close attention to notice it. I expect that this small pond will last through the mid-game before we must pump from somewhere else.

Re: [0.12.x] Finite Water

Posted: Thu Aug 06, 2015 3:17 pm
by ljdp
db48x wrote:This is working well so far, but there's a bug that must be fixed before it'll run. The data.lua script loads prototypes/items.lua, but the file is actually called entities.lua. The easiest fix is to extract the contents of the zip file, then navigate into the prototypes directory and rename entities.lua to items.lua. Then go back and delete the zip file (Factorio won't start if it detects duplicate mods).

I can't say for sure how the balance is; this map I'm using has quite a large number of medium-sized ponds so I doubt I'll ever run out. It does work though. Our power generation is pumping from one of the smaller ponds in the starting area and it's gotten smaller as we played. It's slow enough that you have to pay close attention to notice it. I expect that this small pond will last through the mid-game before we must pump from somewhere else.
Thanks, i've re-uploaded a fixed version.

So far I'm happy with the balance in my current play-through. 2 hours in and I had a blackout and I was thinking "there's loads of coal left", completely forgot about my own mod! Rather than moving all my boilers I created a huge pipeline to another lake, which I thought looked pretty cool, there are some really long pipelines here on earth. I am interested to hear how it spans out in other people's maps.

Re: [0.12.x] Finite Water

Posted: Fri Aug 07, 2015 7:17 am
by Airat9000
ljdp wrote:
db48x wrote:This is working well so far, but there's a bug that must be fixed before it'll run. The data.lua script loads prototypes/items.lua, but the file is actually called entities.lua. The easiest fix is to extract the contents of the zip file, then navigate into the prototypes directory and rename entities.lua to items.lua. Then go back and delete the zip file (Factorio won't start if it detects duplicate mods).

I can't say for sure how the balance is; this map I'm using has quite a large number of medium-sized ponds so I doubt I'll ever run out. It does work though. Our power generation is pumping from one of the smaller ponds in the starting area and it's gotten smaller as we played. It's slow enough that you have to pay close attention to notice it. I expect that this small pond will last through the mid-game before we must pump from somewhere else.
Thanks, i've re-uploaded a fixed version.

So far I'm happy with the balance in my current play-through. 2 hours in and I had a blackout and I was thinking "there's loads of coal left", completely forgot about my own mod! Rather than moving all my boilers I created a huge pipeline to another lake, which I thought looked pretty cool, there are some really long pipelines here on earth. I am interested to hear how it spans out in other people's maps.
the author, it would be good to do all the same ends oceans.

Re: [0.12.x] Finite Water

Posted: Fri Aug 07, 2015 5:14 pm
by orzelek
I think you might need to mark this mod as single player only.

My lua knowledge is a bit limited but I was curious to see how you implemented the water removal and took a peek - this mod is threaded which might mean desyncs in multiplayer.

Re: [0.12.x] Finite Water

Posted: Fri Aug 07, 2015 5:16 pm
by ljdp
orzelek wrote:I think you might need to mark this mod as single player only.

My lua knowledge is a bit limited but I was curious to see how you implemented the water removal and took a peek - this mod is threaded which might mean desyncs in multiplayer.
The mod uses coroutines but that isn't to be confused with threads. Coroutines are still deterministic. (But I haven't tested this with multiplayer yet).

Re: [0.12.x] Finite Water

Posted: Mon Aug 10, 2015 3:59 pm
by adalah217
Awesome mod. Perfect for an added challenge to a world with "very low" resources, and forces me to use trains to transport water from far.

I seem to be getting weird behavior though. At the beginning of the game, I drained a small pond fairly quickly with ~5 steam engines and a few boilers. I set up a new intake, and eventually it started going down too. But it just kinda stopped. Water across the map is staying infinite, across all the ponds. I double checked to make sure I had the mod installed of course. Maybe some weird behavior with bob's mod? Maybe the larger pond is acting like an ocean? Or maybe I haven't observed long enough to watch the water drain. Either way, I tried draining the water into about 10 fluid tanks and nothing happened. Just wanted to drop by and mention it :) Bob's mods are the only other thing installed.

Re: [0.12.x] Finite Water

Posted: Wed Aug 12, 2015 3:59 am
by Degraine
Now all we need is a weather mod to add rain that refills the lakes.

It looks like it has a maximum range it will draw from, similar to how Red Power's drain + pump worked in Minecraft (which is probably the only sane way to do it, really). Have you thought about an option for sufficiently large bodies of water to be inexhaustible?

Re: [0.12.x] Finite Water

Posted: Wed Aug 12, 2015 4:13 pm
by TheSAguy
Degraine wrote:Now all we need is a weather mod to add rain that refills the lakes.

It looks like it has a maximum range it will draw from, similar to how Red Power's drain + pump worked in Minecraft (which is probably the only sane way to do it, really). Have you thought about an option for sufficiently large bodies of water to be inexhaustible?
Great mod idea, going to give it a try when I have the time!

To add to the above note from Degraine, I think that small bodies of water should drain faster than larger bodies. Since larger bodies should be deeper and get more input that smaller bodies of water.
So very large bodies will take a very long, close to infinite to drain.

Re: [0.12.x] Finite Water

Posted: Wed Aug 19, 2015 11:32 pm
by reddutton
TheSAguy wrote:
Degraine wrote:Now all we need is a weather mod to add rain that refills the lakes.

It looks like it has a maximum range it will draw from, similar to how Red Power's drain + pump worked in Minecraft (which is probably the only sane way to do it, really). Have you thought about an option for sufficiently large bodies of water to be inexhaustible?
Great mod idea, going to give it a try when I have the time!

To add to the above note from Degraine, I think that small bodies of water should drain faster than larger bodies. Since larger bodies should be deeper and get more input that smaller bodies of water.
So very large bodies will take a very long, close to infinite to drain.
this would be a nice feature even if there are tiers of pumps for the range they can pump

Re: [0.12.x] Finite Water

Posted: Thu Aug 20, 2015 9:52 pm
by Afforess
FYI, I have noticed this mod tends to cause unpredictable and non-reproducible freezes (In the console it reports that a linked-list has been corrupted in the game engine). This is not a normal factorio crash where you get logs, it is a very terse error message, and the game stays up, but no longer accepts input. I am on Linux, but I suspect this issue occurs on all platforms. I am suspect this is due to the use of coroutines, and that the game engine does not support asynchronus access to the lua API. I think it would be worthwhile to either a thread-safe lua API from the game devs, or rewrite this mod to not use coroutines.

The issue tends to occur when a lake or body of water nears becoming completely drained, although I have rarely had it occur in otherwise normal gameplay.

Just a word of caution to users, if your game freezes/crashes, try uninstalling this mod.

Re: [0.12.x] Finite Water

Posted: Sat Aug 22, 2015 10:02 pm
by TheSAguy
Afforess wrote:FYI, I have noticed this mod tends to cause unpredictable and non-reproducible freezes (In the console it reports that a linked-list has been corrupted in the game engine). This is not a normal factorio crash where you get logs, it is a very terse error message, and the game stays up, but no longer accepts input. I am on Linux, but I suspect this issue occurs on all platforms. I am suspect this is due to the use of coroutines, and that the game engine does not support asynchronus access to the lua API. I think it would be worthwhile to either a thread-safe lua API from the game devs, or rewrite this mod to not use coroutines.

The issue tends to occur when a lake or body of water nears becoming completely drained, although I have rarely had it occur in otherwise normal gameplay.

Just a word of caution to users, if your game freezes/crashes, try uninstalling this mod.
I've had this happen a few times with me. I think the freeze occurs when you empty a body of water, while laying new pipe.
I've opened a crash report: https://forums.factorio.com/forum/vie ... =7&t=15144

Still love the mod!

Re: [0.12.x] Finite Water

Posted: Sun Aug 23, 2015 9:42 pm
by Afforess
TheSAguy wrote:
Afforess wrote:FYI, I have noticed this mod tends to cause unpredictable and non-reproducible freezes (In the console it reports that a linked-list has been corrupted in the game engine). This is not a normal factorio crash where you get logs, it is a very terse error message, and the game stays up, but no longer accepts input. I am on Linux, but I suspect this issue occurs on all platforms. I am suspect this is due to the use of coroutines, and that the game engine does not support asynchronus access to the lua API. I think it would be worthwhile to either a thread-safe lua API from the game devs, or rewrite this mod to not use coroutines.

The issue tends to occur when a lake or body of water nears becoming completely drained, although I have rarely had it occur in otherwise normal gameplay.

Just a word of caution to users, if your game freezes/crashes, try uninstalling this mod.
I've had this happen a few times with me. I think the freeze occurs when you empty a body of water, while laying new pipe.
I've opened a crash report: https://forums.factorio.com/forum/vie ... =7&t=15144

Still love the mod!
My crash doesn't look like yours. I intentionally started using a script that captures the stdout/stderr for factorio so I could catch the exact message next time. Here is an example of my log, and the only error msg I see:
*** Error in `/home/afforess/Downloads/factorio/bin/x64/factorio': corrupted double-linked list (not small): 0x00007fb7c4030a00 ***

Re: [MOD 0.12.x] Finite Water

Posted: Fri Aug 28, 2015 7:21 pm
by ljdp
Interesting, not had that error.
I doubt it is because of coroutines, coroutines are not like threads, they are synchronous. But I would like to hear from the devs if they cause any other side-effects.

Re: [MOD 0.12.x] Finite Water

Posted: Fri Aug 28, 2015 8:08 pm
by orzelek
ljdp wrote:Interesting, not had that error.
I doubt it is because of coroutines, coroutines are not like threads, they are synchronous. But I would like to hear from the devs if they cause any other side-effects.
Devs already said that coroutines are not tested so might cause unexpected behavior.
Take a look here:
Suspicious bug thread

Re: [MOD 0.12.x] Finite Water

Posted: Fri Oct 23, 2015 5:59 pm
by db48x
I've updated the mod for 0.12.11 and put the code into a fork of the github repository at https://github.com/db48x/factorio-finitewater.

Initial testing looks good, though I cannot be entirely sure I haven't broken anything.

Re: [MOD 0.12.x] Finite Water

Posted: Fri Oct 23, 2015 7:17 pm
by Darkestnoir

Code: Select all

Error while running the event handler: __finitewater__/water_drain.lua:52: attempt to index field 'water_drain' (a nil value)
Can't start a new game with 12.13.