Hey, i’m making a multiplayer game, and i got the logic working fine.
I used RPC calls for every thing, but i don’t know if it’s the right way to do it.
Can i use RPC calls sending the player position and lookDirection for all the other players in an Update function?
Or do i need to use some other way?
What i want to do is just send some informations of all players to all players in the update function (or some thing fast enough to pass position and rotation) in the same script, like an RPC call for every one passing these values.
Thanks in advance.
I use RPC calls in the update loop for sending player actions- like jumping or attacking. Location and velocity information, though, should be synchronised with OnSerializeNetworkView().
– syclamoth@syclamoth yes, that is true. However, one needs to be very careful about the RPC buffer - sending, say 30 buffered RPCs per second (game @30 FPS) can cause huge problems, as some of them are almost guaranteed to be lost in the way, which will cause the buffer to swell with waiting RPCs. Could lead to very entertaining results. :)
– asafsitnerBut do i need to use a networkView in every multiplayer character? or i can send all data in one networkView? Sorry, but i didn't understand how exactly OnSerializaNetworkView works, even with the docs :/ I have my fps character controller, and i need to pass the informations of this player to every one, that will update the 3rd person view of my character in their scene... there is something like, link a networkView to an other one?
– anon81905099Basically you need a networkView for everything that you want to sync over the network. I presume you'd have one as part if your player prefab, however, so you won't need to manually attach those. In the OnSerializeNetworkView() method you make the check to see if you should read to the network or write from the network, so you know whether to update other players or your own.
– asafsitner