Skip to main content

Upload the dedicated server to AMS - Dedicated servers with AccelByte Multiplayer Servers (AMS) - (Unity module)

Last updated on June 12, 2024

Upload dedicated server to AMS

Now that you've tested your server locally and verify that it works, in this tutorial, you will upload your dedicated server to AccelByte Multiplayer Servers (AMS).

Package Linux dedicated server

  1. Open Byte Wars in Unity.

  2. Go to File > Build Settings. Choose Dedicated Server as the platform and click Switch Platform.

    Unity Build Settings for Linux Dedicated Server Unity Byte Wars dedicated servers with AMS

  3. Enable the Development Build to be able to see the server logs, then click the Build button.

  4. A file explorer window will appear. Name the package as ByteWars.x86_64 and save it under a folder named linux-server-build.

  5. Wait until the building process finishes.

Upload server image to AMS

You will need to download the AMS executable file to help you upload the dedicated server to AMS. This section will show you how to do that.

  1. Log in to the AccelByte Gaming Services (AGS) Admin Portal and go to your game namespace dashboard.

  2. Go to AccelByte Multiplayer Servers > Download Resource.

  3. Download the AMS Command Line Interface (CLI) For Windows (amd64). The ams.exe file should be downloaded.

  4. Upload the Linux dedicated server using the AMS CLI. Run ams.exe using a Windows PowerShell with the command below. Use the client ID and client secret of your CLI IAM client to replace <AMSCLI_ClientID> and <AMSCLI_ClientSecret>.

    .\ams.exe upload -H demo.accelbyte.io -c <AMSCLI_ClientID> -s <AMSCLI_ClientSecret> -n <DSImageName> -p <DSAbsoluteLocalPath> -e ByteWars.x86_64
    info

    Here 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.
    • -c: the IAM client ID used to authenticate. Set it to the IAM client ID from the AMS CLI IAM client you created.
    • -s: the IAM client secret used to authenticate. Set it to the IAM client secret from the AMS CLI IAM client you created.
    • -n: the name of the dedicated server image after the upload process completes. It can be anything, but make it meaningful. For example, 1.0.3-unity-bytewars, which indicates 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 the ByteWars.x86_64 file.
  5. Once the uploading process finishes, your new dedicated server image will be listed in the Admin Portal. You can check it by going to 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 dedicated server image state to change from uploaded to complete.

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.

  1. Log in to the AGS Admin Portal and go to your game namespace dashboard.

  2. Go to AccelByte Multiplayer Servers > Fleet Manager.

  3. In the Region List section, toggle the regions where you want your dedicated servers to be deployed. In this tutorial, ap-southeast-1 and us-east-2 are enabled.

  4. Click Create Fleet.

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

  6. On the Deployment Profile tab, leave Timeout and Port Configuration configs as default. For Command Line config, enter the default command below, which configures the dedicated server so it can be managed by AMS. Once done, click Next.

    -dsid ${dsid} -port ${default_port} -watchdogUrl ${watchdog_url}
  7. On the DS Host tab, select the glx1.2x for the VM Instance and set the Number of servers to 1. This configuration tells the fleet to spawn one dedicated server on the selected Virtual Machine (VM) instance. Then, click Next.

  8. On the Region tab, expand the enabled regions (which are ap-southeast-1 and us-east-2 in this example). Locate the Pencil icon under the Action column to edit how many dedicated servers 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.
  9. On the Log & Artifacts Sampling tab, you 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 log every single event. Once done, click the Next button.

  10. On the Summary tab, you can review your fleet configurations. Then, click the Create button and activate it.

  11. Your fleet is created and available in the fleet list. Open the fleet details by clicking on the fleet name.

  12. On the fleet details page, locate the Dedicated Server List section. There, you will see your dedicated servers and their statuses.

    info

    A new fleet will take around around 10 minutes to get the dedicated server 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 the 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.

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

  1. Log in to the AGS Admin Portal and go to your game namespace dashboard.

  2. Go to AccelByte Multiplayer Servers > Fleet Manager and click on the name of your fleet you created.

  3. Under the Fleet Information section, click the Add More button. For this tutorial, you need to input a new claim key named unity-ds-ams.

Set up the Session Template

  1. Log in to the AGS Admin Portal and go to your game namespace dashboard.

  2. Go to Multiplayer > Matchmaking > Session Configurations and click on the Session Template tab.

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

  4. On the Session Template General tab, locate the Server section. Then, select the DS - AMS option. This tells the Session Template to use dedicated servers from AMS fleets when the game session is created.

  5. When the DS - AMS option is selected, you will find a new configuration named Requested Regions. Add all of your enabled AMS regions by clicking on the Add Region button.

  6. On the Fallback Claim Keys, add a new claim key that matches the claim keys you configured in your AMS fleet. In the tutorial example, you need to add the unity-ds-ams claim key. To add new claim keys, click on the Add Key button.

    info

    There are two types of claim keys you can configure for Session Template: Preferred Claim Keys and Fallback Claim Keys.

    • Preferred Claim Keys: the top priority claim keys for the game session to claim AMS dedicated servers.
    • Fallback Claim Keys: the fallback claim keys in case no AMS dedicated servers are found when using the Preferred Claim Keys.
  7. Now that you have configured your Session Template to claim dedicated servers from your AMS fleets, click Save. Or, if you are creating a new Session Template, click Next to complete your new Session Template configuration.