NBlood icon indicating copy to clipboard operation
NBlood copied to clipboard

Out of sync between Linux and Windows

Open CommonLoon102 opened this issue 5 years ago • 3 comments

It goes out of sync for the host right after somebody moves. The game runs well though, but the out of sync text will be on the screen for the host.

CommonLoon102 avatar Sep 23 '19 23:09 CommonLoon102

Moving discussion here from #545.

Hendricks266 avatar Aug 03 '23 21:08 Hendricks266

@zZeck wrote:

MinGW by default was using ms_struct style packing. This made XSPRITE a have different structure in memory, and different size. Checksums don't match as a result. In network.cpp CalcGameChecksum this code

    sum = 0;
    length = sizeof(XSPRITE)/4;
    while (length--)
    {
        sum += *pBuffer++;
    }

would give a different sum.

PR #545 specified -mno-ms-bitfields to GCC as a fix.

@nukeykt wrote:

disabling check for xsprite checksum altogether might be a better idea. ENet code is robust enough I think

@NY00123 wrote:

I think that I recently got this reproduced (i.e., an out of sync message during what still looked like a functional game with no sync issue), albeit while using NotBlood.

So, maybe a fix can be applied? I currently think about two options:

  1. Disable the xsprite checksum check as suggested by @nukeykt.

  2. Calculate the checksum in a cross-platform manner, similar in idea to struct serialization.

Hendricks266 avatar Aug 03 '23 22:08 Hendricks266

Checksum code can be rewritten to manually read every member's input to the total sum.

There is also an issue where by changing the player's autoaim setting while looking at a potential target, it'll cause the game to desync. This is caused by the actual autoaim setting being applied locally at a different tick, compare to when the other clients receive the player profile update. This was fixed for NotBlood by separating local and network profiles, and updating the player settings on respawn.

tmyqlfpir avatar Aug 04 '23 11:08 tmyqlfpir