
What every programmer needs to know about game networking (2010) - signa11
http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/
======
daveloyall
TIL that some programmers have to be taught what others learned first hand by
encapsulating IPX packets inside TCP/IP[1] packets inside PPP packets
modulated over the POTS network.

(Not Kali, the OTHER one. :) )

Oh, and there used to be different types of game engines. You used to be able
to SEE whether or not your engine was interpolating missing data, whether it
was maintaining state on your end, their end, or both, etc--by observing how
your opponents' ships would react when your mom picked up the phone in the
kitchen.

Descent had a pretty darned good method.

Alice and Bob play a game. From Alice's point of view, the visual of Alice's
weapon fire striking Bob's ship is rendered on her machine based on her
machine's understanding of the location of his ship. But the AUDIO of weapon
impact is "rendered" on Bob's end. So if you see impact, it means nothing--but
if you hear impact, you know that 1) your fire collided with Bob's ship on his
end and 2) it happened approx. n/2 seconds ago.

This resulted in a kind of meta-game wherein the lagscape was just part of the
terrain. There was a 'general relativity' component to it: since neither side
was master or slave... No point of view was privileged[2]. Alice had to keep
two gamestates in mind at all times, the local to protect her hitpoints, and
the remote to reduce his hitpoints.

In my opinion, both the "sound/visual disconnect" and the "no privileged POV"
were necessary ingredients in order for the lag to be "part of the
landscape"\--ie, fair and fun.

[1]: _Wait, did we already use UDP at that point? I can 't recall..._

[2]: _Some pieces of gamestate were given to the client that started the game
or the client with the highest FPS. I think the reactor countdown was
finalized in one client, for example, resulting in the famous "3... 2... 1...
0... ... ... ... ... BOOM!"_

~~~
acveilleux
I miss playing Warcraft 2 over Khan.

~~~
daveloyall
"Your sound card works PERFECTLY!" ... "It doesn't get any better than THIS!"

I was Hobbes in those days and there are non-zero chances that we have played
together.

------
teddyh
_Distributed Virtual Reality – An Overview_ , Bernie Roehl, 1995:
[https://ece.uwaterloo.ca/~broehl/distrib.html](https://ece.uwaterloo.ca/~broehl/distrib.html)

 _Characteristics of UDP Packet Loss: Effect of TCP Traffic_ , Hidenari
Sawashima, Yoshiaki Hori, Hideki Sunahara, Yuji Oie, 1997:
[http://www.isoc.org/inet97/proceedings/F3/F3_1.HTM](http://www.isoc.org/inet97/proceedings/F3/F3_1.HTM)

 _I Shot You First: Networking the Gameplay of HALO: REACH_ David Aldridge,
2011: [http://www.gdcvault.com/play/1014345/I-Shot-You-First-
Networ...](http://www.gdcvault.com/play/1014345/I-Shot-You-First-Networking)

------
gear54rus
403 for me as well.

Web archive to the rescue:

[http://web.archive.org/web/20141118054424/http://gafferongam...](http://web.archive.org/web/20141118054424/http://gafferongames.com/networking-
for-game-programmers/what-every-programmer-needs-to-know-about-game-
networking/)

------
tinco
This article ends right when you expect him to start telling you everything
you need to know about game networking.

It would be better titled 'a brief history of game networking', and funny
enough on the site that actually has everything a programmer needs to know
about game networking this article has that subtitle. And that site is made by
the author as well!:

[http://gafferongames.com/networking-for-game-
programmers/](http://gafferongames.com/networking-for-game-programmers/)

Cool hn discussion with game network programmers here:

[https://news.ycombinator.com/item?id=8399767](https://news.ycombinator.com/item?id=8399767)

~~~
ohaal
Web archive:
[http://web.archive.org/web/20141015220426/http://gafferongam...](http://web.archive.org/web/20141015220426/http://gafferongames.com/networking-
for-game-programmers/)

------
anonymoushn
(2010)

Thus far I'm having a pretty easy time ensuring that my games are
deterministic functions of sequences of user inputs. For people who don't want
to do that, this talk about Halo multiplayer is pretty informative:
[http://www.gdcvault.com/play/1014345/I-Shot-You-First-
Networ...](http://www.gdcvault.com/play/1014345/I-Shot-You-First-Networking)

------
scarygliders
This is a great series of articles - I had searched for such information a
month or so ago, as the subject was made interesting and relevant to me due to
being a Beta-backer of Elite Dangerous, which is using a combination of
client-server plus P2P networking whilst playing in the "All-Online" mode
(multiplayer), and just uses client-server in the "Solo-Online" mode.

I have my doubts that Frontier Developments will be able to get the P2P side
of the netcode working smoothly and properly by the 16th December when they
officially release the game. I'm also having doubts that model will ever work
smoothly for them, but, time will tell, and good luck to them for all that.

------
Kiro
What is the client sending to the client exactly? "I pushed down W" and "I
released W" or send "I am holding down W" every X ms?

If the latter, how would you prevent the client from spamming it more than
every X allowed ms? I'm thinking it would build up a queue if commands came in
too fast but not sure how that would be handled exactly. Also, even with a
queue someone spamming would gain an advantage since it would bridge the
latency.

Example: If the client sends "move 1px to the right" every 20 ms and someone
manually started sending it in every 5 ms instead, it would still only move
every 20 ms on the server. However, wouldn't this still be better than sending
it every 20 ms from the client since latency and other things (slow
processor?) could mean the real interval is more than 20 ms?

~~~
gear54rus
And there you have it: speedhack :)

This is a topic of where to process commands (client vs server), what data to
send, which restrictions to impose, what rules to enforce, etc. Give client
too much say in the simulation and it can ruin the experience of others, leave
it all on server and enjoy your lack of speed.

------
mey
[https://developer.valvesoftware.com/wiki/Source_Multiplayer_...](https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking)
The technology from Valve referenced in the article. Goes into a bit more
technical detail about the prediction.

------
CocaKoala
People who are interested in this may also be interested in Mauve's posts on
rollback-based netcode for fighting games, and how he handled some issues
related to that:

[http://mauve.mizuumi.net/2012/02/22/investigating-
rollcaster...](http://mauve.mizuumi.net/2012/02/22/investigating-rollcasters-
timing-issues/)

[http://mauve.mizuumi.net/2012/03/08/how-i-didnt-clip-the-
sou...](http://mauve.mizuumi.net/2012/03/08/how-i-didnt-clip-the-sound-
effects/)

[http://mauve.mizuumi.net/2012/07/05/understanding-
fighting-g...](http://mauve.mizuumi.net/2012/07/05/understanding-fighting-
game-networking/)

------
97-109-107
Whover likes this would also enjoy
[http://www.gamasutra.com/view/feature/131781/the_internet_su...](http://www.gamasutra.com/view/feature/131781/the_internet_sucks_or_what_i_.php)
\- The Internet Sucks: Or, What I Learned Coding X-Wing vs. TIE Fighter

~~~
brute
I found great joy in reading about Quake3's networking model [1]. It is build
on top of the assumption that the network is unreliable: most of the packets
will be dropped and those that make it are not in sequence.

[1]
[http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/Quake3Ne...](http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/Quake3Networking)

~~~
nly
It's interesting how similar that approach is to the one taken by Mosh:

[https://mosh.mit.edu/#techinfo](https://mosh.mit.edu/#techinfo)

------
gafferongames
Site is back up. Sorry for the downtime. Thanks site5.com for pulling the plug
on my site arbitrarily! -- gaffer.

------
hahainternet
This link now 403s for me.

~~~
pp19dd
Entire server is 403'd:
[http://www.gafferongames.com/](http://www.gafferongames.com/)

Rather puzzling. Traffic strategy?

------
haidrali
Link is down ....

------
fierarul
I too browse reddit.

Front page post on reddit from 19 hours ago:
[http://www.reddit.com/r/explainlikeimfive/comments/2n9rbj/el...](http://www.reddit.com/r/explainlikeimfive/comments/2n9rbj/eli5_how_doom_1993_had_online_multiplayer_on/)

Top comment:
[http://www.reddit.com/r/explainlikeimfive/comments/2n9rbj/el...](http://www.reddit.com/r/explainlikeimfive/comments/2n9rbj/eli5_how_doom_1993_had_online_multiplayer_on/cmbvd4w)
with content:

> Here's a longer writeup I found: [http://gafferongames.com/networking-for-
> game-programmers/wha...](http://gafferongames.com/networking-for-game-
> programmers/what-every-programmer-needs-to-know-about-game-networking/)

~~~
eat
What's the point of this comment? Some of us don't browse reddit.

