how people on opposite sides of the earth can play video games together seemlessly when these games require split second actions

1.18K views

how people on opposite sides of the earth can play video games together seemlessly when these games require split second actions

In: 4913

50 Answers

Anonymous 0 Comments

Basically each client is running its own separate instance of the game, so the reactions to what you did happen locally right there. Then the animation of what the other players do ALSO happens locally but based on guesswork that might be totally wrong.

Your client game computer software “thinks” thusly: “The last time I checked, that remote other player was traveling at a velocity vector of 8km/h to the south and slightly downward at 1 km/h down the slope, so I’ll keep moving that player avatar that direction and make its legs walk accordingly, even though I don’t know what that player’s inputs are. MOST of the time they aren’t changing their input as fast as I’m simulating it, since I’m a fast computer and they’re just a human and humans are sooo slooow. So MOST of the time they will still be doing the same thing for an eternity, like a whole 500 milliseconds or more. So my guess where they will be standing next will be right most of the time because most of the time they didn’t press a new key or move their mouse since last time.”

Then the remote player does something that invalidates the prediction the local computer made, like stop holding down the “W” key so they didn’t really move as far as the local computer thought they would, Or they did keep holding “W” but moved the mouse a bit so their walking path curved when your local computer predicted it would be going in a straight line.

Every so often, the Server sends a brief burst of extra update data to the client describing the correct position of the other player, where it *should* be. Then the client computer thinks like this: “Well I thought the other player was going to be over here, and I already rendered that and showed it to my local player, so I guess I need to snap teleport the other player to the newly corrected spot. I was off by a whole whopping 0.05 meters! I hope my player doesn’t notice that the other guy just teleported a 5 whole centimeters to the left!”

And of course, being a human, you don’t notice. The animation still looks smooth enough that you see a smooth curving walk instead of a bunch of straight line segments with instant corrections bending the lines.

Until there’s a moment of extra lag, so the local computer has to rely on that prediction from stale player movement info longer than it really works well for. THEN the human player really notices as the correction is more obvious and you see the other person look like they’re walking by way of jittery teleport jumps.

You are viewing 1 out of 50 answers, click here to view all answers.