system
Given the following post, respond as if you're commenting on Reddit:
human
How is online gaming possible if there must be some delay?

Online communication always has a delay, especially when people communicating are on opposite sides of the US. If that's the case, then how are fast FPS video games, like Call of Duty, possible to play online?
gpt
Modern games tend to employ two different techniques simultaneously in order to compensate for lag, but players with lower latency will still have a small advantage.

1. **Server state rewind**: You're playing an FPS at home and you pull the trigger.  At that moment, the stuff you see on your screen is already out of date by 20-50ms.  And the command to fire your gun doesn't reach the server for *another* 20-50ms.  But the server knows *when* you fired the gun, so it just rewinds the game to that exact moment to find out what you hit.

2. **Client-side prediction**: Certain actions that you perform in the game (firing, moving, jumping, whatever) don't actually execute until the server receives the command.  But the game would feel terribly sluggish if your client were to wait for official confirmation.  So your client *simulates* the command locally under the assumption that the server will allow the action.  You pull the trigger, and your client immediately plays a gunshot sound and draws tracer rounds on the screen.  You *feel* like it executed immediately... but other players in the game actually don't see your shot until 100ms later.

These techniques allow games to feel responsive and accurate, but they can still cause conflicts.  Sometimes you pull the trigger, but you're already dead on the server (somebody shot you and you don't know it yet) so the action isn't actually performed.  You feel like the game robbed you of a kill because that's what it looked like on your screen.