メインコンテンツまでスキップ

AGS Game SDK をインストールする - 初期設定 - (Unreal Engine モジュール)

Last updated on June 12, 2024

Introduction

The AccelByte Gaming Services (AGS) Game Software Development Kit (SDK) for Unreal Engine integrates AGS into your game. The AGS Game SDK can be used in both your game's client and server builds.

The AccelByte Game SDK is made up of three parts. Each part has its own repository:

The AGS Unreal Online Subsystem (OSS) acts as a high-level API to interact with AGS, making it quicker and easier to integrate with your game. To follow along with Byte Wars, you must use the AGS Unreal OSS.

ヒント

The AccelByte Unreal OSS implements Unreal's Online Subsystem interfaces. You can find out more about Online Subsystems at Unreal's Online Subsystem Documentation.

The AGS Unreal SDK and Network Utilities are lower-level supporting APIs. You will not interact directly with them in Byte Wars, but it's useful to know they exist. You can find out more about the Unreal SDK and Network Utilities here:

  • AccelByte Unreal SDK: A library that consists of APIs for the game client and game server to send requests to AGS.

  • AccelByte Network Utilities: A library that consists of network functionalities to communicate between game clients for peer-to-peer (P2P) networking.

Project setup

There are a few setup processes you need to complete before your Byte Wars Unreal project is ready for AGS implementation.

Optional: Skip setup with tutorialmodules branch

If you wish to have your initial project setup requirements completed automatically, you can switch to the tutorialmodules branch in your local Byte Wars Unreal repo that you cloned in the previous tutorial and skip directly to setting up an IAM client.

git switch -f tutorialmodules

If you want to know how to set up the AGS SDKs on your own project, continue to the next subsection.

Clone the AGS Unreal OSS

  1. Open your Byte Wars Unreal project folder (the one that contains the .uproject file) in a terminal.

  2. Add the AGS Unreal OSS submodule using the following command:

    git submodule add git@github.com:AccelByte/accelbyte-unreal-oss.git Plugins/AccelByte/OnlineSubsystemAccelByte
  3. Check out the AccelByte Unreal OSS submodule using the following commands:

    cd Plugins/AccelByte/OnlineSubsystemAccelByte

    git checkout 0.12.6

Clone the AGS Unreal Game SDK

  1. Go back to the Byte Wars project folder and add the AGS Unreal SDK submodule using the following command:

    git submodule add git@github.com:AccelByte/accelbyte-unreal-sdk-plugin.git Plugins/AccelByte/AccelByteUe4Sdk
  2. Check out the AGS Unreal Game SDK submodule using the following commands:

    cd Plugins/AccelByte/AccelByteUe4Sdk

    git checkout 25.0.0

Clone the AGS Network Utilities

  1. Go back to the Byte Wars project folder and add the AGS Network Utilities submodule using the following command:

    git submodule add git@github.com:AccelByte/accelbyte-unreal-network-utilities.git Plugins/AccelByte/AccelByteNetworkUtilities
  2. Check out the AccelByte Network Utilities submodule using the following commands:

    cd Plugins/AccelByte/AccelByteNetworkUtilities

    git checkout 4.3.1

Verify plugins setup

To confirm that all the plugins are set up correctly as submodules, check that the %PROJECTPATH%/.gitmodules file contains the configuration for all the submodules, as in the example below.

[submodule "Plugins/AccelByte/OnlineSubsystemAccelByte"]
path = Plugins/AccelByte/OnlineSubsystemAccelByte
url = git@github.com:AccelByte/accelbyte-unreal-oss.git

[submodule "Plugins/AccelByte/AccelByteUe4Sdk"]
path = Plugins/AccelByte/AccelByteUe4Sdk
url = git@github.com:AccelByte/accelbyte-unreal-sdk-plugin.git

[submodule "Plugins/AccelByte/AccelByteNetworkUtilities"]
path = Plugins/AccelByte/AccelByteNetworkUtilities
url = git@github.com:AccelByte/accelbyte-unreal-network-utilities.git

Configure the project to use the plugins

Now that the plugins are correctly cloned in Plugins/AccelByte, you need to tell the Byte Wars project to use the AGS Game SDK plugins.

  1. Add all the plugins to your AccelByteWars.uproject file:

    "Plugins": [
    ...
    {
    "Name": "AccelByteUe4Sdk",
    "Enabled": true
    },
    {
    "Name": "OnlineSubsystemAccelByte",
    "Enabled": true
    },
    {
    "Name": "AccelByteNetworkUtilities",
    "Enabled": true
    }
    ]
  2. Add the plugins to your /Source/AccelByteWars.Target.cs file:

    ExtraModuleNames.AddRange( 
    new string[]
    {
    "AccelByteWars",
    "AccelByteUe4Sdk",
    "OnlineSubsystemAccelByte",
    "AccelByteNetworkUtilities"
    }
    );
  3. Add the plugins to your /Source/AccelByteWarsEditor.Target.cs file:

    ExtraModuleNames.AddRange( 
    new string[]
    {
    "AccelByteWars",
    "AccelByteUe4Sdk",
    "OnlineSubsystemAccelByte",
    "AccelByteNetworkUtilities"
    }
    );
  4. Register the plugins to PublicDependencyModuleNames in your /Source/AccelByteWars/AccelByteWars.Build.cs file

    PublicDependencyModuleNames.AddRange(
    new string[]
    {
    ...
    "AccelByteUe4Sdk",
    "AccelByteNetworkUtilities",
    "OnlineSubsystemAccelByte",
    ...
    }
    );
  5. Regenerate the Visual Studio project files and compile.

  6. Run the Unreal Editor and make sure the AGS Game SDK plugins are enabled for your project in the Unreal Editor by going to Edit > Plugins.

    Edit Plugins

Set up a public IAM Client

In order for the AGS Game SDK to be able to access your client environment, you will need to add a public IAM Client in the AGS Admin Portal.

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

  2. Go to Game Setup > Games and Apps > IAM Clients and click Create IAM Clients.

  3. On the new page, fill out the fields using the configurations below.

    • 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 Game Client option.
    • Client Name: the name of the IAM client. Set it to ByteWars-GameClient.
    • Client Type: the confidentiality of the IAM client. Select the Public option.
  4. Leave all other fields unchanged and click Create to create the new IAM client.

Configure the AGS Game SDK for the IAM client

Before using the AGS Game SDK, you will need to configure it to use the IAM client you just created.

  1. Open /Config/DefaultEngine.ini in a text editor.

  2. Find the [/Script/AccelByteUe4Sdk.AccelByteSettings] section inside DefaultEngine.ini and replace the Client ID with your public IAM client information. Also, replace other placeholder values based on your game namespace and AGS environment.

    [/Script/AccelByteUe4Sdk.AccelByteSettings]
    ClientId=<game_iam_client_id>
    ClientSecret=
    Namespace=<game_namespace_id>
    PublisherNamespace=
    BaseUrl="https://<game_namespace_id>.gamingservices.accelbyte.io"

    [OnlineSubsystem]
    DefaultPlatformService=AccelByte
    備考
    • ClientId is randomly generated and used to uniquely identify your public IAM client.
    • 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.
    ヒント
    • To 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.

  3. Save the DefaultEngine.ini file and rebuild your Byte Wars project.

Verify AGS Game SDK configuration

  1. Ensure that you have the log level for LogAccelByteOSS in Config/DefaultEngine.ini set to Log or higher.

    [Core.Log]
    LogAccelByteOSS=Log
  2. Save and close the DefaultEngine.ini file.

  3. Run the Unreal Engine editor, show the Output Log Window by going to Window > Output Log, and if you see AccelByte API initialized! in the log, the SDK is configured properly.

    LogAccelByteOSS: Starting OnlineSubsystemAccelByte module!
    ...
    LogAccelByteOSS: AccelByte API initialized!
  4. You can also run the game in Unreal Editor to check if your SDK is configured properly.

    • If the SDK configured properly, you will be redirected to the Main Menu:

    • If the SDK is not configured properly, an error message will be shown instead of the Main Menu.

注記

At this stage, you might see a few errors from LogAccelByte stating you have not configured the DefaultEngine.ini properly yet. If you are planning to continue with these tutorials and are planning to use dedicated servers, ignore these messages, as they will be resolved later and will not hinder the flow of the tutorials. Otherwise, open DefaultEngine.ini, navigate to [/Script/AccelByteUe4Sdk.AccelByteServerSettings], and set the value of ClientId, Namespace, and BaseUrl to " ".