I'm the author of the mod Factory Planner, and I just got a desync report from a user. He took a look at the desync report and noticed that the difference was not with the actual data, but with the order that it was saved in. I'm no good at interpreting desync reports, but I don't know how a mod can affect the serialization order of lua tables. I'd like to think it shouldn't be able to, but I don't know, maybe I'm missing something.
The desync reports are linked in the discussion thread. I investigated my code and I'm pretty sure I don't do any of the typical desync-causing stuff, like modifying global during on_load, or using read/write lua-global variables.
[0.17.68] Desync with mod caused by different serialization order
Re: [0.17.68] Desync with mod caused by different serialization order
Thanks for the report. The script contents may be different and there may be a bug around that logic but the desync itself is never triggered due to the contents of the script file. The desync is always triggered by what's different in level-heuristic.dat.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.17.68] Desync with mod caused by different serialization order
The heuristic shows some diff in the number of active entities
Well, I am going to move this to desyncs with mods
Well, I am going to move this to desyncs with mods
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [0.17.68] Desync with mod caused by different serialization order
I was paranoid that this was being caused by my mod, so I did some poking.
The only diff in the heuristics (which I barely understand) is on line 626, it mentions trains and active entities. My mod doesn't create or destroy any entities via scripting.
The report came from folks who were running a pack that includes the mod Electric Train. Looking at that mod's control.lua, it seems that it does use two local variables (i.e. defined outside of all functions, not in the global table) that are used by several functions, and it does create and destroy trains based on the values of those variables. Presumably any player that left and then returned would end up with different values.
I don't know that much about desyncs in Factorio but this seems like a good place to start.
The only diff in the heuristics (which I barely understand) is on line 626, it mentions trains and active entities. My mod doesn't create or destroy any entities via scripting.
The report came from folks who were running a pack that includes the mod Electric Train. Looking at that mod's control.lua, it seems that it does use two local variables (i.e. defined outside of all functions, not in the global table) that are used by several functions, and it does create and destroy trains based on the values of those variables. Presumably any player that left and then returned would end up with different values.
I don't know that much about desyncs in Factorio but this seems like a good place to start.
Re: [0.17.68] Desync with mod caused by different serialization order
Well, that should put it to bed. Thanks again Deadlock. I just was kind of paranoid because I got two desync reports in two days, with both not being my fault after all. Sorry to bother.