NBlood
NBlood copied to clipboard
Out of sync between Linux and Windows
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.
Moving discussion here from #545.
@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:
Disable the xsprite checksum check as suggested by @nukeykt.
Calculate the checksum in a cross-platform manner, similar in idea to struct serialization.
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.