mirror of https://github.com/OpenTTD/OpenTTD
Codechange: improve desync documentation (#12521)
parent
07b162ffc4
commit
f7bd080015
|
@ -195,10 +195,11 @@ Last updated: 2014-02-23
|
||||||
'src/network/network_func.h'.
|
'src/network/network_func.h'.
|
||||||
(DEBUG_FAILED_DUMP_COMMANDS is explained later)
|
(DEBUG_FAILED_DUMP_COMMANDS is explained later)
|
||||||
- Put the 'commands-out.log' into the root save folder, and rename
|
- Put the 'commands-out.log' into the root save folder, and rename
|
||||||
it to 'commands.log'.
|
it to 'commands.log'. Strip everything and including the "newgame"
|
||||||
- Run 'openttd -D -d desync=3 -g startsavegame.sav'.
|
entry from the log.
|
||||||
This replays the server log and creates new 'commands-out.log'
|
- Run 'openttd -D -d desync=0 -g startsavegame.sav'.
|
||||||
and 'dmp_cmds_*.sav' in your autosave folder.
|
This replays the server log. Use "-d desync=3" to also create a
|
||||||
|
new 'commands-out.log' and 'dmp_cmds_*.sav' in your autosave folder.
|
||||||
|
|
||||||
## 3.2) Evaluation of the replay
|
## 3.2) Evaluation of the replay
|
||||||
|
|
||||||
|
@ -226,7 +227,7 @@ Last updated: 2014-02-23
|
||||||
savegames with your own ones from the replay. You can also comment/disable
|
savegames with your own ones from the replay. You can also comment/disable
|
||||||
the 'NOT_REACHED' mentioned above, to get another 'dmp_cmds_*.sav' from
|
the 'NOT_REACHED' mentioned above, to get another 'dmp_cmds_*.sav' from
|
||||||
the replay after the mismatch has already been detected.
|
the replay after the mismatch has already been detected.
|
||||||
See Section 3.2 on how to compare savegames.
|
See Section 3.3 on how to compare savegames.
|
||||||
If the saves differ you have located the Desync between the last dmp_cmds
|
If the saves differ you have located the Desync between the last dmp_cmds
|
||||||
that match and the first one that does not. The difference of the saves
|
that match and the first one that does not. The difference of the saves
|
||||||
may point you in the direction of what causes it.
|
may point you in the direction of what causes it.
|
||||||
|
@ -252,16 +253,14 @@ Last updated: 2014-02-23
|
||||||
are replayed. Their internal state will thus not change in the
|
are replayed. Their internal state will thus not change in the
|
||||||
replay and will differ.
|
replay and will differ.
|
||||||
|
|
||||||
To compare savegame more semantically, there exist some ugly hackish
|
To compare savegame more semantically, easiest is to first export them
|
||||||
tools at:
|
to a JSON format with for example:
|
||||||
http://devs.openttd.org/~frosch/texts/zpipe.c
|
|
||||||
http://devs.openttd.org/~frosch/texts/printhunk.c
|
|
||||||
|
|
||||||
The first one decompresses OpenTTD savegames. The second one creates
|
https://github.com/TrueBrain/OpenTTD-savegame-reader
|
||||||
a textual representation of an uncompressed savegame, by parsing hunks
|
|
||||||
and arrays and such. With both tools you need to be a bit careful
|
|
||||||
since they work on stdin and stdout, which may not deal well with
|
|
||||||
binary data.
|
|
||||||
|
|
||||||
If you have the textual representation of the savegames, you can
|
By running:
|
||||||
compare them with regular diff tools.
|
|
||||||
|
python -m savegame_reader --export-json dmp_cmds_NNN.sav | jq . > NNN.json
|
||||||
|
|
||||||
|
Now you can use any (JSON) diff tool to compare the two savegames in a
|
||||||
|
somewhat human readable way.
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
* Used to load the desync debug logs, i.e. for reproducing a desync.
|
* Used to load the desync debug logs, i.e. for reproducing a desync.
|
||||||
* There's basically no need to ever enable this, unless you really know what
|
* There's basically no need to ever enable this, unless you really know what
|
||||||
* you are doing, i.e. debugging a desync.
|
* you are doing, i.e. debugging a desync.
|
||||||
* See docs/desync.txt for details. */
|
* See docs/desync.md for details. */
|
||||||
bool _ddc_fastforward = true;
|
bool _ddc_fastforward = true;
|
||||||
#endif /* DEBUG_DUMP_COMMANDS */
|
#endif /* DEBUG_DUMP_COMMANDS */
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uncomment the following define to enable command replaying.
|
* Uncomment the following define to enable command replaying.
|
||||||
* See docs/desync.txt for details.
|
* See docs/desync.md for details.
|
||||||
*/
|
*/
|
||||||
// #define DEBUG_DUMP_COMMANDS
|
// #define DEBUG_DUMP_COMMANDS
|
||||||
// #define DEBUG_FAILED_DUMP_COMMANDS
|
// #define DEBUG_FAILED_DUMP_COMMANDS
|
||||||
|
|
Loading…
Reference in New Issue