Page 1 of 1

[Rseding91] [0.17.9] Modded:Cannot save map: Detected corruption of the game state

Posted: Sat Mar 09, 2019 9:31 am
by CaveGrinder
Hi,

i am currently working on a mod and am encountering a reproduce-able game state corruption. I am seeing this in 0.17.9 and 0.17.0, i did not try intermediate versions. Also the mod needs 0.17.x so i cannot try it in 0.16.x

steps to reproduce:
add only one attached mod RepeatingIslands_0.1.1
RepeatingIslands_0.1.1.zip
(4.32 KiB) Downloaded 173 times
start a new game
choose "island" from map type (mandatory, otherwise the mod doesn't work correctly)
change Island size to lowest 17% (not so relevant but should show the issue faster)
run the command
/c game.forces.player.chart(game.player.surface, {lefttop = {x = -2048, y = -2048}, rightbottom = {x = 2048, y = 2048}})
Wait, the corruption typically occurs within ~1-2 minutes. It is 100% reproduceable on my machine, i tried it at least 30 times while trying to narrow it down.

The mod creates a new surface with the island type in the background. once the island is completely generated it is copied over to nauvis, and another one is started.
The mod makes heavy use of the APIs is_chunk_generated/request_to_generate_chunks/force_generate_chunk_requests/count_tiles_filtered/clone_area/delete_surface.
I was not able to pin it down to one responsible call, but the combination in the current mod shows it the fastest for me.
I know the delete_surface call is not the cause since it happens also when i don't delete the surfaces and just use new ones.

Re: [0.17.9] Modded:Cannot save map: Detected corruption of the game state

Posted: Sat Mar 09, 2019 11:29 am
by Klonan
Can you post the log

Re: [0.17.9] Modded:Cannot save map: Detected corruption of the game state

Posted: Sat Mar 09, 2019 11:30 am
by Klonan
Also if you want multiple islands you can just set multiple starting points to the nauvis surface

Re: [0.17.9] Modded:Cannot save map: Detected corruption of the game state

Posted: Sat Mar 09, 2019 12:40 pm
by CaveGrinder
i have attached the log:
factorio-current.log
(5.08 KiB) Downloaded 182 times
the starting_points is almost what i wanted but it didn't quite fit.
- i have to know the number of islands in advance, but i want to use ships and don't know if i spend 10h,100h or 1000h on the map so i tried a generic approach
- maybe i got it wrong, i thought changing the map_gen_settings of nauvis does nothing as it would not be re-applied... i could create another surface with those settings but then mods that assume i am playing on nauvis would not work

Re: [0.17.9] Modded:Cannot save map: Detected corruption of the game state

Posted: Fri Mar 15, 2019 7:25 am
by CaveGrinder
i have found a workaround; if i ensure that the chunk exists before calling clone_area
(using calling is_chunk_generated+request_to_generate_chunks and waiting till that is done)
this corruption doesn't seem to happen

Re: [Rseding91] [0.17.9] Modded:Cannot save map: Detected corruption of the game state

Posted: Tue Apr 30, 2019 8:18 pm
by Rseding91
Thanks for the report. It's now fixed for the next version of 0.17.

Re: [Rseding91] [0.17.9] Modded:Cannot save map: Detected corruption of the game state

Posted: Wed May 01, 2019 1:31 pm
by CaveGrinder
awesome :)