Network compression: just say no!

Originally posted to Shawn Hargreaves Blog on MSDN, Tuesday, January 1, 2008

There is only one way to take up less space than a cunningly compressed network packet, and that is if you don't send any data at all.

Obviously, when you send no data, things are unlikely to remain in sync from one machine to another. But you know what? Sometimes that doesn't matter.

Two rules:

  1. If it matters to gameplay, you must synchronize it
  2. Most things do not matter to gameplay

Sounds and animations rarely need to be synchronized. If the network tells you a character is moving rapidly forward, each machine can independently work out that they ought to be playing the run animation and triggering footstep sounds at regular intervals. It doesn't matter if the footsteps happen at slightly different times on each machine, so there is no need to bother synchronizing this over the network.

Case study: when you overtook another rider in MotoGP, 5% of the time they would play a "shake fist at you" animation. When you crashed, we would choose between many different animations of the rider flying through the air. This was random, and not synchronized over the network. One player might see the fist shaking while another did not, and during crashes each machine would display the rider tumbling in a different direction. We didn't have enough bandwidth to properly synchronize this stuff, but it didn't matter because the animations did not affect gameplay, so nobody noticed or cared if they were out of sync.

Similarly, in a shooter there is usually no need to synchronize the exact position of bullet hole decals, or the fact that you shot out a pane of glass, or which direction each spent cartridge particle is flying. Just send a single "I'm in ur game, firing ur gun" boolean, and each machine can figure the rest out for themselves. It doesn't matter if they each get a slightly different result, as long as the resulting parallel universes are approximately similar.

Once you get in the habit of not bothering to send information, it is amazing how much you can get away with.

Case study: in MotoGP we had advertising billboards and cones positioned around the edges of the track. If a bike collided with one of these, both object and bike would go flying. If a bike repeatedly nudged up against one while moving slowly, they could gradually move the billboard to a new location.

Most players took their racing very seriously, organizing tournaments to see who was fastest, but some griefers wanted to spoil things for everyone else. They would ride backward around the track, competing to see who could cause the biggest pile-up.

The griefers learned that if they were patient they could move several billboards out into the middle of the track, creating a barricade. The serious racers would come flying around the bend, crash into the barricade, and the dust would fly.

Thing is, this didn't actually work!

We never bothered to synchronize the position of the billboards and cones over the network. We didn't have enough bandwidth to do that.

Here is what actually happened:

Despite millions of players putting more hours into the game than could possibly be healthy, nobody ever noticed this was not consistent.

The griefer saw a spectacular crash, and assumed everyone had been respawned after it.

The serious racers finished their serious race.

And they all lived happily ever after.

Blog index   -   Back to my homepage