question

mattdavidson2017 avatar image
mattdavidson2017 asked

Using Playfab Matchmaking, how can I place users on a team based on a player attribute?

In the game I am developing, the user chooses a team when they first sign in and they belong on that team for the rest of the season. This value is stored in Playfab. How can I match players who chose the same team with each other and make sure no one from different teams ever ends up on the same team in a match?

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.

Citrus Yan avatar image
Citrus Yan answered

Hi, If I got you right, you want all the players in a match are from the same team, if this is the case, you can use the Rule “String Equality” which ensures that a string attribute is the same across all tickets in a match( for your situation, this string attribute is the team name of the player). If I got you wrong, could you provide us more details about your requirement so we can offer an eligible suggestion, Thanks.

By the way, here is the doc which talks about Rule configuration you might be interested: https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/matchmaking/config-queues

7 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.

mattdavidson2017 avatar image mattdavidson2017 commented ·

Thanks for the reply but that's not quite what I meant. There should be two different teams per match, but the team the user is on is determined when they first launch the game.

For example, User A launches the game for the first time and chooses the Red team. User B launches the game for the first time and chooses the Blue team. This is the team they will remain on for a long period of time so each match they join, User A will be on the Red team and User B will be on the Blue team.

I want to be able to use Playfab matchmaking to only match Red teammates together on a team, and do the same for Blue teammates, and they will play each other. Red will never play another Red team and Blue will never play another Blue team.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan mattdavidson2017 commented ·

Hi, as far as I am aware, PlayFab MatchMaking does not natively support your requirements. However, after a discussion with our team, we have come up with a solution that may suit your needs. Here is the deal, You create three matchmaking queue, the first queue matches all the players from team A(Use Rule “String Equality” to make sure they all from team A, you can specify match size and other stuff in the configuration). The second queue matches all the players from team B the same as the first queue did. After these two queues get a match, for each match made in these two queues, create a ticket that contains all the players from the match. In the third queue, define 2 teams in the team configuration, use Rule “Team difference” to make sure team A matches team B. So this is the general idea we are having, we will try to test it and inform you about new progress. You can have a try yourself, any issues let us know:)

By the way, here is the doc about multiple user ticket matchmaking you may find helpful :https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/matchmaking/quickstart#multiple-user-ticket-matchmaking

0 Likes 0 ·
mattdavidson2017 avatar image mattdavidson2017 Citrus Yan commented ·

Ok thanks I'll give it a shot!

0 Likes 0 ·
Show more comments
Citrus Yan avatar image Citrus Yan mattdavidson2017 commented ·

Hi Matt, I think the Host/Searcher or Role Based Requirements in this doc will meet your requirements. Let's say Team A contains an attribute called "IsTeamA", and its value is 1, Team B's value is 0. Define a MatchTotalRule, set the Min and Max to be 1. In this way, only Team A and Team B can be matched together. You could have a try, any issues let us know:)

0 Likes 0 ·
mattdavidson2017 avatar image mattdavidson2017 Citrus Yan commented ·

How do I set a team attribute? I'm sorry if this is a dumb question, but I'm using C# and the API only gives options for MatchmakingPlayerAttributes. I suppose I could have an IsTeamA = 1 attribute on a single player on Team A and it should work because all of the players on a team are on the same ticket at that point, but I feel like there is a more polished solution that I am missing.

0 Likes 0 ·
Show more comments
rahul-1 avatar image
rahul-1 answered

Hi,

I am also facing similar issues, how do I mention "Team" while creating matchmaking ticket
so that it can be considered in team configuration rule of the queue

is it similar to this

Attributes = new MatchmakingPlayerAttributes
            {
                DataObject = new
                {
                    Team = "Agents"
                },
            },
10 |1200

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

rima avatar image
rima answered

Hi

Have there been any changes or solution to this?

We are also in the need of this to be able to allow players to choose the preferred team.

Currently we use something similar to this in our current matchmaking service.

"teams": [{        
"name": "players",
"maxPlayers": 5,
"minPlayers": 5
}, {
"name": "monster",
"maxPlayers": 1,
"minPlayers": 1
}],

"rules": [{
"name": "MonsterSelection",
"type": "comparison",
"measurements": ["teams[monster].players.attributes[wantsToBeMonster]"],
"referenceValue": 1,
"operation": "="
},{
"name": "PlayerSelection",
"type": "comparison",
"measurements": ["teams[players].players.attributes[wantsToBeMonster]"],
"referenceValue": 0, "operation": "="
}]
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.