Network compression: arithmetic encoding

Arithmetic encoding is one of those obscure tools that is rarely used, but every now and then is the only thing that can do the job. It’s the oddly sized Allen-key of network data compression. Arithmetic encoding is cool because not many people have heard of it, and at first glance it doesn’t seem like…

3

Network compression: bitfields

Bitfields are just like this most totally awesome old-skool way of packing data, dude! C# programmers rarely have an excuse to mess with such things, but network packet compression offers an excuse par excellence, so let us mess away. A byte is 8 bits. An int is 32 bits. But what if our data values are…

3

Network compression: packed vectors

The Microsoft.Xna.Framework.Graphics.PackedVector namespace contains types that could be described as “quantization for lazy people”. This functionality was originally designed for packing textures and vertex buffers into smaller GPU formats, but is equally useful for compressing network packets. Consider this line from our Peer-to-Peer sample: packetWriter.Write(localTank.Position); The tank position is a Vector2, which contains two floating point…

1

Network compression: quantization

Fewer bits take up less space than more bits. If you have a number that you know will always be in the range 0-100, there is no need to send a 4 byte integer over the wire. Cast it to a byte first. Sometimes you can reduce the necessary range by offsetting the value first. Lets…

2

Network compression

Because network bandwidth is so limited, it is critically important to compress all the data you send over the wire. Generalized compression algorithms like zip don’t tend to be much use here. To get good results, that kind of compression needs a reasonably large piece of data to sink its teeth into. But network packets…

0

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…

8

Network bandwidth: packet headers

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…

5

Network packet loss

Networks are not reliable. When you send a data packet, many things can happen: It might arrive at the other end. It might never arrive. Packets might arrive, but in a different order to how you sent them. Packets might arrive, but their contents could be corrupted. Someone may have altered them along the way,…

0

Network latency

 “The time has come”, the Walrus said, “to talk of networking“… The network game programmer has three mortal enemies: Latency makes your data arrive late Packet loss makes some data not arrive at all Bandwidth limits how much data you can send I shall write about all three, in that order. Latency is caused by physics. Decades…

3

Why do people hate Wikipedia?

To celebrate the release of XNA Game Studio 2.0, I’m going to write about something completely unrelated. I’m getting increasingly fed up with reading articles dissing Wikipedia. For some reason its very existence makes some people (who mostly seem to be academics) very angry. As far as I can figure out their main complaints are: Anyone…

10