Fix desync when cancelling a gravship launch#966
Open
cmlee119 wants to merge 1 commit into
Open
Conversation
The prelaunch-cancel handler closed the GravshipTravelSession with
CloseSessionAt(Find.CurrentMap.Tile). Cancelling runs as a synced command
on every peer, but Find.CurrentMap is the map each peer's camera is on -
local UI state, not synchronized simulation state. A peer whose camera is
on a different map closes the wrong tile and never closes the gravship
session, so that map stays paused only for them. The per-map tick counts
then diverge and the game desyncs ("Map instances don't match" /
"Wrong random state on map N").
Close the session by looking it up instead of by the local camera. Of the
four CloseSessionAt call sites, this was the only one using Find.CurrentMap;
the others already pass deterministic tiles (curTile/landingTile/takeoffTile).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #965.
Problem
PatchGravshipPreLaunchCancel.Postfixclosed theGravshipTravelSessionwith:Cancelling a gravship launch is a synced command, so this runs on every peer — but
Find.CurrentMapis the map each peer's camera is on, i.e. local UI state, not synchronized simulation state. A peer whose camera is on another map callsCloseSessionAtwith the wrong tile and never closes the session, so that map stays paused only for them. BecauseGravshipTravelSession.IsCurrentlyPausing(map) => map == Mapgates whether the map ticks, the per-map tick counts then diverge and the game desyncs (Map instances don't match/Wrong random state on map N).Of the four
CloseSessionAtcall sites inGravshipTravelSessionPatches.cs, this was the only one usingFind.CurrentMap; the others already pass deterministic tiles (curTile/landingTile/takeoffTile).Fix
Close the session by looking it up instead of by the local camera. There is exactly one open
GravshipTravelSessionwhile a launch is pending, so a smallCloseAllSessions()helper closes it deterministically on every peer.Testing
Source/Clientbuilds clean (Release).Investigated and written with the help of Claude (Anthropic).