OnPhotonSerializeView, too many parameters

Options
deldam
deldam
edited September 2014 in Photon Unity Networking (PUN)
Hello,

I am wondering about the correct use of photonserializeView:

if i understand its send less data than a rpc?

if I have something like 10 parameters serialized, is it too much ? how many is too much?

im doing an rpg on mobile, i would keep the bandwitch as low as possible.


is there some method to save bandwitch ?
for example instead of
stream.SendNext((float)controller.forwardAmount);
stream.SendNext((float)controller.turnAmount);
stream.SendNext((float)controller.velocity.y);
if i do this:
Vector3 somefloats = New Vector3(controller.forwardAmount,controller.turnAmount,controller.velocity.y);
stream.SendNext((Vector3)somefloats);
Its same?

Comments

  • Tobias
    Options
    There is no fixed limit for "too much". It depends on your target platform, hard- and software and the network.
    Give it a proper test and unless you break things often, it should work for your players, too.
    Keeping bandwidth low is always a good idea.

    Low level info about our protocol and serialization is available here:
    http://doc.exitgames.com/en/realtime/cu ... y-protocol
    http://doc.exitgames.com/en/realtime/cu ... -in-photon

    Sending 3 floats is actually more effective than sending them as custom type but only slightly. The stream is a object[] and will need 3 times the "float" type info but no length. The Vector3 is a custom type which has 2 bytes for type info and 2 for length. The difference is just 1 byte.

    You will be able to save more bytes by thinking about when and how you send updates. In a PhotonView set the "Observe Option" to some value that suits your needs.
    See:
    http://doc.exitgames.com/en/pun/current ... servembpun