Vixen
02b45cc4
csharp
public sealed class ReplicationClient

Applies snapshots into a client's world.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The client keeps its own map from NetworkId to its own Entity, because the two worlds have no reason to agree about handles. An id it has never seen is an entity it creates; an id in the removal list is one it destroys.

A snapshot that does not decode is not acknowledged. Records are applied as they are read, so a malformed one leaves the world part-way through — and that is fine, because the tick is never acknowledged, so the server's baseline does not advance and everything in it comes again. The alternative, buffering the whole snapshot to apply it atomically, costs an allocation per tick to protect against a case that corrects itself.

Fields and properties (5)

  • public Tick AppliedTick

    The newest tick that was applied without anything going wrong.

  • public bool HasApplied

    Whether anything has been applied at all.

  • public int EntityCount

    How many networked entities this client is holding.

  • public int RejectedSnapshotCount

    Snapshots that failed to decode since this client was made.

  • public int StaleSnapshotCount

    Snapshots that arrived after a newer one had already been applied, and were dropped.

Methods (5)

  • public ReplicationClient(ReplicationRegistry registry)

    Creates a client-side applier.

  • public bool TryGetEntity(NetworkId id, out Entity entity)

    Finds the local entity a networked id names.

  • public void Bind(NetworkId id, Entity entity)

    Says which local entity an id names.

  • public bool TryApply(World world, ReadOnlySpan<byte> snapshot)

    Applies a snapshot.

  • public void Clear()

    Forgets everything, for a client that is reconnecting into a fresh world.

Used by (10)

  • GameClientMultiplayer
  • LocalMatchMultiplayer
  • NetworkMatchMultiplayer
  • DeltaTestsVixen.Net.Tests
  • NetworkSpawnSystemVixen.Net.Engine
  • NetworkSpawnTestsVixen.Net.Engine.Tests
  • ReplicationTestsVixen.Net.Tests
  • SnapshotTargetVixen.Net.Fuzz
  • SyncListReplicationTestsVixen.Net.Engine.Tests
  • SyncStateTestsVixen.Net.Engine.Tests