Handling early/late/dropped packets for interpolation in a 3D multiplayer game

Posted by Ben Cracknell on Game Development See other posts from Game Development or by Ben Cracknell
Published on 2014-06-05T17:27:23Z Indexed on 2014/06/05 21:43 UTC
Read the original article Hit count: 281

I'm working on a multiplayer game that for the purposes of this question, is most similar to Team Fortress.

Each network data packet will contain the 3D position of the target moving object. (this object could be another player) The packets are sent on a fixed interval, and linear interpolation will be used to smooth the transition between packets. Under normal circumstances, interpolation will occur between the second-to-last packet, and the last packet received.

The linear interpolation algorithm is the same as this post:

Interpolating positions in a multiplayer game

I have the same issue as in that post, but the answers don't seem like they will work in my situation. Consider the following scenario:

  1. Normal packet timing, everything is okay
  2. The next expected packet is late. That's okay, we'll just extrapolate based on previous positions
  3. The late packet eventually arrives with corrections to our extrapolation. Now what do we do with its information?

The answers on the above post suggest we should just interpolate to this new packet's position, but that would not work at all. If we have already extrapolated past that point in time, moving back would cause rubber-banding.

The issue is similar in the case of an early or dropped packet.


So I believe what I am looking for is some way to smoothly deal with new information in an ongoing interpolation/extrapolation process.

Since I might be moving on to quadratic or even cubic interpolation, it would be great if the same solutiuon could be applied to those as well.

© Game Development or respective owner

Related posts about multiplayer

Related posts about interpolation