Bit Packing
Bit packing is a form of data compression that reduces the number of bits it takes to serialize a value.
A simple example of this is an integer that is always between 0 and 100. Normally an integer will be serialized as 32 bits, but knowing its range is 100 it can be packed into only 7 bits.
Bit Packing in Mirage
Mirage has many attributes that can be applied to SyncVars and Rpc parameters
- BitCount Sets the number of bits on an integer
- BitCountFromRange Sets the number of bits from a given range, rounding up.
- ZigZagEncode Encodes a value using ZigZag Encoding. Only useable with BitCount or VarIntBlocks
- VarInt Packs int to different sizes based on their size. Allows for 3 configurable size ranges
- VarIntBlocks Packs int to different sizes based on their size. Uses block size so can be used over a large range of values
- FloatPack Compresses a float value
- VectorPack Compresses a Vector value
- QuaternionPack Compresses a Quaternion value