sending packages

Started by
6 comments, last by wolfram 18 years, 1 month ago
Hello, I'm trying to create a multiplayer FPS-game. How often should I update my clients (i.e. send UDP-datagrams)? What happens if I send to often? Or to seldom? Thanks in advance!
Advertisement
Oh, one more thing...
What's the difference between a stateful and stateless protocol?
When should I use either of them?
- At least 25 times a second. If it's less than that, movement will appear choppy. Many games refresh at 60 or more fps. If you send too often then you could clog the network and get lag. Send too rarely and your clients will not all have the same view of the game.
Do you know how a general aproach to limit the number sends to my clints?
Quote:Original post by Bob Janova
- At least 25 times a second. If it's less than that, movement will appear choppy


Not true. There are many techniques such as interpolation / extrapolation which is used to smouth out movement. Virtually all commercial FPS's use some form of movement smoothing technique. Even at 25 fps you would want to apply some form of smoothing.

Quote:Original post by wolfram
Hello,

I'm trying to create a multiplayer FPS-game.
How often should I update my clients (i.e. send UDP-datagrams)?
What happens if I send to often? Or to seldom?

Thanks in advance!



Quake3 servers usually run at 20-30 fps, thats not a bad value to go by for a typical FPS with typical amount of players. Dont send too often or too seldom - Best having a fixed rate, but be prepared that you might have to change it based on the specific game / player count etc.

Quote:Original post by wolfram
Do you know how a general aproach to limit the number sends to my clints?


To limit the number of sends you can just run the server at that framerate; for most cases this is probably the best approach. No need to create more states than what needs to be sent to clients.
Thanks for the replies!

My last question for today. (a little of topics perhaps...)

What is a stateful protocol? And what is a stateless protocol?
When do we need them?
A stateful protocol assumes that the other end remembers data that's been sent before. A stateless protocol contains ALL the data needed to serve a specific request in each message.

So, a stateful protocol update message might look like:
"move entity 3 by delta 4,-5,0.17"

A stateless protocol update message would look like:
"There's an entity with id 3, using mesh file BigMonster, 113 of 247 hitpoints, at position 1132.5,-85.4,223.8, at point 23.6 into its idle animation"

With a stateless protocol, you can join at any time and "do something" with the message stream. With a stateful protocol, you need to be in from the beginning.

Clearly, stateful protocols are must better for pretty much everything that involves wanting to send fewer bytes on the wire. The draw-back is that you can't join "anywhere" in the stream of messages.

Btw: "packages" is something you send using FedEx. You probably meant to say "packets." :-)
enum Bool { True, False, FileNotFound };
I guess, sometimes my English slips away ... I'm truly greatful for any corrections! Its perfect opportunity for me to improve it and while doing so, learn new stuff about games and network-programming. Life is great!

Thank you all!

This topic is closed to new replies.

Advertisement