"Owner-simulated networking"
- Proxies simulate input and fight the owner (jitter, double-apply).
- Host-authoritative meters get written on clients then snapped back every snapshot.
- You
NetworkSpawna scene-wide clock/singleton and nothing makes sense.
Two different recipes get mixed:
- Per-owner objects (player pawns) — owner simulates,
[Sync]replicates to proxies. - Shared host truth (day/night, run stats) — every peer builds the same GO locally; host mutates;
[Sync(SyncFlags.FromHost)]replicates.
GameObject.NetworkMode defaults to Snapshot, not Never (per Sandbox.Engine.xml). The engine does not stop a non-host from writing a FromHost field locally — the next snapshot steamrolls it — so a manual host guard is still load-bearing.
Lobby + pawn spawn (host)
if (!Networking.IsActive)
Networking.CreateLobby(new LobbyConfig());
// on host, INetworkListener.OnActive(Connection):
var go = prefab.Clone();
go.NetworkSpawn(channel); // owner channelOwner-simulated pawn
protected override void OnFixedUpdate()
{
if (IsProxy) return; // proxies do not simulate
// read input, integrate, write [Sync] fields
}
[Sync] public Vector3 NetPosition { get; set; }
[Sync(SyncFlags.FromHost)] public bool RoundActive { get; set; } // example host flag[Rpc.Broadcast] for one-shot events. Host migration and interp come free with the stock path.
Networked props are runtime-only — never rely on them being saved into scene files.
Scene-wide singleton (shared truth)
- Build identically on every peer from your bootstrap/world generator before any lobby dependency.
- Tag authoritative fields
[Sync(SyncFlags.FromHost)]. - Gate mutations:
if (Networking.IsActive && !Networking.IsHost) return;Do not reach for NetworkSpawn when there is no per-client owner — only one shared host-owned truth.
IsProxy partitions simulation so only the owning connection integrates. [Sync] streams owner state to everyone else. FromHost is the parallel channel for global state; Snapshot mode already exists on scene objects, so spawning them again as owned network objects fights the default model.