Struct GhostDeltaPredictor
For internal use only. Used by the ghost component serializer to calculate (predict) the new value for a field, given the two previous baseline values.
This value provides a good estimate for current value of a variable when changes are linear or otherwise predictable. I.e. Small deltas have good compression ratios.
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
public struct GhostDeltaPredictor
Constructors
GhostDeltaPredictor(NetworkTick, NetworkTick, NetworkTick, NetworkTick)
Construct the predictor using the last three recent baselines ticks. The ticks are used to calculate the relative weight that is applied to the baseline values.
Declaration
public GhostDeltaPredictor(NetworkTick tick, NetworkTick baseline0_tick, NetworkTick baseline1_tick, NetworkTick baseline2_tick)
Parameters
Type | Name | Description |
---|---|---|
NetworkTick | tick | the current server tick |
NetworkTick | baseline0_tick | |
NetworkTick | baseline1_tick | |
NetworkTick | baseline2_tick |
Methods
PredictInt(int, int, int)
Calculate the predicted value for the given integer, using the previous three baselines.
Declaration
public int PredictInt(int baseline0, int baseline1, int baseline2)
Parameters
Type | Name | Description |
---|---|---|
int | baseline0 | |
int | baseline1 | |
int | baseline2 |
Returns
Type | Description |
---|---|
int |
PredictLong(long, long, long)
Calculate the predicted value for the given long, using the previous three baselines.
Declaration
public long PredictLong(long baseline0, long baseline1, long baseline2)
Parameters
Type | Name | Description |
---|---|---|
long | baseline0 | |
long | baseline1 | |
long | baseline2 |
Returns
Type | Description |
---|---|
long |