How do online video games prevent lag times?

Assume that I am playing Fortnite with a friend in Australia. This signals from our controllers must travel some distance to a central server then back again to our screen. We are ten of thousands of kilometers apart and data cannot travel faster than light. Assuming that these signals travel at the speed of light (do they?), wouldn’t there be a very slight and annoying lag time between my controller and my avatar?
I’m just doing back of napkin calculations and finding a potential 0.1s lag time for both players.

There is some lag but the amount of data used by the computer to paint pretty pics on your screen and the amount of data the three computers need to communicate to each other are very different. Very often with modern computers and a decent connection, what people call “lag” is actually an overloading of their graphic card due to locally-managed data rather than to data-transmission times: if lowering the graphs “eliminates the lag” - it wasn’t lag. And in fact, one of the ways games prevent lag times is by reducing the amount of data which needs to travel, by having it be just enough to tell the locally-managed database what to paint.

Nava, who used to be able to tell the NYSE was about to close because of the several-minutes lag she and everybody else in the same game got. Now get off my digital lawn.

Google “Ping” and “Lag”

100ms sounds about right.

This is also close to what your brain registers as instantaneous.

Keep in mind that what you are seeing isn’t a result of a back-and-forth to the server. Your local image is going ahead and predicts a little bit to draw stuff ahead of what the server tells it. With more pronounced lag you’ll get shot down three steps ago by players you never saw.

This is, in part, why game companies establish data centers / servers in different areas (often in North America, Europe, and East Asia), and encourage players to use the server that’s closer to where they’re located. When I played the Star Wars: The Old Republic MMO, I was in a guild on a North American server, but we had several members of our guild who were located in Europe; they were more likely to suffer from lag issues than the rest of us were.

The way I understand it, most of the heavy lifting is done locally on your computer, and what’s sent via the network and through the game servers while the game is going on is basically map updates and stuff like that- player position, status, armament, facing, etc… but your PC is actually keeping track of where the player model is, line of sight, etc…

I imagine stuff like the basic models/skins of the players, map information, etc… is sent before the game actually starts, or as you enter it.

And yeah, they try to predict as much as they can, but if you start getting lag, you start getting players “warping” around, or you start getting killed by people who you thought you killed first. CoD2 was notorious for this IMO; I’d feel like I got the drop on someone, shoot at them, and watch them turn and shoot me dead. Because of lag, it wasn’t representing what was actually going on. The Kill Cam would show me basically coming up stupidly and getting mowed down without firing, despite my console showing me that I had fired (first!).

Yep a 100ms ping is perfectly good, sometimes to close servers I get more like 20ms. Back in modem days a steady 250ms (1/4 second) was fine. Consistency is almost as important as the speed.

Many action games can be configured to kick high ping players, because it’s highly frustrating to be killed by someone you never saw or that warps around according to what you see. High ping used to be a bigger liability before predictive algorithms smoothed things out for higher pings.

Some don’t. LOL

I play L4D2 with a friend who hosts the game and only lives about 5 miles away. Every time we reach a safe house, the game transitions to the next level before your character becomes active again. I have to ask him to wait for me because of the lag time between his character becoming active and my character becoming active. One time, he immediately left and something came in and killed my character so, when I became active, I was already dead!

Not related, but this reminds me of how some strategy games save match replays. The TotalWar franchise is semi-infamous for this, because instead of simulating battles between some 40 guys/tanks on each side, they model hundreds upon hundreds of little dudes (organized in units, yes, but the games really keep track of HP, attacks, damage and so on at the little pixeldude level). So rather than saving a blow-by-blow of each individual soldier and each of their thousands of dice rolls per battle, they just save the timestamped instructions units were given during the battle. And the replay is, mechanically, a re-play of the battle, complete with new dice rolls. Which in practice sort of works out the same because of how they have chosen to weigh their random number generator. If you rewatch the same battle over and over, maybe that one unit will kill two more guys in the other unit before it routs, or maybe they take two more casualties etc… but the general flow of the battle remains the same.
That is, assuming you’re watching a replay with the same version of the client that it took place in. Because any time Creative Assembly does a balance patch and tweaks the stats of units around, replays get real fucky. Give those spearmen slightly higher morale and suddenly that cavalry charge that instantly scattered them in the real battle won’t work as well in the replay, they in fact hold fast, so the cavalry is still bogged down when it “was given” the order to move through the unit of spearmen that is, in fact, still there… you get the idea.