Search Unity

Question Matchmaker and Lobby

Discussion in 'Matchmaker' started by erdmannjacob0, Jan 4, 2023.

  1. erdmannjacob0

    erdmannjacob0

    Joined:
    Nov 23, 2021
    Posts:
    16
    Hi All,

    I have game that is using the lobby system as well as the Matchmaker to connect to Multiplay servers. As a solo player I can connect to the servers from within a lobby with no problem, but when I invite another player and queue up only the host gets placed into the lobby. This is because right now I am only running a connect client method to the host of the lobby. Does anyone have any suggestions how I should propagate to the rest of the lobby that there is a connection available to a server?

    Thanks for you input.
     
  2. FlorianAtUnity

    FlorianAtUnity

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    15
    I can see 3 ways of doing this:
    1. Once the lobby host is connected to the server, share the IP and PORT in the lobby data so that other players can join directly without any matchmaking.
    2. Wait for all the players in the lobby to be ready and have the lobby host make a matchmaking ticket for all the players in the lobby. Share the matchmaking ticket id in the lobby so that other players can pull for the ticket status. The lobby host then pulls the ticket status and shares the result with the lobby.
    3. You can add a matchmaking equality rule checking that all players in a match have the same lobby id. Each player makes a matchmaking request and passes the lobby id as a parameter.
     
    Last edited: Feb 1, 2023
    Coderious and erdmannjacob0 like this.
  3. erdmannjacob0

    erdmannjacob0

    Joined:
    Nov 23, 2021
    Posts:
    16
    Nice, Thank you for the input. I will try these out and see which one I like most.
     
    FlorianAtUnity likes this.
  4. erdmannjacob0

    erdmannjacob0

    Joined:
    Nov 23, 2021
    Posts:
    16
    Hey I have been working on solution #2 that @FlorianAtUnity had recommended, I place the ticket Id into the lobby data then attempt to call MatchmakerService.Instance.GetTicketAsync(TicketId) but it throws :
    [Matchmaker]: Forbidden (21403). Message: (403) HTTP/1.1 403 Forbidden
    UnityEngine.Logger:LogError (string,object)

    Should I be using a different method to be poling the ticket?
     
  5. FlorianAtUnity

    FlorianAtUnity

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    15
    Using the same method should be fine.
    When you created the matchmaking ticket, did you put all the players from the lobby inside the matchmaking ticket?

    In this example, players would be a list of all the players in the lobby (Note that the first parameter to the Player class is the player-id you get from the authentication).
     
  6. Emsey

    Emsey

    Joined:
    Mar 7, 2021
    Posts:
    2
    Did you solve that problem? I got the same issue and im also including all the players in the ticket. Only creator of the ticket is able to read the response, for others it throws Forbidden (21403).

    UnityIDs are correct and matches UnityID of each player.
     
  7. FlorianAtUnity

    FlorianAtUnity

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    15
    I double-checked check, and it looks like I was wrong :oops:. Only the ticket author can fetch the ticket status.
    You can still make it work by having the lobby host pulls the ticket status and then shares the result with the lobby.
     
    Coderious likes this.
  8. Coderious

    Coderious

    Joined:
    Mar 28, 2020
    Posts:
    26
    Is there a way to indicate to the players in the lobby that the lobby was updated (like an event?) or would they have to poll from time to time to check? In terms of workflow I was considering the following:
    1) player click ready and update their player data, start polling for connection data update from lobby data every let's say 1 second.
    2) once everyone is ready the host can start the game, create a matchmaker ticker, update the lobby with the connection data, start a 10sec timer to make sure everyone updates the connection data, start the game

    Does that make sense? subscribing to an event OnLobbyDataUpdate would be much simpler.