Configure Session service to claim dedicated servers from AMS
Introduction
The management of a game session lifecycle, from matchmaking to game hosting, is the responsibility of the AccelByte Gaming Services (AGS) Session service. Its session template offers various configuration options to find a host for the game session, whether it is a P2P host or a dedicated server, the session template offers various configuration options.
The Session service uses templates to define default properties. This is intended to make it easy for you to conceptualize the different player experiences you want to enable in your game. To learn more about the Session service, see Introduction to Session.
This article walks you through how to configure session templates to automatically claim dedicated servers from AccelByte Multiplayer Servers (AMS) fleets to host a game session.
Prerequisites
Before you begin this guide, you must have:
- Created a fleet that uses one of your dedicated server images.
- Assigned claim keys to some of your fleets.
Create a session template to claim dedicated servers from AMS
- AGS Shared Cloud
- AGS Private Cloud
Go to your game namespace on the AGS Admin Portal.
On the sidebar, go to Multiplayer > Matchmaking > Session Configuration.
Create a session template. To learn how, see Configure session templates. For configure the session template for AMS, ensure that you set the following:
- Ensure that you select DS - AMS as the session type.
- Enter the claim keys that your sessions will use, in the order that you want your claim keys to be used. For more information on claim keys, see Claim dedicated servers.
- Select the regions that you want to claim from in the Requested Regions field, in the order of regions that you want the claim to happen.
注記The Requested Regions field contains the default values for when no region preference is supplied to the session at creation time. Normally, when using AGS matchmaking, the game client will submit a list of latencies to each region along with the match ticket. Then, the matchmaking will decide the best regions for the matched players (in order of preference), which will override the values in the session template. In most cases, the Requested Regions field in the Admin Portal will not be used, and thus, for the majority of cases, the region can safely be left blank.
Click Create to create the session template.
Go to your game namespace on the AGS Admin Portal.
On the sidebar, go to Multiplayer > Matchmaking > Session Configuration.
Create a session template. To learn how, see Configure session templates. For configure the session template for AMS, ensure that you set the following:
- Ensure that you select DS - AMS as the session type.
- Enter the claim keys that your sessions will use, in the order that you want your claim keys to be used. For more information on claim keys, see Claim dedicated servers.
- Select the regions that you want to claim from in the Requested Regions field, in the order of regions that you want the claim to happen.
注記The Requested Regions field contains the default values for when no region preference is supplied to the session at creation time. Normally, when using AGS matchmaking, the game client will submit a list of latencies to each region along with the match ticket. Then, the matchmaking will decide the best regions for the matched players (in order of preference), which will override the values in the session template. In most cases, the Requested Regions field in the Admin Portal will not be used, and thus, for the majority of cases, the region can safely be left blank.
Click Create to create the session template.
Dynamic claim keys with client version launch arguments
Another way to associate a claim key is from the game client using the optional client version attribute as part of the matchmaking or session creation request. The provided client version will be automatically added as a claim key after the preferred claim keys and before the fallback claim keys. This can be further combined with game client launch arguments to enable dynamic claim keys. An example use case for this is deployment using a Continuous Integration script during development.
const FString OverriddenDSVersion = UTutorialModuleOnlineUtility::GetDedicatedServerVersionOverride();
if (!OverriddenDSVersion.IsEmpty())
{
MatchmakingSearchHandle->QuerySettings.Set(SETTING_GAMESESSION_CLIENTVERSION, OverriddenDSVersion, EOnlineComparisonOp::Equals);
}
...
GetSessionInt()->StartMatchmaking(
LocalPlayers,
SessionName,
FOnlineSessionSettings(),
MatchmakingSearchHandle,
CompletionDelegate)
Refer to the Byte Wars tutorial Matchmaking with DS for the full code example.
Preferred claim keys in the session template will be evaluated first over the client version claim key set through the game client. This means when AMS is asked for a Dedicated Server, it will first try to find one from a fleet that matches the preferred claim keys (in order), and if it does not find one it will then try to find one matching the client version, and if that fails, it will try the fallback keys (in order).
Leave the preferred claim keys empty or set it as fallback claim keys if you want the client version as claim key to take precedence.
What's next
Now that you have successfully claimed a dedicated server and finished a game session, you can view and manage the dedicated server logs and artifacts for the claimed dedicated server.
You can also explore different dedicated server claim scenarios.