How to implement boat synchronization?

Options
Qmaks
Qmaks ✭✭
I create boat in my room. Boat is scene object and it owner is current master client. One of the players want to sit on the boat and sail. But he is not owner of it, and he can not send position and rotation of the boat to other players.
How to allow to stream position and rotation of a particular customer for the object and not the current master client.

Comments

  • Tobias
    Options
    Currently, there is no easy and clean way to do this. Every object is owned by someone or belongs to the scene. Scene objects can be modified by the master.
    This is all client side logic, so it can be modified and changed but as said: That's not so simple.
    I think scene objects would be the best way to start, as they don't belong to a certain player. Maybe you send an RPC to the current owner to take over control and then this owner can assign someone new as owner. This way, only one player owns the object any time.
  • hi there,


    Though i am a beginner with Photon, but...

    What about to place another object in the scene,parenting it to the boats positionand hierarchy by code and then who ever takes ownership of that object
    can steearing the boat (the object, NOT THE PLAYER is sending control information to the owner(master) of the boat.

    that Object(letz call it steering wheel) should have some public methods like sail left, sail right and send the according data to the master of the boat.

    i hope you can understand me.
  • TommiH
    Options
    I would also like to accomplish a similar thing. I managed to do it in Unity Networking but what works there doesn't seem to work with Photon.
    Tobias wrote:
    I think scene objects would be the best way to start, as they don't belong to a certain player. Maybe you send an RPC to the current owner to take over control and then this owner can assign someone new as owner. This way, only one player owns the object any time.

    How would you do the part where the current owner assigns someone else as an owner? In Unity Networking, you have to have the new owner create a new NetworkViewID, then propagate it to everyone, after which everyone assigns that new id to the object. After this, everyone will consider the user who created the new ID to be the owner (as in, isMine will return true for the new owner only). However, it seems isMine will return true for the master client even after this has been done. I also tried checking photonView.owner == PhotonNetwork.player directly, but I seem to be having "null" as the other of the scene objects by default.

    Edit: I got this working. I hadn't realized owner == null means it's a scene object. So I just manually assigned all of the networked objects a new ID at the beginning, to make it clearer who owns what. Then when I want to switch owners, I have the new owner create a new ID and propagate it to the others via RPC.
  • Tobias
    Options
    I managed to do it in Unity Networking but what works there doesn't seem to work with Photon.

    Was that solution similar to what you do now in PUN (which you described)?