network game example - Java-Games
This is a discussion on network game example - Java-Games ; 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 ...
-
network game example
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)?
Best regards,
Torsten.
-
Re: network game example
Hi,
> How can the server update the states of the clients reliably
> (with unreliable UDP)?
I think you have to make UDP more reliable. It will nevertheless
be faster than TCP.
Maybe you want to have a look at:
"Unix network programming", Stevens, pp. 405
or
RakNet, http://www.rakkarsoft.com/
for a library you could use (of course there are many others)...
so long,
Andreas
-
Re: network game example
In article <dibnnj$7rf$1@schleim.qwe.de>,
Torsten Mohr <tmohr@s.netic.de> 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.
-
Re: network game example
To add to that, have the client send absolute position and facing data
rather than relative info. That way if a packet is missed, the server
is not missing a step or a turn on the next update.
--
TAZ
-
Re: network game example
Torsten Mohr ecrivit le 09/10/2005 20:32 :
> 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)?
I found this article really enlightening:
http://unreal.epicgames.com/Network.htm
Similar Threads
-
By Application Development in forum Java-Games
Replies: 5
Last Post: 05-29-2007, 02:54 AM
-
By Application Development in forum Java-Games
Replies: 0
Last Post: 09-29-2005, 11:40 AM
-
By Application Development in forum Java-Games
Replies: 5
Last Post: 08-23-2005, 06:17 AM
-
By Application Development in forum Java-Games
Replies: 6
Last Post: 10-03-2004, 11:50 AM
-
By Application Development in forum Java-Games
Replies: 28
Last Post: 01-10-2004, 03:14 PM