Table of Contents

Struct CharacterReplicateData

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Unified per-tick input data for all predicted character subsystems. Contains movement input (KCC) and ability activation input. Prediction works best when replicate data contains only input, not state.

public struct CharacterReplicateData : IReplicateData
Implements
IReplicateData
Inherited Members

Fields

ActivationFlags

Flags representing the ability activation state. Bit positions defined by AbilityActivationFlags.

public int ActivationFlags

Field Value

int

AimDirection

Aim direction for this input frame, as a unit vector.

public Vector3 AimDirection

Field Value

Vector3

Remarks

Always store a value that has been through Quantize(Vector3). This is input to a deterministic simulation, so the producer must commit to the value the wire can carry rather than to whatever it holds locally — otherwise the owner predicts with one direction while the server and observers simulate with the decoded one, and every cast diverges by the quantisation error.

Replaced a full Quaternion CameraRotation. Nothing ever read the roll: movement takes rotation * Vector3.forward to build its planar basis and the ability path takes the same forward as its trace direction, so the rotation carried a degree of freedom that no consumer used and that could not be represented exactly.

MoveAxisForward

Forward movement axis value (W/S or up/down).

public float MoveAxisForward

Field Value

float

MoveAxisRight

Right movement axis value (A/D or left/right).

public float MoveAxisRight

Field Value

float

MoveFlags

Bitmask of movement flags (jump, crouch, sprint, etc). Each flag is a bit position defined by KCCMoveFlags.

public int MoveFlags

Field Value

int

QueuedAbilityID

The ID of the queued ability or consumable template.

public long QueuedAbilityID

Field Value

long

ViewOffsetFraction

The sub-tick remainder of the view offset, in 1/256ths of a tick.

public byte ViewOffsetFraction

Field Value

byte

Remarks

The whole-tick part alone quantises the rewind to a tick boundary, and the client's view of a peer does not sit on one: NetworkTransform interpolation blends between two received snapshots, so what it renders is a fraction of the way between two ticks. At 6 m/s one tick is 20 cm — the difference between a hit and a miss on a capsule. This byte is what lets the server resolve to the same fractional point, through RewindTarget and CharacterPositionHistory's interpolating resolve.

ViewOffsetTicks

How many ticks behind server-present this client was rendering its peers when it produced this input. Lag compensation rewinds by this much.

public byte ViewOffsetTicks

Field Value

byte

Remarks

The server cannot work this out for itself. It is one-way latency plus the interpolation buffer, and FishNet exposes no per-connection latency server-side — the value that used to be used, ReplicateTick.LocalTickDifference, is stamped with the current server tick immediately before the replicate body runs, so it read 0 on every tick that carried real input and every player was compensated the same fixed two ticks whatever their ping.

The client does know: it has TimeManager.RoundTripTime and its own interpolation setting. It carries the FULL round trip, not half of it — the offset is subtracted from the server tick at which the replicate body RUNS, and the input's own trip to the server is part of that gap. The server adds the one term the client cannot see, its replicate queue depth; see LagCompensationTick.

Client-supplied, so the server treats it as a claim rather than a fact: MaximumCompensationTicks caps it, and CharacterPositionHistory clamps anything still older to the oldest sample it holds, so an inflated value buys the recorded window and never more than it. One byte, which at 30 Hz covers 8.5 seconds of claimed view lag.

Methods

Dispose()

Allows for any cleanup when the data is being discarded.

public void Dispose()

GetPredictionTick()

Returns the network tick for this replicate input as a PredictionTick. This is the only sanctioned way to produce a PredictionTick — use it as the currentTick argument when applying prediction-domain buff and cooldown state.

public PredictionTick GetPredictionTick()

Returns

PredictionTick

GetTick()

Local tick when the data was created.

public uint GetTick()

Returns

uint

SetTick(uint)

Sets the local tick when data was created.

public void SetTick(uint value)

Parameters

value uint