Server Side Logic
Options
Hey,
I am trying to set up my multiplayer game but I cant seem to find any way to design my server side logic in my level. I want the scene to have some dynamic persistent objects. For example a dynamic train which moves on the server and all clients see its position in sync.
I'm sure I'm missing something obvious so I really appreciate any help in the right direction.
Thanks
I am trying to set up my multiplayer game but I cant seem to find any way to design my server side logic in my level. I want the scene to have some dynamic persistent objects. For example a dynamic train which moves on the server and all clients see its position in sync.
I'm sure I'm missing something obvious so I really appreciate any help in the right direction.
Thanks
0
Comments
-
Hi,
Conventional approach used in PUN is that 'server side' logic runs on one of clients, usually so called 'master client'. This client instantiates scene objects (with PhotonNetwork.InstantiateSceneObject as opposed to PhotonNetwork.Instantiate for client-owned objects) and controls them.
Also note that scene objects can be added to scene at design time and be controlled by master client after scene loaded at run time.0 -
Thanks for your reply,
Are the objects that the master client instantiated automatically destroyed when the it disconnects?0 -
Objects created with PhotonNetwork.InstantiateSceneObject persist after master disconnects. New master takes control on them.
Objects created with PhotonNetwork.Instantiate destroyed after any client created them disconnects including master.1