question

Ozan Yilmaz avatar image
Ozan Yilmaz asked

How to make these 2 rules for matchmaking?

Hello everyone,

I'm a bit confused about the rules section of the matchmaking system. I want to add 2 rules to my matchmaking queue.

1) If a player's statistics is lower than 5000 let's say, they can't use the matchmaking system. (Basically a level limit). I'm not sure how I can check the level on PlayFab. I can make an if statement on the client, but the client still can bypass it.

2) I want to match the players depending on their locations/regions in order to reduce the latency between the players. If no local player's found, then the player can match with the other players who are in the other regions. I think, the image down below is what I should do in order to achieve this, but there's still some sections I'm not sure about what I should enter.

- What is the attribute path? What is the purpose of this?

- I entered 150 for the latency. I assume, this means 150ms, and I think, it's enough for a player to search the local players first.

- I entered 30 for the "until optional". What I want to do is that after 30 seconds of wait, the player should be able to match with the other players who are in the other regions.

01.jpg (45.7 KiB)
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

·
Citrus Yan avatar image
Citrus Yan answered

First, the Matchmaking Rule cannot be used to prevent the player from using the system based on their statistics (level), instead, you should prevent them from creating the matchmaking ticket in the first place. Since you think the client can still bypass the “if statement”, therefore you can consider using server-side logic such as CloudScript to first verify the player level, and if it passes, create the ticket using CreateServerMatchmakingTicket and return necessary info back to the clients accordingly.

The attribute path means the path to a player’s attribute, depending on the attribute source. There are two attribute sources: 1) the create ticket request (for rules configured with the attribute type “User” ) ; 2) the player’s entity (for rules with attribute type “Player Entity” ). Please go through this doc to learn more about the attribute path and how to use them: Specifying attributes with your tickets - PlayFab | Microsoft Docs

Regarding the region selection rule, you got most of the parts correct. The attribute path you should put in for it is simply “Latencies”:

And, please note that region selection rule requires a more complex attribute format used in the CreateMatchmakingTicket request, here is a sample:

POST https://{ {TitleId}}.playfabapi.com/Match/CreateMatchmakingTicket

POST https://{
                {TitleId}}.playfabapi.com/Match/CreateMatchmakingTicket
{
    "Creator": {
        "Entity": {
            "Id": "A8140AB9109712B",
            "Type": "title_player_account",
            "TypeString": "title_player_account"
        },
        "Attributes": {
            "DataObject": {
                "mu": 16.0,
                "sigma": 1.8,
                "Latencies": [
                    {
                        "region": "EastUs",
                        "latency": 150
                    },
                    {
                        "region": "WestUs",
                        "latency": 400
                    }
                ]
            }
        }
    },
    "MembersToMatchWith": [],
    "GiveUpAfterSeconds": 2,
    "QueueName": "ServerEnabledQueue"
}


You can find more details in this section: https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/matchmaking/ticket-attributes#special-formats


attribute-path.png (7.4 KiB)
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.

Ozan Yilmaz avatar image Ozan Yilmaz commented ·

@Citrus Yan Thank you for the answer. I have one more question. If I start the matchmaking on the server (by using CreateServerMatchmakingTicket), I can't use the latency rule, can I? Because the request will be done on the server, which means the latency value will be low every time?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Ozan Yilmaz commented ·

In that case the client should also provide latency info to the server.

1 Like 1 ·

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.