question

dsousa avatar image
dsousa asked

Connecting Lobby Players to Server

Hi,

I am using the PlayFabMultiplayerSDK for Unity to allow players to create searchable lobbies and have other player be able to find and join them. However, I am unsure as to how you are supposed to connect the lobby players to a server for them to play a match on.

If I understand correctly, this should be done by having the lobby owner call CreateMatchmakingTicket when all players are ready to start a match, then having all the other players in the lobby call JoinMatchmakingTicketFromId, which should connect all the lobby players to a server. Is this the correct approach?

If so, how can the ticketId of the owner's matchmaking ticket be shared with the other players in the lobby so they can join it? The documentation (https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/lobby/lobby-matchmaking-sdks/multiplayer-unity-plugin-quickstart) also mentions that the localUsers argument passed into CreateMatchmakingTicket should include a userAttributesJson that is obtained from another lobby player. What is the purpose of the userAttributesJson, and again, how can this information be shared between lobby players?

Thank you,

Daniel

multiplayerMatchmaking
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

If I understand correctly, this should be done by having the lobby owner call CreateMatchmakingTicket when all players are ready to start a match, then having all the other players in the lobby call JoinMatchmakingTicketFromId, which should connect all the lobby players to a server. Is this the correct approach? If so, how can the ticketId of the owner's matchmaking ticket be shared with the other players in the lobby so they can join it?

Yes, the Matchmaking Ticket should be created by the Lobby owner. Once the ticket is created, the Lobby owner can store the Ticket Id in the Lobby Data so that other players in the Lobby can get it and join the ticket. But joining a ticket doesn’t mean they are connected to a server. The ticket needs to match against other tickets, and once it is matched, players can get the match details which contains the server info(if you enabled the server allocation for the queue), then they can connect to the server.

The documentation also mentions that the localUsers argument passed into CreateMatchmakingTicket should include a userAttributesJson that is obtained from another lobby player. What is the purpose of the userAttributesJson, and again, how can this information be shared between lobby players?

The userAttributesJson is used for Matchmaking system, as the Queue’s Rules determine which tickets are matched, based on the attributes specified by players. But this part “string remoteUserAttributesJson = ...; // JSON string with another PlayFab user's attributes for matchmaking” of the docs is not correct, the ticket creator should only specify his own attributes, and other members of the ticket should specify their attributes when they join the ticket.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.