Skip to content

Synchronize building conditions from the host - #345

Open
macery12 wants to merge 2 commits into
CitiesSkylinesMultiplayer:masterfrom
macery12:Building-sync
Open

macery12 wants to merge 2 commits into
CitiesSkylinesMultiplayer:masterfrom
macery12:Building-sync

Conversation

@macery12

@macery12 macery12 commented Oct 9, 2026

Copy link
Copy Markdown

Summary

Clients can miss building fires or show different sickness counts and warning icons from the host. Correcting these differences currently requires a full /sync, which interrupts gameplay.

This PR makes the host authoritative for building conditions and keeps clients updated automatically, reducing the need for manual synchronization.

Changes

  • Synchronize building fire state, damage, warnings, and household health summaries.
  • Prevent client simulation from independently changing synchronized conditions.
  • Send changes in batches and periodically refresh state to correct divergence.
  • Reject stale updates after building replacement or save reloads, and require matching synchronization versions.
  • Add /building-sync for local diagnostics.

Validation

  • Release build successful.
  • All 16 regression groups pass.
  • In-game multiplayer validation completed successfully.

Reverse engineering assisted by GPT Sol 6.1 High.

Replicate fire state, building warnings and home health summaries in bounded
batches. Bind client snapshots to building lifetimes and reject mismatched
protocol versions to prevent stale or incompatible updates.

Keep host authority during client building simulation and reset caches on
connection and level transitions. Add local diagnostics and 16 regression
groups covering serialization, identity, recovery and patch target metadata.

Validation: Release build and all regression groups pass.
In-game multiplayer validation: user confirmed the preview works correctly.
@macery12

Copy link
Copy Markdown
Author

ci is failing prior to my changes

also should refrence #125 "The different errors/issues a building can have"

@kaenganxt kaenganxt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution! This is really appreciated. I didn't have time to test yet, but could you please take a look at these two comments?

Comment thread scripts/test-building-sync.ps1 Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, this file is about building and running the test. Could you please integrate this with the other script (build.ps1) to not repeat the logic of copying assemblies and also support other operating systems.

public List<string> Mods { get; set; }

[ProtoMember(9)]
public int BuildingStatusProtocol { get; set; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this protocol field for? The existing ModVersion field already takes care that only compatible game versions can play together.

@macery12

Copy link
Copy Markdown
Author

thanks for the review! ill get those fixes pushed here maybe today or so!

- Remove BuildingStatusProtocol from the connection handshake. The
  existing ModVersion check already rejects mismatched CSM builds.
- Replace scripts/test-building-sync.ps1 with a -Test switch in
  build.ps1, reusing its -Update assembly copy and MSBuild detection
  and running the test runner through mono on Linux/macOS.
- Resolve Harmony for the tests through NuGet instead of a custom
  lookup in project.assets.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macery12

Copy link
Copy Markdown
Author

Merged the script into build.ps1 as -Test (it reuses -Update for the assemblies and runs through mono on Linux/macOS). I've play-tested this as well. If you'd rather not keep a test project in the repo, I'm happy to drop tests/ entirely.

forgot to remove claude from commit 😭 sorry

as disclosure:
gpt sol 6.1 high used for first commit
claude opus 5.5 high for review

anything else lmk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants