Create room and keep searching for rooms

Options
We're implementing skill-based matchmaking using a PUN SQL Lobby. Quite similar to what https://doc.photonengine.com/en-us/realtime/current/lobby-and-matchmaking/matchmaking-and-lobby suggests, we're operating on an increasing skill window. The algorithm is supposed to work like this:
  1. maxDelta = 50
  2. join SQLLobby
  3. PhotonNetwork.GetCustomRoomList(lobby, $"rank BETWEEN {current-maxDelta} AND {current+maxDelta}");
  4. OnRoomListUpdate:
  5. If roomList.Count > 0: select best candidate and join it, done!
  6. else:
    1. create a room ourselves
    2. wait 3 seconds
    3. increase maxDelta by 50
    4. call GetCustomRoomList again until we either find a room, or until someone joins our room.
This requires us to be able to both open (and, preferrably, join) a room, but still keep querying for other rooms in parallel. It seems that PUN isn't designed to deal with this, however. We get:
Operation GetGameList (217) not allowed on current server (GameServer)

If we try to work around this by first completing the whole search range, and only then creating a room, this would greatly worsen the user experience, so we want to avoid it.

While the documentation's last paragraph kind of states that photon matchmaking is not the right choice for "popular games", we decided to use it at the beginning at least to benefit from the tight integration with PUN multiplayer, to save time and get started quickly.

Is there any way to circumvent this restriction? Maybe instantiating 2 LoadBalancingClients or something of the sort?

Comments

  • squirrel
    Options

    Any luck figuring this out?

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options

    Hi @Robin,

    Thank you for choosing Photon and sorry for the 2 years delay (I hope you got what you needed already a long time ago, you could always reach out via email if you don't get help here or on discord within 2 business days).

    Hi @squirrel,

    Thank you for choosing Photon and for resurrecting this!

    My answer:

    First of all, I need to rectify a misunderstanding:

    While the documentation's last paragraph kind of states that photon matchmaking is not the right choice for "popular games"

    While we probably did update the matchmaking guide documentation page I don't think we change this part a lot or we rephrased the sentence that uses the exact words "popular games":

    That said, using a room as 'lobby' or a 'matchmaking place', before the actual gameplay starts, is in most cases not a good idea for popular games.

    What we want to explain is that it's not recommended to use a room as a lobby for matchmaking.

    Let's now move to the actual question:

    When a Photon client creates a room, it automatically join it.

    So it does not make sense to keep searching for rooms when you are already in one that you just entered after creating it because there was no other match found for your search.

    So we think it does not make sense to keep searching for rooms after creating one.

    Operation GetGameList (217) not allowed on current server (GameServer)

    This error means that the Photon client is trying to call GetGameList on the wrong server (GameServer instead of MasterServer which is the lobby/matchmaking server) because the client is already in the process of entering a room on the GameServer.

    Please not that since the original post we have added JoinRandomOrCreateRoom.

    The documentation also exposes chained filters (up to 3) feature.

    So I think using a combination of all these could shorten the matchmaking process duration.

    So you could go ahead and call JoinRandomOrCreateRoom instead of GetCustomRoomList * k (0 < k < 4) + CreateRoom.

    And PUN 2 adds more checks when trying to call methods on the wrong server or in an unexpected client state.