Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm thinking about an algorithm for firing projectiles with lag compensation. Now I did find only one descent solution:

  1. Player hits fire button.
  2. Client sends input "fire".
  3. Client waits for server response.
  4. Server generates bullet then sends response to client.
  5. Client recieves response and finally fires projectile.

Is this solution only "trueway"? I find it the only one that can be fair to all of the clients. Valve in this case, doesn't compensate lag from rocket shots. I am feeling that I will not compensate it, too. I think that with today's bandwidth I can close my eyes on this problem, because I don't see any solutions with fair logic. What do you think?

share|improve this question
up vote 3 down vote accepted

Since you mention bullets...

  1. player hits fire
  2. player immediately draws something
  3. client sends command to server
  4. server gets fire command
  5. server calculates the results, hit or miss
  6. server sends result to player
  7. player applies the result from the server
  8. player draws something to show the result

There is no physical "bullet" flying around, just a phantom drawn locally. You cannot wait 200msec for for server responses or your game will feel sluggish.

Rockets are a totally different subject: they are expected to have an "ignition time" before flying off, they move slowly, they have an area-effect when they hit, some have a small AI guiding them during flight. Bullets are not rocket science.

share|improve this answer
I need projectiles with life time and flying time, and i will not have rockets, players will shoot projectiles, like small fireballs, frozen arrows, etc. How i have to manage networking with projectiles? – Denis Ermolin Mar 2 '12 at 19:09
Actually not all games use this approach. The sluggish feel is not true for every FPS. Unreal Tournament 2004 and 3 waits for the server respond before shooting. Not only for rockets, but every weapon, including shock rifle. – Peter Ølsted Mar 2 '12 at 19:26
Yeah i feel like i just dont need to make any prediction system for projectiles and spells, just wait for server response – Denis Ermolin Mar 2 '12 at 19:29
You need prediction if there is latency. Otherwise, you're asking for a laggy game. There is nothing worse than hitting the "fire" button, and having a delay. Keep in mind that a 1/4 second delay is unacceptable, even if it seems like a very quick amount of time. – Tim Holt Mar 2 '12 at 20:27
And how i need to predict flying projectile and be fair to players? – Denis Ermolin Mar 2 '12 at 20:29

Your Answer


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.