Repository navigation
fix(coop): keep a PvP client's new base in the host's copy of its world (#21) - #234
Merged
Merged
Conversation
…ld (#21) In a PvP campaign with the host on the alien side, the X-COM client's world lives on the host as a copy. The host serves that copy when the client rejoins after a drop, and writes it into a save it makes without asking the client (SAVE & QUIT on its waiting dialog after the client dropped). The client sent its world only at the campaign start, around battles and for soldier gifts, so a base built later was missing from the copy: it vanished from both machines on a rejoin, and from that save. The client now sends its world to the host when it places the access lift of a later base. test_pvp_second_base covers both alien sides: a later base on both machines after a client crash and rejoin, the month-end report, and the host's save reloaded by both players.
NonPolynomialTim
enabled auto-merge (squash)
November 6, 2026 01:46
NonPolynomialTim
disabled auto-merge
November 6, 2026 02:05
NonPolynomialTim
enabled auto-merge (squash)
November 6, 2026 02:05
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.
Problem
In a PvP campaign where the host plays the alien side, the X-COM player's second base disappears. Reproduced on stock data at main
8ccc045c9: the client builds a second base, then crashes (or loses its connection) and rejoins. The second base is gone from its own base list and from the host's globe. The same happens when the host takes SAVE & QUIT on its waiting dialog after the client dropped and both players reload that save.Root cause
The X-COM client's world lives on the host as a copy. The host serves that copy to a rejoining client and writes it into a save it makes without asking the client. The client sent its world only at the campaign start, around battles and for soldier gifts. Building a base sent only the globe marker, so the copy stayed at its campaign-start state.
Captured with temporary logging on the host's store and serve paths (since removed):
A host save through the save menu or an autosave first asks the client for its current world, so it keeps the base. Only the paths that read the copy directly lose it.
Fix
PlaceLiftState::viewClick: after a PvP player places the access lift of a later base, it sends its world to the host (pushProgressToHostSilently). That call does nothing on the host and on the alien side, and SHARED and SEPARATE campaigns never reach this branch.Test
tools/coop_test/test_pvp_second_base.py, stock data, both alien sides. It checks both machines after every step: the X-COM machine owns each base once, and the alien machine shows each one once.On main: red 3 of 3. SecondBase is lost at the rejoin, and ThirdBase is lost from the SAVE & QUIT save. The client-as-alien leg passes. With the fix: green, then 20 of 20 in a row (10 per harness slot, two slots in parallel), about 21 s per run. Related tests pass once each:
test_pvp_duplicate_bases,test_pvp_campaign_resume,test_pvp_campaign_battle,test_pvp_campaign_reconnect,test_pvp_campaign_month.The client-as-alien case from the report (host is X-COM, no battle) does not reproduce on current main, under stock data or X-Com Files 3.9. The host's bases live in its own world, and they survive the month end, the host's save and reload, and a client rejoin.
Fixes #21