Best way to synchronize all rigidbodies? [Cloud]

Options
My plan:
  • Mark all rigidbodies on Clients as kinematic
  • If Client touch rigidbody then send force to Master Client
  • Master Client update physics and send changes to Clients
But how send changes? Inside OnPhotonSerializeView? Or using RPC?

OnPhotonSerializeView


RPC

Comments

  • vadim
    Options
    RPC is always reliable and can be sent from any client.
    OnPhotonSerializeView allows broadcast changes from owner only but supports non-reliable synchronization. Aside that, not much differences between them.
  • Rusildo
    Rusildo
    edited October 2015
    Options
    vadim
    OnPhotonSerializeView called 10 times per second by default. How about RPC? If FixedUpdate called 30 times per second then RPC method will be sent 30 times per second too?

    And also. It's correct form to use OnPhotonSerializeView?
    if (PhotonNetwork.isMasterClient && stream.isWriting)
        // write only on master client...
    else if (!PhotonNetwork.isMasterClient && stream.isReading)
        // read only on client...
  • vadim
    Options
    Look at demos for correct OnPhotonSerializeView usage.
    They only check stream.isWriting (true for owner) and stream.isReading (true for others).

    Frequency of sending set with PhotonNetwork.sendRateOnSerialize for OnPhotonSerializeView and with PhotonNetwork.sendRate for RPC.
    You can send RPC immediately after invoking it by calling PhotonNetwork.SendOutgoingCommands()