# Where can I find information for programming a game to avoid network latency issues?

I am looking for programming methods to counter network latency for say a racing game or a FPS. What I specifically mean is what would I need to do to the physics engine and what information should I transmit so that the physics engine does it's job when the network information is not available?

If anyone has any pointer to articles or sites that have this type of information. It would be greatly appreciated.

-

## migrated from stackoverflow.comJul 12 '11 at 16:18

This question came from our site for professional and enthusiast programmers.

-

What we have learned in Numerics for example is the topic interpolation of polynomials. Using the theory about this topic you could provide some information about acceleration, velocity, location, ... of all entities to be computed with via differentiation or numerical integration and usage of ordinary differential equations (ODE) to predict the movement and happenings and render them smoothly although you might not have received all data yet.

Using ODEs you might want to look at the Euler method, the Heun method or the Runge-Kutta method. Interpolation itself is based on Lagrange polynomials and the Aitken-Neville scheme or the Newton method.

-

I wrote a series of articles that you may find useful: http://www.gabrielgambetta.com/?p=11 I don't invent anything, but maybe you find the way I present it more understandable.

-

Check out Mike Zyda's Networked Games course, has MP3 lectures if you like that.

-

More important then network latency, a lot of which is out of you hands, is accurate client side prediction. Especially for a FPS where lag can be a very frustrating handicap.

http://en.wikipedia.org/wiki/Client-side_prediction

-
This is along what I was looking for. The concept seems simple. In a car game I would get data from the sever about position and use physics to predict where the car is going then tween to adjust the position when it is received. This could get a little tricky. – Leonardo Amigoni Jul 12 '11 at 22:00

Here's a good place to start: Gaffer on Games, networking notes

-
This is the link everyone posts to every networking question, but IIRC (it's down for me right now) he doesn't actually write anything about synchronizing state or clientside-prediction. – BlueRaja - Danny Pflughoeft Jul 12 '11 at 17:12
The client methods are varied, most simply maintain a short queue of recent and known position updates and then use that pattern to extrapolate future positions either by building a spline or linearly. It's really not much more complicated than that. – Patrick Hughes Jul 12 '11 at 17:14
So then.. put that in your answer. – BlueRaja - Danny Pflughoeft Jul 12 '11 at 17:16
This buffered concept is covered in "needs to know about game networking" section of the Gaffer link, I merely summarized because the link was down for him momentarily. – Patrick Hughes Jul 12 '11 at 17:37
I agree with BlueRaja. If all you're going to do is post a link, then add it as a comment. It's not going to be very helpful to future users if the link ever breaks (site is down, files moved, etc.). – Richard Marskell - Drackir Jan 16 '12 at 18:44