Struct ClientServerTickRate
The ClientServerTickRate singleton is used to configure the client and server simulation time step,
server packet send rate and other related settings.
The singleton entity is automatically created for the clients in the NetworkStreamReceiveSystem
first update if not present.
On the server, by countrary, the entity is never automatically created and it is up to the user to create the singletong instance if
they need to.
It is not mandatory to set all the fields to a proper value when creating the singleton. It is sufficient to change only the relevant setting, and call the ResolveDefaults() method to
configure the fields that does not have a value set.
- the maximum number of tick per frame
- the maximum number of tick per frame
- tick batching (MaxSimulationStepBatchSize and others.
Inherited Members
Namespace: Unity.NetCode
Assembly: solution.dll
Syntax
[Serializable]
public struct ClientServerTickRate : IComponentData, IQueryTypeParameter
Fields
Name | Description |
---|---|
MaxSimulationStepBatchSize | If the server cannot keep up with the simulation frequency with running |
MaxSimulationStepsPerFrame | If the server updates at a lower rate than the simulation tick rate it will perform multiple ticks in the same frame. This setting puts a limit on how many such updates it can do in a single frame. When this limit is reached the simulation time will update slower than real time. The network tick rate only applies to snapshots, the frequency commands and RPCs is not affected by this setting. |
NetworkTickRate | The rate at which the server sends snapshots to the clients. This can be lower than than the simulation frequency which means the server only sends new snapshots to the clients every N frames. The effect of this on the client is similar to having a higher ping, on the server it will save CPU time and bandwidth. |
PredictedFixedStepSimulationTickRatio | Multiplier used to calculate the tick rate/frequency for the PredictedFixedStepSimulationSystemGroup. The group rate must be an integer multiple of the SimulationTickRate. Default value is 1, meaning that the PredictedFixedStepSimulationSystemGroup run at the same frequency of the prediction loop. The calculated frequency is 1.0/(SimulationTickRate*PredictedFixedStepSimulationTickRatio) |
SimulationTickRate | The fixed simulation frequency on the server and prediction loop. The client can render at a higher or lower rate than this. |
TargetFrameRateMode | If the server is capable of updating more often than the simulation tick rate it can either
skip the simulation tick for some updates ( |
Properties
Name | Description |
---|---|
PredictedFixedStepSimulationTimeStep | The fixed time used to run the physics simulation. Is always an integer multiple of the SimulationFixedTimeStep. |
SendSnapshotsForCatchUpTicks | If the server has to run multiple simulation ticks in the same frame the server can either send snapshots for all those ticks or just the last one. |
SimulationFixedTimeStep | 1f / SimulationTickRate. Think of this as the netcode version of |
Methods
Name | Description |
---|---|
ResolveDefaults() | Set all the properties that hasn't been changed by the user or that have invalid ranges to a proper default value. In particular this guarantee that both NetworkTickRate and SimulationTickRate are never 0. |