Upload the dedicated server to AMS - Dedicated servers with AccelByte Multiplayer Servers (AMS) - (Unreal Engine module)
Upload dedicated server to AMS
To upload your dedicated server to AccelByte Multiplayer Servers (AMS), you need to package your game as a Linux game server. To do this, you need to install the the Cross-Compile Toolchain. For more information, see Development Requirements from Unreal. After downloading and installing the Cross-Compile Toolchain, restart your computer and follow the steps below.
Open your Byte Wars project in the Unreal Engine editor.
Package your project by going to Platforms > Linux, selecting Shipping and AccelByteWarsServer, and clicking Package Project. Then, save the project to a location on your computer.
Log in to the AccelByte Gaming Services (AGS) Admin Portal and go to your game namespace dashboard.
From the side bar menu, select AccelByte Multiplayer Servers > Download Resource.
Then, download the AMS Command Line Interface (CLI) For Windows (amd64). The ams.exe file should be downloaded.
The next step is to upload the Linux dedicated server using the AMS CLI. Run ams.exe using a Windows PowerShell with the following command. Please use the client ID and client secret of your CLI IAM client to replace
<AMSCLI_ClientID>
and<AMSCLI_ClientSecret>
..\ams.exe upload -H <AMS_HostURL> -c <AMSCLI_ClientID> -s <AMSCLI_ClientSecret> -n <DSImageName> -p <DSAbsoluteLocalPath> -e AccelByteWarsServer.sh
infoHere are the details of the AMS CLI command to upload your dedicated server.
-H
: the AMS host URL depending on where you run your AGS namespace. For AGS Private Cloud, your host URL is<studio_name>.accelbyte.io
. For AGS Shared Cloud, your host URL isprod.gamingservices.accelbyte.io
.-c
: the IAM client ID used to authenticate. Set it to the IAM client ID from the AMS CLI IAM client you created from the previous tutorial section.-s
: the IAM client secret used to authenticate. Set it to the IAM client secret from the AMS CLI IAM client you created from the previous tutorial section.-n
: the name of the dedicated server image after the upload process is complete. It can be anything, but make it meaningful. For example,2.7.5-unreal-bytewars
which indicate the server version.-p
: the absolute local path to the server directory to upload. For example,C:/Documents/ByteWars/LinuxServer
.-e
: the dedicated server executable within the server directory. In this case, the executable is theAccelByteWarsServer.sh
file.
Once the uploading process is finished, your new dedicated server image will be listed on the Admin Portal. You can check it from the side bar menu of the dashboard, select AccelByte Multiplayer Servers > Server Images. There will be two states after the upload process:
- Uploaded: the dedicated server binaries successfully uploaded.
- Complete: the dedicated server image was successfully created and is ready to go. It takes a few minutes for the DS image state changes from uploaded to complete.
Congratulations! You have successfully uploaded your dedicated server to AMS. The next step is to create a fleet to deploy and manage the DS.
Create a fleet to manage the dedicated server
AMS fleets function to scale virtual machines and manage dedicated servers that are hosted within those virtual machines based on regional configurations. In this section, you will learn how to create a fleet for your game.
Log in to the AGS Admin Portal and go to your game namespace dashboard.
From the side bar menu, select AccelByte Multiplayer Servers > Fleet Manager.
Next, locate the Region List section and toggle the regions where you want your dedicated servers to be deployed. In this tutorial, we enable the ap-southeast-1 and us-east-2 regions.
Then, click Create Fleet > Create New to create a new fleet.
On the new Fleet & Image tab, fill in fleet name and select the server image that you just uploaded. The fleet name can be anything, but to make it simpler, you can use the same name as the server image name. Once done, click the Next button.
On the Deployment Profile tab, leave Timeout and Port Configuration configs as default. For Command Line config, enter the default command below. The command below configures the dedicated server so it can be managed by AMS. Once done, click Next button.
-dsid=${dsid} -port=${default_port} -log=${log_file} -watchdog_url=${watchdog_url}
On the DS Host tab, select the glx1.2x for the VM Instance and set the Number of server to 1. This configuration tells the fleet to spawn 1 dedicated server on the selected Virtual Machine (VM) instance. Now, click Next button.
On the Region tab, expand the enabled regions, in this example is the ap-southeast-1 and us-east-2. Locate the Pencil icon under the Action column to edit how many dedicated server should be deployed by the fleet. For this tutorial, set the Min Servers to 0, Max Servers to 1, and the Buffer Value to 1.
info- Min Servers: The minimum number of servers that the deployment needs to maintain, regardless of whether the servers are in the "Ready" (warmed buffer) state or "In Session" (serving a game session) state. This value is useful to handle the baseline concurrent users by ensuring that there are enough servers ready to go.
- Max Servers: The maximum number of servers that the region can maintain. This value is useful as a limiter to make sure the cost of game servers will not go over budget.
- Buffer Value: The buffer value tells the fleet the exact number of servers to maintain as warmed buffers.
On the Log & Artifacts Sampling tab, we want the dedicated server able to generate logs. To do this, enable the Enable Log Sampling option and set the samples to 100%. This config lets the dedicated server to log every single events. Once done, click the Next button.
On the Summary tab, you can review your fleet configurations. Now, click the Create button and activate it.
Now, your fleet should be created and available on the fleet list. You can open the fleet details by clicking on the fleet name.
On the fleet details page, locate the Dedicated Server List section. There, you should see your dedicated servers and their statuses.
infoA new fleet will take around around 10 minutes to get the dedicated server to up and running before you can see them in the list. Below are the states of the dedicated servers on a fleet.
- Creating: the dedicated server is currently initializing (not yet calling the send ready message to AMS watchdog).
- Ready: the dedicated server has sent a ready signal to AMS and is ready to go.
- Claiming: the fleet manager is currently claiming the dedicated server to a session using a claim key.
- Claimed: the dedicated server is already bound to a game session and the game is currently in progress.
- Removed: the dedicated server is removed from the fleet.
Congratulations! You have successfully created an AMS fleet. The next step is to adjust the session configuration to use our fleet for Byte Wars matchmaking.
Set up a game session to use an AMS dedicated server
In this section, you will learn how to set up the game session to use the dedicated server from your new AMS fleet.
Create claim keys for the fleet
Log in to the AGS Admin Portal and go to your game namespace dashboard.
From the side bar menu, select AccelByte Multiplayer Servers > Fleet Manager. Then, click on the name of your fleet you created from the previous tutorial.
Under the Fleet Information section, click the Add More button next to the Claim Keys attribute. For this tutorial, you need to input a new claim key namely unreal-ds-ams.
Set up the Session Template
Log in to the AGS Admin Portal and go to your game namespace dashboard.
From the side bar menu, select Multiplayer > Matchmaking > Session Configuration. Then, locate the Session Template tab.
From here, you can either create a new Session Template by clicking the Add Session Template button. Or, you can modify your existing Session Template by clicking on the Session Template name.
On the Session Template General tab, locate the Server section. Then, select the DS - AMS option. This tells the Session Template to use dedicated server from AMS fleets when the game session is created.
When the DS - AMS option selected, you can find a new configuration namely Requested Regions. Add all of your enabled AMS regions by clicking on the Add Region button.
Then, on the Fallback Claim Keys, add a new claim key that match with the claim keys you have configured on your AMS fleet. In tutorial case, you need to add unreal-ds-ams claim key. To add new claim keys, click on the Add Key button.
infoThere are two types of claim keys you can configure for Session Template, there are Preferred Claim Keys and Fallback Claim Keys. Here is the difference between the two.
- Preferred Claim Keys: is the top priority claim keys for the game session to claim AMS dedicated servers.
- Fallback Claim Keys: is the fallback claim keys in case no AMS dedicated servers found when using the Preferred Claim Keys.
Now, you have configured your Session Template to claim dedicated servers from your AMS fleets. Click on the Save button on the right bottom corner to save your Session Template configuration. Or, if you are creating a new Session Template, then click the Next button on the right corner, follow and complete your new Session Template configuration.
Congratulations! You have successfully setup a game session using an AMS fleet.
Use a development fleet to manage dedicated servers
By default, the fleet you created before is a production fleet. A production fleet is meant for live games, and the configurations, such as dedicated images and command line arguments, are immutable unless you stop and restart the fleet.
Alternatively, you can create a development fleet. A development fleet provides more flexibility and cost efficiency by letting you run multiple dedicated server image versions and command line permutations in the same fleet. This type of fleet will only spawn dedicated servers when requested. In this section, you will learn how to configure a development fleet and use it for your game sessions.
Create a development fleet
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to AccelByte Multiplayer Servers > Fleet Manager. Then, create a new fleet by clicking Create Fleet > Create New.
On the new Fleet & Image tab, fill in fleet name. Then, turn on the Development Fleet option and click Next.
On the Deployment Profile tab, leave everything as default, keeping the Command Line empty, as it will be filled by the build configuration, which will be discussed later. Once done, click Next.
On the DS Host tab, select the ttx1.s for the VM Instance and set the Number of servers to 1. This configuration tells the fleet to spawn one (1) dedicated server on the selected virtual machine (VM) instance. Click Next when finished.
On the Region tab, expand the enabled regions. Locate the pencil icon under the Action column to edit how many dedicated servers should be deployed by the fleet. Unlike production fleets, buffer for development fleets is how many DS you want to have room to launch on ready VMs, therefore you need at least 1 buffer. For this tutorial, set the Min Servers to 0, the Max Servers to 1, and the Buffer Value to 1.
On the Log & Artifacts Sampling tab, you want the dedicated server to be able to generate logs. To do this, enable the Enable Log Sampling option and set the samples to 100%. This config lets the dedicated server log every single event. Once done, click the Next.
On the Summary tab, review your development fleet configurations. Click Create when you're done, and then activate it.
Create a build configuration
A development fleet can only spawn dedicated servers when requested, and it does not know what configuration to use to spawn the dedicated server. Thus, you need to create a build configuration.
A build configuration stores the dedicated server configuration, including dedicated server image and command line, to be used by your development fleet to spawn your dedicated server instances. This way, you can make many build configuration for each of your game versions and deploy them on the same development fleet. To create a build configuration, follow the steps below.
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to AccelByte Multiplayer Servers > Development Servers > Build Configurations. Then, create a new config by clicking Create Config > Create New.
On the Name & Image tab, set your configuration by using the guide below. Once done, click the Next button.
Build Configuration Name: you need to fill this with the exact game version of your game.
Image: select your desired dedicated server version. Make sure it also has the exact same game version as your Build Configuration Name.
tipFor Unreal Engine projects, you can find the game version in the
Project Version
attribute in theDefaulGame.ini
.[/Script/EngineSettings.GeneralProjectSettings]
GitHash=xxxxxxx
ProjectID=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
ProjectVersion=mygame-x.xx.x-dev
BuildNumber=xxxOn the Command Line tab, fill the Command section with the command below. It configures the dedicated server so it can be managed by AMS. Once done, click Next.
-dsid=${dsid} -port=${default_port} -log=${log_file} -watchdog_url=${watchdog_url}
On the Summary tab, review your config. Once ready, click Create and activate it.
Create claim keys for development fleet
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to AccelByte Multiplayer Servers > Fleet Manager. Then, click the name of your development fleet you created.
Under the Fleet Information section, click the Add More button next to the Claim Keys attribute. For this tutorial, input a new claim key named unreal-ds-ams-dev.
Set up the session template to use the development fleet
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to Multiplayer > Matchmaking > Session Configurations. Then, click the Session Template tab.
From here, you can either create a new session template by clicking Add Session Template, or you can modify your existing session template by clicking on the session template name.
On the General tab of the session template, select the DS - AMS option under the Server section. This tells the session template to use dedicated servers from AMS fleets when the game session is created.
With the DS - AMS option selected, you can find a new configuration named Requested Regions. Add all of your enabled AMS regions by clicking on the Add Region button.
Then, on the Fallback Claim Keys, add a new claim key that matches the claim keys you have configured on your AMS development fleet. If following the examples from this tutorial, you need to add the unreal-ds-ams-dev claim key. To add new claim keys, click Add Key. You can add it to Preferred Claim Keys or Fallback Claim Keys.
Now that you have configured your session template to claim dedicated servers from your AMS development fleet, if you are modifying an existing session template, click Save to save your session template configuration. If you are creating a new Session Template, proceed with its creation as normal until it's complete.
Congratulations! You have successfully set up a game session to use an AMS development fleet.
Set up game to send request to development fleet
To make your game send a request to your development fleet based on the game version, you need to set a game session attribute named client_version
. This attribute is the game version of your game.
When client_version
is set, the game session will first request a dedicated server from the development fleet that has the same claim key with the requested game session. In this tutorial example, the claim key you use will be unreal-ds-ams-dev.
Then, the development fleet will spawn a new dedicated server instance based on your build configuration you created. The fleet will select the build configuration that has the Build Configuration Name that is the same as the game session's client_version
attribute. After the dedicated server instance is created, the fleet will claim it and inform the game session.
To set the client_version
attribute in the Byte Wars project, you can toggle the config below in the DefaultEngine.ini
to true
. This config will set the client_version
value to the Unreal's project version when the game sends a request for a game session, whether through matchmaking or a match session.
[/ByteWars/TutorialModule.DSEssentials]
bOverrideDSVersion=true
The config above sets the client_version
value by adding the session settings before starting matchmaking or creating a match session.
Set client version session setting for matchmaking.
void UAccelByteWarsOnlineSession::StartMatchmaking(
const APlayerController* PC,
const FName& SessionName,
const EGameModeNetworkType NetworkType,
const EGameModeType GameModeType)
{
// ...
// Set up matchmaking search handle, it will be used to store session search results.
TSharedRef<FOnlineSessionSearch> MatchmakingSearchHandle = MakeShared<FOnlineSessionSearch>();
MatchmakingSearchHandle->QuerySettings.Set(SETTING_SESSION_MATCHPOOL, MatchPoolId, EOnlineComparisonOp::Equals);
MatchmakingSearchHandle->QuerySettings.Set(GAMESETUP_GameModeCode, GameModeCode, EOnlineComparisonOp::Equals);
// Check for DS version override.
const FString OverriddenDSVersion = UTutorialModuleOnlineUtility::GetDedicatedServerVersionOverride();
if (!OverriddenDSVersion.IsEmpty())
{
MatchmakingSearchHandle->QuerySettings.Set(SETTING_GAMESESSION_CLIENTVERSION, OverriddenDSVersion, EOnlineComparisonOp::Equals);
}
// ...
}Set client version session setting for match session.
void UAccelByteWarsOnlineSession::CreateSession(
const int32 LocalUserNum,
FName SessionName,
FOnlineSessionSettings SessionSettings,
const EAccelByteV2SessionType SessionType,
const FString& SessionTemplateName)
{
// ...
if (SessionType == EAccelByteV2SessionType::GameSession)
{
// Check for DS version override.
const FString OverriddenDSVersion = UTutorialModuleOnlineUtility::GetDedicatedServerVersionOverride();
if (!OverriddenDSVersion.IsEmpty())
{
SessionSettings.Set(SETTING_GAMESESSION_CLIENTVERSION, OverriddenDSVersion);
}
// ...
}
// ...
}
You can check your game session attribute once it's created on the Admin Portal. You can do this by navigating to Multiplayer > Matchmaking > Sessions and Parties. Then, select your game session. On the Session Details page, select the Session Data (JSON) tab. There, you can check the clientVersion
attribute value.