メインコンテンツまでスキップ

リージョンのマッチメイキングを設定する

Last updated on October 23, 2024

Overview

When using AccelByte Unreal OSS, the game client will send all the available regions by default during matchmaking requests. However, you can also configure the matchmaking process for a specific region only.

Prerequisites

Configure matchmaking request with all available regions

During a matchmaking request, the game client can provide a region list in the latencies field as the preference region for the matchmaking result. The following is an example payload for requesting a matchmaking:

POST /match2/v1/namespaces/{namespace}/match-tickets

{
"attributes": {},
"latencies": {
"us-west-2":44,
"eu-west-2":187,
"ap-northeast-1":600
},
"matchPool": "matchpool_test",
"sessionID": ""
}

We can get the list of available regions from the QoS service using the following API endpoint:

GET /qosm/public/qos

// Using the StartMatchmaking() method, 
// OSS will automatically fill matchmaking tickets with all available QoS regions

// Matchmaking to all region
TSharedRef<FOnlineSessionSearch> NewSearchHandle = MakeShared<FOnlineSessionSearch>();
NewSearchHandle->QuerySettings.Set(SETTING_SESSION_MATCHPOOL, "5v5bf", EOnlineComparisonOp::Equals);

if (!SessionInterface->StartMatchmaking(TArray<FSessionMatchmakingUser>{{LocalUserId1}}, NAME_GameSession, FOnlineSessionSettings(), NewSearchHandle, OnStartMatchmakingCompleteDelegate))
{
// Matchmaking failed to start
return false;
}

Configure matchmaking requests for a specific region

To get a specific region during matchmaking results, the game client can only send one region (latency) when creating a match ticket.

If you're using AMS or Armada v3, ensure that you add the region that you want to use or choose into the deployment config regions, which will be used by the session template.

Image shows deployment config

Make sure the region that will be chosen is active in the region setting. To do this follow these steps:

  1. In the AccelByte Gaming Services (AGS) Admin Portal, go to Dedicated Server Management > Servers.

  2. On the Servers page, click the Available Regions button.

  3. In the QoS Servers section, switch on the Active toggle button of the country you want to set to active.

    Image shows region active

The following is an example for a game client to always request for matchmaking in the region “us-west-2”:

POST /match2/v1/namespaces/{namespace}/match-tickets

{
"attributes": {},
"latencies": {
"us-west-2":44
},
"matchPool": "matchpool_test",
"sessionID": ""
}
// Region names can be provided by setting the SearchSetting with `SETTING_GAMESESSION_REQUESTEDREGIONS` key

TSharedRef<FOnlineSessionSearch> NewSearchHandle = MakeShared<FOnlineSessionSearch>();
NewSearchHandle->QuerySettings.Set(SETTING_SESSION_MATCHPOOL, "5v5bf", EOnlineComparisonOp::Equals);
// Insert the region you want to lock to here
NewSearchHandle->QuerySettings.Set(SETTING_GAMESESSION_REQUESTEDREGIONS, "us-west-2", EOnlineComparisonOp::Equals);

if (!SessionInterface->StartMatchmaking(TArray<FSessionMatchmakingUser>{{LocalUserId1}}, NAME_GameSession, FOnlineSessionSettings(), NewSearchHandle, OnStartMatchmakingCompleteDelegate))
{
// Matchmaking failed to start
return false;
}
注記

If you're using Armada, there will be a failover if the preferred region is full or outage. Then, the Dedicated Server Management Controller (DSMC) service will request a dedicated server in another region listed in the deployment config. This means that there is still a small possibility that the session gets a dedicated server from another region even when we request matchmaking only using one region.