- Home /
Synchronizing player information over a peer-to-peer network
I've been trying to learn networking as much as I could but I've been struggling with a few key things recently. I've gotten players to spawn in each others' games properly but I'm not sure how to synchronize game states properly.
I'm using Network.Instantiate to spawn players but I'm not sure how to synchronize information after that point.
As far as I understand networking (and Network.Instantiate), each time a player connects to the server, an instance of the player is created on that machine as well as the RPC telling each other machine to spawn a generic version of the player at the correct position.
How do I then tell that generic version what its name, player number, material, etc are? I have a networkView set to observer the PlayerController script but OnSerializeNetworkView can not handle some of these types of variables.
I have also tried using RPCs but they can only send Objects and NetworkViews and not GameObjects. Another issue that I can't seem to solve with the RPCs is bit of a catch-22: the object I'm referencing (via finding its NetworkView) doesn't already have any of the information set, so it's impossible to read the information from that object in order to set it.
Is the only way to get around this to use an Authoritative server?