Page MenuHomeWildfire Games

Fix MP OOS when rejoining on turn 0.
Needs ReviewPublic

Authored by wraitii on Sat, Nov 7, 11:42 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Trac Tickets
#5185
Summary

As reported in #5185 by elexis, there is a weird issue where rejoining on turn 0 will systematically OOS. However, a -rejointest=0 does not reproduce this.

The cause is that, on game init, m_CurrentTurn=0, m_ReadyTurn=1 . Thus, in OnJoinSyncingLoadedGame, when the server catches the client up to saved commands, it will ask it to play Turn 1, and will inform the rejoiner that Turn 1 has a duration of 0, since that's what's initialised.

Fixing this initialisation makes things work correctly.

Test Plan

Reproduction: Host an MP game, while the map loads, run Engine.SetSimRate(0) in the console. Then when the players have joined, play the game normally. You will OOS shortly.

Event Timeline

wraitii created this revision.Sat, Nov 7, 11:42 AM
wraitii retitled this revision from Fix MP OOS when rejoining no turn 0. to Fix MP OOS when rejoining on turn 0..Sat, Nov 7, 11:42 AM
wraitii added inline comments.
source/network/NetServerTurnManager.cpp
36–37

I think this comment is wrong, and turn 1 is actually executed.

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libnetwork.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libengine.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1773/display/redirect

wraitii requested review of this revision.Sat, Nov 7, 11:49 AM
wraitii updated this revision to Diff 13787.EditedSun, Nov 8, 10:50 AM

Next-day investigations are always fruitful.

Indeed, the comment is wrong (well, rather misleading). While turn 0 is indeed never executed, turn 1 is, but the clients do it on their own (since m_ReadyTurn == 1 at init). This means turn 1 is always of default length, and we ought to save that instead of 0.

This still fixes the OOS, obviously.

wraitii added inline comments.Sun, Nov 8, 10:52 AM
source/network/NetServerTurnManager.cpp
40

This is only technically correct in that CheckClientsReady will only ever send a CEndCommandBatchMessage message for turns 2 and above, but turn 1 is executed by all clients, in fact this is what triggers the whole process.

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libnetwork.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1780/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/3432/display/redirect