Game Development Reference
In-Depth Information
Chapter 19
Network Programming for
Multiplayer Games
I remember the very moment the Internet became relevant to my job, and it
completely changed the way I worked. A colleague of mine walked into my office
and showed me a website for the very first time. He
d made it himself, and although
it was very simple, I knew right away that the Internet was going to change the
world. Well, maybe it wasn ' t quite that clear. I missed out on the Netscape IPO, but
it was certainly clear after that.
At the time, computer games could be played via modem or over a LAN, but they
were quite the bear to program. Once gamers started playing online game, companies
started using the Internet, and the communications protocols it uses, for hooking up
fragfests. Now, whether you
'
re playing with a buddy in the next office or a friend
from overseas, or just checking out the latest game on Facebook, pretty much all net-
work games use Internet protocols to communicate.
As it turns out, getting two computers to talk to each other is pretty easy. The trouble
happens when you try to make some sense of the bits coming in from the other side:
keeping track of them and their memory buffers, changing the raw data stream into
useful game data, and trying to create a plug-in architecture that doesn ' t care if you
are playing locally or from afar.
This chapter covers moving bits across the network, how you come up with the bits
to send, and how you transform that raw data back into something your game can
use just as if there were no network at all. First, we
'
'
ll start with a little primer on the
643
 
 
 
Search WWH ::




Custom Search