Welcome to MSDN Blogs Sign in | Join | Help

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.
Published Thursday, December 20, 2007 11:00 AM by ShawnHargreaves

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Friday, December 21, 2007 12:03 AM by radioact1ve

# re: Network bandwidth: voice

I never knew bandwidth was so troublesome (hence the lack of experience).

I'm guessing this is not just an XNA thing. How is this handled in say Big Team battle via Halo.

Friday, December 21, 2007 9:51 AM by CGomez

# re: Network bandwidth: voice

My guess is the way Halo handles it in Big Team Battle is by using the Push to Talk option.

1) Once the game starts you can only talk to the other 7 players on your team.  As Shawn has pointed out, this is still potentially a lot of bandwidth, and with what I've seen Halo 3 do, it needs that bandwidth.

2) You have to Push To Talk just to transmit.  Once you click up on your dpad, they effectively use LocalNetworkGamer.EnableSendVoice to let you talk and shut it off when you are done.  Since people aren't constantly hitting their up directional button, bandwidth is saved.

Saturday, December 22, 2007 9:36 PM by radioact1ve

# re: Network bandwidth: voice

Sounds good. In fact, sounds a little obvious. 8)

Thanks!

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker