How netcode works, and what makes 'good' netcode

Want to learn more about netcode in video form? Check out Battle(non)sense's video above.

Netcode misconceptions

If you've ever found netcode confusing, you're not alone. Here are some common misconceptions.

You just need to increase the tick rate and high ping won't be an issue anymore
While increasing the tick and update rates from 30 to 60Hz does indeed result in a delay reduction, it will never "fix" a high ping, as sending data more frequently does not make it travel any faster.

You need 100Mbps for online games

When an Internet Service Provider tries to sell you a "high speed internet" plan, this only refers to bandwidth, where "faster" means that your downloads and uploads will take less time to finish. But this is really about capacity, not the travel time of data.

Bandwidth does not affect the speed of a data packet. It will not travel any faster when you upgrade your plan from 10Mbps to 100Mpbs.

What does affect the actual speed of the data packet is the "velocity factor" of the copper and fibre optic cables that are used between your client and the server that you connect to.

The velocity factor (VF%) describes the speed at which a signal propagates along the cable, compared with the velocity of light. A category 5e twisted pair network cable, for example, has a velocity factor of 64, while an optical fibre has a VF of around 67.

Most online games actually need very little up and downstream bandwidth as you can see in the following graph.

Generally speaking, if your internet connection has 2 Mbps upstream, then you should not run into any problems. As long as no one else is downloading or uploading data while you are gaming—or if you own a router that prioritizes data from real time applications.

WiFi is good enough for gaming

Most of the networking issues in online games are caused inside the player's local network, where WiFi and powerline are the biggest offenders.

WiFi (wireless LAN) is prone to interference, the 2.4GHz band is crowded, the 5Ghz band has shorter range, and the low effective bandwidth quickly causes network congestion.

Another major drawback of WiFi is that unless you have a MU-MIMO access point, your clients can't "talk" to the access point all at once. This causes higher latency and latency variation (jitter) as your PC must wait for "its turn" to talk to the access point, which also increases the risk of packet loss.

So, while the comfort provided by WiFi is great, it’s terrible for online gaming, which is why WiFi should be avoided at all costs.

Call of Duty uses peer to peer:
Call of Duty games never used the peer-to-peer network model. Some CoD games only used dedicated servers, while others used a mix of dedicated servers and listen servers (client hosted matches).

Ingredients for good netcode

Using the best network models:
Peer-to-peer is the best network model for 1v1 fighting or sports games, while for any other fast-paced online game with 2+ players, the dedicated server model provides the best possible online experience—though it is expensive.

The game must feel responsive:
High tick and update rates keep the additional delay low and prevent "super bullets" (bundling of damage).

Security:
The design must be secure (never trust the client), which will make it harder to create cheats and hacks. 

Also, players don’t want the game to reveal their IP address to everyone else (don’t use peer-to-peer for VOIP in a game that otherwise uses dedicated game servers).

Low latency is key
Matchmaking must try to avoid mixing players with widely different pings.
When the dedicated server network model is used, developers must ensure that all players have access to low latency servers. If they can't, a global launch will cause serious problems, as players will not like playing at 150ms or higher ping, and players with 20ms ping won't enjoy receiving shots from high ping players far behind cover.

Limit lag compensation:
Even if matchmaking ensures that all players have a similar ping at the start of a round, a player's latency can still increase as the match progresses. There has to be a reasonable limit in place for how much lag the game compensates for in order to avoid all players suffering as a result of a single player's connection issues.

Don’t overtax residential internet connections:
Packets per second (pps) can become a limiting factor long before bandwidth. When a game ties the client's send rate to the frame rate, then this can lead to send rates of 200Hz or more. In Quake Champions players have suffered from rubber banding because of that design, and the only workaround for them was to cap their frame rate at a value that their internet connection could sustain.

Tell the player when something is wrong
Players get upset when they have a bad online experience, and they will always blame the game first. Online game makers must tell players when there is something wrong with their connection, so that they can understand why they had a terrible experience. Also, when the game server is experiencing issues the player must be made aware of it, so that they can move to a different server.