Movement Synchronization¶
The vast majority of real-time multiplayer games require synchronization of location, direction, and velocity to accurately reflect the player’s movement within the world.
Strix provides several components for this purpose.
One of these components is StrixMovementSynchronizer
,
the most versatile component for movement synchronization.
As soon as you add it to a replicated GameObject, it starts synchronizing its position, rotation, and velocity. The synchronizer performs interpolation/extrapolation and is therefore suitable when smooth movement is desired, such as for player characters.
Properties¶
The StrixMovementSynchronizer
has a lot of settings which are accessible from the inspector. They also can be changed from code, if needed.
NearDistance |
The acceptable error distance from the current location to the desired location. Setting this too high may cause rubber banding. |
MaxSpeed |
The max speed this GameObject will travel. Setting this too low will result in jumpy movement. Setting this too high may result in GameObjects moving unnaturally fast. |
Acceleration |
The max acceleration this GameObject will be under. Setting this too low will result in jumpy movement. Setting this too high may result in GameObjects accelerating unnaturally fast. |
Damping |
A smoothing value. Using a low value will make the interpolation smoother but using a high value will make the movement less reactive. |
SyncPeriodMin |
This is the minimum amount of time in milliseconds between updates. The smaller this value is, the more updates we make and therefore the more accurate the movement becomes, at the cost of network bandwidth. |
SyncPeriodMax |
This is the maximum amount of time in milliseconds between updates. The smaller this value, the more updates we make when still. In conjunction with Sync Period Min, this allows some network performance to be saved when we are not moving much. |
PredictionPeriod |
The time in milliseconds in which the interpolator will try to reach the next target position in the movement path using a smooth movement before teleporting (jumping) to the position. Setting this too low will result in jumpy movement. Setting this too high will make the predicted transform fall too far behind the original. |