I've implemented interpolation to smooth character drawing in my networked game. But now I want to fall back on extrapolation if too much time has passed from a user sending an update and the interpolation buffer has been used up.

I'm just wondering if there is an equation that suites the following :

If it has been X since this user's last update, extrapolate the user position using the current time.

That determines the optimal amount of time for X.

I could try lots of different things like "we have surpassed the standard deviation of the last 100 moves + a constant", but I'm convinced there has to be an optimal strategy for deciding when we need to extrapolate. Surely this is a solved problem, is my thinking.

I've searched thoroughly but have found nothing. Also, for reference, I'm interpolating and extrapolating on the client.

  • \$\begingroup\$ "That's my secret, Cap, I extrapolate all the time." Is not extrapolation nothing more than continued interpolation? \$\endgroup\$ – Patrick Hughes Jun 20 '14 at 3:59
  • 1
    \$\begingroup\$ Well there are equations for continued extrapolation different than the equations for interpolations. I treat the extrapolated point the same as any other move that comes in from the server to achieve really nice smoothness with interpolation, if that's what you're getting at. \$\endgroup\$ – brian Jun 22 '14 at 8:16

It is a solved problem: choose a value or a formula that works well for your game. Playtest. Tweak the value. Iterate. Et cetera. There is no single value that works optimally for all games, and no formula to compute a value for a game.

Remember you're making a game, and you should choose solutions that serve the game (solutions that make it fun, and make it feel responsive, connected, and engaging) and not solutions that serve some algorithm.

|improve this answer|||||
  • \$\begingroup\$ I fully agree, but I'm unable to even find ideas that people have used that worked for them. It would be one thing if there were different public solutions, but solving it from scratch with no outside ideas feels like I'm throwing away many years of knowledge that I should at least peek at before going to implement my own solution. Given the trade-offs networked games have to make, almost any solution is going to need a lot of testing and tweaking. There are lots of ways to sort a list but I'd hate to have to implement a lot of them because they're not even close to optimal. \$\endgroup\$ – brian Jun 19 '14 at 17:38
  • \$\begingroup\$ I'm not sure what you are hoping for, but I suspect if you found any public implementations buried in some code somewhere they wouldn't translate that well (I know the ones I have built have been the result of extensive game-specific tweaking). Why not start with setting "X" from your example to, say, two seconds and see how that feels. Just use constants until you think you need to do something more involved like scale the constant by some factor depending on the amount of action in the game at the time, or whatever. \$\endgroup\$ – user1430 Jun 19 '14 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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