Overview

In this guide, we're going to walk you through how to set up the game server using our platform. After the game server is ready, we'll also guide you how to implement our Dedicated Server Management (DSM) to run after the matchmaking service matches a group of players so players are able to connect to the game server.

Requirements

Get your server-build of the game ready.

Implementations

Create Game Namespace

Right after you are logged in to the admin portal (https://demo.accelbyte.io/admin), you are directed to AcceByte dashboard. Go to Namespaces menu on Platform Configurations section.

Figure 1. Admin Portal - Dashboard
Figure 2. Admin Portal - Namespaces

Click the Add New Namespace button to create a new namespace. As an example, we fill in "lightfantastic" as our namespace.

Figure 3. Admin Portal - Creating a Namespace

Create Client Credentials & Set Up Permissions

After a namespace is created, you need to create the client credentials. In order to create one, go to the Clients menu in Platform Configurations section and hit the Add A New Client button at the upper right corner.

Figure 4. Admin Portal - Clients

You have the option to select the Client Type to be Public or Confidential. Set the Client Type to Confidential to generate the Client Secret, fill up all the mandatory fields as instructed, select the Namespace that we've created earlier (lightfantastic). Save the Client ID and Client Secret as we are going to use these in our next config step. Hit create when you're ready.

Figure 5. Admin Portal - Creating a new Client
Figure 6. Admin Portal - The newly created Client

The next thing to do is adding permission to our client credential. Switch to the Permissions tab to set up the permission settings. Click the Add button and fill the resource field with “NAMESPACE:{namespace}:DSM:SERVER”. Check mark the Update action for client's permission and confirm the setup.

Figure 7. Admin Portal - Permissions tab
Figure 8. Admin Portal - Adding a new Permission

There, we have a working client credential with a proper permission ready.

Figure 9. Admin Portal - the newly created Client Permission

Create Matchmaking Channel / GameMode

To create a matchmaking channel, you can follow the instruction from our previous guide article.

Once you're done with the configuration for all the rules (including the Flexing Rules), we continue by implementing the matchmaking feature into the game.

Setting Up Game Config for GameServer/Dedicated Server & Game Client

This setup is pretty straight forward. Set the AccelByte SDK config and make sure all the config value is valid. Below are the config samples for game client and game server. Both config samples are located in Assets/Resources/folder.

{
    "PublisherNamespace": "accelbyte",
    "Namespace": "lightfantastic",
    "UseSessionManagement": true,
    "BaseUrl": "https://sampleaddress.io",
    "LoginServerUrl": "https://sampleaddress.io",
    "IamServerUrl": "https://sampleaddress.io/iam",
    "PlatformServerUrl": "https://sampleaddress.io/platform",
    "BasicServerUrl": "https://sampleaddress.io/basic",
    "LobbyServerUrl": "wss://sampleaddress.io/lobby/",
    "CloudStorageServerUrl": "https://sampleaddress.io/binary-store",
    "TelemetryServerUrl": "https://sampleaddress.io/telemetry",
    "GameProfileServerUrl": "https://sampleaddress.io/soc-profile",
    "StatisticServerUrl": "https://sampleaddress.io/statistic",
    "ClientId": "clientid",
    "ClientSecret": "clientsecret",
    "RedirectUri": "http://127.0.0.1"
}
GitHub Gist link
{
  "PublisherNamespace": "accelbyte",
  "Namespace": "lightfantastic",
  "BaseUrl": "https://sampleaddress.io",
  "DSMServerUrl": "https://sampleaddress.io/dsm",
  "IamServerUrl": "https://sampleaddress.io/iam",
  "ClientId": "clientid",
  "ClientSecret": "clientsecret",
  "RedirectUri": "redirecturi"
}
GitHub Gist link

Create Server Image Using Docker

Install Docker Desktop

In order to progress, you will need to install Docker. Below are the steps required to get the Docker up and running on your Windows.

  1. Install Docker Toolbox here.
  2. Install Docker Desktop for Windows here.
  3. After installation is complete, it asks you to enable Hyper-V and requires you to restart - make sure to do that afterwards.
  4. To check if the Docker is working properly, use command prompt (cmd) or power shell to run “docker version”. If that goes well, move on to the next step.

Build Server Image

After Docker is properly installed, you need to build the Linux Server to an image. To be able to do so, you need to create a Dockerfile first. Basically, it contains the config of the image - a set of commands that needs to run before it runs on the container.

Steps:

  1. Prepare a folder to work on. In this sample, we use a folder named “DSBuild”
  2. Inside the folder, create a file named “Dockerfile” without a file extension type
  3. Create one more folder to place the Linux server build, in our case we name it “lightfantastic”
Figure 13a. Inside the DSBuild folder
Figure 13b. Inside the lightfantastic folder

4. Fill in the commands inside the Dockerfile.

Figure 13c. Dockerfile

5. The next step is to open cmd in DSBuild folder and run the build command as following:

docker build -t lightfantastic-server:latest -f "Dockerfile" lightfantastic

It takes a few moment.

6. To verify that your image has been created, run the command “docker images” to see if lightfantastic-server with the latest tag is within the list.

Upload Image to AWS ECR

After your image is ready inside the docker, the next step is to push your image to your preferred cloud platform. In this sample game, we choose to use AWS.

  1. Create a repo on ECR, we name ours lightfantastic-server
  2. Use AWS CLI to login to AWS. Tag the image we've created earlier then push it to the AWS ECR.
  3. Login to AWS with “aws configure” command. Fill in your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY along with the region where we'd like to push the image to.
  4. Get the login token by using the following command, as we use region us-west-2
aws ecr get-login --no-include-email --region us-west-2

5. With the token information received from the previous command, run

docker login -u AWS -p <TOKEN> kiam

6. Tag your image using a generated number provided by AWS ECR repo using the following command:

docker tag lightfantastic-server:latest [generatednumber].dkr.ecr.us-west-2.amazonaws.com/lightfantastic-server:latest

Replace the [generatednumber] with 12 digits of generated number you get from the repo.

7. Push the tagged image to AWS ECR with this command

docker push [generatednumbers].dkr.ecr.us-west-2.amazonaws.com/lightfantastic-server:latest

Create a New DSM Configuration on Admin Portal

In order to configure AccelByte Dedicated Server Management (DSM), we make use of our AWS repository. The DSM Configuration setting can be found in our Admin Portal (https://demo.accelbyte.io/admin), Game and Social section. Click on Dedicated Servers from the menu and go to Configurations.

Figure 14a. Dedicated Servers Configuration

Click on Create Configuration button to create a new configuration for the newly created game server. Below are the configuration values:

  • Min. Count : 0
    Min Count is the minimum game server you'd like to spawn.
  • Max. Count : 0
    Max Count is the maximum game server you'd like to spawn.
  • Buffer Count : 0
    Buffer Count is the number of idle game server that's ready to go when needed.
  • Image : [generatednumbers].dkr.ecr.us-west-2.amazonaws.com/lightfantastic-server:latest
    The image's located in your AWS ECR.
  • CPU Request : 500m
    The CPU request of the game server, the format matches the kubernetes format.
  • CPU Limit : 1000m
    The CPU limit of the game server, the format matches the kubernetes format.
  • Memory Request : 256Mi
    The memory request of the game server, the format matches the kubernetes format
  • Memory Limit : 512Mi
    The memory limit of the game server, the format matches the kubernetes format
  • Creation Timeout : 120
    The time limit for "Creating" status
  • Claim Timeout : 60
    The time limit for the DSM to claim game server
  • Busy Timeout : 400
    The time limit for game server on "Busy" status
Figure 14b. Adding a new config for DSM

Right after this you can start the matchmaking from your game client and get your game client connected to the game server with AccelByte service.


Should you have a question regarding this guide, please reach out to us at support@accelbyte.io.