Shawn Hargreaves Blog
Network bandwidth refers to how much data you have room to send over the wire. As you approach the limit, you will see increased amounts of packet loss. If you go over the limit, you will eventually get disconnected from your session.
The XNA Framework measures bandwidth in bytes per second. Confusingly, network vendors like to measure it in bits per second (I suspect they do this to make their numbers look bigger). Even more confusingly, both units have the same acronym: bps, or kps/kbps if you are talking about thousands of them. Be wary, and always check which you are dealing with.
In order to be playable by the majority of home Internet users, Xbox games are expected to work with as little as 8 kilobytes per second of both upstream and downstream bandwidth.
You might think you could figure out your bandwidth usage by adding up the size of all the data you are sending, multiplying by the number of machines you are sending it to, then multiplying again by the number of sends per second.
But you'd be wrong.
You forgot to include the packet headers. Every time you send a packet over the network, in addition to the data inside that packet, you must factor in:
That is ~50 bytes of header data per packet.
Consider an example where we are sending a single boolean value to a single other player, 60 times per second:
Whoah! We are using 3 kilobytes per second (remember we only have 8 in total) even for so little real data. 98% of our bandwidth is being wasted on packet headers.
How can you survive this deadly attack of the killer packet header gremlins?
This post was very informative and I am enjoying reading your posts on networking in XNA, I find them quite interesting and useful.
Just a quick question, is the 8 kilobyte per second "limit" for 8 kilobytes up and 8 kilobytes down or is it shared so I instead could use (for example) 5 kilobytes up and 3 down per second?
The 8k limit is separate for upstream and downstream. So you can be dealing with 16k in total: 8k going out from you to other machines, and another 8k coming in from them to you.
For peer-to-peer games this usually balances out pretty well, but for client/server games it can be a pain when the clients have very little data to send to the server, but the server has way too much data to send to each client, so the clients end up running out of downstream bandwidth, while the server runs out of upstream bandwidth, even though each had plenty of bandwidth going unused in the other direction.
Ahh I see, that will definitely loosen things up a bit.
Thanks for the reply.
thanks for this explaination.
I have a question on that.
Is it possible that in the last passed years the up- and down speed increased from 8kb/s to 40kb/s?
I cant find something reliable on that where the actual bandwitch is described.
I don't have any more recent data on this, but at least for commercial Xbox games the TCR about bandwidth usage has not changed.
My totally unscientific estimate is that, while bandwidth has certainly improved dramatically for some users over the last few years, it is unchanged for many others, so if you want your game to run well for a large number of players, this 90th percentile figure has probably not changed much if at all.
For instance I'm still using the same home net connection as I was in 2005.