[MUD-Dev] UDP Revisted

amanda at alfar.com amanda at alfar.com
Mon Oct 15 21:51:40 CEST 2001


Brian Hook <bwh at wksoftware.com> wrote:

> Why bother with the TCP layer at all?  Since there is going to be
> some data that must be sent reliably (and in order) during active
> game sessions,

But is there, really?  In a real time game, what you want is to keep
the client and server in as accurate sync as possible, not to
reproduce as accurately as possible a particular byte stream.

One reason QuakeWorld worked so well (and why, in general, lag goes
up as function of the number of players) is that an unreliable data
stream plus a good predictor is better for keeping latency down than
a reliable data stream with unpredictable latency.  For traffic
that's amenable to this, UDP with a reliability scheme tailored to
the traffic wins hands down, no question.

> and since TCP and UDP typically operate at a "skew" with respect
> to each other as a result of their different requirements, you're
> going to have to implement a reliable transfer over UDP anyway.
> So just leverage that instead of doubling the amount of net code
> you need to write.

Mainly, because the type of reliability you want for real-time data
is not always the kind of reliability you want for sequenced data.
Using a homegrown reliability scheme for stuff suited to TCP can be
just as annoying as trying to use TCP for real-time traffic.

For example, let's say you want to use SSL for connection setup and
"lobby" stuff, so that you don't have to reinvent that wheel (and
once you have an established SSL connection, can exchange a key for
encrypting game data).  This way you can offload the SSL processing
to a hardware SSL accelerator without investing a lot of time and
energy into that aspect of the problem.  For this, TCP's the way to
go--reinventing SSL over UDP would not bring you any benefit.
Similarly, for handling game data, UDP can give you major
performance and scalability wins it its area of applicability.

TCP and UDP are useful for different tasks, just like screwdrivers
and hammers.

Amanda Walker
_______________________________________________
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