Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#5199 closed defect (fixed)

Out-Of-Sync when doubleclicking on StartGame

Reported by: elexis Owned by: elexis
Priority: Release Blocker Milestone: Alpha 23
Component: Network Keywords:
Cc: Patch: Phab:D1558 Phab:D1562

Description

If clicking twice on StartGame as a multiplayer host (one has to be really quick), then launchGame(); is executed twice.

The first call choses an rng seed, starts networked game and loading screen. But launchGame doesn't switch the GUI page, the networking code does that and that is delayed. So the second click still has time to be executed. A new RNG is set again, the different gamesettings are broadcasted again.

StartNetworkGame is called again which doesn't execute code but throws this error:

ERROR: Net client: Error running FSM update (type=24 state=6) NMT_GAME_START while NCS_LOADING

If there are two clients connected, it can yield an instant OOS error.

temple considers that this could be the cause for the KunstRaucher Mainland OOS reported in #5162. The entities are serialized and deserialized properly, but a different RNG seed would generate a different terrain.

Change History (5)

comment:1 by elexis, 4 years ago

Milestone: BacklogAlpha 23
Patch: Phab:D1558

comment:2 by elexis, 4 years ago

Amazingly there is no OOS message on rejoin for arbitrary amount of time if the terrain is flat enough to not change the territory borders of players at gaia resources if units don't move.

But one can see that the mapgen terrain textures and elevation are different while the entities are deserialized and thus correct (most notably CC patch not below the CC).

One can warn(uneval(g_GameAttributes)); after rejoin or gamestart and see that the Seed is in fact different too.

So the terrain and entity effect are not only perfectly able to explain the KunstRaucher replay, but I'm inclined to say that this error must have been it, since the oos_dump.diff fingerprint exactly matches and every further rejoin was broken (whereas all other OOS issues we found and all other games we observer are in sync).

Reproducing yields exaclty those territory differences, and only for the rejoined client, not for the non-rejoined ones.

2nd Bug: This triggers a network FSM error, as the StartGame packet is not expected once it started. This FSM error was never reported afaics (would have been in #3199).

3rd Bug: The playernames are copied from the assignments to the gameattributes in launchGame(). When launchGame is called the second time, it writes them to the persistmatchsettings file. Then they appear after the next gamesetup instead of "Player 1" in the slot labels: #5206.

comment:3 by elexis, 4 years ago

Patch: Phab:D1558Phab:D1558 Phab:D1562
Priority: Must HaveRelease Blocker

comment:4 by elexis, 4 years ago

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 21836:

Fix an OOS on rejoin after doubleclicking on the StartGame button, fixes #5199, refs #5162.

Prevents changes to the gamesettings after the game was started, so as to use the correct map seed when generating the random map terrain for rejoiners.
D1558 will prevent the UI bug #5206 and FSM error from doubleclicking on StartGame.

Differential Revision: https://code.wildfiregames.com/D1562
Tested and accepted by: temple

comment:5 by elexis, 4 years ago

In 21843:

Prevent calling the JS gamestart function twice when doubleclicking on the "Start Game" button.

It triggered an OOS on rejoin prior to rP21836, refs #5199 and
resulted in the playernames of the current match persisting into new gamesetups, fixes #5206.

Differential Revision: https://code.wildfiregames.com/D1558
Comments By: wraitii

Note: See TracTickets for help on using tickets.