Re: network game example
- From: Miss Elaine Eos <Misc@*your-shoes*PlayNaked.com>
- Date: Tue, 11 Oct 2005 01:56:41 GMT
In article <dibnnj$7rf$1@xxxxxxxxxxxxxx>,
Torsten Mohr <tmohr@xxxxxxxxxx> wrote:
> Hi,
>
> i have a basic question about network games. Some principles
> so far, for example for a first person shooter:
>
> The state of the game, the map and so on are stored on the server.
> The clients send their controls/move commands to the server.
> The server updates the states of the clients so they can update the
> screen.
>
> I got the hint to use UDP for a network game.
>
> How can the server update the states of the clients reliably
> (with unreliable UDP)?
You don't, UDP is unreliable. But you use it, anyway, because it's fast
& lightweight. And TCP will hang up if there's a network error and wait
& wait & wait, whereas UDP will just forget about it and send the next
frame.
....Which is what you want. By the time frame#2 comes, the information
for frame#1 is no longer interesting, so no one cares if the client
missed it.
....Which it hardly ever does, anyway. Turns out that UDP is "pretty
reliable" -- it's just that it's not guaranteed, so they have to call it
unreliable.
If you're really worried about it, you can use one of those packages (or
reinvent) that keeps track of which packages were sent, which were
acknowledged, resend the ones that are needed, etc.
But the basic scheme used by most games is:
* Send frame data UDP, ignore dropped frames & move on.
* Use TCP for login and to establish the connection.
* Pre-send descriptor information, before the client encounters the
particular object being described. This cuts down on...
* Have the client ask for objects in the frame for which it doesn't have
a descriptor. It can ask again next frame if it still doesn't have them.
--
Please take off your shoes before arriving at my in-box.
I will not, no matter how "good" the deal, patronise any business which sends
unsolicited commercial e-mail or that advertises in discussion newsgroups.
.
- Follow-Ups:
- Re: network game example
- From: zircher
- Re: network game example
- References:
- network game example
- From: Torsten Mohr
- network game example
- Prev by Date: Re: network game example
- Next by Date: Where are we heading to...
- Previous by thread: Re: network game example
- Next by thread: Re: network game example
- Index(es):
Relevant Pages
|