Vixen
02b45cc4
csharp
public readonly record struct Tick

The unit of network time: one fixed simulation step, counted from when the server started.

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

Remarks

Every packet is stamped with one, and wall-clock time never appears in a packet. Snapshots, input, interpolation targets and history rings are all keyed by tick, so two machines that disagree about what time it is still agree about what happened when.

It wraps, and the comparisons know it. A UInt32 at 60 Hz lasts a bit over two years of continuous uptime, which is long enough that no one will ever see it and short enough that somebody would eventually. Comparison is therefore by signed distance — (int)(a - b) — which gives the right answer across the wrap as long as the two ticks are within about 2^31 of each other, and they always are.

There is deliberately no < operator and no IComparable`1. Modular comparison is not a total order: with three ticks spread far enough apart, A is after B, B is after C, and C is after A. Sorting by it would be undefined behaviour, so the type refuses to look sortable and says IsAfter instead.

Fields and properties (4)

  • public uint Value

    The count. Wraps at MaxValue.

  • public static Tick Zero

    The first tick.

  • public Tick Next

    The tick after this one.

  • public Tick Previous

    The tick before this one.

Methods (10)

  • public Tick(uint Value)

    The unit of network time: one fixed simulation step, counted from when the server started.

  • public bool IsAfter(Tick other)

    Whether this tick happened after .

  • public bool IsBefore(Tick other)

    Whether this tick happened before .

  • public Tick Add(int ticks)

    Moves forward, or backward for a negative count.

  • public Tick Subtract(int ticks)

    Moves backward, or forward for a negative count.

  • public int Subtract(Tick earlier)

    How many ticks this one is after , across the wrap.

  • public static Tick operator +(Tick tick, int ticks)

    Moves forward.

  • public static Tick operator -(Tick tick, int ticks)

    Moves backward.

  • public static int operator -(Tick later, Tick earlier)

    The signed distance between two ticks.

  • public override string ToString()

    Returns the fully qualified type name of this instance.

Used by (49, showing 40)

  • GameClientMultiplayer
  • GameServerMultiplayer
  • LocalMatchMultiplayer
  • MatchProtocolMultiplayer
  • NetworkMatchMultiplayer
  • SoakNetworkSoak
  • BodyHistoryVixen.Net.Physics
  • BodyPoseVixen.Net.Physics
  • CaptureVixen.Net
  • CaptureRingVixen.Net
  • ClientPredictionVixen.Net
  • ClientPredictionTestsVixen.Net.Tests
  • ConnectionVixen.Net
  • ConnectionBaselineVixen.Net
  • DeltaTestsVixen.Net.Tests
  • DiagnosticsTestsVixen.Net.Tests
  • DistanceReplicationRateVixen.Net
  • FrameVixen.Net
  • IReplicationRateVixen.Net
  • InputBufferVixen.Net
  • InputLogVixen.Net
  • LagCompensationTestsVixen.Net.Physics.Tests
  • LagCompensatorVixen.Net.Physics
  • MotionTestsVixen.Net.Tests
  • NetworkMetricsVixen.Net
  • NetworkMetricsTestsVixen.Net.Tests
  • NetworkPlayerVixen.Net
  • NetworkSessionVixen.Net
  • PacketCodecTestsVixen.Net.Tests
  • PacketReaderVixen.Net
  • PacketWriterVixen.Net
  • PredictedPlayerMovementVixen.Net.Physics
  • PredictedPlayerMovementTestsVixen.Net.Physics.Tests
  • PredictionHistoryVixen.Net
  • ReplicationClientVixen.Net
  • ReplicationServerVixen.Net
  • ReplicationTestsVixen.Net.Tests
  • RewindScopeVixen.Net.Physics
  • SentVixen.Net
  • SessionTestsVixen.Net.Tests