Hornwitser's Python Scripts (desync diff/.dat parse/multi instance)

Tools which are useful for mod development.
Post Reply
Hornwitser
Fast Inserter
Fast Inserter
Posts: 204
Joined: Fri Oct 05, 2018 4:34 pm
Contact:

Hornwitser's Python Scripts (desync diff/.dat parse/multi instance)

Post by Hornwitser »

I've made some open source Python scripts for helping with diffing desync reports, inspecting .dat files (not level.dat) and running multiple instances of Factorio on Windows from the same installation.

Of these tools the desync differ is probably the most interesting one. You can install it (and all the other tools) with the following command on Windows:

> py -m pip install --user --upgrade hornwitser.factorio_tools

Then run it against a desync report with:

> py -m hornwitser.factorio_tools desync path\to\desync-report.zip

This gives an output similar to the sample output below. Which should aid in finding out the cause of the desync, though it might take a long time, and it might output a lot of junk. The pos=number indicates the byte offset in file and ref/des is shorthand for reference-level/desynced-level.

Code: Select all

level-heuristic differs
-----------------------

replace   ref[8:9] -> des[8:9]
<player name=arty714> pos=0
  <output-console> pos=70
    <output-console-item> pos=90
      <localised-string> pos=111
        <localised-string> pos=133
ref: b'\x02l...nces/game1/temp/currently-playing/expcore/Mini_games.lua:584: A game is already running, please use /stop\x00'
<player name=arty714> pos=0
  <output-console> pos=70
    <output-console-item> pos=90
      <localised-string> pos=111
        <localised-string> pos=133
des: b'\x02l...ances/base/temp/currently-playing/expcore/Mini_games.lua:584: A game is already running, please use /stop\x00'

script.dat differs
------------------
parsing desynced-level/script.dat
parsing mp-save-7/script.dat
Path: ['data', 'level', 'dump', 'data', 'tokens', 'value', 7.0, 'value', 'participants', 'value', 1.0, 'value', 'playertarget', 'value']
Reference value: 3.0
Desynced value: 1.0
Path: ['data', 'level', 'dump', 'data', 'tokens', 'value', 7.0, 'value', 'participants', 'value', 2.0, 'value', 'playertarget', 'value']
Reference value: 4.0
Desynced value: 2.0
Path: ['data', 'level', 'dump', 'data', 'tokens', 'value', 10.0, 'value', 'chests', 'value', 1.0, 'value', 1.0, 'value', 'entitytarget', 'value']
Reference value: 1.0
Desynced value: 3.0
Path: ['data', 'level', 'dump', 'data', 'tokens', 'value', 10.0, 'value', 'chests', 'value', 2.0, 'value', 1.0, 'value', 'entitytarget', 'value']
Reference value: 2.0
Desynced value: 4.0

level_with_tags.dat differs
---------------------------

replace   ref[13:14] -> des[13:14]
<players> pos=114105240
  <output-console> pos=114105295
    <output-console-item> pos=114105315
      <localised-string> pos=114105338
        <localised-string> pos=114105360
ref: b'\x02l...nces/game1/temp/currently-playing/expcore/Mini_games.lua:584: A game is already running, please use /stop\x00'
<players> pos=114105240
  <output-console> pos=114105295
    <output-console-item> pos=114105315
      <localised-string> pos=114105338
        <localised-string> pos=114105360
des: b'\x02l...ances/base/temp/currently-playing/expcore/Mini_games.lua:584: A game is already running, please use /stop\x00'
You can find the latest version and instructions for use on my Github repository for it, and on PyPI under the name hornwitser.factorio_tools.

Hornwitser
Fast Inserter
Fast Inserter
Posts: 204
Joined: Fri Oct 05, 2018 4:34 pm
Contact:

Re: Hornwitser's Python Scripts (desync diff/.dat parse/multi instance)

Post by Hornwitser »

I added a ping tool which can ping Factorio servers over UDP and show basic statistics about it, might be useful for troubleshooting multiplayer issues. See the README on the Github/PyPi page linked in my previous post for details.

Post Reply

Return to “Development tools”