Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Consider the following scenario:

Let's say, for sake of example and simplicity, that you have an authoritative game server that sends state to its clients every 45ms. The clients are interpolating state with an interpolation delay of 100 ms. Finally, the clients are rendering a new frame every 15ms.

When state is updated on the client, the client time is set from the incoming state update. Each time a frame renders, we take the render time (client time - interpolation delay) and identify a previous and target state to interpolate from. To calculate the interpolation amount/factor, we take the difference of the render time and previous state time and divide by the difference of the target state and previous state times:

var factor = ((renderTime - previousStateTime) / (targetStateTime - previousStateTime))

Problem: In the example above, we are effectively displaying the same interpolated state for 3 frames before we collected the next server update and a new client (render) time is set.

The rendering is mostly smooth, but there is a dash of jaggedness to it.

Question: Given the example above, I'd like to think that the interpolation amount/factor should increase with each frame render to smooth out the movement. Should this be considered and, if so, what is the best way to achieve this given the information from above?

share|improve this question
    
Prehaps you could extrapolate by allowing the factor to become greater than 1? –  gareththegeek Jul 1 '13 at 13:01
    
It crossed my mind, but I do not have extrapolation implemented and would prefer to solidify/optimize my interpolation before moving forward. –  J.C. Jul 1 '13 at 13:14
    
maybe you are overengineering things, frame rendering times are never equal and the eye don't notice differences of say...20ms... –  Quonux Jul 1 '13 at 13:45
    
To achieve a 60 frames per second update rate, 16.7ms frame updates are required. Film is standardized at approximately 41.7ms update rate (24 fps), but this is due to multiple factors, only one being perception. 20ms is a substantial amount. –  Evan Jul 1 '13 at 14:06
    
An note to author, you consider using a queue of RPC's or state changes (or your systems equal) that the client uses, as opposed to a singular state change. This is not uncommon, and can be seen in many games when a delayed update looks like a fast forward as opposed to a sudden and complete change of everything. –  Evan Jul 1 '13 at 14:10
show 2 more comments

1 Answer 1

I've written an article (http://www.gabrielgambetta.com/fpm3.html) which deals with this problem, I think in a slightly different way than what you're doing. May still be useful to you, though.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.