Feature: Understanding and Avoiding the Lag Monster in Games

2400 Baud Modem

Computer networks are like magic. Think about it. I can press a key on my keyboard and within a fraction of a second the letters I am typing right now are being communicated through the “series of tubes” of the internet to the PlayStation LifeStyle servers and stuffed into the website’s database to eventually become this article. Even crazier, I can press a button on my DualShock 4 controller and ruin some other guy’s night by shooting his character in the head as he is about to pull off a ninja defuse in a round of Search and Destroy in Call of Duty. All of this crazy witchcraft that allows us to play games with friends and random strangers over the internet usually “just works” without us having to think about it. When it doesn’t, it can be annoying and sometimes downright infuriating.

Bandwidth

Believe it or not, when it comes to playing games online, the “speed” of your internet connection doesn’t play that much of a factor in how well your experience will be. Network providers often market network bandwidth as speed. Really, bandwidth is more about “capacity” than speed. Bandwidth is the number of bytes of data you can send and receive per second. For example, my cable internet bandwidth is about 25 Mbps or Megabits per second. There are 8 bits in a byte, so that means I can download a little over 3 MB (Megabytes) every second. Most internet providers provide asymmetric bandwidth, which just means that you can download more data per second than you can upload. I can send about 5 Mbps, or about 625 Kilobytes per second. 

Most online games surprisingly don’t require that much bandwidth to function. Most games that I have analyzed use anywhere from 128 Kbps up to maybe 1-2 Mbps if you are hosting the match. While that should be no problem for most internet connections, unless you are on a very low bandwidth connection, if you’re also sharing that connection with other users then you will start to run into problems. Streaming audio and video can eat up a lot of bandwidth. If you like to listen to music while you play, make sure you’re not listening to something that is streaming. If you can avoid it, don’t have YouTube or Netflix streams open while you’re playing. An HD VOD stream can eat up anywhere from 5 Mbps to 20 Mbps depending on the provider and the quality of the video. While you may have plenty of bandwidth for everything going on, you probably have little say over what traffic gets handled first. See the later section on QoS.

Another thing that can interfere is streaming your gameplay. Remember that asymmetric bandwidth? Streaming your gameplay from your console (or any other device for that matter) involves sending that video stream up to your streaming provider. That’s just like Netflix in reverse, and even worse it is using that smaller upstream bandwidth. Even a reasonably fast 5 Mbps upstream connection can get saturated fast when you’re streaming a high quality stream.

Network Switch

Latency

Network bandwidth is only one part of the picture. Another big factor when it comes to how well you can play games online is latency. Latency is a fancy word for how much time it takes for you to send a message to its destination and get a response back. This is known as Round Trip Time (RTT) or “ping time”. 

There are not a lot of things you can do about RTT, unfortunately. Most of that has to do with which ISP you use, where you are physically located in the world, what game you are playing and who you are playing with. Most games try to match you up with players who are close to you to minimize RTT. But even the best matchmaking algorithm can’t help you if it can’t find enough players close to you. Try playing a twitch shooter against players in another country. That’s not very fun. 

Many online games use some form of lag compensation to try to level the playing field. Do a Google search for “lag compensation” and you will find a lot of varying opinions on just what it is, and whether to not it is needed. With no doubt, if there were no lag compensation you would understand just why lag compensation is needed. One form of lag compensation accounts for varying levels of latency between each player in an online game by rewinding time based on each player’s lag. Everything that you see on screen is already many milliseconds behind, and depending on how lagged you are may be hundreds of milliseconds behind. Lag compensation in a shooter game rewinds time to determine where you and your target were at a given point in time. If your bullets hit where your target was at the time you took the shot, you score a hit. Now try a shooting game without lag compensation. In a peer to peer game, the host is running around murdering everyone while you are shooting at where they were 50-200ms ago. You’re never going to hit them unless you aim for where they are going to be in 50-200ms (or you just have terrible aim to begin with)!

Products like Lagbuster (lagbuster.com) try to overcome a problem known as “buffer bloat”. Without getting too technical, most network devices have internal queues that they use to improve bandwidth. Under normal conditions this works fine, but under some circumstances it can artificially increase your RTT because data is having to wait for those buffers to fill. Unfortunately, this is not easy for most gamers to fix. If your ping times with your ISP are outrageous, a product like Lagbuster might give you some relief. I use basically the same technique on my own network. You might also have success with routers that are based on Linux, since newer Linux kernel network drivers are smart about the way they manage their buffers. Some routers will allow you to install an aftermarket firmware like dd-wrt that is based on Linux.

Bandwidth

Network Quality

Network quality and reliability is another major factor. Networks may be magical things, but even magic can have its issues. Sometimes data gets lost on its way from your console to the host. This is called “packet loss.” While you don’t have any control over what happens to your data once it leaves your network, there are a few things that you can do on your end of the connection. 

Wireless networking is awesome and convenient, but it is horrible for gaming. Even on an excellent wi-fi connection, inches away from your wi-fi router you are going to see higher RTT than if you were using a wired connection. On a busy wifi network this gets even worse because of the way that wi-fi works, especially with home routers. Unless you absolutely cannot avoid it, never, never, ever, ever use wi-fi for playing online. Obviously if you’re playing on PlayStation Vita that’s your only option, but if you’re playing on PS3 or PS4, plug that baby in. You’ll thank me later.

Another thing that might surprise you is the effect that the quality of your network cable can have on the quality of your connectivity. Ethernet is a pretty robust protocol, to the point where it can continue to function even if either your network cable or the cable plug or even the port on your router is damaged. I’ve had instances where a network cable was plugged in but not fully seated in the switch port. The system was online, but it was very slow and was seeing occasional packet loss. Sure enough, when I checked the cable I heard the little noise you hear when the little key/lock on the cable engages. Once the cable was securely connected everything worked perfectly. 

Depending on your router, you may also be able to enable Quality of Service (QoS). QoS allows you to set priorities on certain types of traffic, or prioritize network traffic from a particular device over others. Not all routers support QoS or support it well, so try it out and see if it helps.

Internet Providers

Not all ISPs are created equal. Latency is going to increase the farther your packets have to go from your console to their destination. A good ISP with a nationwide network from end to end is less likely to have a large number of hops to get across the country. It also matters who they peer with! They can have a stellar network, but once your packets exit their network, you’re at the mercy of their peering agreements. ISPs don’t exist in a vacuum, every major network on the internet connects to other networks — that’s the “inter” in internet. 

Traceroute will show you the route your packets are taking from you to a given destination. If the intermediate routers along the route have reverse DNS entries you can learn a lot about the trek your packets will be making as you play. If not, a quick whois of the IP will tell you the owner of the IP addresses along the way. See the gallery above for some examples. Ookla’s SpeedTest.net includes an aggregation of submitted speed tests by ISP. While the bandwidth and other numbers are good to have, their quality index is the important piece. Sadly, I don’t see latency in their ISP stats, unless that is incorporated into the quality index.

To sum up all of the advice:

  • Limit high bandwidth use when playing online. Tie your little brother up so they can’t stream Netflix while you’re trying to play (don’t do this)
  • If possible, invest in a high quality router that can help limit network latency. 
  • Plug that console in! Never use a wireless network for gaming unless you have no other alternative.
  • Check your network cables and router. Loose connections might cause bizarre behavior.
  • If you have the option, find an internet provider with the best connectivity

Need some help with your own network, or have some expertise to lend? Post a comment and share your network setups, the ISPs you use, routers, etc. Feel free to hit me up there if you want to go into more detail or need help with your specific network. 

TRENDING