Struct ClientTickRate
Create a ClientTickRate singleton in the client world (either at runtime or by loading it from sub-scene) to configure all the network time synchronization, interpolation delay, prediction batching and other setting for the client. See the individual fields for more information about the individual properties.
Inherited Members
Namespace: Unity.NetCode
Syntax
public struct ClientTickRate : IComponentData, IQueryTypeParameter
Fields
CommandAgeCorrectionFraction
The percentage of the error in the predicted server tick that can be corrected each frame. Used to control the client deltaTime scaling, used to slow-down/speed-up the server tick estimate. Must be in (0, 1) range.
________ Max
/
/
Min ______/__________
CommandAge
DefaultValue: 10% of the error. The two major causes affecting the command age are:
- Network condition (Latency and Jitter)
- Server performance (running below the target frame rate)
Small time scale values allow for smooth adjustments of the prediction tick but slower reaction to changes in both network and server frame rate. By using larger values, is faster to recovery to desync situation (caused by bad network and condition or/and slow server performance) but the predicted ticks delta are larger. Good ranges: [0.075 - 0.2]
Declaration
public float CommandAgeCorrectionFraction
Field Value
Type | Description |
---|---|
Single |
InterpolationDelayCorrectionFraction
The percentage of the error in the interpolation delay that can be corrected in one frame. Used to control InterpolationTickTimeScale. Must be in range (0, 1).
________ Max
/
/
Min _____/____________
InterpolationDelayDelta
DefaultValue: 10% of the delta in between the current and next desired interpolation tick. Good ranges: [0.075 - 0.2]
Declaration
public float InterpolationDelayCorrectionFraction
Field Value
Type | Description |
---|---|
Single |
InterpolationDelayJitterScale
Multiplier used to compensate received snapshot rate jitter when calculating the Interpolation Delay. Default Value: 1.25.
Declaration
public float InterpolationDelayJitterScale
Field Value
Type | Description |
---|---|
Single |
InterpolationDelayMaxDeltaTicksFraction
Used to limit the maximum InterpolationDelay changes in one frame, as percentage of the frame deltaTicks. Default value: 10% of the frame delta ticks. Smaller values will result in slow adaptation to the network state (loss and jitter) but would result in smooth delay changes. Larger values would make the InterpolationDelay change quickly adapt but may cause sudden jump in the interpolated values. Good ranges: [0.10 - 0.3]
Declaration
public float InterpolationDelayMaxDeltaTicksFraction
Field Value
Type | Description |
---|---|
Single |
InterpolationTimeMS
The time in ms to use as an interpolation buffer for interpolated ghosts, this will take precedence and override the interpolation time in ticks if specified.
Declaration
public uint InterpolationTimeMS
Field Value
Type | Description |
---|---|
UInt32 |
InterpolationTimeNetTicks
The number of network ticks to use as an interpolation buffer for interpolated ghosts.
Declaration
public uint InterpolationTimeNetTicks
Field Value
Type | Description |
---|---|
UInt32 |
InterpolationTimeScaleMax
The maximum value for the InterpolateTimeScale. Must be greater that 1.0. Default: 1.1.
Declaration
public float InterpolationTimeScaleMax
Field Value
Type | Description |
---|---|
Single |
InterpolationTimeScaleMin
The minimum value for the InterpolateTimeScale. Must be in range (0, 1) Default: 0.85.
Declaration
public float InterpolationTimeScaleMin
Field Value
Type | Description |
---|---|
Single |
MaxExtrapolationTimeSimTicks
The maximum time in simulation ticks which the client can extrapolate ahead when data is missing.
Declaration
public uint MaxExtrapolationTimeSimTicks
Field Value
Type | Description |
---|---|
UInt32 |
MaxPredictAheadTimeMS
This is the maximum accepted ping, rtt will be clamped to this value when calculating server tick on the client, which means if ping is higher than this the server will get old commands. Increasing this makes the client able to deal with higher ping, but the client needs to run more prediction steps which takes more CPU time
Declaration
public uint MaxPredictAheadTimeMS
Field Value
Type | Description |
---|---|
UInt32 |
MaxPredictionStepBatchSizeFirstTimeTick
The client can batch simulation steps in the prediction loop. This setting controls how many simulation steps the simulation can batch for ticks which are being predicted for the first time. Setting this to a value larger than 1 will save performance, but the gameplay systems needs to be adapted.
Declaration
public int MaxPredictionStepBatchSizeFirstTimeTick
Field Value
Type | Description |
---|---|
Int32 |
MaxPredictionStepBatchSizeRepeatedTick
The client can batch simulation steps in the prediction loop. This setting controls how many simulation steps the simulation can batch for ticks which have previously been predicted. Setting this to a value larger than 1 will save performance, but the gameplay systems needs to be adapted.
Declaration
public int MaxPredictionStepBatchSizeRepeatedTick
Field Value
Type | Description |
---|---|
Int32 |
PredictionTimeScaleMax
PredictionTick time scale max value, max be greater then 1.0f. Default: 1.1f Note: it is not mandatory to have the min-max symmetric. Good Range: (1.05 - 1.2)
Declaration
public float PredictionTimeScaleMax
Field Value
Type | Description |
---|---|
Single |
PredictionTimeScaleMin
PredictionTick time scale min value, max be less then 1.0f. Default: 0.9f. Note: it is not mandatory to have the min-max symmetric. Good Range: (0.8 - 0.95)
Declaration
public float PredictionTimeScaleMin
Field Value
Type | Description |
---|---|
Single |
TargetCommandSlack
Specifies the number of simulation ticks the client tries to make sure the commands are received by the server before they are used on the server.
Declaration
public uint TargetCommandSlack
Field Value
Type | Description |
---|---|
UInt32 |