Environment
- Visual Studio 2017 (15.5.5)
- UE4.18.3
- Amazon GameLift Cpp Server SDK 3.1.7
.
Tips to integrate Amazon GameLift Server SDK into UE4
To build GameLift Server SDK
- Basically refer to the official guide:
- Add Amazon GameLift to an Unreal Engine Game Server Project - Amazon GameLift
- This official guide seems too rough to follow.
- Change
cmake
parameter:
- before:
cmake -G "Visual Studio 14 2015 Win64" -DBUILD_FOR_UNREAL=1 ..
- after:
cmake -G "Visual Studio 15 2017 Win64" -DBUILD_FOR_UNREAL=1 -DBUILD_SHARED_LIBS=1 ..
- Change
boost
version:
-
1.61.0
→1.64.0
(Caution: you’d better not try any higher version…) - Refer to https://gamedev.amazon.com/forums/articles/62441/compiling-gamelift-for-visual-studio-2017.html
- You may meet an encoding error on
gtest-internal.h
. Fix it manually:
- You’d better run
msbuild
onx64 Native Tools Command Prompt for VS 2017
, not on any normal command prompt.
After building it successfully, you should find:
GameLift-Cpp-ServerSDK-3.1.7\out\prefix\lib\aws-cpp-sdk-gamelift-server.lib
GameLift-Cpp-ServerSDK-3.1.7\out\prefix\bin\aws-cpp-sdk-gamelift-server.dll
.
To update GameLiftServerSDK Plugin
-
Since UE4.16, Change the plugin’s constructor:
// GameLift-Unreal-plugin-3.1.7\GameLiftServerSDK\Source\GameLiftServerSDK\GameLiftServerSDK.Build.cs
// before
public GameLiftServerSDK(TargetInfo Target)// after
public GameLiftServerSDK(ReadOnlyTargetRules Target) : base(Target) -
Enable exceptions to suppress error C4577, in constructor:
// GameLift-Unreal-plugin-3.1.7\GameLiftServerSDK\Source\GameLiftServerSDK\GameLiftServerSDK.Build.cs
public GameLiftServerSDK(ReadOnlyTargetRules Target) : base(Target)
{
// …
if (bHasGameLiftSDK)
{
if (Target.Type == TargetRules.TargetType.Server)
{
bEnableExceptions = true;
// …
}
// …
}
}
.
To integrate GameLiftServerSDK Plugin into your project
- Copy the lib/dll files into
GameLift-Unreal-plugin-3.1.7\GameLiftServerSDK\ThirdParty\GameLiftServerSDK\Win64
directory(it was initially empty when you unzipped the downloaded sdk zip file). - Copy the whole
GameLift-Unreal-plugin-3.1.7\GameLiftServerSDK
directory intoYourGame\Plugins
directory.
- As a result, you can find the lib/dll files on this directory:
**YourGame\Plugins\GameLiftServerSDK\ThirdParty\GameLiftServerSDK\Win64
- Update
YourGame.uproject
andSource\YourGame\YourGame.Build.cs
as the official guide, and plus:
-
in
YourGame.uproject
** You may want to build this plugin only for dedicated server.// in "Plugins"
{
“Name”: “GameLiftServerSDK”,
“Enabled”: true,
“WhitelistTargets”: [
“Server”
]
} -
in
Source/YourGame/YourGame.Build.cs
** Add this plugin into PublicDependencyModuleNames,
** and enable exceptions, only for dedicated server.
** MentionWITH_GAMELIFT
explicitly to suppress warning C4668.// constructor
public YourGame(ReadOnlyTargetRules Target)
: base(Target)
{
// …
if (Target.Type == TargetType.Server)
{
bEnableExceptions = true;PublicDependencyModuleNames.AddRange(new string[] { "GameLiftServerSDK", }); } else { Definitions.Add("WITH_GAMELIFT=0"); } // ...
}
You should build YourGame
successfully.
.