Networking

Network Neutrality Considered Harmful

Why I created Network Next

Fixing the Internet for Games

What we're doing at my new startup [Network Next](https://networknext.com) 🚀

Networked Physics in Virtual Reality

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction About a year ago, Oculus approached me and offered to sponsor my research. They asked me, effectively: “Hey Glenn, there’s a lot of interest in networked physics in VR. You did a cool talk at GDC. Do you think could come up with a networked physics sample in VR that we could share with devs?

Why can't I send UDP packets from a browser?

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Premise In 2017 the most popular web games like agar.io are networked via WebSockets over TCP. If a UDP equivalent of WebSockets could be incorporated into browsers, it would greatly improve the networking of these games. Background Web browsers are built on top of HTTP, which is a stateless request/response protocol initially designed for serving static web pages.

Client Server Connection

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. So far in this article series we’ve discussed how games read and write packets, how to unify packet read and write into a single function, how to fragment and re-assemble packets, and how to send large blocks of data over UDP.

Reliable Ordered Messages

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. Many people will tell you that implementing your own reliable message system on top of UDP is foolish. After all, why reimplement TCP? But why limit ourselves to how TCP works? But there are so many different ways to implement reliable-messages and most of them work nothing like TCP!

Sending Large Blocks of Data

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. In the previous article we implemented packet fragmentation and reassembly so we can send packets larger than MTU. This approach works great when the data block you’re sending is time critical and can be dropped, but in other cases you need to send large blocks of quickly and reliably over packet loss, and you need the data to get through.

Packet Fragmentation and Reassembly

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. In the previous article we discussed how to unify packet read and write into a single serialize function and added a bunch of safety features to packet read. Now we are ready to start putting interesting things in our packets and sending them over the network, but immediately we run into an interesting question: how big should our packets be?

Serialization Strategies

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. In the previous article, we created a bitpacker but it required manual checking to make sure reading a packet from the network is safe. This is a real problem because the stakes are particularly high - a single missed check creates a vulnerability that an attacker can use to crash your server.

Reading and Writing Packets

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. In this article we’re going to explore how AAA multiplayer games like first person shooters read and write packets. We’ll start with text based formats then move into binary hand-coded binary formats and bitpacking. At the end of this article and the next, you should understand exactly how to implement your own packet read and write the same way the pros do it.

State Synchronization

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networked Physics. In the previous article we discussed techniques for compressing snapshots. In this article we round out our discussion of networked physics strategies with state synchronization, the third and final strategy in this article series. State Synchronization What is state synchronization? The basic idea is that, somewhat like deterministic lockstep, we run the simulation on both sides but, unlike deterministic lockstep, we don’t just send input, we send both input and state.

Snapshot Compression

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networked Physics. In the previous article we sent snapshots of the entire simulation 10 times per-second over the network and interpolated between them to reconstruct a view of the simulation on the other side. The problem with a low snapshot rate like 10HZ is that interpolation between snapshots adds interpolation delay on top of network latency.

Snapshot Interpolation

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networked Physics. In the previous article we networked a physics simulation using deterministic lockstep. Now, in this article we’re going to network the same simulation with a completely different technique: snapshot interpolation. Background While deterministic lockstep is very efficient in terms of bandwidth, it’s not always possible to make your simulation deterministic.

Deterministic Lockstep

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networked Physics. In the previous article we explored the physics simulation we’re going to network in this article series. In this article specifically, we’re going to network this physics simulation using deterministic lockstep. Deterministic lockstep is a method of networking a system from one computer to another by sending only the inputs that control that system, rather than the state of that system.

Introduction to Networked Physics

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to the first article in Networked Physics. In this article series we’re going to network a physics simulation three different ways: deterministic lockstep, snapshot interpolation and state synchronization. But before we get to this, let’s spend some time exploring the physics simulation we’re going to network in this article series:

Floating Point Determinism

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. Lately I’ve been doing some research into networking game physics simulations via deterministic lockstep methods. The basic idea is that instead of synchronizing the state of physics objects directly by sending the positions, orientations, velocities etc. over the network, one could synchronize the simulation implicitly by sending just the player inputs.

What Every Programmer Needs To Know About Game Networking

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. Have you ever wondered how multiplayer games work? From the outside it seems magical: two or more players sharing a consistent experience across the network like they actually exist together in the same virtual world. But as programmers we know the truth of what is actually going on underneath is quite different from what you see.

Reliability and Congestion Avoidance over UDP

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. In the previous article, we added our own concept of virtual connection on top of UDP. In this article we’re going to add reliability, ordering and congestion avoidance to our virtual UDP connection. The Problem with TCP Those of you familiar with TCP know that it already has its own concept of connection, reliability-ordering and congestion avoidance, so why are we rewriting our own mini version of TCP on top of UDP?

Virtual Connection over UDP

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. In the previous article we sent and received packets over UDP. Since UDP is connectionless, one UDP socket can be used to exchange packets with any number of different computers. In multiplayer games however, we usually only want to exchange packets between a small set of connected computers.

Sending and Receiving Packets

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. In the previous article we discussed options for sending data between computers and decided to use UDP instead of TCP for time critical data. In this article I am going to show you how to send and receive UDP packets.

UDP vs. TCP

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. In this article we start with the most basic aspect of network programming: sending and receiving data over the network. This is perhaps the simplest and most basic part of what network programmers do, but still it is quite intricate and non-obvious as to what the best course of action is.

Networked Physics (2004)

Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Game Physics. In the previous article we discussed how to use spring-like forces to model basic collision response, joints and motors. In this article we’re going to discuss how to network a physics simulation. First Person Shooters First person shooter physics are usually very simple.