Vixen
02b45cc4
csharp
public sealed class SnapshotBuffer

The last few places something was, and where it therefore is now.

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

Remarks

A client draws the world behind the server, not at it: at TickManager.InterpolationTick, far enough back that the snapshots bracketing the moment being drawn have already arrived. That is what makes motion smooth on a connection that delivers in bursts — the buffer is the delay, and the delay is what buys the interpolation something to interpolate between.

Rotation is held rather than extrapolated. A position that overshoots comes back with the next snapshot and reads as momentum; a rotation that overshoots reads as a stumble, and there is no rotational equivalent of the position's constant velocity that is worth assuming.

Fields and properties (10)

  • public SnapshotBufferOptions Options

    How it behaves when it runs out.

  • public int Count

    How many samples are held.

  • public int Capacity

    How many it can hold before the oldest goes.

  • public long StaleCount

    Samples ignored because something newer had already arrived.

  • public long InterpolatedCount

    Times a value was interpolated between two samples, which is the ordinary case.

  • public long ExtrapolatedCount

    Times motion past the newest sample had to be guessed at.

  • public long SnappedCount

    Times two samples were too far apart to move between, so the object jumped.

  • public long StarvedCount

    Times there was nothing to work with and the newest or oldest was held.

  • public TransformSample Newest

    The newest sample held.

  • public TransformSample Oldest

    The oldest sample held.

Methods (4)

  • public SnapshotBuffer(int capacity = 32, SnapshotBufferOptions? options = null)

    Creates a buffer.

  • public bool Add(in TransformSample sample)

    Takes a sample.

  • public void Clear()

    Forgets everything, for an object that has just been spawned again.

  • public bool TrySample(Tick tick, float fraction, out TransformSample sample)

    Works out where the thing is at a moment between ticks.

Used by (2)

  • GameClientMultiplayer
  • MotionTestsVixen.Net.Tests