question

Ivan Kozka avatar image
Ivan Kozka asked

The entities for the caller and the member do not match

Hello!

Why I get this error message? I Want to join second player to Matchmaking but I get this error every time

public async Task JoinOtherPlayers(string entityId, string entityType, string player2Id)
        {
            PlayFabResult<JoinMatchmakingTicketResult> result = await PlayFabMultiplayerAPI.JoinMatchmakingTicketAsync(
                 new JoinMatchmakingTicketRequest
                 {


                     TicketId = ticketId,
                     QueueName = "Queue-1",
                     Member = new MatchmakingPlayer
                     {
                         Entity = new EntityKey
                         {
                             Id = player2Id,
                             Type = "titile_player_account"
                         },
                         Attributes = new MatchmakingPlayerAttributes
                         {
                             DataObject = new
                             {
                                 Skill = 19.3
                             }
                         }
                     }
                 });
        
apisMatchmaking
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.

Ivan Kozka avatar image Ivan Kozka commented ·

No this doesn't work!

My Title Id: 7DCFA

Creater : 7A83B7F4C80410AA

Queue Name: PVP

Ticket ID: 130f96d4-1bd5-46d9-a459-dad53d61554e

Member To Match With: 1A6090C723BCC7D4

0 Likes 0 ·
Ivan Kozka avatar image Ivan Kozka Ivan Kozka commented ·

I need to have a server in order to attach a player, or I can do without a game server for the test?

0 Likes 0 ·
Rick Chen avatar image
Rick Chen answered

No server is needed to create/join a matchmaking ticket with other members. I have inspected your title, I cannot find any event related to the ticket id: 130f96d4-1bd5-46d9-a459-dad53d61554e. And I cannot find any “ticket_completed” event that has 2 or more ticket entities. What were the exact request parameters of your CreateMatchmakingTicket API call and JoinMatchmakingTicket API call and what is the flow of your test? Generally the JoinMatchmakingTicket test flow for your scenario would be:

      "Creator": { 
            "Attributes": { 
            "DataObject":  { 
            "Skill": 19.3, 
            }}, 
            "Entity": { 
            "Id": "7A83B7F4C80410AA", 
            "Type": "title_player_account" 
            }}, 
      
      "MembersToMatchWith":
            [ 
            { 
            "Id": "1A6090C723BCC7D4", 
            "Type": "title_player_account" 
            } 
            ], 
            "GiveUpAfterSeconds": 300, 
            "QueueName": "PVP"
        • Login as entity 1A6090C723BCC7D4
        • Call JoinMatchmakingTicket API with the following parameters (assuming the ticket id from 2nd step is 130f96d4-1bd5-46d9-a459-dad53d61554e):
        • "TicketId":
                "130f96d4-1bd5-46d9-a459-dad53d61554e", 
                "QueueName": " PVP", 
                "Member": { 
                "Entity": { 
                "Id": "1A6090C723BCC7D4", 
                "Type": "title_player_account" 
                }  }

          If this flow doesn’t work for you, please provide a fiddler trace of the issue for us to diagnose.

        1 comment
        10 |1200

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

        Ivan Kozka avatar image Ivan Kozka commented ·

        Nice, I tried don't using PlayFabMultiplayerAPI and my problem is solved.Thank you very much! I used HttpClient for request real address.

        0 Likes 0 ·
        Rick Chen avatar image
        Rick Chen answered

        The “Member” parameter in the JoinMatchmakingTicket request should be matching with one of the “MembersToMatchWith“ when calling CreateMatchmakingTicket API, otherwise it will return the error you mentioned in the title. You can use GetMatchmakingTicket API to check the “MembersToMatchWith“ attribute. Please check if your “Member” parameter (from line 10 to line 24 of your code snippet) is listed in the “MembersToMatchWith“ from the corresponding matchmaking ticket. If you still encounter this issue after that, you can provide your title id, the issue matchmaking ticket id, and your request parameters of the relevant API calls for us to troubleshoot.

        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.

        Rick Chen avatar image Rick Chen ♦ commented ·

        Also please make sure that the Id in line 14 of your code snippet is a valid entity id.

        0 Likes 0 ·
        Ivan Kozka avatar image Ivan Kozka commented ·

        My Title Id: 7DCFA

        Creater : 7A83B7F4C80410AA

        Queue Name: PVP

        Ticket ID: 130f96d4-1bd5-46d9-a459-dad53d61554e

        Member To Match With: 1A6090C723BCC7D4

        I need to have a server in order to attach a player to machmaking or I can do without a gameserver?

        0 Likes 0 ·
        Ivan Kozka avatar image
        Ivan Kozka answered

        look this is my Client have two player first player create matchmaking and second player joining.

         private static HttpClient client = new HttpClient();
        static async Task Main(string[] args)
                {
                    PlayFabApiSettings instanceSetting = new PlayFabApiSettings { TitleId = "7DCFA" };
                    var clientAPIInstance = new PlayFabClientInstanceAPI(instanceSetting);
                    await LoginIn(clientAPIInstance);
                }
                public static async Task LoginIn(PlayFabClientInstanceAPI instance)
                {
                    PlayFabResult<LoginResult> result = await instance.LoginWithPlayFabAsync(new LoginWithPlayFabRequest
                    {
                        Username = "player1",
                        Password = "*****"
                    });
                    string id = result.Result.EntityToken.Entity.Id;
                    string type = result.Result.EntityToken.Entity.Type;
                    var request = new HttpRequestMessage(HttpMethod.Get, $"http://localhost:64310/playfab/CreateNewMatchmaking?entityId={id}&entityType={type}");
                    HttpResponseMessage response = await client.SendAsync(request);
                    string ticketId = await response.Content.ReadAsStringAsync();
                    PlayFabResult<LoginResult> result2 = await instance.LoginWithPlayFabAsync(new LoginWithPlayFabRequest
                    {
                        Username = "player2",
                        Password = "****"
                    });
                    string id2 = result2.Result.EntityToken.Entity.Id;
                   
                    var request2 = new HttpRequestMessage(HttpMethod.Get, $"http://localhost:64310/playfab/JoinPlayer?entityId={id2}&entityType={type}&ticketId={ticketId}");
                    HttpResponseMessage response2 = await client.SendAsync(request2);
                    string ticketId2 = await response2.Content.ReadAsStringAsync();
                }
        

        and this server side my web api which connect at PlayFab API

        Create Matchmaking

         public async Task<PlayFabResult<CreateMatchmakingTicketResult>> Create(string entityId, string entityType)
                {
                    return await PlayFabMultiplayerAPI.CreateMatchmakingTicketAsync(new CreateMatchmakingTicketRequest
                    {
                        Creator = new MatchmakingPlayer
                        {
                            Entity = new EntityKey
                            {
                                Id = entityId, //7A83B7F4C80410AA
                                Type = entityType, //title_palyer_account
                            },
        
        
                            Attributes = new MatchmakingPlayerAttributes
                            {
                                DataObject = new
                                {
                                    Skill = 24
                                }
                            },
                        },
                        MembersToMatchWith = new List<EntityKey>
                        {
                            new EntityKey { Id = "1A6090C723BCC7D4", Type = entityType },                                           
                        },
                        GiveUpAfterSeconds = 120,
                        QueueName = "PVP",
                    });
                }
        

        And Join

         public async Task<JoinMatchmakingTicketResult> JoinOtherPlayers(string entityId, string entityType, string ticketId)
                {
                    PlayFabResult<JoinMatchmakingTicketResult> result = await PlayFabMultiplayerAPI.JoinMatchmakingTicketAsync(
                         new JoinMatchmakingTicketRequest
                         {
                             TicketId = ticketId,
                             QueueName = "PVP",
                             Member = new MatchmakingPlayer
                             {
                                 Entity = new EntityKey
                                 {
                                     Id = entityId, //1A6090C723BCC7D4
                                     Type = entityType //title_player_account
                                 },
                                 Attributes = new MatchmakingPlayerAttributes
                                 {
                                     DataObject = new
                                     {
                                         Skill = 24
                                     }
                                 }
                             }
                         });
                    return result.Result;
                }
        
        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.