Vol.
2, Issue 10
January 31, 2000
efore
we begin this journey into the inner workings of networking in
games, it's important to define some terms, and get some background
on the Internet and how it works. This is of inestimable help
later when trying to explain why certain things are done the way
they are when coding for the net, plus, if you're anything like
me, it's just plain interesting.
I'm going
to go over some history of the Internet, with some simple examples
of how it works, without getting too technical. This is not intended
to be a programming reference document, more an enlightenment
of what others are talking about when they talk about latency,
pings, TCP/IP and so on. I will avoid those areas of the net that
aren't directly related to games, since there is no reason to
bore the pants of anyone more than is strictly necessary. This
is not a 'how to' document, but more a FYI type of thing. There
is nothing in this about making your home system better over the
Internet, but more an explanation of why so many Internet games
have networking troubles and where they come from. So lets
begin.
The Internet
as everyone knows it came about from a much smaller network called
ARPANET that the pentagon created a) because America was on a
science kick in the 60's and wanted to get a head start in burgeoning
industries and b) because the pentagon wanted to use and keep
tabs on the expensive mainframes it was funding at places like
MIT and UCLA without having to use multiple remote terminals.
To cut
a long story short, the pentagon put out a contract to tender
that would link multiple mainframes together, for use in real
time. This would mean that one man at one terminal should be able
to access multiple machines, share data and run programs on different
systems.
From this
contract, the concept of packet switching and routers was born.
Now everyone bandies those words 'routers' and 'packet switching'
around, but what do they actually mean? Well, first up, lets dissolve
one common misconception. Many people use the phone system as
an example when discussing the Internet. "It's like a phone
system," they say, "You have an IP address, thats
like a telephone number." Well, not really. A better one
would be to use the post office as an example. Imagine that when
you send a file from one computer to another it's like sending
a letter. It first goes to your post office where it is examined,
and it's decided if it's intended for someone that has an address
that post office serves. If it's not, then it's forwarded to another
post office for examination again. Eventually it will arrive at
a post office that says, "Oh, I know where the post office
that this letter is intended for is located," and it's forwarded
directly to the correct one, which then sends it on to the intended
recipient.
Long winded,
but you get the idea. Well, a router is effectively a post office.
It sorts files that come in and decides what to do with them and
where to send them. This is very different from the phone system
where you end up with a direct link between you and who you are
calling. With routers, there is no direct link. - Incidentally,
there is a common myth that states that the original APRANET,
and by default the Internet, was designed to withstand a nuclear
war, so that if one machine was taken out, then others would still
be able to communicate, since there was no one route that everyone
depended on. Having researched this, there is no actual proof
that this was ever an original requirement. It would be able to
withstand losing a large portion of its connecting machines, but
that would appear to be more of a side benefit than an original
requirement.