Complex modular player over network

Options
Hey,

I need to create a complex modular player over the network. The problem is that my player is not simply a prefab but it is a combination of some more prefabs. All of these components (i.e. weapon modules) are required in gameplay.

My first idea was to create the main component using PhotonNetwork.Instantiate and to use an RPC to create all other modules of the player character. That works fine. The main component is created and the other parts are created by the RPC. Unfortunately every component is local only and I cannot synchronize the state of the modules over the network.

Anyway it is very complex to create the player that way. Is there a better solution? Of course I tried to use PhotonNetwork.Instantiate for the modules as well but that creates duplicated objects and resulting in even more trouble.

Maybe I could create a player prefab that already got all modules on it and just activate the right one depending on the RPC? That way I would need only one PhotonNetwork.Instantiate but I'm not sure if thats the right way to go.

Would love to hear some ideas. By the way I'm interested if there is a advantage/disadvantage if I send a Vector3 vs. the single float values?

Comments

  • Creating single network-synchronized object per complex modular player should be enough. You can easily synchronize modules state including transformations via main object RPC's or OnPhotonSerializeView. Put all modules in prefab or create/destroy them on-the-fly depending on player state.

    There is no difference between serialization of Vector3 and 3 floats. Both send 3 floats.