Search Unity

Third Party How to count players in Photon Networking?

Discussion in 'Multiplayer' started by shivam3d, Jul 17, 2017.

  1. shivam3d

    shivam3d

    Joined:
    Nov 13, 2012
    Posts:
    10
    The users have the choice to become either a monster or a human being. It's a one-on-one combat game. So, 1 room can only have 1 monster and 1 human being. When a user opens the game, I want him to see the number of available monsters. So, if a total of 10 users are online, out of which 4 are human beings and 6 are monsters. 3 human beings and 3 monsters are in 3 rooms (1 human + 1 monster in 1 room). So, 4 users are left (1 human and 3 monsters). I can calculate the number of users available (X = total users - number of rooms * 2 ) But I need to know the number of available monsters, not users.

    However, I can't think of how I can get the 'number of monsters available' - monsters that are in the lobby waiting (excluding the ones who are already in rooms). This number also needs to exclude human beings (both in the lobby and in rooms). I only need to know the number of available monsters.

    Under the hood, monsters and human beings are just regarded as 'users'. Therefore, I'm having trouble singling out the number of monsters.

    How do I count the number of available monsters?