Account for multiplayer desynchronisation
Closed this issue · 2 comments
ChrisNeedham24 commented
Desynchronisation very rarely occurs now due to the random number generator being seeded with the turn number in multiplayer games. However, that doesn't mean it never occurs.
This issue can be resolved in one of two ways:
- Identify where desync is occurring and fix it (I last saw it with AI settlements being located in slightly different locations) [preferable, but obviously may not be so easy to do]
- Detect when a client has fallen out of sync with the game server by either adding a new SYNC event type or by extending the keepalive requests to also include a hash of the server's game state. Fortunately
GameStateobjects are hashable so this could work quite nicely. If a client falls out of sync, just load them into the game again, but display some sort of message first.
ChrisNeedham24 commented
This could probably be nicely done by sending a hash of the server's game_state.players as part of EndTurnEvents.
ChrisNeedham24 commented
Fortunately GameState objects are hashable so this could work quite nicely.
Narrator: GameState objects were not hashable.