Open andreas-eberle opened 9 years ago
If the game gets out of sync it may be wise to slow down the users in the future's game slightly until they are in sync to make the proces smooth and unnoticable, especially when playing against a laggy machine.
Delaying slow players is a different proble. In this case here, a game command has already been executed on client but not on the other. This cannot be repaired, we need to restore an older game status or sync back with one master player.
Ahhh, i see.
Return To The Roots, the Settlers II engine reimplementation, additionally provides a log file which makes tracking down causes for desyncs easier. This guide on how to track down a Desync may serve as an inspiration: https://github.com/Return-To-The-Roots/s25client/wiki/Async---What-is-that-and-how-to-help-fixing-it%3F
@Hiradur: Thanks for the link.
In general, our netcode prevents desyncs by design. So only a bug in that system or the usage of random numbers could cause a desync. That's why I think a simple check would be enough for now. The problem should never occur ;)
In multiplayer the game should check if the players are still in sync. This would prevent a later "manual" detection and therefore the loss of a lot of playing time. Furthermore, it would help to detect bugs that cause the asynchronism.
Suggested Implementation All clients could regularly (all clients at the same game time) send a calculated pseudo random number of the game's random generator. If the game is in sync, these numbers are all equal. If the game is out of snyc, the numbers will differ immediately.