Building a Game Network Protocol

Client Server Connection

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. Now in this article we’re going to bring everything together and build a client/server connection on top of UDP.

Reliable Ordered Messages

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! So let’s get creative and work out how we can implement a reliable message system that’s better and more flexible than TCP for real-time games.

Sending Large Blocks of Data

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

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

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. In this article, we’re going to transform the bitpacker into a system where this checking is automatic.

Reading and Writing Packets

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.