Sign in to follow this  
MikeDee

Lag and shooting

Recommended Posts

Hi everyone, I'm working on a online FPS. I'm having a problem with lag, whenever the server lags and the player shoots at the enemy but the enemy is already somewhere else, it will still cause damage. How do I avoid this ?

Share this post


Link to post
Share on other sites
Network programming, and in particular lag compensation, is really more art than science. The fact is, the nature of the internet, or any network, is unpredictable. You can't create a system where the player has to compensate not only for their delayed (and possibly incomplete) perception of the world, while simultaneously trying to compensate for an unpredictable network.

In an online shooter, the way things really work are somewhere between "perfect" accuracy, and what the player perceives. The server basically has to somehow take into account the picture of the world that the player has when deciding whether their shot was accurate. A little fudging is common, if not necessary. You have to also balance that with the "reality" of what the server knows. If you allow too much fudging on accuracy, then its not fair to the player being shot at (who might think he's hidden behind a rock), but if you don't fudge it a little bit, no shooter will be able to anticipate the correct lead, and all your players will be frustrated.

Here's an article that tells a little bit (high-level) about how Halo 2, which supports internet play, works, and how it differs from Halo 1, which only supports LAN play.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this