[GD-General] Re: Basic questions regarding networking games...
Brought to you by:
vexxed72
|
From: Colin F. <cp...@ea...> - 2002-09-24 03:41:02
|
2002 September 23rd
Monday
QUESTIONS:
[1] Okay, let's say I want to come up with some
default port number for my game server. My instinct
would be to pick some random number (1024<-->65535)
and then do a WWW search to see if there were any
hits for "port 12345" (or whatever).
Then I would guess the probability of a person
running MY application and simultaneously running
whatever other applications might use that port
number by default.
Is that pretty much the state of the art of
port-choosing technology?
[2] I know this depends greatly on the genre of
game, and how real-time the action is, but what
is an example of the packet rate (packets/sec)
sent from server to client? What is the size
of data in each packet?
I just want to get a sense of the order of
magnitude of the traffic that typical,
small scale first-person shooters use
successfully -- for LAN and Internet cases.
I've heard of packet rates as low as 10 packets per
second (average) for Internet games with 64 players.
I don't know what the data size was for these packets.
Anyhow, I know that this question is almost too
general to answer, but I'd like to hear about
working concrete numbers, in any game play genre,
for LAN or Internet games.
[3] Let's say you want a server to establish the time that
someone pressed a key on a client computer. Let's say
that the server wants to express the client key press time in
terms of its local time.
Basically, each client has its own local time, and
the server has its local time. I'd like to compute
the delta's between the server's time value and each
client time value, and vice versa.
Thus, I can place any client event in to a single
server timeline, regardless of network glitches.
So, I'm thinking that when the "connection" is
first initiated (player joins the game), the server
makes a bunch of pings to the client, asking for
the client local time values. Then, through some
round-trip time math, etc, we can pin down the time
difference.
Okay, here's are the questions: Is this common
practice? Do games try to improve the measurement
of the time delta throughout game play? What are
some techniques for arriving at this value?
[NOTE: The time delta should be an exact number (per client)
that is essentially a constant throughout a typical
game duration -- assuming the high resolution timers
or performance counters don't drift in any significant
way on the client machines or the server. If you had
instant communication between two machines you would
get this time delta exactly.
My computer says it's 12:34:56 AM, and your computer
says it's 12:34:58 AM at that same instant; perhaps
we're both way off the "real" time, but I just want
to know that your machine will report times that
should be adjusted by -2.0 seconds before using
in my time line. This time delta has nothing to do
with any network variability or lag.]
To make this even clearer, one simple-minded way
of getting this time delta is the following:
[1] I send a "ping" from machine "A" at local time TA1
[2] Machine "B" receives "ping" at its local time TB1,
and sends TA1 and TB1 back to machine "A".
[3] Machine "A" receives packet at its local time TA2,
and the packet contains values TA1 and TB1.
The round-trip time was (TA2 - TA1). Assuming the
lag was symmetric (an assumption that could be
very wrong, as with cable modems where upload speed
is way slower than download, etc), you might decide
that the time delta was:
TDeltaConvertBToA = (TA1 - TB1) + ((TA2 - TA1)/2);
In other words, just compute the delta as if the
reported machine time values were at the same instant,
and then correct for the lag by using half of the
known round-trip time.
Another method might be just sending lots of pings
from server to client, and returning the minimum of
all computed (TA1 - TB1).
Anyhow, there's probably a technique that converges
on the exact time, maybe in just a couple of exchanges
between server and client.
This is like those annoying middle school problems:
"A train going east at 50 MPH leaves station X at 3:00 PM,
and another train leaves station Y, 400 miles away,
at 4:00 PM at 60 MPH... When the trains collide they
produce two new identical trains, with one standing still
and the other moving at 0.99c heading for Alpha Centauri.
Will humanity be ready when the second train returns from
Alpha Centauri loaded with Schrodinger Cats and magnetic
monopoles?"
--- Colin
cp...@ea...
www.colinfahey.com
|