question

Radghiv avatar image
Radghiv asked

Matchmaking with multiple local players

Hello,

I've just got started with the new matchmaking API and everything seems to be working fine so far with 4-player queues with 1 player per client.

The problem is that our game needs to support multiple players playing locally from a single device and I've been unable to find information on how to tackle this case in the docs/forums.

Here's an example to clarify the use case:

  • Clients queue for our 4-player game mode supporting multiple local players
  • Client A queues with 3 local players (1 mouse/keyboard and 2 controllers)
  • Client B queues with 1 local player
  • Client A and Client B are matched together and the match starts as all the 4 slots available are have been filled

Here's another case we would like to cover with the same queue:

  • Clients queue for our 4-player game mode supporting multiple local players
  • Client A queues with 2 local players (1 mouse/keyboard and 1 controller)
  • Client B queues with 1 local player
  • Client C queues with 1 local player
  • Client A, Client B and Client C are matched together and the match starts as all the 4 slots available are have been filled

How can we handle these cases?

Thanks,

Radghiv

Matchmaking
10 |1200

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

Radghiv avatar image
Radghiv answered

Thanks for the tips!

I managed to solve my problem with the MatchTotalRule you suggested but, as we needed a single queue for all the combinations, here's what I did:

  • I created a matchmaking queue
  • I set the match size to [min = 2; max = 4]
  • I added a MatchTotalRule configured as follows:
    • Attribute source: User
    • Attribute path: PlayerCount
    • Min: 4
    • Max: 4
  • When creating a matchmaking ticket, I defined the Creator's attributes as follows
    • Attributes = new MatchmakingPlayerAttributes
      {
                          
      EscapedDataObject = JsonConvert.SerializeObject(new ClientData {
      PlayerCount = //Local player count value
      })
      },

This way, the matchmaker successfully creates 3v1, 2v1v1, 2v2 and 1v1v1v1 matches and makes sure that the total count of all the local players within a match is 4.

I hope this can be useful to others trying to implement similar queues :)

10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

The first problem is how do you manage these three players on the local clients? Do they have three PlayFab player accounts? Or they just share one account on one client?

If they have three accounts, the process of matchmaking will be the same as the one which has three clients. Matchmaking works based on the player accounts not IP addresses. So, you just need to let them log in individually, store and manage their corresponding session tickets and player Ids on the client locally. Then you can refer to the doc under this title Multiple user ticket matchmaking to learn more about how to add team members to one ticket. On [Edit Queue] page, please add two teams have different team sizes to handle the 3v1 battle mode. There is an example of Standard 4v4 style skill based which can be referred to. You can modify their team sizes to "Name": "Red", "MinTeamSize": 3, "MaxTeamSize": 3 and"Name": "Blue", "MinTeamSize": 1, "MaxTeamSize": 1. 2v1v1 is the similar thing.

If they share one account, please set a 1v1 queue which have a suitable rule then manage the multiple players on the clients locally directly. You can check the doc Configuring matchmaking queues and Matchmaking scenario and configuration examples to find the rule type most suits your game.

2 comments
10 |1200

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

Radghiv avatar image Radghiv commented ·

Thanks for the reply!

The local players all share the same account as doing otherwise wouldn't be practical, so the first solution is unfortunately not applicable.

As for the second one, how can a 1v1 queue cover the cases I described?

It's not just 3v1, we need 2v1v1 but also 1v1v1v1 to work within the same queue.

I'd already read all of the pages you linked form the docs but I can't find anything useful regarding this case.

Is there a way to specify how many slots a matchmaking ticket fills?

If not, could you please expand on the shared account solution you mentioned?

Thank you again,

Radghiv

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Radghiv commented ·

>> As for the second one, how can a 1v1 queue cover the cases I described?

A possible workaround is using MatchTotalRule. Match Total Rule ensures that the sum of a number attribute across all players in a match is within a configured range. You can let the 2 players clients and 1 player clients hold different attributes. The queue will match the teams based on the number of attributes.

>> It's not just 3v1, we need 2v1v1 but also 1v1v1v1 to work within the same queue.

Do you mean handling these three modes in one queue? In your case, 3v1 means 2 teams(1v1), 2v1v1 means 3 teams(1v1v1), 1v1v1v1 means 4 teams. One queue can only handle one type of matching mode, you need three queues to handle them. You can duplicate the queue settings in the [Matchmaking] page, set them separately. Then add condition judgment in the client code, choose the corresponding queue name based on the specific situations.

0 Likes 0 ·

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.