How to perform client side smoothing

Started by
2 comments, last by hplus0603 10 years, 6 months ago

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.

Lior Tal
Game Developer/Software Engineer
Advertisement

I'm a bit confused, the client sends the server information information about game objects? Or is this peer to peer? Who is authoritative?

Chris

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.

Lior Tal
Game Developer/Software Engineer

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)

enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement