Network bandwidth: voice
Bandwidth is needed for more things than just the data you send yourself. The XNA Framework handles voice automatically, but every time you speak into the headset, we have to send that data out over the wire.
The voice stream is heavily compressed, using ~500 bytes per second, and only when you are actually talking.
By default, all players can talk to all others. Consider a 16 player game, where one player is talking to the other 15:
- 500 * 15 = 7.3 kilobytes per second
Yikes! Remember we only have 8k in total. We've nearly used the whole thing up, even before sending any actual game data.
How can you survive this deadly attack of the killer voice bandwidth gremlins?
- Limit your game to a smaller number of players.
- Or use LocalNetworkGamer.EnableSendVoice to limit who can talk to who:
- Only talk to players on your team.
- Only talk to people who are near you in the world. But avoid changing this too often! EnableSendVoice must itself send network data to coordinate the new settings. If you change it often, this could end up costing more than you saved.
- In MotoGP, we let each of our 16 players talk to all the other 15 when in the lobby (we didn't have much other data to send then), but while racing they could only talk to the 3 closest players.