Nebula
Core

StateHistory

The bounded per-entity ring of recorded ticks behind NetworkIdentity.StateAt: pose, velocity, container, epoch and the SyncHistoryAttribute variables, one entry per server tick, indexed by tick % capacity.

generated from the sources
public sealed class StateHistory

The bounded per-entity ring of recorded ticks behind NetworkIdentity.StateAt: pose, velocity, container, epoch and the SyncHistoryAttribute variables, one entry per server tick, indexed by tick % capacity. One instance per NetworkIdentity, created on the first recorded tick.

The ring and the per-slot buffers are allocated once and reused: recording a tick copies into them and never allocates after the buffers have reached the size the entity's marked variables need.

Design record: docs/state-history.md.

Fields

DefaultWindowTicks

public const int DefaultWindowTicks = 32;

Ticks kept per entity when the game does not say otherwise (NebulaConfig.StateHistoryTicks).

MaxWindowTicks

public const int MaxWindowTicks = 1024;

The most ticks a window may be asked for. A larger value is clamped to this.

GapToleranceTicks

public const int GapToleranceTicks = 4;

How far TryGetStateAt looks either side of the asked-for tick when that tick itself was not recorded (a ghost whose owner sent nothing that tick because nothing moved). The entry returned says which tick it is; nothing is interpolated or extrapolated.

Properties

WindowTicks

public static int WindowTicks { get; }

Ticks of history every entity in this process keeps, from NebulaConfig.StateHistoryTicks. Zero turns recording off entirely. Set by NebulaWorker at start-up; a client leaves it at zero, because history is a worker-side facility (the client has RemoteInterpolator).

Capacity

public int Capacity { get; }

Ticks this ring can hold.

HasEntries

public bool HasEntries { get; }

True once at least one tick has been recorded.

NewestAvailableTick

public uint NewestAvailableTick { get; }

The newest recorded tick; meaningless when HasEntries is false.

OldestAvailableTick

public uint OldestAvailableTick { get; }

The oldest tick still in the ring: the smallest recorded tick inside the window that ends at NewestAvailableTick. A tick nothing was recorded for (nothing moved, so nothing was streamed) does not shorten it; only the ring's capacity does. Meaningless when HasEntries is false.

On this page