Best way to synchronize all rigidbodies? [Cloud]
Options
Rusildo
✭
My plan:
OnPhotonSerializeView
RPC
- 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
OnPhotonSerializeView
RPC
0
Comments
-
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.0 -
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...0 -
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()
1