[ENet-discuss] Compression algorithm

Syed Setia Pernama syedhs at yahoo.com
Wed Mar 24 08:01:34 PDT 2010

There are many ways to compress packet.

1) For quaternion, you can compress it from 32 bytes (256 bit) down to 32 bit.
2) For 'normalized' values which range from 0 to 1, you can still get a good precision by converting it to word (2 bytes). eg value of 0.5 is converted to 32768. You can halve the size this way.
3) For position, probably you can transmit delta and only once a second (for an example), transmit the whole x,y,z. You can get it halved too this way.
4) Use a class like BitStream (Raknet uses this class) which can utilize every single bit. For an example:-
BitStream bit;
bit.write(true); // uses only 1 bit instead of 1 byte
5) Yes, use string table lookup. Instead of sending the whole string, just send the id to the table. Make sure the tables are both ends are the same.
6) Compression library will probably help although I don't use it. Make sure it compresses well (which is your concern) even the buffer size is small.


More information about the ENet-discuss mailing list