Difference between photonView.viewID and PhotonNetwork.player.ID

edited July 2017 in Any Topic & Chat
I have received the list of players through PhotonPlayer.playerList. Now I need to send the message to the certain player. How I am able to do it? I assumed that it is possible with such method: photonView.Find ( PhotonNetwork.playerList[ index ].ID ).

But then I have read that photonView.viewId doesn't correspond to PhotonNetwork.player.ID.

Explain me, please, purpose of photonView.viewId and PhotonNetwork.player.ID: in what their purposes, and in what a differences?

Whether there is between photonView.viewId and PhotonNetwork.player.ID a strong interrelation?

Best regards!


  • JohnTubeJohnTube mod
    edited August 2019
    Hi @SN_007,

    Thank you for choosing Photon!

    The PhotonView ID is unique per networked object.
    The PhotonView could be attached to an actor networked object or a scene networked object.
    The player ID or actor number is unique per actor inside the room.
  • Thanks! This is good information for me!
  • @JohnTube

    I tried following your link above but getting a "page does not exist" message.
  • JohnTubeJohnTube mod
    edited July 2018
    Hi @krx,

    Here is the snippet from the last link:

    For performance reasons, the PhotonNetwork API supports up to 1000
    PhotonViews per player and a maximum of 2,147,483 players (note that
    this is WAY higher than your hardware can support!). You can easily
    allow for more PhotonViews per player, at the cost of maximum players.
    This works as follows:

    PhotonViews send out a viewID for every network message. This viewID is
    an integer, composed of the player ID and the player's view ID.
    The maximum size of an int is 2,147,483,647, divided by our
    MAX_VIEW_IDS(1000) that allows for over 2 million players, each having
    1000 view IDs. As you can see, you can easily increase the player count
    by reducing the MAX_VIEW_IDS. The other way around, you can give all
    players more VIEW_IDS at the cost of less maximum players.

    It is important to note that most games will never need more than a few
    view ID's per player (one or two for the character...and that's usually
    it). If you need much more then you might be doing something wrong! It
    is extremely inefficient to assign a PhotonView and ID for every bullet
    that your weapon fires, instead keep track of your fire bullets via the
    player or weapon's PhotonView.

    There is room for improving your bandwidth performance by reducing the
    int to a short( -32,768, 32,768). By setting MAX_VIEW_IDS to 32 you
    can then still support 1023 players Search for "//LIMITS
    NETWORKVIEWS&PLAYERS" for all occurrences of the int viewID.
    Furthermore, currently the API is not using uint/ushort but only the
    positive range of the numbers. This is done for simplicity and the usage
    of viewIDs is not a crucial performance issue in most situations.
Sign In or Register to comment.