Network game example

Hi,

i’d like to write a multiplayer network game (several charaters
at once on a screen and all are moving at the same time).

I’m not sure about the design for that. So far the idea is to
have one server that gets the movement commands of the clients.
The server updates the screen of the players.

Is it better to use UDP or TCP for that?

Is there a better design possible with less network traffic?

Are there some examples available about network games?

Best regards,
Torsten.

Hi,

Hello.

i’d like to write a multiplayer network game (several charaters
at once on a screen and all are moving at the same time).

I’m not sure about the design for that. So far the idea is to
have one server that gets the movement commands of the clients.
The server updates the screen of the players.

That should work.

Is it better to use UDP or TCP for that?

UDP is potentially faster, but has less built in reliability. I would
use TCP until you are more experienced.

Is there a better design possible with less network traffic?

I would not worry about optimization until you had something that
already exists that needed to be improved.

Are there some examples available about network games?

I am sure there must be. What language and platform? You might try
exploring with a few keywords on Google.

Best of luck,
ChrisOn 10/8/05, Torsten Mohr wrote:


E-Mail: Chris Nystrom
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris

El s?b, 08-10-2005 a las 07:36, Torsten Mohr escribi?:

Hi,

i’d like to write a multiplayer network game (several charaters
at once on a screen and all are moving at the same time).

I’m not sure about the design for that. So far the idea is to
have one server that gets the movement commands of the clients.
The server updates the screen of the players.

Is it better to use UDP or TCP for that?
Depends of what you need, less bandwidth or reliability.

Is there a better design possible with less network traffic?

Are there some examples available about network games?
Not many, I wrote something very basic I put in my blog. Uses UDP.–
Roger D. Vargas
Linux user #180787
dsgp.blogspot.com

  • No hay nada tan importante que no pueda ser olvidado *
    Alzheimer

Hi,

i’d like to write a multiplayer network game (several charaters
at once on a screen and all are moving at the same time).

I’m not sure about the design for that. So far the idea is to
have one server that gets the movement commands of the clients.
The server updates the screen of the players.

Is it better to use UDP or TCP for that?

Is there a better design possible with less network traffic?

Are there some examples available about network games?

Best regards,
Torsten.

As for the examples… maybe http://www.gaffer.org/articles/ will help?
Especially the last article. Also -
http://www.gamedev.net/reference/list.asp?categoryid=30

Koshmaar

Hi,

tanks for all your hints regarding network games techiques.

So i see that using UDP has an advantage regarding latency
and traffic but is less reliable.

How do i update the clients understanding of the world then?
I need to make sure that when client A has collected a coin
or medi-pack or some energy pack or whatever this is told to
client B. How can i ensure that over UDP?

Is there an additional TCP channel? Is there some protocol
put on top of UDP? Is the state cyclically updated and some
inbetween time of inconsistency just unwillingly accepted?

Best regards,
Torsten.> Hi,

i’d like to write a multiplayer network game (several charaters
at once on a screen and all are moving at the same time).

I’m not sure about the design for that. So far the idea is to
have one server that gets the movement commands of the clients.
The server updates the screen of the players.

Is it better to use UDP or TCP for that?

Is there a better design possible with less network traffic?

Are there some examples available about network games?

Best regards,
Torsten.

As for the examples… maybe http://www.gaffer.org/articles/ will help?
Especially the last article. Also -
http://www.gamedev.net/reference/list.asp?categoryid=30

Koshmaar


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi,

tanks for all your hints regarding network games techiques.

So i see that using UDP has an advantage regarding latency
and traffic but is less reliable.

How do i update the clients understanding of the world then?
I need to make sure that when client A has collected a coin
or medi-pack or some energy pack or whatever this is told to
client B. How can i ensure that over UDP?

You have to implement your own reliability with UDP, such as
serializing the packets.

Is there an additional TCP channel?

You can open as many sockets as you want.

Is there some protocol
put on top of UDP?

There can be, but you have to do it yourself.

To get this back on topic study the SDL_Net documentation:

http://jcatki.no-ip.org/SDL_net/On 10/9/05, Torsten Mohr wrote:


E-Mail: Chris Nystrom
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris

Is it better to use UDP or TCP for that?

UDP adds an order of magnitude of complexity, but you’re going to find
that you’ll need it eventually if you’re doing anything realtime.
Something like a network chess game can do fine with TCP.

There are lots of good examples of how to do this (the Quake 3 network
code is particularly clever, but it’s not a simple example).

The original quake 1 test used TCP networking, and it had too many
problems…eventually it moved to UDP, and kept a seperate TCP
connection for reliable data like scoreboard updating, etc…I think it
might have later ditched that for pure UDP.

enet solves a lot of the problems, though:
http://enet.cubik.org/Features.html

–ryan.

Is it better to use UDP or TCP for that?

UDP is potentially faster, but has less built in reliability. I would
use TCP until you are more experienced.

I spent a lot of my college career testing TCP/IP reliability in real
time multiuser games[0].

In my experience, lagbursts were a rarity, rather than the rule.
TCP provided fine performance, without the overhead of having to deal
with out of order and dropped packets.

YMMV.

[0] Played a lot of MUDs.On Sat, 08 Oct 2005, Chris Nystrom wrote:


Any sufficiently advanced incompetence is indistinguishable from malice.
- Vernon Schryver

I spent a lot of my college career testing TCP/IP reliability in real
time multiuser games[0].

MUDs aren’t “real time” in the same way as, say, an FPS.

–ryan.

I spent a lot of my college career testing TCP/IP reliability in real
time multiuser games[0].

MUDs aren’t “real time” in the same way as, say, an FPS.

It may have been the people I knew, but when you are “room dancing”
(abusing exits/entrances) to avoid being targetted by combat specials
and spells, it would fall under my definition of realtime. :wink:

MUDs include a lot of different games, with different pacings. I should
have been more clear about what I’ve met.On Tue, 11 Oct 2005, Ryan C. Gordon wrote:


Any sufficiently advanced incompetence is indistinguishable from malice.
- Vernon Schryver

Hi,

enet solves a lot of the problems, though:
http://enet.cubik.org/Features.html

thanks, that hint looks just great. I wonder if something
like this will be available in SDL at some time, maybe based
on the UDP part of SDL_net.

Best regards,
Torsten.

thanks, that hint looks just great. I wonder if something
like this will be available in SDL at some time, maybe based
on the UDP part of SDL_net.

It handles the platform-specific bits, just like SDL_net would.

Realistically, most of the platform-specific in SDL_net is a complete
seperate implementation for MacOS Classic…all the Unixes are the same,
and there are only minor variations for WinSock (which is 95% the same
as BSD Sockets, like the Unixes).

Other than that, for what reasons are people choosing SDL_net at this
point? Just brand name? I’m genuinely asking here.

–ryan.

I don’t. I use SDL_Image, SDL_ttf, SDL_Mixer, etc, in my app, but not
SDL_net. Like you say, there did not seem to be any real need for it.
I just made my own little sockets library for networking.

ChrisOn 10/11/05, Ryan C. Gordon wrote:

Other than that, for what reasons are people choosing SDL_net at this
point? Just brand name? I’m genuinely asking here.


E-Mail: Chris Nystrom
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris

I use SDL_net, for the main reason that who knows what M$ or other group
will release in a future OS. Who knows if MacOS will continue to
support its current networking API. Who knows if embedded devices will
support BSD-style sockets of some proprietary crud? Who knows if
Winsock won’t change, etc… I’d prefer my game to use SDL_net and
SDL_net can just update with any of these changes without requiring
updates to my game (or its internal libraries) itself, I mean, isn’t
that the point of SDL?On Wed, Oct 12, 2005 at 03:15:45AM -0500, Chris Nystrom wrote:

On 10/11/05, Ryan C. Gordon wrote:

Other than that, for what reasons are people choosing SDL_net at this
point? Just brand name? I’m genuinely asking here.

I don’t. I use SDL_Image, SDL_ttf, SDL_Mixer, etc, in my app, but not
SDL_net. Like you say, there did not seem to be any real need for it.
I just made my own little sockets library for networking.


Steaphan Greene
GPG public key: http://www.cs.binghamton.edu/~sgreene/gpg.key.txt
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20051012/85051466/attachment.pgp