question

jahelmer4 avatar image
jahelmer4 asked

How to add latency to matchmaking ticket in c++?

I understand that this is a sample for the Json I believe? :` { "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" }`

I'm just not sure how to actually implement this in c++. Thanks in advance.

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

Neils Shi avatar image Neils Shi commented ·

I will do some research.

1 Like 1 ·

1 Answer

·
jahelmer4 avatar image
jahelmer4 answered

If anyone else is wondering this here is how I did it:

 TSharedPtr<FJsonObject> LatencyItem = MakeShared<FJsonObject>();
         LatencyItem->SetStringField(TEXT("region"), TEXT("EastUS"));
         LatencyItem->SetStringField(TEXT("latency"), TEXT("150"));
    
         TArray<TSharedPtr<FJsonValue> > LatencyItemArray;
         TSharedRef<FJsonValueObject> LatencyItemValue = MakeShareable(new FJsonValueObject(LatencyItem));
         LatencyItemArray.Add(LatencyItemValue);
    
         TSharedPtr<FJsonObject> LatenciesItem = MakeShareable(new FJsonObject);
         LatenciesItem->SetArrayField(TEXT("Latencies"), LatencyItemArray);
    
         TSharedPtr<FJsonObject> AttributesItem = MakeShareable(new FJsonObject);
         AttributesItem->SetObjectField(TEXT("DataObject"), LatenciesItem);
    
         TSharedPtr<FJsonObject> EntityItem = MakeShareable(new FJsonObject);
         EntityItem->SetStringField(TEXT("Id"), PLoginResult.EntityToken.Get()->Entity.Get()->Id);
         EntityItem->SetStringField(TEXT("Type"), PLoginResult.EntityToken.Get()->Entity.Get()->Type);
    
         TSharedPtr<FJsonObject> Creator = MakeShareable(new FJsonObject);
         Creator->SetObjectField(TEXT("Attributes"), AttributesItem);
         Creator->SetObjectField(TEXT("Entity"), EntityItem);
    
    
    
         PlayFab::MultiplayerModels::FCreateMatchmakingTicketRequest request;
         request.GiveUpAfterSeconds = 60;
         request.QueueName = TEXT("Testing");
         request.Creator = Creator;
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.

Neils Shi avatar image Neils Shi commented ·

I'm glad you solved it, feel free to let me know if there are any other questions.

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.