pelya / openttd-android

OpenTTD for Android
Other
91 stars 22 forks source link

Android-only desync #12

Open ldpl opened 3 years ago

ldpl commented 3 years ago

Saw some player desync on my server so I asked them and it turns out they were using the android version. I checked it and indeed, android desyncs while pc one works for both me and them. I bundled everything I have on this desync, hope that can be of some help. desync.zip

d27.sav - server save at the moment it received the desync netsave.sav - from the (android) client netsave_4_ticks.sav - netsave.sav advanced 4 ticks forward to match the server save (without applying the commands) cmdlog.json - command log preceding the desync. Unfortunately, my diagnostics bugged out so it's in an internal json format, not sure how helpful that is. g.dfff - difference between d27.sav and netsave_4_ticks.sav. You can probably ignore PSAC chunk, that's some extra citymania data that shouldn't be affecting unmodified clients. log.txt - relevant parts of the server log

At a quick glance I didn't find anything too out of the ordinary in the diff but may be you can figure out what's wrong.

pelya commented 3 years ago

I'll try to compare git tag 1.11.2 with 1.11 branch of my Android repo. There should not be any changes to the network code. ARM on Android is little-endian, so it should not be endianness issue either.

Does this bug happen often?

On Sun, 16 May 2021, 13:56 Pavel Stupnikov, @.***> wrote:

Saw some player desync on my server so I asked them and it turns out they were using the android version. I checked it and indeed, android desyncs while pc one works for both me and them. I bundled everything I have on this desync, hope you can figure out what's wrong. desync.zip https://github.com/pelya/openttd-android/files/6489080/desync.zip

d27.sav - server save at the moment it received the desync netsave.sav - from the (android) client netsave_4_ticks.sav - netsave.sav advanced 4 ticks forward to match the server save (without applying the commands) cmdlog.json - command log preceding the desync. Unfortunately, my diagnostics bugged out so it's in an internal json format, not sure how helpful that is. g.dfff - difference between d27.sav and netsave_4_ticks.sav. You can probably ignore PSAC chunk, that's some extra citymania data that shouldn't be affecting unmodified clients. log.txt - relevant parts of the server log

At a quick glance I didn't find anything too out of the ordinary int the diff but may be you can figure out what's wrong.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pelya/openttd-android/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABF5QCPJ5JY3U75MBCUKXDTN6QGDANCNFSM446YZJOQ .

ldpl commented 3 years ago

Not sure how often it happens in general but in that particular game android players are always getting desynced few minutes after join.

pelya commented 3 years ago

I've reproduced the desync, for what it's worth. Start OpenTTD, Muliplayer -> Start server -> Load game -> d27.sav. Connect to the server with Android OpenTTD. On the server, load d27.sav again, and let it run for one minute. Android OpenTTD will disconnect with a desync error. When I am compiling Android sources on PC (yes you can compile Android repo for PC), the desync does not happen. The difference with Android code is SDL2 vs SDL1.2 and several #ifdef ANDROID lines in the code, but the biggest difference is probably the ARM64 architecture.