There are some pretty good resources on game networking out there, but they are pretty scattered and sometimes hard to find. To remedy this, in this post I’m going to collect all the good game networking links I know. Please share any links you would like to add in the comments section. Thanks!
First up is The Unreal Networking Model by Tim Sweeney. This article covers the concepts of writing a general purpose networking engine on top of a distributed object model. Take careful note of Tim’s ideas about bandwidth vs. CPU growth (still true today), his replication statement design, and the concept of authority enabling selective simulation on the client. Pay special attention to his explanation of client side prediction!
Of course, Tim’s document is very high-level. It doesn’t really explain how you would actually send that stuff over the network. That’s fine if you are going to use Unreal, but for the rest of us who want to write our own engine, there is The Tribes Networking Model. Key ideas include their notify protocol for reliability over UDP and their concept of independent event channels with different reliability guarantees. You can even take a look at the source code for this as part of their open source library OpenTNL. Lots of good stuff here.
Another way to synchronize your game data is via delta encoding as described in the Quake3 Networking Model. Here Brian Hook explains the technique developed by John Carmack for Quake3. The basic idea is to delta encode the entire game state, ensuring that everything gets across without needing to worry about the complexity of using events to synchronize state. Be careful though, because this technique is only applicable if you have a small set of data. Why? Well your packet needs to contain the *complete* difference between a previous base state and your new state, so don’t try using it for open world streaming games!
No networking resource list is complete without Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization by Yahn Bernier. This document describes the key techniques differentiating Counterstrike and Team Fortress 2 from the original Quake networking model, namely their latency compensation techniques for player aiming so you don’t have to lead the player by the round trip time (RTT). Take note because this technique is why these games are so goddamn popular, and simultaneously why they are so prone to cheating
Eventually you are going to have to get familiar with low-level networking issues, especially NAT (network address translation) routers and how to establish connections with players behind them. The standard technique for this is called “NAT Punch-through” and it basically involves “fooling” the router into exchanging packets it would otherwise would not allow. You can find a good overview of this technique here.
As you can imagine getting this working across every router ever made is very tricky. Even the big guys have trouble with it (EA, microsoft etc…). So don’t get arrogant and expect that you are going to get it right first time! Take my advice here and use an existing library that has already worked out all the kinks. If you are writing a PS3 game then PSN NP has matchmaking services for you that handles the NAT punch-through, as does XBox-Live on the 360. But, if you are on the PC you are SOL so take a look at one of the following libraries: OpenTNL, Raknet, Quazal. Do not write this yourself if you can possibly avoid it!
Ok that’s about it for now, I have a lot more docs to add, but that covers the big ones that should get you started.
Let me know in the comments if you have any other good docs to add, cheers!.
{ 11 comments… read them below or add one }
Hey Glenn!
Nice post!
I worked with several of the authors of the Tribes paper (unfortunately I don’t have a link either), and helped implement OpenTNL. I gave a talk at Austin GDC 2008 about doing good game networking based on that work. See http://coderhump.com/austin08/ for links to PDF/video/MP3 of the talk.
IMO the best networking solution is one that uses multiple techniques to address the needs of the game. No one solution will get you where you need to go.
PS – nice work on your own networking presentations.
Ben
thanks ben, thats a great talk i saw that a while back – i especially like your suggestion to send the same size packets at a steady rate, this matches what i have discovered as well
i have a big gdc talk this year so i hope to see you there, i think you’ll dig it, it’s a pretty out there technique compared to the standard client/server approach, but it’s a natural fit for a simulation heavy coop game (like an open world streaming physics game…)
cheers
The Tribes Engine Network Architecture is available from the gamasutra archive http://www.gamasutra.com/features/gdcarchive/2000/index.htm
thanks liam, updated
Gamasutra also features the classic “1500 Archers on a 28.8″ which talks about the networking architecture behind Age of Empires, and has the fundamentals of networking a RTS game: http://www.gamasutra.com/view/feature/3094/1500_archers_on_a_288_network_.php
A bit old too, but worth reading is “The Internet sucks!” the problems faced by the X-Wing vs. Tie Fighter developers: http://www.gamasutra.com/view/feature/3374/the_internet_sucks_or_what_i_.php
A more detailed article about “dumb” prediction “Dead Reckoning Latency Hiding”: http://www.gamasutra.com/view/feature/3230/dead_reckoning_latency_hiding_for_.php
And another, this one from the Valve guys again, about their lag compensation techniques with pictures to help visualize what’s going on under the hoods: http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
I hope it helps!
awesome, thanks gizard!
I just tried the link for The Tribes Networking Model but it doesn’t point to the article.
@rajend3 – here’s another link to The Tribes Networking Model: http://www710.univ-lyon1.fr/~jciehl/Public/educ/GAMA/2008/tribes_networking_model.pdf
@Glenn – Thanks for the list of resources, enjoying reading through them.
no worries dave, thanks for helping out
http://www.codewhore.com/links.html
Looks like someone let the opentnl.org domain expire. No matter, both it and the sourceforge links were out of date.
TNL and newer versions are maintained by Mark Frohnmayer, etc here:
http://github.com/nardo/tnl2