Oops, that's my fault. This version should work correctly.Darkestnoir wrote:Can't start a new game with 12.13.Code: Select all
Error while running the event handler: __finitewater__/water_drain.lua:52: attempt to index field 'water_drain' (a nil value)
[MOD 0.12.x] Finite Water
Re: [MOD 0.12.x] Finite Water
- Attachments
-
- finitewater_1.0.2.zip
- Fixes initialization on new maps
- (87.23 KiB) Downloaded 1501 times
- ZombieMooose
- Filter Inserter
- Posts: 289
- Joined: Mon Feb 09, 2015 7:23 am
- Contact:
Re: [MOD 0.12.x] Finite Water
EDIT: I found it
"men will literally learn everything about ancient Rome instead of going to therapy"
Re: [MOD 0.12.x] Finite Water
multiplayer arises dissynchronization (factorio 0.12.11 + hardcorio)db48x wrote:Oops, that's my fault. This version should work correctly.Darkestnoir wrote:Can't start a new game with 12.13.Code: Select all
Error while running the event handler: __finitewater__/water_drain.lua:52: attempt to index field 'water_drain' (a nil value)
when new player picked in game with the pumps
Re: [MOD 0.12.x] Finite Water
Yes, I've noticed the desyncs as well. Perhaps now that Christmas is past I can get around to debugging them...
Re: [MOD 0.12.x] Finite Water
I already hated infinite water playing minecraft and was more than happy when Redpower introduced pumps that really used up existing water. When i saw this mod i hoped to add water to the transport management of factorio. So i installed your mod and created a testworld to see how it works and adjust water per tile to my needs.
First problem was that it only worked with offshore pumps but not with the ones in other mods. This was easy to fix by adding the other pumps to your code.
find this in waterdrain.lua:
and add needed pumps like this:
Don't forget to also add tem to
This works very good and all pumps produce the same amount of water but at different speeds.
And then i ran into some problems i can't fix. It started with some random freezes (had to use the taskmanager to end factorio). I don't know what causes them but they only happen when a body of water gets depleted and the pump is connected to a pipe. (had one when my base was destroyed by biters but was not able to reproduce this). If i put a tank behind the pump all works well.
Now i had enough data on the amount of water i can get from small lakes i made in a custom scenario to start testing how long i can produce energy with a small power plant. Made a small build and let it run. Well, i got massive amounts of water from the same small lakes i used for testing. I was able to identify the problem but unfortunately it means i can't use your mod at the moment.
Pumps produce the right amount of water only when connected to only one tank. as soon as the tank is connected to anything else (pipes, other tanks, boilers) i get massive amounts of water and often the lake turns to infinite water.
Hope this information helps because i would really love to add this to my game.
Setup:
laptop with 16 GB ram
Win 7 Ultimate
Factorio 0.12.20
shadowmegamodpack
and a few more mods
Ask if you want detailed specs
Edit: i used finitewater_1.0.2
First problem was that it only worked with offshore pumps but not with the ones in other mods. This was easy to fix by adding the other pumps to your code.
find this in waterdrain.lua:
Code: Select all
function WaterDrain.OnBuiltEntity( entity )
if entity.valid and entity.name == "offshore-pump" then
WaterDrain.AddWaterDrainingPump( entity )
end
end
Code: Select all
function WaterDrain.OnBuiltEntity( entity )
if entity.valid and entity.name == "offshore-pump" then
WaterDrain.AddWaterDrainingPump( entity )
end
if entity.valid and entity.name == "5d-offshore-pump" then
WaterDrain.AddWaterDrainingPump( entity )
end
if entity.valid and entity.name == "5d-offshore-pump-2" then
WaterDrain.AddWaterDrainingPump( entity )
end
end
Code: Select all
function WaterDrain.OnDestroyEntity( entity )
And then i ran into some problems i can't fix. It started with some random freezes (had to use the taskmanager to end factorio). I don't know what causes them but they only happen when a body of water gets depleted and the pump is connected to a pipe. (had one when my base was destroyed by biters but was not able to reproduce this). If i put a tank behind the pump all works well.
Now i had enough data on the amount of water i can get from small lakes i made in a custom scenario to start testing how long i can produce energy with a small power plant. Made a small build and let it run. Well, i got massive amounts of water from the same small lakes i used for testing. I was able to identify the problem but unfortunately it means i can't use your mod at the moment.
Pumps produce the right amount of water only when connected to only one tank. as soon as the tank is connected to anything else (pipes, other tanks, boilers) i get massive amounts of water and often the lake turns to infinite water.
Hope this information helps because i would really love to add this to my game.
Setup:
laptop with 16 GB ram
Win 7 Ultimate
Factorio 0.12.20
shadowmegamodpack
and a few more mods
Ask if you want detailed specs
Edit: i used finitewater_1.0.2
-
- Filter Inserter
- Posts: 311
- Joined: Sat Jan 09, 2016 1:11 am
- Contact:
Re: [0.12.x] Finite Water
just tryed it in multiplayer and even tho I was alone on the server this mod was causing frequent desyncljdp wrote: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).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.
it's too bad because it's one of my favorite mod
Re: [MOD 0.12.x] Finite Water
There is something wrong again. I tried my current game, a new one, everything! I can't make it work, version 0.12.28. Someone fix it please, i love this mod.
EDIT: Through testing, i realize that it does drain the water, but if it is connected to a tank or anything, it is infinite, but if there are only pipes, it will drain the lake to fill the pipes.
EDIT: Through testing, i realize that it does drain the water, but if it is connected to a tank or anything, it is infinite, but if there are only pipes, it will drain the lake to fill the pipes.
-
- Fast Inserter
- Posts: 136
- Joined: Wed Dec 23, 2015 1:17 pm
- Contact:
Re: [MOD 0.12.x] Finite Water
You can make dried up territory was replaced by a new biome - pit (black) ?
English is not my native language. Translator.
-
- Filter Inserter
- Posts: 311
- Joined: Sat Jan 09, 2016 1:11 am
- Contact:
Re: [MOD 0.12.x] Finite Water
In the hope of one day be able to play with this mod, I made a test map with 90 pump draining from diverse lake in a map with high terrain segmentation to stress test the mod.
It crash the game every time about 5-10 second after you plug the power to all pump.
There a chest near the map start area, grab a power pole from it and complete the circuit to start all the pump.
I used the liquid void mod to get rid of all the water and an inline pump so it need power as well as the test mode for the cheated infinite power solar panel. The map is locked to day only.
http://www.mediafire.com/download/iks6y ... urrent.log
http://www.mediafire.com/download/4wgad ... st_map.zip
Thanks!
It crash the game every time about 5-10 second after you plug the power to all pump.
There a chest near the map start area, grab a power pole from it and complete the circuit to start all the pump.
I used the liquid void mod to get rid of all the water and an inline pump so it need power as well as the test mode for the cheated infinite power solar panel. The map is locked to day only.
http://www.mediafire.com/download/iks6y ... urrent.log
http://www.mediafire.com/download/4wgad ... st_map.zip
Thanks!
Re: [MOD 0.12.x] Finite Water
You'll need to report that in the bug reporting forum; it's crashing in the lua interpreter.
-
- Filter Inserter
- Posts: 311
- Joined: Sat Jan 09, 2016 1:11 am
- Contact:
Re: [MOD 0.12.x] Finite Water
Yeah I wasn't sure if they would check it or just told me that it's the mod code that is the problem, without checking it.
anyway I posted it, let's see what they say :
viewtopic.php?f=7&t=23461
I tried to isolate the part that crashing, but I had no success yet and that log file is kinda useless.
anyway I posted it, let's see what they say :
viewtopic.php?f=7&t=23461
I tried to isolate the part that crashing, but I had no success yet and that log file is kinda useless.
-
- Filter Inserter
- Posts: 311
- Joined: Sat Jan 09, 2016 1:11 am
- Contact:
Re: [MOD 0.12.x] Finite Water
it went exactly as I expected
Rseding91 wrote:The finite water mod uses coroutines which we haven't done any testing with and as such don't officially support at this time.
Re: [MOD 0.12.x] Finite Water
Hello
My first post here.
I have looked at your code and i modified it to consume the lake water that is actually pumped by the pump more precisely regarding the amount (didn't liked how it was calculated before with epsilon and stuff).... so if you have steam engines or 20 storage tanks in which you are pumping it shouldn't matter now regarding the difference between those 2 setup because it should be less than 1% plus minus regarding the amount of water which could be extracted from that lake.
I did this modification for myself and tought i share it. It should also work with 5 dim mod but i didn't tested it yet but as i said should work.
The offshore pumps are a bit affected , in order to get the most exact amount of water pumped i needed to reduce their pressure a bit by 10%. You will only get affected if you run a huge pipe to supply with water your steam engines , of course without additional small pumps to keep the pressure up because they still pump the same amount of water 60 units/sec.
I had set WATER_PER_TILE in water_drain.lua to 2500 default now but if you want to clear a lake faster 100 times you can set it to 25 or 100 times slower just set it to 250000. The number now represents something close to the amount of units of water which can be extracted from a tile.
Also a good idea would be to make the huge lakes oceans with lots of tiles harder to drain by adding additional bonuses to the total amount of water per tile which should directly depend on their size total number of tiles.
My first post here.
I have looked at your code and i modified it to consume the lake water that is actually pumped by the pump more precisely regarding the amount (didn't liked how it was calculated before with epsilon and stuff).... so if you have steam engines or 20 storage tanks in which you are pumping it shouldn't matter now regarding the difference between those 2 setup because it should be less than 1% plus minus regarding the amount of water which could be extracted from that lake.
I did this modification for myself and tought i share it. It should also work with 5 dim mod but i didn't tested it yet but as i said should work.
The offshore pumps are a bit affected , in order to get the most exact amount of water pumped i needed to reduce their pressure a bit by 10%. You will only get affected if you run a huge pipe to supply with water your steam engines , of course without additional small pumps to keep the pressure up because they still pump the same amount of water 60 units/sec.
I had set WATER_PER_TILE in water_drain.lua to 2500 default now but if you want to clear a lake faster 100 times you can set it to 25 or 100 times slower just set it to 250000. The number now represents something close to the amount of units of water which can be extracted from a tile.
Also a good idea would be to make the huge lakes oceans with lots of tiles harder to drain by adding additional bonuses to the total amount of water per tile which should directly depend on their size total number of tiles.
- Attachments
-
- finitewater_1.0.2.zip
- (87.25 KiB) Downloaded 136 times
Re: [MOD 0.12.x] Finite Water
It would be interesting if the total water per lake were related to, say, tiles^2.
That might do what you want, and might even be possible? You'd need to scan the lake to see how big it was, mind you, then divide to get the appropriate value per-tile.
That might do what you want, and might even be possible? You'd need to scan the lake to see how big it was, mind you, then divide to get the appropriate value per-tile.
Re: [MOD 0.12.x] Finite Water
This is a single player only mod, it does not synchronize with everyone and causes massive amounts of desyncronization errors.
You can get my mods by clicking here, and use discussions there or PMs here to suggest or report issues.
Want some blueprints made by me? Click here then!
Want some blueprints made by me? Click here then!
Re: [MOD 0.12.x] Finite Water
The OP has to use global.* tables in order for this mod to be MP-Compatible, anything "local" is never synced between clients, and thus never to be used on "on.tick", local variables should only be used inside a function that returns a variable that is not dynamic. (i.e. does not modify the game state). For example, SEARCH_OFFSET can be "local", but not "WATER_PER_TILE", since the latter actually affects how the tiles get removed.Vas wrote:This is a single player only mod, it does not synchronize with everyone and causes massive amounts of desyncronization errors.
-
- Filter Inserter
- Posts: 311
- Joined: Sat Jan 09, 2016 1:11 am
- Contact:
Re: [MOD 0.12.x] Finite Water
also like I proved a few post ago, even in single player the performance is pretty awfull.. anything more than 3-5 pumps and you're looking at a game crash.bloc97 wrote:The OP has to use global.* tables in order for this mod to be MP-Compatible, anything "local" is never synced between clients, and thus never to be used on "on.tick", local variables should only be used inside a function that returns a variable that is not dynamic. (i.e. does not modify the game state). For example, SEARCH_OFFSET can be "local", but not "WATER_PER_TILE", since the latter actually affects how the tiles get removed.Vas wrote:This is a single player only mod, it does not synchronize with everyone and causes massive amounts of desyncronization errors.
I made a bug report but the DEV discarded it because the mod use co-routine which they don't officially support at the moment.
a recode from scratch would be nice if one of you lua experts ever have the time, I'm available for testing if you need me.
Last edited by devilwarriors on Fri Apr 22, 2016 3:36 am, edited 2 times in total.
Re: [MOD 0.12.x] Finite Water
I currently see two ways this concept can work without lagging the entire game:devilwarriors wrote:also like I proved a few post ago, even in single player the performance is pretty awfull.. anything more than 3-5 pumps and your locking at a game crash.
I made a bug report but the DEV discarded it because the mod use co-routine which they don't officially support at the moment.
a recode from scratch would be nice if one of you lua experts ever have the time, I'm available for testing if you need me.
The easy, fast and rough way:
1-Search for water tiles in an area of radius r around the pump, and compute how much water there is on that area, save that in a variable. When that variable "water" runs out, replace the tiles around the pump to "grass" or "sand".
The elegant way, but much more complex to create:
2-Find all water tiles connected to the pump, and list the coordinates. Save that list and associate the coordinates to a UNIQUE and COMMON "water value". (Note every tile uses that one variable)
If there is multiple pumps, there's not more calculations to do, the water value just has to decrease faster
When that value runs out, for every x seconds the pump still runs, use a function to gradually replace the water tiles.
The only way this method can lag is
i. List the coordinates too fast when placing the pump, game might freeze for a couple ticks. Slower listing can compensate.
ii. Replacing the water tiles too fast, again, doing it slower and more gradually will compensate.
Note that you can abandon the "water value", and start slowly removing the tiles as soon you place the pump. For every k water used by pump, remove a water tile. If there is 2 pumps, you can just check for k1+k2.
Just don't save a water value for each tile for performance's sake, and don't compute the water value of each tile each tick...
The API already runs multiple lines of code for each event, multiplied by each water tile per tick... ouch...
I'm not a lua expert, but I have common sense regarding performance... (not insulting anyone, just giving constructive criticism)
Edit: That crash log looks like that the game ran out of threads... Probably too computationally intensive. You can make a similar crash by looping an bit of entity creation code.
-
- Fast Inserter
- Posts: 136
- Joined: Wed Dec 23, 2015 1:17 pm
- Contact:
Re: [MOD 0.12.x] Finite Water
You need to make the tiles had the number of the resource as ore.
Dark tile lot of water - 10000, bright tile - 5000. for example
This is the only sane way out! Somewhere I read on the forum that they will implement in version 0.13.
Or support or function in the game. Look forward to...
Dark tile lot of water - 10000, bright tile - 5000. for example
This is the only sane way out! Somewhere I read on the forum that they will implement in version 0.13.
Or support or function in the game. Look forward to...
English is not my native language. Translator.
Re: [MOD 0.12.x] Finite Water
Factorio2016, water above a certain size can not be depleted, that size is by default 10,000. So if there are 10k water blocks, it won't drain.
You can get my mods by clicking here, and use discussions there or PMs here to suggest or report issues.
Want some blueprints made by me? Click here then!
Want some blueprints made by me? Click here then!