AGS Game SDK をインストールする - 初期設定 - (Unreal Engine モジュール)
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:
- AGS Unreal Online Subsystem (OSS) GitHub Repository
- AGS Unreal Game SDK GitHub Repository
- AGS Network Utilities GitHub 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
Open your Byte Wars Unreal project folder (the one that contains the
.uproject
file) in a terminal.Add the AGS Unreal OSS submodule using the following command:
git submodule add git@github.com:AccelByte/accelbyte-unreal-oss.git Plugins/AccelByte/OnlineSubsystemAccelByte
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
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
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
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
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.
Add all the plugins to your
AccelByteWars.uproject
file:"Plugins": [
...
{
"Name": "AccelByteUe4Sdk",
"Enabled": true
},
{
"Name": "OnlineSubsystemAccelByte",
"Enabled": true
},
{
"Name": "AccelByteNetworkUtilities",
"Enabled": true
}
]Add the plugins to your
/Source/AccelByteWars.Target.cs
file:ExtraModuleNames.AddRange(
new string[]
{
"AccelByteWars",
"AccelByteUe4Sdk",
"OnlineSubsystemAccelByte",
"AccelByteNetworkUtilities"
}
);Add the plugins to your
/Source/AccelByteWarsEditor.Target.cs
file:ExtraModuleNames.AddRange(
new string[]
{
"AccelByteWars",
"AccelByteUe4Sdk",
"OnlineSubsystemAccelByte",
"AccelByteNetworkUtilities"
}
);Register the plugins to
PublicDependencyModuleNames
in your/Source/AccelByteWars/AccelByteWars.Build.cs
filePublicDependencyModuleNames.AddRange(
new string[]
{
...
"AccelByteUe4Sdk",
"AccelByteNetworkUtilities",
"OnlineSubsystemAccelByte",
...
}
);Regenerate the Visual Studio project files and compile.
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.
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.
- 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, 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.
Leave all other fields unchanged and click Create to create the new IAM client.
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, fill out the fields using the configurations below.
- Client Type: the confidentiality of the IAM client. Since the you want the IAM client to be public, set it to Public.
- Client Name: the name of the IAM client. Set it to ByteWars-GameClient.
- Redirect URI: the URI used to redirect once the IAM client authorization is successful. Set it to
https://127.0.0.1
.
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.
Open
/Config/DefaultEngine.ini
in a text editor.Find the
[/Script/AccelByteUe4Sdk.AccelByteSettings]
section insideDefaultEngine.ini
and replace theClient ID
with your public IAM client information. Also, replace other placeholder values based on your game namespace and AGS environment.- AGS Shared Cloud
- AGS Private Cloud
[/Script/AccelByteUe4Sdk.AccelByteSettings]
ClientId=<game_iam_client_id>
ClientSecret=
Namespace=<game_namespace_id>
PublisherNamespace=
BaseUrl="https://<game_namespace_id>.prod.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.
[/Script/AccelByteUe4Sdk.AccelByteSettings]
ClientId=<game_iam_client_id>
ClientSecret=
Namespace=<game_namespace_id>
PublisherNamespace=accelbyte
BaseUrl="https://<studio_name>.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.
- PublisherNamespace is the publisher ID of your publisher namespace. The default value is
accelbyte
. - BaseUrl is the URL of 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.
Save the
DefaultEngine.ini
file and rebuild your Byte Wars project.
Verify AGS Game SDK configuration
Ensure that you have the log level for
LogAccelByteOSS
inConfig/DefaultEngine.ini
set to Log or higher.[Core.Log]
LogAccelByteOSS=LogSave and close the
DefaultEngine.ini
file.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!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 " "
.