Download

Senseless FVector_NetQuantize limits?

Currently UE4 provides 3 main classes for FVector network transfer:

FVector_NetQuantize: 0 decimal points, 20 bits for component maximum, Valid range: 2^20 = +/- 1,048,576
FVector_NetQuantize10: 1 decimal points, 24 bits for component maximum, Valid range: 2^24 / 10 = +/- 1,677,721.6
FVector_NetQuantize100: 2 decimal points, 30 bits for component maximum, Valid range: 2^30 / 100 = +/- 10,737,418.24

Format used for all vector types is the same:

[N of bit per component][component 1 packed in N bits][component 2 packed in N bits][component 3 packed in N bits]

Size of bits selected for N is depends only component absolute value and limit (20/24/30).

So, what is the sense of this differerent values: 20, 24, 30… In any case all values from 16 to 31 will require 4 bits to serialize…

So, we could change:
SerializePackedVector<1, 20>(*this, Ar); // range: 2^20 = +/- 1,048,576 (~10km)
SerializePackedVector<10, 24>(*this, Ar); // range 2^24 / 10 = +/- 1,677,721.6 (~16km)
SerializePackedVector<100, 30>(*this, Ar); // range 2^30 / 100 = +/- 10,737,418.24 (~100km)

To:

SerializePackedVector<1, 31>(*this, Ar); // range: 2^24 = +/- 2147483648 (~214740km)
SerializePackedVector<10, 31>(*this, Ar); // range: 2^31 /10= +/- 214748364.8 (~21474km)
SerializePackedVector<100, 31>(*this, Ar); // range: 2^31/100 = +/- 21474836.48 (~2147km)

totally without any additonal bandwidth usage… Yes, float precision issues still will take place, but it is better to provide ability to transfer larger values than not.

So, what is the sense for 20/24/30?