How to perform game object smoothing in multiplayer games
- by spaceOwl
We're developing an infrastructure to support multiplayer games for our game engine.
In simple terms, each client (player) engine sends some pieces of data regarding the relevant game objects at a given time interval.
On the receiving end, we step the incoming data to current time (to compensate for latency), followed by a smoothing step (which is the subject of this question).
I was wondering how smoothing should be performed ?
Currently the algorithm is similar to this:
Receive incoming state for an object (position, velocity, acceleration, rotation, custom data like visual properties, etc).
Calculate a diff between local object position and the position we have after previous prediction steps.
If diff doesn't exceed some threshold value, start a smoothing step:
Mark the object's CURRENT POSITION and the TARGET POSITION.
Linear interpolate between these values for 0.3 seconds.
I wonder if this scheme is any good, or if there is any other common implementation or algorithm that should be used?
(For example - should i only smooth out the position? or other values, such as speed, etc)
any help will be appreciated.