Search Unity

Question about OnSerializeNetworkView

Discussion in 'Multiplayer' started by cody, Nov 6, 2009.

  1. cody

    cody

    Joined:
    Oct 7, 2009
    Posts:
    20
    in the Bitstream which gets passed in OnSerializeNetworkView there is a method:

    function Serialize (ref value : float, maxDelta : float = 0.00001F) : void

    For what is maxDelta good for? Does it mean that data is only sent if delta between current and last value is greater than maxDelta?
    If so, how does it determine the last value?
     
  2. Tubeliar

    Tubeliar

    Joined:
    May 21, 2009
    Posts:
    14
    I don't really know since the documentation page doesn't explain it either. But since only the float based functions are overloaded it must have something to do with rounding errors and the margin of error in deciding whether two values are the same. Whether it is used at all probably depends on the state synchronization method you have selected in your Network View.
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    The delta there is to define the your float precision.
    If you have larger deltas, which means less precision, the amount of data written for floats can be cut down (why use 32bit if you only have 22bit of relevant data for example) which allows you to effectively reduce the traffic you generate.