How do I create 1 host and 3 clients, instead of 4 clients/hosts

Hello,
I am currently creating a game using photon Networking, and I am having a problem with defining a host. Basically I spawn some cubes right now, that are spawned locally on every user's program, and each user's computer does their own calculations for the cube's movement, I want to only create these cubes on one of the client's computer, and then send any death state or movement information to the other clients, so everything is synced to the "host". But so far I have not been able to find a way to do that.

This is an image of the code I currently use to try defining a "host".


This is an image of the code I use to transfer the data to the objects PhotonVeiw in other clients.


Any feedback is appreciated :smile:

Comments

  • Hi @DerekSmith,

    I honestly don't get the problem I guess. If you are using PhotonNetwork.Instantiate(...), you are instantiating a certain object on each client, whereat the caller of this function is also the owner of the object. If a client is the owner of the object, he can send updates to the other clients, for example by using OnPhotonSerializeView.

    Another option is to use Scene Objects. Those can be instantiated by using PhotonNetwork.InstantiateSceneObject(...) by the MasterClient only. Those objects are owned by the scene but controlled by the MasterClient by default.

    The third option is to use Manual Instantiation according to the last section of the linked documentation page.
Sign In or Register to comment.