when I joined the room,there are two player in room

2017-10-13 02:01:51,809 [327] DEBUG Photon.LoadBalancing.MasterServer.GameServer.IncomingGameServerPeer - HandleUpdateGameState
2017-10-13 02:01:51,810 [327] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=2, oldPlayerCount=1, plyaerCount=2
2017-10-13 02:01:51,810 [327] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User joined on game server: gameId=82094, userId=f04e9bbd-774c-402c-806a-edc92f51c88b
2017-10-13 02:01:51,810 [327] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User not found in joining list: gameId=82094, userId=f04e9bbd-774c-402c-806a-edc92f51c88b
2017-10-13 02:01:51,811 [327] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=2, oldPlayerCount=2, plyaerCount=2
2017-10-13 02:01:51,811 [327] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - UpdateGameState: id=82094, peers=1, max=3, open=True, visible=False, peersJoining=1, inactive=0, ispersistent=False
2017-10-13 02:01:51,811 [330] DEBUG Photon.LoadBalancing.MasterServer.PlayerCache - Player state changed: pid=f04e9bbd-774c-402c-806a-edc92f51c88b, master=True, gid=82094
2017-10-13 02:01:58,978 [331] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - Checked join timeouts: before=1, after=1
2017-10-13 02:02:06,481 [335] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=1, oldPlayerCount=2, plyaerCount=1
2017-10-13 02:02:06,481 [335] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - Checked join timeouts: before=1, after=0
2017-10-13 02:02:06,481 [26] DEBUG Photon.LoadBalancing.MasterServer.PlayerCache - Player removed: pid=100716, master=False, gid=

Hi all , who met this kind of problem
when I joined the room,there are two players in room.
PlayerCount updated:newValue=2, oldPlayerCount=2, plyaerCount=2

Comments

  • and creategame very slow or lag
  • hi, @coco

    this just internal state of counter. as you may see at the end of your log you see PlayerCount == 1. it happens like this because there is moment when we count both one who is joining on master and one who is joining on GS. then we update state and one from master does not exist anymore.

    very slow and laggy it could be because of many reason. for instance DEBUG logging. you should check what is going on on your machine

    best,
    ilya
  • Ryan
    Ryan
    edited February 2018
    Hi @coco

    TL;DR:
    Make sure you set the PhotonNetwork.playerName = "YourUserId" before connecting to Master Server. Otherwise, GameServer treats it as two users joining the room, since the UserId is different. ( string.empty vs "YourUserID" ).

    We met the exact same issue lately,
    
    2018-02-13 11:35:01,286 [10] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=1, oldPlayerCount=0, plyaerCount=1
    2018-02-13 11:35:01,286 [10] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - Added peer: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=, joiningPeers=1
    2018-02-13 11:35:01,926 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=2, oldPlayerCount=1, plyaerCount=2
    2018-02-13 11:35:01,926 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User joined on game server: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=68207219
    2018-02-13 11:35:01,942 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User not found in joining list: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=68207219
    2018-02-13 11:35:01,942 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=2, oldPlayerCount=2, plyaerCount=2
    2018-02-13 11:35:16,317 [20] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=1, oldPlayerCount=2, plyaerCount=1
    
    And the actual cause is,

    1. We call `ConnectToMaster` with UserId = string.empty.
    2. We set the `PhotonNetwork.playerName` before creating the game room.
    3. Then GameServer thinks there are two users joining the room the UserIds are different.

    See below log,
    The first line is joining the lobby, userId=="".
    The second is creating room userId is different.
    
    2018-02-13 11:35:01,286 [10] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - Added peer: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=, joiningPeers=1
    
    2018-02-13 11:35:01,942 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User not found in joining list: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=68207219
    
    It works immediately after we changed to set PhotonNetwork.playerName before connecting.

    Hope this helps.

    Best,
    Ryan
  • Hi @coco

    TL;DR
    Make sure you set the PhotonNetwork.playerName = "YourUserId" before connecting to MasterServer, otherwise when creating room the GameServer will treat it as two users in the room since their UserId is Different. (string.empty vs "YourUserID")

    ---

    We met this exact issue lately,
    2018-02-13 11:35:01,286 [10] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=1, oldPlayerCount=0, plyaerCount=1
    2018-02-13 11:35:01,286 [10] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - Added peer: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=, joiningPeers=1
    2018-02-13 11:35:01,911 [14] DEBUG Photon.LoadBalancing.MasterServer.GameServer.IncomingGameServerPeer - HandleUpdateGameState
    2018-02-13 11:35:01,926 [14] INFO Photon.LoadBalancing.MasterServer.Lobby.GameState - [2/13/2018 11:35:01 AM] - Reinitialize
    2018-02-13 11:35:01,926 [14] INFO Photon.LoadBalancing.MasterServer.Lobby.GameState - [2/13/2018 11:35:01 AM] - HasBeenCreatedOnGameServer == false
    2018-02-13 11:35:01,926 [14] INFO Photon.LoadBalancing.MasterServer.Lobby.GameState - [2/13/2018 11:35:01 AM] - updateOperation.CheckUserIdOnJoin != null
    2018-02-13 11:35:01,926 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=2, oldPlayerCount=1, plyaerCount=2
    2018-02-13 11:35:01,926 [14] INFO Photon.LoadBalancing.MasterServer.Lobby.GameState - [2/13/2018 11:35:01 AM] - this.GameServerPlayerCount != updateOperation.ActorCount
    2018-02-13 11:35:01,926 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User joined on game server: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=68207219
    2018-02-13 11:35:01,942 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User not found in joining list: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=68207219
    2018-02-13 11:35:08,802 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - Checked join timeouts: before=1, after=1
    2018-02-13 11:35:16,317 [20] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=1, oldPlayerCount=2
    And the cause is,
    1. We connecting to MasterServer without setting PhotonNetwork.playerName.
    2. When creating the room we set PhotonNetwork.playerName = "MyUserID".
    3. Then GameServer think there are two users joining the newly created room.

    See below log for details,
    First userId is empty, the second userId is different.

    2018-02-13 11:35:01,286 [10] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - Added peer: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=, joiningPeers=1

    2018-02-13 11:35:01,926 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User joined on game server: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=68207219

    It works after we changed to set the PhotonNetwork.playerName before connecting to MasterServer.

    Hope this helps.

    Best,
    Ryan
  • Hi @coco

    TL;DR
    Make sure you set PhotonNetwork.playerName = "YourUserId" before connectiong to MasterServer, otherwise when creating Room the GameServer treats it as two different users, since the UserIds are different. (string.empty vs "YourUserId")

    ---

    We met the exact issue recently,

    2018-02-13 11:35:01,286 [10] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=1, oldPlayerCount=0, plyaerCount=1
    2018-02-13 11:35:01,286 [10] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - Added peer: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=, joiningPeers=1
    2018-02-13 11:35:01,911 [14] DEBUG Photon.LoadBalancing.MasterServer.GameServer.IncomingGameServerPeer - HandleUpdateGameState
    2018-02-13 11:35:01,926 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User joined on game server: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=68207219
    2018-02-13 11:35:01,942 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User not found in joining list: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=68207219
    2018-02-13 11:35:01,942 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=2, oldPlayerCount=2, plyaerCount=2
    2018-02-13 11:35:08,802 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - Checked join timeouts: before=1, after=1
    2018-02-13 11:35:16,317 [20] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameListBase - PlayerCount updated:newValue=1, oldPlayerCount=2, plyaerCount=1

    And the issue is,
    1. We connect to MasterServer without setting the UserId.
    2. When creating room we set PhotonNetwork.playerName = "MyUserId"
    3. Then in newly created room we have two user instead of one.

    See below logs for detail,
    1. When joining the lobby, userId is empty.
    2. After created room the userId is different.

    2018-02-13 11:35:01,286 [10] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - Added peer: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=, joiningPeers=1

    2018-02-13 11:35:01,942 [14] DEBUG Photon.LoadBalancing.MasterServer.Lobby.GameState - User not found in joining list: gameId=44d4e93f-8b35-4a4a-b04d-11c2b0335481, userId=68207219
    After we changed to set the PhotonNetwork.playerName = "MyUserId" before connecting to Master, it works fine.

    Hope this helps.

    Best,
    Ryan