   Lag and shooting
  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 ?   
  you cant really avoid it, but you can work around it.Source Engine : Lag Compensation.   ;  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.   ;  that's a cool article.   ;  mmh...very interesting stuff guies, thanks a lot for the help :D   