Network traffic in games.

Started by
2 comments, last by Hans 23 years, 4 months ago
I''m creating an online action/strategy game. I don''t know how some of you ppl talk about sending 500 byte UDP packets, when I have usually only 1-8 byte packets (+header) and I send them about 10 times per second. Only chat messages are bigger. From client->server I send key presses (or coordinates). And from server->client only the stuff that client can see and what is important. I also read about Serious Sam (a 3d action game like Quake) compressing UDP packets. Compressing?! The ~4 byte packets I use probably wouldn''t gain much from compression . I understand the header is 20 bytes and when my packets are only about 4 bytes, the header part is quite large. But still the traffic is about 1-2 kb/sec so who cares? Or am I missing something important now?
Advertisement
In your situation I would not expect compression to do a whole lot for you.

There are infinite situations out there though and many of them benefit from compression.

Many games also "bunch" packets together before sending. So, if you bunched together 100 4-byte packets you may see benefit from compression.

LostLogic
"My book on multiplayer game programming coming out Q2/2001"
www.lostlogic.com

LostLogicwww.GamerOutfit.comXBox 360 Community Games Reviews and NewsExisled - 2D/3D Shooter for XBox 360

Good luck keeping the packets that low. You''ll find as you flesh out your client - server protocols and sync scheme, you''ll have to send more than 4 bytes / entity. What about world state data which the client doesn''t see ? or the timmer sync routine for the dead recoking to work? Etc.. it adds up, though not to 500 bytes/update worth though. It will proably be 50 bytes/update, more likely. And at times can peak at much higher, perhaps 2x - 3x that much per packet during heavy action scenes. As for compression it only becomes functional with an adaptive scheme or using a dictonary scheme sent async with the packets and the packets have to be large enough to be worth compressing.

I think the UDP header is 32 bytes.

Good Luck

-ddn
8byte packets are inefficent, because 80% of the packet is overhead :p
And is that 8bytes per player?

- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement