Vixen
dd8b0a81
csharp
public sealed class NetworkTransformInterpolateSystem

Draws received objects where they were, not where the last packet said they are.

Read the guide page for this →

As a system

Phase
FixedUpdate

Remarks

The engine's answer to "who owns interpolation", and it had not been given one. Vixen.Net shipped SnapshotBuffer — the ring, the interpolation, the clamped extrapolation, the teleport-aware snap — and nothing in Core/ ever built one: the only two construction sites in the repository were a unit test and Samples/08-Multiplayer, which drives the whole thing by hand. Meanwhile NetworkTransformApplySystem, the system a game reaches for, wrote the received pose straight into LocalTransform with no buffering and no interpolation delay, so the engine's own bridge was the *un*smoothed path and the smoothed one had no system. See .

It runs after the apply system rather than instead of it, and the split is the whole design. The apply system resolves NetworkParent frames, reparents, and places anything this one has nothing to say about; this overwrites the placement for the entities it holds a buffer for. A game that wants the raw path adds only the apply system, which is what it always had; a game that wants smoothing adds both. Nothing has two policies for one question.

One sample per applied tick, for every networked object, whether or not it moved. "It did not change" is as much a fact about where something is at that tick as a new position would be, and the buffer drops anything not newer than what it holds, so re-adding costs a comparison. Sampling only what the snapshot mentioned would leave a still object with one sample and a buffer that reports itself starved for ever.

⚠ An entity whose NetworkParent has not arrived is left alone. The buffer holds what NetworkTransform said, which for a parented entity is a seat offset — and a seat offset written as a world position puts the rider at the middle of the map. The apply system already holds those still and counts them; this must not undo that by interpolating between two offsets and placing the result in world space.

Fields and properties (6)

  • public SystemAccess Access

    What this system reads and writes.

  • public int BufferedCount

    How many objects have a buffer.

  • public long SampledCount

    How many transforms have been placed from a buffer.

  • public long EvictedCount

    How many objects have been forgotten because they left this peer's world.

  • public long StarvedCount

    How many samples had nothing to sit between and were held at the newest pose instead.

  • public long UnresolvedFrameCount

    How many were left where the apply system put them, their frame not having arrived.

Methods (5)

  • public NetworkTransformInterpolateSystem(ReplicationClient client, TickManager clock, SnapshotBufferOptions? options = null, int capacity = 32)

    Creates the system.

  • public override JobHandle Update(in SystemContext context, JobHandle dependency)

    Runs the system.

  • public void Advance(World world)

    Takes a sample of everything, then draws everything at the interpolation tick.

  • public bool TryGetBuffer(NetworkId id, out SnapshotBuffer? buffer)

    The buffer an object's poses are kept in, for a diagnostic that wants to draw it.

  • public void Clear()

    Forgets everything, for a peer that has reconnected into a different world.

Used by (1)

  • NetworkTransformInterpolationTestsVixen.Net.Engine.Tests