Set up AMS configuration - Dedicated servers with AccelByte Multiplayer Servers (AMS) - (Unity module)
About
IAM clients are used to give permissions to certain resources in AccelByte Gaming Services (AGS). In order for your game's dedicated server to be able to communicate with AccelByte Multiplayer Servers (AMS), you will need to set up the correct IAM client permissions, and also config the installed AGS Game SDK in your project to enable the AMS features for your game.
Create a server IAM client
The server identity and access management (IAM) client is an IAM client that gives permissions for your game server. Sufficient permissions are needed for your game server so it can communicate with AMS.
- AGS Shared Cloud
- AGS Private Cloud
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to Game Setup > Games and Apps > IAM Clients and click Create IAM Clients.
On the new page, use the configuration below to create a new server IAM client.
- Create Options: the available options to create a new IAM client. Choose the Create from Template option to create a new IAM client from a template.
- Select Template: the template to create a new IAM client. Select the Dedicated Server option to create a new server IAM client. This option gives the necessary permissions for your game server.
- Client Name: the name of the IAM client. Set it to ByteWars-GameServer.
- Client Type: the confidentiality of the IAM client. Since the server IAM client must be secret, set it to Confidential.
- Secret: the secret or password for the IAM client. You can use your own secret or click the Generate button to generate a random one. Be sure to copy this.
- Redirect URI: the URI used to redirect once the IAM client authorization is successful. Set it to
http://127.0.0.1
.
warningThe Secret will not be shown again after you create the IAM client. Be sure to copy and save it before proceeding to the next step.
Click Create to create your server IAM client. Once you're done with the creation, the setup is complete.
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to Authorizations > IAM Clients and click Create New.
On the new window, use the configuration below to create a new server IAM client.
- Client Type: the confidentiality of the IAM client. Since the server IAM client must be secret, set it to Confidential.
- Secret: the secret or password for the IAM client. You can use your own secret or just click the Generate Client Secret button to generate a random secret.
- Client Name: the name of the IAM client. Set it to ByteWars-GameServer.
- Redirect URI: the URI used to redirect once the IAM client authorization is successful. Set it to
https://127.0.0.1
.
warningThe Secret will not be shown again after you create the IAM client. Be sure to copy and save it before proceeding to the next step.
Click Create to create your server IAM client. After that, your new IAM client information will be displayed on the screen.
Go to the Permissions tab and click on the Add button to add new permissions. Then, add the permissions below one by one.
Resource Permission NAMESPACE:{namespace}:SESSION:GAME Create, Read ADMIN:NAMESPACE:{namespace}:SESSION:GAME Update NAMESPACE:{namespace}:MATCHMAKING:BACKFILL Create, Read, Update, Delete ADMIN:NAMESPACE:{namespace}:STATITEM Create, Read, Update
Now, your server IAM client setup is complete.
Create an AMS CLI IAM client
The AMS command line interface (CLI) IAM client is an IAM client that gives permission for you to upload your server to AMS.
- AGS Shared Cloud
- AGS Private Cloud
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to Game Setup > Games and Apps > IAM Clients and click Create IAM Clients.
On the new page, use the configuration below to create a new AMS CLI IAM client.
- Create Options: the available options to create a new IAM client. Choose the Create from Template option to create a new IAM client from a template.
- Select Template: the template to create a new IAM client. Select the Dedicated Server Tools option to create a new AMS CLI IAM client. This option gives the necessary permissions to run AMS CLI.
- Client Name: the name of the IAM client. Set it to ByteWars-AMSCLI.
- Client Type: the confidentiality of the IAM client. Since the AMS CLI IAM client must be secret, set it to Confidential.
- Secret: the secret or password for the IAM client. You can use your own secret or click the Generate button to generate a random one. Be sure to copy this.
- Redirect URI: the URI used to redirect once the IAM client authorization is successful. Set it to
http://127.0.0.1
.
warningThe Secret will not be shown again after you create the IAM client. Be sure to copy and save it before proceeding to the next step.
Click Create to create your AMS CLI IAM client. Once you're done with the creation, the setup is complete.
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to Authorizations > IAM Clients and click Create New.
On the new window, use the configuration below to create a new AMS CLI IAM client.
- Client Type: the confidentiality of the IAM client. Since the AMS CLI IAM client must be secret, set it to Confidential.
- Secret: the secret or password for the IAM client. You can use your own secret or just click the Generate Client Secret button to generate a random secret.
- Client Name: the name of the IAM client. Set it to ByteWars-AMSCLI.
- Redirect URI: the URI used to redirect once the IAM client authorization is successful. Set it to
https://127.0.0.1
.
warningThe Secret will not be shown again after you create the IAM client. Be sure to copy and save it before proceeding to the next step.
Click Create to create your AMS CLI IAM client. After that, your new IAM client information will be displayed on the screen.
Go to the Permissions tab and Add. Then, add the permission below.
Resource Permission AMS:UPLOAD Create, Update
Now, your AMS CLI IAM client setup is complete.
Configure the Server SDK
Once your server IAM client is configured in the AGS Admin Portal, you'll need to configure the Server SDK in your game project.
Open Byte Wars in Unity.
In the
Resources
folder, create a new JSON file namedAccelByteServerSDKConfig.json
. Copy the code below and paste it into the file. Then, replace the values with your credentials.- AGS Shared Cloud
- AGS Private Cloud
{
"Default": {
"Namespace": "<game_namespace_id>",
"PublisherNamespace": "",
"BaseUrl": "https://<game_namespace_id>.prod.gamingservices.accelbyte.io",
"RedirectUri": "http://127.0.0.1"
}
}info- Namespace is the namespace ID of your game namespace.
- BaseUrl is the base URL made out of your game namespace ID combined with your AGS Admin Portal environment.
{
"Default": {
"Namespace": "<game_namespace_id>",
"PublisherNamespace": "accelbyte",
"BaseUrl": "https://<studio_name>.accelbyte.io",
"RedirectUri": "http://127.0.0.1"
}
}info- Namespace is the namespace ID of your game namespace.
- PublisherNamespace is the publisher ID of your publisher namespace. The default value is
accelbyte
. - BaseUrl is the URL of your AGS Admin Portal environment.
tipTo find your game namespace ID, go to your Admin Portal and navigate to the Namespace page where your game namespaces are listed. Then, locate your game namespace under the GAMES section and click on the gear icon. On the new page, locate the Namespace ID property and there you can find your game namespace ID value.
Similarly, to find your publisher namespace ID, go to your Admin Portal and navigate to the Namespace page where your game namespaces are listed. Then, locate your publisher namespace under the PUBLISHER section and click on the gear icon. On the new page, locate the Namespace ID property and there you can find your publisher namespace ID value.
Create another JSON file in the
Resources
folder namedAccelByteServerSDKOAuthConfig.json
. Then, copy the code below and paste it into the file, replacing the values with your credentials.{
"Default": {
"ClientId": "<server_iam_client_id>",
"ClientSecret": "<server_iam_client_secret>"
}
}info- ClientId is randomly generated and used to uniquely identify your server IAM client.
- ClientSecret is the secret (password) for your server IAM client.
Save the files and your server SDK configuration is complete.
Enable AMS in the AGS Game SDK
In this section, you will enable AMS in the installed AGS Game SDK in your project so your game server will be able to use AMS features and be authorized to communicate with AMS. You can use one of the following methods:
In the future, AMS will be enabled by default in the AGS Game SDK.
- From Config File
- From Unity Editor
Open the
AccelByteServerSDKConfig.json
file in any text editor.To enable AMS in the AGS Game SDK, add and enable the
EnableAmsServerQos
configuration as shown below into theAccelByteServerSDKConfig.json
file.{
"Default": {
...
"EnableAmsServerQos": true
}
}Save the file to enable the configuration.
Open Byte Wars in the Unity Editor.
From the toolbar, go to AccelByte > Edit Server Settings.
On the AccelByte Configuration window, expand Service URL Configs and enable Use AMS QoS Server URL to activate AMS in the AGS Game SDK.
Once done, click the Save button to save the configuration.
Enable Starter Mode
To follow the rest of the module, you need to enable a Starter Mode. To do this, open your project in Unity. From the Project window, open Assets\Resources\Modules\MultiplayerDSEssentials\MultiplayerDSEssentialsAssetConfig.asset
and enable the Is Starter Active setting in the Inspector. This setting will enable the starter files you will use to follow the tutorials.