Short answer: they can’t, long answer: as developers we cheat to make it look like everything is happening at the same time when actually that’s not what is going on. For example you see a player on your screen and shoot scoring a direct hit. However, the other player in a different country saw something else: they noticed you and quickly dodged behind a wall. The server then gets two notifications “I shot the player at this time” and “I hid behind a wall at this time”. It’s up to the server to the arbitrate which ones of those things happened.
I worked on netcode architecture that was heavily influenced by this great Overwatch talk. It’s not ELI5, but has some great examples, like this one:
https://youtu.be/zrIY0eIyqmI?t=2439
Latest Answers