[MUD-Dev] UDP Revisted

Amanda Walker amanda at alfar.com
Sun Oct 14 01:34:27 CEST 2001


> My understanding is that if you read the TCP spec, it becomes
> obvious what parts are overkill.  I'm pretty sure a part of
> Stevens' book covers this in some detail, but I don't have it with
> me.

It's not so much that TCP is overkill as much as whether or not the
functionality TCP provides is actually what you want.

TCP provides a reliable sequenced bytestream.  For some things, like
email or web surfing, this is exactly what you want.  SMTP over UDP
would be horrible.  For tasks that need what TCP provides, there's
nothing better.

However, what you want in a real-time game is *not* a reliable
sequenced bytestream.  What you want (at least from server to
client) is a low-latency unreliable packet stream, which is what UDP
provides.  This doesn't seem inuitive, but it's true.

In effect, the data stream being sent from the server to the client
isn't a fancy terminal session, it's *extremely* compressed video.
If you drop a packet, you want the client to make up something
plausible and wait for the next one, rather than have the server
retransmit the original one until you get it and go from there.

For an analogy, pretend you're on the phone with someone.
Occasional dropouts are *much* better than having the delay get
longer every few seconds.

If you don't want to invent the wheel, take a look at how the
streaming media folks have approached the problem.  Use TCP for
setting up connections, passing authorization and control
information, billing data, etc. where it absolutely positively has
to arrive intact and latency doesn't really matter.  Use UDP for the
media, where staying in sync is more important than getting
everything.  RTSP and RTP are the classic example: RTSP to tell the
server which movie you want, RTP to get the actual movie data.

Think of a game server as a highly augmented videoconference bridge.
In effect, that's what they are, as far as network traffic is
concerned...


Amanda Walker
Networking Geek

_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list