Is there anyone here, who could explain me how exactly maxDelta (from BitStream.Serialize()) works? I know that it helps to save bandwidth by cutting the precision. But how it works exactly? How much am I saving when the value is 0.01f?
Thank you.
Is there anyone here, who could explain me how exactly maxDelta (from BitStream.Serialize()) works? I know that it helps to save bandwidth by cutting the precision. But how it works exactly? How much am I saving when the value is 0.01f?
Thank you.
No one? Do you even use this maxDelta parameter?
I have never had the need to use it.
I only serialize Vector3 and Quaternions.
It works for Vector3 and Quaternion as well.
http://docs.unity3d.com/Documentation/ScriptReference/BitStream.Serialize.html
hmmm, isn’t that what I just said ?
I understood from your previous post, that you don’t have to deal with maxDelta because you only use Serialize function for Vector3 and Quaternion. So from this I understood that you thought that maxDelta doesn’t work for Vector3 and Quaternion.
Maybe I misunderstood your post ![]()
I finally figured out what is the maxDelta parameter. It is only usable if you are using Reliable Delta Compression. As you know delta compression means, that the data will be sent only if there is any change in the data.
Example 1:
var test : float = 0.0;
function OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo)
{
if (stream.isWriting)
{
stream.Serialize(test);
test += 0.001;
}
}
Your value will be sent all the time, because it’s different every time (0.001 is the difference).
If you would like it to be sent only when the difference is equal or greater than 0.1, you have to use maxDelta:
var test : float = 0.0;
function OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo)
{
if (stream.isWriting)
{
stream.Serialize(test, 0.1);
test += 0.001;
}
}
Thanks for figuring this out and sharing your knowledge!
It’s sad that this is not explained at all in the Unity docs. No love for networking.