Nature of the UDP packet sends.

Started by
2 comments, last by Westeria 19 years, 4 months ago
Its always been my understanding that since UDP has very little header information, you could get away with sending alot of packets per frame in game. My game runs at a smooth FPS, (20 <= FPS <= 50). And with sending 4 packets per frame, it gets boggled down (I'm on a Network, so its really strange). eg.. my game was model'd so that each packet was a creature update. So if you walked into a room with 10 creatures, you'd get 10 packets per frame. So really, I'm wondering... should I be aiming for a certian size of packet? eg... close, but not a byte over, 64kb?
Advertisement
It depends on whether you're aiming at LAN or Internet network play. The optimum packet size is that at which it won't get fragmented as it travels over the network. I can't remember off hand what the best sizes are though. The Winsock Programmers FAQ is a pretty good source of information - http://tangentsoft.net/wskfaq/

But yeah, you really don't want to put each monster's info in a separate packet - each individual send occurs numerous overhead penalties as it sinks through the network stack layers to the hardware then rises back up at the other end, plus the more packets you send, the more chance of losing some (UDP being unreliable).
---PS3dev
64 kB UDP packets? Crikey...

The guaranteed-unbroken UDP packet size, if I remember right, is something like 560-ish bytes total (header and data). Could be wrong.

Anyways, I'd say a good rate would be one packet for all creatures, at most 10 or 15 times per second, to keep from bogging the local (or at least the local part of the) network into the ground.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
Each creature is roughly 107 bytes, but I can shrink to 80 relatively easy.

Put > 7 creatures on the screen at one point, and the UDP packets become fragmented?

What does fragmented UDP packets mean? Do I have to change my code over it?

UDP packets arrive in random order, so theoretically, combine that with random sizes, and it makes it IMPOSSIBLE to work with.

So what is a fragmented UDP packet?

This topic is closed to new replies.

Advertisement