question

duartedd avatar image
duartedd asked

matchmaker is there a way to have a value return to clients on being matched?

Hi I am looking for a way to say - 'this entity id is going to start the turn' or something along those lines - is there a way to have that done - like perhaps result.CustomData. in the ongetmatchresult ? like run a cloudscript on a matched pair before the ongetmatch gets returned to the client so that the customdata can be filled in

thanks!

Daniel

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

Seth Du avatar image Seth Du ♦ commented ·

May I ask which API are you using? To be clear, any API contains "matchmaker" in the name belong to legacy matchmaker system, which is only available for customers that have implemented legacy custom multiplayer server system.

The new matchmaking system is preferred as it is a replacement solution for all developers. Please refer to Matchmaking quickstart - PlayFab | Microsoft Docs.

In terms of your question, because during the matching progress, the client will need poll the ticket state via GetMatchmakingTicket API every few seconds, and you can get what you required in the Status property of the callback result.

0 Likes 0 ·
duartedd avatar image duartedd Seth Du ♦ commented ·

Hi SethDu thanks for the reply -

PlayFabMultiplayerAPI is the api call on the client i am using for the matchmaking (the new one)

GetMatchmakingTicketResult would be the one you are talking about for the result status - put it in the customtags there like -


Dictionary<string, string> customTag = new Dictionary<string, string>(); customTag.Add("PlayerStartFirst", PlayerEntity.Id);

then on the onget match return that to both members ?

I can only perform the random code on 1 of the players though and the problem with that is what if the other client that doesnt perform the random code calls the ongetmatch before the person who performed the randomizer code put in the request.

basically the flow ->
client1 - checks to see if it should make be the randomizer - makes the randomizer - assigns custom tag with who goes first - pull the getmatch api with the customtag

client2 - checks to see if it should be the randomizer - it doesnt - called getmatch api without customtag

on get match result - will both clients have the customtag in this scenario?

0 Likes 0 ·
duartedd avatar image duartedd duartedd commented ·

tried custom tags and then tried to call customdata from the ongetmatch result and it didnt exist

GetMatchmakingTicketResult

doesnt show all members - it shows the members After the ongetmatch result

so i cant check who the members are until the ongetmatch result

PlayFabMultiplayerAPI.GetMatch( new GetMatchRequest { MatchId = result.MatchId, CustomTags = customTag, QueueName = result.QueueName,

private void OnGetMatch(GetMatchResult result) {

thennnn

if (result.CustomData != null) {

Debug.Log("raafaFA"); Debug.Log( result.CustomData.ToString());

}

doesnt even show raafaFA so its null the custom tag is null because it never gets set from the previous method to add it to the customtag in the request - this is because the code tries to add the other member of the match but the member doesnt exist in the getmatchmakingticketresult.

so that wont work for what i need cause i dont know who will flip the coin unless i get both members

once i get both members then i can decide who will toss the dice

and whoever does the toss the dice i can say "Player Entity ID goes first"\

0 Likes 0 ·
Show more comments

1 Answer

·
duartedd avatar image
duartedd answered

@SethDu

The purpose of custom tags is not for store and return in the callback, mainly it was added in order to give developers another tool for tracking their API calls, while it is not involved in client gameplay.

Are you trying to determine the player that moves first when the game is matched?

yup thats right - trying to have one side say - this is the starting player to both clients

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.

Seth Du avatar image Seth Du ♦ commented ·

Do you have hosted multiplayer server? Is it a real-time game or a near-time multiplayer game?

If you want to determine the first move without multiplayer server, you may need a workaround. When a matchmaking ticket is matched, there will be a PlayStream Event "match_found" generated in the title, which can be used as a trigger of Rules. This event also contains a list of matched tickets IDs and player information, which is contained in "context" argument of Cloud Script/Azure Function. You may get any necessary information from it and determine the first move as you want.

0 Likes 0 ·
duartedd avatar image duartedd Seth Du ♦ commented ·

ya I worked around it another way:

I worked around the issue though by using the matchmaker attributes - i basically just said

when I look for a match - put in another attribute MYPLAYFABID

now when the ongetmatchresult i have both members of the match with that attribute listed in the result

and then i can siphon out which is not my pfid easy - since its 2 player its automatically the other one.


thanks!

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.