GameListUpdate event issue

Options
Hi there,

I'm populating a list of games each time the GameListUpdate event is received. Whenever a game is created each client in the lobby receives the GameListUpdate and populates the list which is great.The problem is that two events are received when a game is left, one the moment the game is left and one when the game is actually removed from the RoomInfoList, so a client leaves a game, all clients recieve an event and rebuild the list but its the same, then 5/6 seconds later they receive another event and rebuild again and the list has been properly updated with the game removed.

One of my first ideas was that the games "PlayerTtl" property was the reason for the additional event/delay, but when I set that to 0 there is no change to either.

It's not a massive problem but I would at least like to know why this is happening, and how I can control it. If you can give any insight it would be massively appreciated.

I suppose this is not really Photon Turnbased specific, even though I am using it, if there's a forum better suited please let me know and I'll move it there .

Josh

Comments

  • v1r7u3
    Options
    OK it was the "EmptyRoomTTL" property that was causing this, it seems to me (expand if you can) that GameListUpdate is raised once immediately when you leave the game, and then again when the empty room timeout occurs, I'm not sure exactly how this occurs but I'm pretty sure its not intended. For now I've just set the property to 0 but would actually like the option to have the timeout without the multiple events. If there is a way to distinguish between these two events that would work fine.

    If you can add any insight, please do.
  • Tobias
    Options
    I have to ask what you do here. How do you know when a room was left and how do you get a room list update for that??

    If you talk about EventCode.GameList and EventCode.GameListUpdate, then you get those from Photon in a fixed interval - provided some room info was changed in that interval. That interval is fixed and you only get those updates while on the master server in some lobby.

    The EmptyRoomTTL might affect the time until a room gets de-listed. It affects how long a room stays in-memory (to be re-joined by some existing player without loading the state from the WebHook).
    As said: I'm not entirely sure this affects the time until the room gets de-listed.

    You can set Room.IsVisible to false to de-list rooms. Unless all players abandon the game, they can return, no matter if it's in the lobby listing.
  • v1r7u3
    Options
    Ok sorry I think I was pretty unclear I'll try to better explain. I understand why this happens now that you mentioned "provided some room info was changed in that interval" so I will delete the post soon as it was just me being stupid and it isn't useful!

    So I have some gui list containing each game in the lobby, but rather than populate it repeatedly I would prefer to do so when the list is updated. All that is working fine but I noticed that when a room has "EmptyRoomTTL" > ~1000ms the OnEvent(EventCode.GameListUpdate) gets called twice.
    public override void OnEvent(EventData photonEvent)
    	{
    		base.OnEvent(photonEvent);
    		
    		switch (photonEvent.Code)
    		{
                    case EventCode.GameListUpdate: 
    			Debug.Log("GameListUpdate Event");
    			NetworkManager.instance.gameListUpdated();
    			 break;
                     }
             }
    

    This then eventually calls a function that builds the gui list with NGUI.
    public void BuildList()
    	{
                    Debug.Log("Building List");
    
    		foreach (Transform child in grid.GetChildList()) {
    			NGUITools.Destroy(child.gameObject);
    		}
    		
    		foreach (RoomInfo roomInfo in NetworkManager.instance.gameClient.RoomInfoList.Values) {
     			GameObject newEntry = NGUITools.AddChild (grid.gameObject, matchEntryPrefab);
    			newEntry.GetComponentInChildren<UILabel> ().text = roomInfo.Name;
    		}
    		
    		grid.Reposition();
    	}
    

    Now when a game is removed from RoomInfoList, the clients gui lists should be updated and they are.

    But if the EmptyRoomTTL is high enough, two EventCode.GameListUpdate are recieved and the list is rebuilt twice, once when the player leaves and once when the room is removed.

    I understand now that it is because although the game was not removed, some RoomInfo was changed (the player left the room) and the because of the "EmptyRoomTTL" spanning more than one of these fixed intervals you mentioned, two events are sent, one for player leaving and one for room being removed.

    Sorry for wasting you're time, and thanks for replying anyway.
  • Tobias
    Options
    v1r7u3: You don't have to be sorry at all! If I gave you that feeling, I have to excuse myself.
    Your question is a valid one. To be honest, it's even revealing a (known) bug on our side.
    The lobby is currently listing Turnbased rooms only with the active players in it and totally ignores inactive players of a room. This is why your player count goes down, even if you just leave the room (with the option to come back later on).
    We are working on an update for the server's lobby which will send the player count that includes inactive players.

    We will also add a lobby that won't list rooms when they are full. This can be optionally used to improve the room list per client (you only see rooms you could also join).