Sign in to follow this  
Liort

How to perform client side smoothing

Recommended Posts

Liort    785

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:

    1. Mark the object's CURRENT POSITION and the TARGET POSITION.
    2. 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.

Share this post


Link to post
Share on other sites
Liort    785

There's no central server. Each player sends his own state to all other players.

 

Upon receiving state regarding another player, each local client updates his local approximation accordingly.

Edited by LiorTal

Share this post


Link to post
Share on other sites
hplus0603    11347

I'm assuming that you are aware of the cheating vulnearbilities in a P2P architecture, and you have made sure that your particular game design is not susceptible to catastrophic failure because of that?

 

Anyway, the EPIC interpolator does forward smoothing by calculating where the entity ought to be 100 milliseconds from now, and interpolates from the current position to that position over 100 milliseconds, but which time the next network packet has arrived. (The actual value of "100 milliseconds" varies depending on networking implementation.)

 

0.3 seconds sounds like a lot, although can be fine if your game is not twitch-based and doesn't rely on players knowing very accurately where other players are at all times. (So, no shooting or driving or fighting games)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this