What is latency? To understand the term, picture the following: your team is on point. The clock’s ticking down, and the enemy team is mounting a counter-attack with their Reinhardt leading the way and clearing a path. You’re playing Widowmaker, covering your team from the rafters. Your first click is a clean headshot, taking the enemy Mei out of the equation.
You set your crosshairs on McCree, who left the cover of Reinhardt’s shield to line up a flashbang. With a smirk, you relish the inevitable Play-of-the-Game that shall result from your rampage. You click your mouse—but something happens. Everyone seems to freeze. Your breath catches. A moment later, your shot hits empty space as McCree and everyone else visible through your scope seem to snap to a new position, meters away from where they once stood. Including the enemy Widowmaker, who now has a clear line-of-sight to your head.
Her shot doesn’t miss. As you wait out your respawn timer, you mutter angry curses at your internet service provider.
Welcome to the wonderful world of multiplayer networking, where your client-side representation of the game state is made up, and sometimes clean shots don’t matter. There’s a lot we could discuss in this little sliver of gameplay, but today we’re going to be talking about latency: the speedometer of the internet.
What is Latency in Gaming?
For every action, there is an equal and opposite reaction. Perhaps you believe that the preceding is Newton’s Third Law of Physics—and you’re right! But it can also be referred to as Carmack’s First Law of Game Design.
Every input provided by the player corresponds to some action taking place on screen. For single-player games, the only real latency exists client-side in the engine itself. Inputs must be processed, both at the hardware level and in the game engine proper. The engine parses keystrokes, translating them into actions, and renders each frame several dozen to several hundred times per second. We’re talking mere milliseconds (ms) per time step—single digits for the most part—but even fundamental electrical signals have travel time.
As Gabe Newell, founder of Valve, once said: “These things, they take time.”
What is Low Latency?
When latency is low, life is good. Everything has that buttery smooth “feel” you’ve come to know and love. You still blame lag for your shortcomings, but deep down, you know it’s all a ruse. Your fingers dance a merry jig on your keyboard, and all resulting actions in-game are tightly coupled with your gestures. You may not always be able to quantify it, but when it’s low, you just know.
What is High Latency?
If you’ve ever complained about a game feeling “floaty” or “loose,” you were likely experiencing high input latency. Despite your best efforts, you might find that it’s taking a wee bit too long between your inputs and in-game actions. This often occurs when the game engine is under heavy load, perhaps while loading assets or rendering the massive, environment-shredding explosions you love to cause.
On top of that, you have the latency from your monitor – though a good gaming monitor can render the correct scene in a single millisecond. Most gaming monitors and peripherals advertise their latency these days, often measuring less than or equal to 1ms. This is why quality equipment can add so much to your experience. With the human response time averaging about 0.25 seconds from stimuli to action, every millisecond you can shave off could be the difference between a glorious life or a humiliating respawn timer.
Thus far, we’ve only discussed client-side latency. If you fancy a bit of multiplayer, there’s another layer of lag to note in the networking world.
What is Latency in Networking?
Like client-side latency, networking latency represents the delay between something happening in the digital world and the visible representation on our screen. It’s generally measured in milliseconds, often appearing beside your name on the scoreboard. This extra measure of latency arises when sending and receiving packets representing client-side actions made by players. This can also be called “ping,” though in its purest form, a ping represents a single round-trip between a client and server to verify connectivity.
Just as the roads we choose can powerfully impact how soon we reach our destination, the route taken by a packet can have the same impact on the amount of latency you experience. Every single stop along the way, called a “hop” in networking parlance, inevitably results in the addition of a few milliseconds—sometimes more in worst-case scenarios.
How to Measure Latency
Multiplayer games maintain a constant stream of information, as clients send data packets containing their actions to the server for verification, and servers, in turn, approve (or disapprove) the actions before relaying them out to the other clients. This processing and retransmission of actions by the server occur at set intervals—which you may have heard called the “tick rate”—but actions can be received by the server as fast as you like. In this instance, the amount of time it takes for your packet to reach the server is also called latency. Therein lie all the ghosts-in-the-machine that make you miss your shots, warp from one position to the next, and otherwise provide handy excuses for poor performance.
As a side note, sometimes the packets for you and your opponent firing weapons arrive and resolve in the same tick. Depending on how the game is coded, you might both end up eliminating one another. Games with servers that run at higher tickrates tend to encounter this problem less often, but even with modern networking techniques, it is nigh impossible to eliminate completely.
How to Reduce Latency in Online Gaming
Anywhere along the route—whether at your router, at an intermediary point, at the server itself, or even in your local machine—a heavy load or other unexpected turbulence might delay your packet’s arrival. We tend to call this a “lag spike,” and the sudden, sharp increase in latency is unmistakable. Depending on the way the game chooses to handle invalid game states, you might find that players warp around the map, sometimes snapping back to previous positions. Shots miss, grenades thrown might reappear in your hands, and for some strange reason, the resulting situation always seems worse for you than it does your opponents.
There could be a perfectly valid explanation for that, as the cause for latency might lay along your packet’s route to the server and not the routes taken by other clients. Unfortunately, understanding why provides little comfort while you’re waiting to respawn. If it’s been a while, maybe it’s time to take a look at your own modem-router setup. Make sure the bottleneck isn’t like a slasher-film villain calling from inside the house.
Client-side latency can add up too, blocking the formation and transmission of packets before they even have a chance to jam with the console cowboys in cyberspace. This is why top-tier graphics cards, processors, and RAM are essential for more than blistering-fast framerates and graphical fidelity. If your processor remembers a time before microtransactions, it’s going to struggle with the rendering your old GPU should be handling—on top of packing up and shipping out packets.
You can also take a look at any unnecessary services and applications that may be running in the background. Turn off anything you don’t need, like the driver suite for that gaming keyboard you stopped using. Also, consider running a virus scan to ensure there’s no malware mining Bitcoin behind-the-scenes. Then see if your antivirus offers a gaming-specific mode, or schedule additional scans for off-hours.
The beating heart of the gaming industry is—and will always be—latency. Even in the far-flung future, when the world is filled with neural interfaces and Matrix-like simulations, latency will still be involved when translating input to action in our terrifying, dystopian virtual lives.
The closest thing to true magic today can be found right in your computer case, and the millions of miles of communications cables around the world. With some internet service providers, we experience hiccups more often than we like. But if magic were easy, the world would be full of witches and wizards, aka IT professionals. Does that make the Microsoft campus Hogwarts? Something to ponder.
The next time your teammate complains about lag, feel free educate him or her on the inner workings of latency and networking hops. If you’re fortunate, you might have the opportunity to spread a little knowledge. If you’re not, you might get teamkilled at your spawnpoint. Either way, now you know—and knowing is half the battle.
Want to know more about the technology behind your favorite games? Check out our other popular guide: