===================== Vector NetSerialization customization.








#include "Engine/NetSerialization.h"


template<int32 ScaleFactor, int32 MaxBitsPerComponent>
bool WritePackedVector
    FVector Value,
    FArchive & Ar


===================== Vector NetSerialization customization. ===================== Provides custom NetSerilization for FVectors.

There are two types of net quantization available:

Fixed Quantization (SerializeFixedVector) -Fixed number of bits -Max Value specified as template parameter

Serialized value is scaled based on num bits and max value. Precision is determined by MaxValue and NumBits (if 2^NumBits is > MaxValue, you will have room for extra precision).

This format is good for things like normals, where the magnitudes are often similar. For example normal values may often be in the 0.1f - 1.f range. In a packed format, the overhead in serializing num of bits per component would outweigh savings from serializing very small ( < 0.1f ) values.

It is also good for performance critical sections since you can guarantee byte alignment if that is important.

Packed Quantization (SerializePackedVector) -Scaling factor (usually 10, 100, etc) -Max number of bits per component (this is maximum, not a constant)

The format is =""> =""> =""> ="">

The advantages to this format are that packed nature. You may support large magnitudes and have as much precision as you want. All while having small magnitudes take less space.

The trade off is that there is overhead in serializing how many bits are used for each component, and byte alignment is almost always thrown off.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey