Match list comes back empty

KelsoKelso
edited August 2017 in Photon Thunder
Hey there-

So I'm in the process of migrating from UNet to Thunder. It seems like I've got match creation working but when I attempt to list available matches from another client the list always returns empty. I get no error messages and I see this in the console which seems to indicate that nothing bad happened, but logging the size of the list sent in the callback always prints 0.

MatchMakingClient ListMatches :https://mm.unet.unity3d.com/json/reply/ListMatchRequest
UnityEngine.Networking.Match.CustomMatchmaker:ListMatches(Int32, Int32, String, Boolean, Int32, Int32, DataResponseDelegate`1, Dictionary`2)
FracturedState.Game.Network.c__Iterator0:MoveNext() (at Assets/Code/Game/Network/FracNet.cs:104)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

I execute the ListMatch call in a coroutine because I also start the MatchMaker at the same time and I wait for it to fully initialize before sending the request. The actual call itself isn't too crazy and works in UNet
networkManager.matchMaker.ListMatches(0, 25, "", true, 0, 0, networkManager.ParseInternetGameList);
Creating the match is equally straightforward.
networkManager.matchMaker.CreateMatch(data, 8, true, "", "", "", 0, 0, (succcess, info, matchInfo) =>
            {
                if (succcess)
                {
                    networkManager.CurrentMatch = matchInfo;
                    NetworkServer.Listen(matchInfo, 9000);
                    InitClientMessages(networkManager.StartHost(matchInfo));
                }
                if (callback != null)
                    callback(succcess, info, matchInfo);
            });
where callback is an optional argument passed into the method that executes this.

Comments

  • KelsoKelso
    edited August 2017
    Actually it doesn't look like it's my code at all. The demo scene doesn't find matches either. So maybe I'm missing some configuration stuff?
  • Any update on this? If this is a bug do you guys have an estimated timeframe for a fix to be released? Even just something as broad as "will/won't be ready in two weeks" would be fine - I'm just trying to plan my next release.
  • Hello Kelso,

    Did you configure the App IP correctly ? Both clients are connected to the same Region ?

    When listing matches, they will not present on the ListMatch callback right after the creation. Internally, there is an update loop (called a fixed time interval) from the Photon Services that update this list; when you call the ListMatch from the Unet API, this list is just filtered based on the arguments, and returned.

    You can be notified when new stats from server arrive using the snippet below, it will hook an event handler with the internal Photon Client.
    using ExitGames.Client.Photon;
    using ExitGames.Client.Photon.LoadBalancing;
       
    // ----- CLASS DEFINITION -----
        
    private void Start()
    {
        PhotonMatchmaker matchMaker = GetComponent<PhotonMatchmaker>();
        matchMaker.client.OnEventAction += handlerEventAction;
    }
    
    public void handlerEventAction(EventData evt)
    {
        if (EventCode.AppStats == evt.Code)
        {
            // New room info from server
        }
    }
  • KelsoKelso
    edited August 2017
    Hey ramon,

    I tried this and got a runtime exception.
    ((PhotonMatchmaker)networkManager.matchMaker).client.OnEventAction += GotServerData;
    
    private void GotServerData(EventData evt)
    {
            if (evt.Code == EventCode.AppStats)
            {
                Debug.Log("got stuff");
            }
    }
    InvalidCastException: Specified cast is not valid.
  • Upon further inspection that error makes sense. It looks like a CustomMatchmaker component is being attached to my networkManager and not a PhotonMatchmaker.

    Thoughts?
  • KelsoKelso
    edited August 2017
    Ok so I managed to get this working. It looks like because you guys initialize the NetworkManager's PhotonClient in Start you can't initialize the NetworkManager, start the Matchmaker, and call ListMatches in the same frame. So the games list shows up now (had to modify the UI code to look for different stuff, but that's fine).

    The issue now seems to be that a player can join a room but none of the UNet hooks appear to fire. I have code in OnServerConnect that sends some data to the newly joined player and allows them to "officially" enter the pre-game lobby. I can see from the logs that the player connects (and disconnects when I close the game) but because these hooks don't fire the player doesn't know they're connected.

    Is this an issue with my setup or does Thunder bypass these calls? If so, what method can I use to hook into Thunder's events?
  • Any feedback on this? I hate to be pushy but if the OnServer* / OnClient* methods in NetworkManager aren't called in Thunder this would represent a pretty big refactor so I need to know if I should investigate this.
  • ramonmeloramonmelo
    edited September 2017
    Hello Kelso,

    All callback are called as normal, ours NetworkManager and Matchmaker just extends the Unet classes, so, there is no major differences. Inside the Demo files, you can find a 'CustomNetworkManager' class, and as a test, if you modify it to:
    
    #if PHOTON_THUNDER
    public class CustomNetworkManager : PhotonNetworkManager
    {
        public override void OnServerConnect(NetworkConnection conn) 
        {	
            Debug.LogWarning("OnServerConnect");
        }
    
        public override void OnClientConnect(NetworkConnection conn)
        {
            Debug.LogWarning("OnClientConnect");
        }
    }
    #endif
    
    This way, you will be able to receive the callbacks.
Sign In or Register to comment.