How can I distinguish between a call to PollHostList that returns no servers because the call to RequestHostList specified a game type name that doesn’t exist, and one that returns no servers because it hasn’t been populated yet?
e.g.
function Awake() {
// Make sure list is empty and request a new list
MasterServer.ClearHostList();
MasterServer.RequestHostList("DoesThisGameExist");
}
function Update() {
if (MasterServer.PollHostList().length == 0)
{
//does this mean no games exist? or do I still have wait a bit longer?
}
}
I beleive you get an OnFailedToConnectToMasterServer event thrown if the RequestHostList method fails. I can’t double check this now, but you can test yourself by building the master server conntester and just shutting it down manually to see if the error occurs.
That’s true, but it’s only throw when the connection really fails. We still have no way of identifying when the server responded with an empty list as you never know how long it takes, even though I’m sure you can assume it doesn’t longer than 3 seconds, otherwise it would probably send a fail.
This is important for features like quickmatch/play-now, where you use the masterserver to decide join an excisting game or host.
Meh, it just requires my users to wait 3 seconds longer when there are no matches, on witch my “play now” feature will start hosting a game.