Table of Contents

Class NetworkSendSchedule

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

How often each side flushes its outgoing network data, while the simulation keeps ticking at the full tick rate: with an interval of 2, every packet carries two ticks of messages, so there are half as many packets and half the per-packet transport cost (IP, UDP and QUIC headers, which at ~58 B a packet were over half of a player's traffic).

public static class NetworkSendSchedule
Inheritance
NetworkSendSchedule
Inherited Members

Remarks

Nothing is dropped or merged, only delayed. Every message a tick writes is queued exactly as before and leaves with the next flush, in order, so every peer simulates the same data as at an interval of 1. What changes is arrival timing, and each place that depends on timing is covered:

  • The server's input queue. At a client interval of 2, inputs arrive two at a time. An empty replicate queue runs DEFAULT input (a misprediction the reconcile must undo), so the queue is kept one tick deeper per extra tick of interval: PredictionManager.StateInterpolation = base + (client interval − 1). Lag compensation already adds that depth (LagCompensationTick.ResolveReplicateQueueTicks reads it live), so hits stay exact.
  • Observed characters. Their transform updates arrive two ticks' worth at a time: the same pattern as the observer streaming's 2-tick interval, which the interpolation buffer was sized for. The interval is therefore capped at MaximumInterval, never above what has been tested.
  • Lag compensation's view offset. The client adds the measured round trip; pings are batched like everything else, so the measured round trip carries the batching delay on average.
  • Agreement. The server decides both intervals (its configuration) and tells each client on entry (NetworkScheduleBroadcast), so a client and the server can never run different depths. A client that has not been told (the login server, an older server) runs at 1.

Fields

EngagedHoldTicks

How long a player stays at the full rate after its last sign of a fight, in ticks (3 s at 30 Hz).

public const uint EngagedHoldTicks = 90

Field Value

uint

MaximumIdleInterval

The largest idle interval (a player away from any fight). Observed characters are drawn on the playback clock, whose adaptive delay absorbs the extra tick (NetworkTransform timed playback), and lag compensation uses the exact view tick the client claims, so one more tick of delay costs no accuracy; it only arrives 33 ms later.

public const byte MaximumIdleInterval = 3

Field Value

byte

MaximumInterval

The largest interval allowed: the observer interpolation buffer is sized for 2-tick delivery.

public const byte MaximumInterval = 2

Field Value

byte

Methods

Apply(NetworkManager, byte, byte, bool)

Applies a schedule to this process: the server's or the client's own flush interval, and the matching replicate queue depth. Idempotent; the authored depth is captured once, so applying again never compounds.

public static void Apply(NetworkManager networkManager, byte serverSendInterval, byte clientSendInterval, bool asServer)

Parameters

networkManager NetworkManager
serverSendInterval byte
clientSendInterval byte
asServer bool

Clamp(int)

An interval within 1..MaximumInterval.

public static byte Clamp(int interval)

Parameters

interval int

Returns

byte

ClampIdle(int, byte)

The idle interval: 0 (off) unless it is above the server's own interval, at most MaximumIdleInterval.

public static byte ClampIdle(int idleInterval, byte serverInterval)

Parameters

idleInterval int
serverInterval byte

Returns

byte

CurrentStateInterpolation(NetworkManager)

The replicate queue depth in force (for logs).

public static int CurrentStateInterpolation(NetworkManager networkManager)

Parameters

networkManager NetworkManager

Returns

int

IsEngaged(bool, bool)

A player is engaged while it is in combat (it dealt or took damage: set on that very tick) or the observer streaming found it near a fight (a target selected, someone fighting it, a character in combat within its engagement range).

public static bool IsEngaged(bool inCombat, bool nearCombat)

Parameters

inCombat bool
nearCombat bool

Returns

bool

Reset(NetworkManager, bool)

Back to FishNet's own behaviour (every tick, the authored depth), e.g. when the client leaves a scene server.

public static void Reset(NetworkManager networkManager, bool asServer)

Parameters

networkManager NetworkManager
asServer bool

ResolveConnectionInterval(byte, uint, uint)

The connection's own interval: 0 (the server's) while engaged or within EngagedHoldTicks of it, else idleInterval.

public static byte ResolveConnectionInterval(byte idleInterval, uint tick, uint lastEngagedTick)

Parameters

idleInterval byte
tick uint
lastEngagedTick uint

Returns

byte

StateInterpolationFor(byte, byte)

The replicate queue depth for a client send interval: one more tick per extra tick of interval.

public static byte StateInterpolationFor(byte baseInterpolation, byte clientSendInterval)

Parameters

baseInterpolation byte
clientSendInterval byte

Returns

byte