Skip to content

Synchronize customization, gadgets, items, and shops - #163

Draft
Patrick-van-Halm wants to merge 8 commits into
AMacro:betafrom
Patrick-van-Halm:feat/gadget-sync
Draft

Synchronize customization, gadgets, items, and shops#163
Patrick-van-Halm wants to merge 8 commits into
AMacro:betafrom
Patrick-van-Halm:feat/gadget-sync

Conversation

@Patrick-van-Halm

@Patrick-van-Halm Patrick-van-Halm commented Aug 10, 2026

Copy link
Copy Markdown

Summary

This PR expands multiplayer world synchronization to cover vehicle customization, gadgets, soldering, item reconciliation, and shop purchases. It also hardens item ownership and late-join restoration so clients converge on the same world state without relying on every relevant scene or object being loaded at the same time.

What changed

Customization and gadgets

  • Synchronizes gadget placement and removal, drilling holes, mounting, wiring, snapping, spool changes, duct-tape replacement, and soldering.
  • Tracks mutable gadget state such as channels, modes, switches, text, timers, mounting points, and soldering progress.
  • Captures a complete customization snapshot for joining clients and applies it in dependency order.
  • Defers placements, relationships, and hole state until their items and customization targets are ready.
  • Prevents remotely applied actions from being echoed back onto the network.

Items and late-join reconciliation

  • Adds explicit client/server item reconciliation packets and shared reconciliation rules.
  • Restores referenced items before applying customization relationships that depend on them.
  • Synchronizes extensible tracked values through a central serializer instead of adding gadget-specific fields to the base item protocol.
  • Improves item creation, deletion, ownership, storage, and dropped-item handling when objects load in a different order on each peer.
  • Reconciles player and train state after late joins and scene transitions.

Shops and ownership

  • Coordinates purchases through the host while preserving the initiating player's ownership of purchased items.
  • Synchronizes approved baskets and global shop stock across peers.
  • Scales stock allowances for multiplayer without overwriting zero-value lockouts or unrelated runtime overrides.
  • Recounts existing shop items when initializing synchronized stock.
  • Fixes lost-and-found and storage flows that could otherwise assign ownership to the wrong player.
  • Integrates shop registers with the existing networked cash-register lifecycle.

Architecture

  • CustomizationStateManager owns capture, deferred restoration, and application of customization actions.
  • GadgetTrackedValueRegistry maps game gadget types onto the generic tracked-value item protocol.
  • NetworkedItemManager remains responsible for item identity, lifecycle, ownership, and reconciliation.
  • ShopPurchaseCoordinator isolates shop inventory and purchase semantics from packet transport and Harmony patches.
  • Harmony patches observe game actions at their source, while synchronization scopes prevent feedback loops during remote application.
  • The host relays shared world changes and coordinates purchases; ordinary customization interactions remain client-authoritative because the host may not have the initiating player's area loaded.

@Patrick-van-Halm
Patrick-van-Halm force-pushed the feat/gadget-sync branch 24 times, most recently from e86c576 to 537b657 Compare August 13, 2026 18:23
@Patrick-van-Halm Patrick-van-Halm changed the title Gadget & item customization synchronization Synchronize customization, gadgets, items, and shops Aug 16, 2026
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.

1 participant