How to Adjust Movement Synchronizer Parameters¶
StrixMovementSynchronizer
is a component for synchronizing object movements.
Using interpolation/extrapolation techniques,
it tries to synchronize complex movements accurately and naturally.
The component has a lot of adjustable parameters,
so that you can best fit the component to the expected movement patterns.
You can follow the guidelines below when you need to adjust the parameters to your game object.
Start with the default values¶
Some engineers try to find exact settings of parameters
before running StrixMovementSynchronizer
attached to an actual GameObject.
It is usually not recommended.
The default values of parameters are chosen to cover typical movement patterns of many in-game objects,
and they will work just fine in most cases.
It is recommended to write the script to move the owner object first,
and then to see how StrixMovementSynchronizer
moves replicas.
If the movement looks fine, you don’t need to adjust the parameters.
Don’t try to synchronize too frequently¶
Typical 3D games refresh tens of frames per second, e.g., 30 fps, 60 fps, or more.
Your script may potentially update object’s position or acceleration
every time FixedUpdate
(or Update
) is invoked.
It is usually too much, however,
for most games to try to update replicas over network in the same rate.
StrixMovementSynchronizer
uses extrapolation technique
to predict future positions of an object
and reduces the required number of synchronizations.
It even tries to optimize the synchronization period dynamically
based on the movement patterns.
SyncPeriodMin
and SyncPeriodMax
control the movement synchronization frequency.
They are period of time between synchronization, in milliseconds,
so smaller values mean more frequent synchronization and larger values less frequent.
SyncPeriodMin
is the minimum time between synchronization,
so it effectively defines a maximum frequency.
SyncPeriodMax
is the maximum time between synchronization, defining a minimum frequency.
The default values are 50ms for SyncPeriodMin
and 200ms for SyncPeriodMax
,
that in turn define at most 20 times and at least 5 times of synchronization per second.
You may think synchronizing movements in the frequency of 5-20 times per second is not enough for a game running in 60 fps, but usually it is.