Hi,
I’m trying to optimize my networking and for one I’m using FVector_NetQuantize. I noticed when I tested by looking at the size increase of my FArchive that the size always increases by 16 bytes, when I use FVector_NetQuantize100, FVector_NetQuantize10, or even when I call something like SerializePackedVector<1, 8> manually.
I noticed that in the Quantized vector structs SerializePackedVector is called, and from there WritePackedVector, and eventually FArchive::SerializeInt. This is a virtual function, and my testing is done using a FArchiveFileWriterGeneric (which does not overwrite that method)
In WritePackedVector (in NetSerialization.h), this is called 4 times:
FArchive::SerializeInt( Value, Max);
The default implementation of FArchive::SerializeInt:
virtual void SerializeInt(uint32& Value, uint32 Max)
{
ByteOrderSerialize(&Value, sizeof(Value));
}
Since sizeof(uint32) is being used here, that explains why the FVector is always 16 bytes. I wonder if this is intentional? Does it only actually serialize when the supplied Archive has its SerializeInt method overridden?
My main question however is: How do I test how large my struct is when it is actually NetSerialized for networking? I can identify when the NetSerialize call is being made during networking, but the Archive::TotalSize call always returns -1.