Re: network game example



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.
.



Relevant Pages

  • Re: Example: VMS to Web Browser "push" technology
    ... to all clients that subscribe to a particular IP address. ... Was there some special reason to use UDP? ... There is no benefit in maintaining a persitent connection between client ... and server because who's to say that you'll want to visit that same server ...
    (comp.os.vms)
  • Re: Events between machines
    ... The problem with UDP is that it is generally not reliable. ... would also work if no single event would ever reach the clients. ... Windows Server 2003) which allows you to send a message to multiple ... > regarding how the clients (which are listening for these udp packets) ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Max NFSD processes
    ... >>I have several heavily used NFS servers, ... I meant a sysctl for the MAXNFSDCNT setting in nfsd.c. ... I have found that nfs over udp ... Most of my clients are using udp. ...
    (freebsd-questions)
  • Re: Max NFSD processes
    ... >>I have several heavily used NFS servers, ... I meant a sysctl for the MAXNFSDCNT setting in nfsd.c. ... I have found that nfs over udp ... Most of my clients are using udp. ...
    (freebsd-net)
  • network game example
    ... i have a basic question about network games. ... The clients send their controls/move commands to the server. ... The server updates the states of the clients so they can update the ... (with unreliable UDP)? ...
    (comp.games.development.programming.misc)