2

In Photon what is the difference between

  • CreatorActorNr
  • OwnerActorNr
  • ControllerActorNr

I only found them in the API of PhotonView but it doesn't explain the difference between / purpose of the entities in question.

derHugo
  • 83,094
  • 9
  • 75
  • 115

1 Answers1

2

This is better explained in Photon - Ownership & Control -> Definitions

  • PhotonView Creator
    The creator of a PhotonView or the 'instantiator' (or 'spawner'), is the actor that calls PhotonNetwork.Instantiate. This actor number is be part of the PhotonView.ViewID and is determined using ViewID / PhotonNetwork.MAXVIEWIDS. The ViewID of a PhotonView does not change, so the creator ID also does not change. In case of 'networked room objects', there is no creator (null/0) so the networked object is not created by an actor and is instead associated with the room.

  • PhotonView Owner
    The owner of the PhotonView indicates the default Controller of the PhotonView.

    In case of 'networked room objects', there is no owner (null) as the object is owned by the room and not by an actor. In case there is an owner, if the latter is active it is also the controller. Otherwise, the master client has control.

  • PhotonView Controller
    The actor in control of the PhotonView (has state authority).

    The owner is always the controller unless:

    • the owner is null; then the master client is the controller.
    • the owner is disconnected from the room; If the PlayerTTL is greater than 0, it is possible for an actor to leave the room temporarily and rejoin it later. While the owner is soft-disconnected, the master client becomes controller and when the owner rejoins, the owner resumes control.

    photonView.IsMine indicates if the PhotonNetwork.LocalPlayer is the current Controller for this photonView.

For Creator vs Owner also see

Ownership can be transferred to another player with PhotonView.TransferOwnership or any player can request ownership by calling the PhotonView's RequestOwnership method. The current owner has to implement IPunCallbacks.OnOwnershipRequest to react to the ownership request.

so in my own words I'd understand it this way:

  • Creator is the one who created the object (and owns it by default). This ID never changes.
  • Owner is the one who currently owns the object, either same as creator or the ownership was transferred somehow. For scene objects this isn't set at all.

And then Controller is getting a little bit tricky:

  • This either simply equals Owner if this object

    • Has an Owner (=> is not a scene object)
    • The owner is connected and active
  • Specific for scene objects (so objects that haven't been spawned by anyone but existed right from the beginning with a photonview in your scene) do not have an owner.

    This means that for nobody isMine will be true except for the current MasterClient even though he is not the real Owner of this object, he is however per documentation/definition the current Controller of the object. So without changing the Owner the Controller can still change over time if the MasterClient changes.

  • The last case are objects that are not scene objects (so someone spawned and originally owned them), but the current Owner is (in that moment) not connected and active anymore so the MasterClient automatically claims control over it until the owner returns .. or forever if this doesn't happen.

So long story short: For most cases the ControllerID is the most meaningful value.

I hope that makes somewhat sense, at least this is how I would interpret the documentation.

derHugo
  • 83,094
  • 9
  • 75
  • 115