Tutorial on integrating Unreal with Amazon GameLift
Many times on here, I see questions about the confusing process of deploying a dedicated server to Amazon GameLift. These questions are warranted because of Amazon's lackluster documentation. To ease the process, I decided to make a very simple tutorial on how to host a server on aws gamelift. Click here to watch.
These are some of the tiny things that gave me trouble that I go over to make sure that you don't spend endless hours debugging a stupid issue:
- Building Unreal source
Make sure you have the right .NET Framework SDKs and targeting packs installed (I happened to have both 4.5 and 4.6.1 installed). It seems for Visual Studio 2019, in addition to 4.5 and 4.6.1, you need to install .NET Framework SDK version 4.6.2. Note that you don't need every SDK installed, just the targeting packs and the SDK for the highest version since targeting only works backwards. Visual Studio 2019 came with SDK version 4.7.1 so I'm not sure if you need this too but download it just in case.
Make sure you have MSBuild (under individual components of the Visual Studio Installer) installed whether it's through the IDE or separately through the build tools.
Make sure you have the VC++ toolset (under individual components of the Visual Studio Installer) installed whether it's 2015 or 2017 or 2019.
Before running the Setup and GenerateProjectFiles batch files, make sure the file path of the directory in which you are running the files in isn't too long. Also, if using Visual Studio 2017, you need to add the -2017 tag when running GenerateProjectFiles. If using Visual Studio 2019, you need to add the -2019 tag when running GenerateProjectFiles.
Before compiling Unreal Engine, go to the VCToolChain.cs file located at the file path, Engine\Source\Programs\UnrealBuildTool\Platform\Windows. And after line 484, add these two lines,
This is to suppress certain warnings and will be fixed in 4.22.1.
- Generating GameLiftServerSDK lib and dll files
When installing cmake and msbuild tools, make sure the file paths in your path variable are correct. For msbuild, the path with depend on your version of visual studio:
Also, make sure your VCTargetsPath path variable is right depending on which version of build tools are being used:
Note that this process currenlty doesn't work with Visual Studio 2019 build tools, so you will have to use 2017 or 2015 build tools in the meantime.
With that noted, it may be good to define another system environment variable called VS140COMNTOOLS, VS150COMNTOOLS, or VS160COMNTOOLS. 140 corresponds with 2015, 150 corresponds with 2017, and 160 corresponds with 2019. And the value for this variable should be
Don't forget to have Git installed!
You will need to download the Visual C++ tools for Cmake as well.
And again, make sure the file path of the directory in which you're running cmake and msbuild commands is not too long.
The cmake command for building the dll and lib files will depend on your version of visual studio:
The -G in the commands above are optional, but it can prevent errors when you're using cmake with different versions of visual studio.
- Adding the gameliftserversdk and gameliftclientsdk plugins to your unreal project
Make sure to add
- Creating an iAM user with a security policy in AWS
Make sure your AWS CLI is configured with a user with admin privileges.
Save the access and secret access keys for your newly created user (with limited permissions) somewhere, you will need them...
- Packaging the project and preparing it for upload to GameLift
I've noticed that when trying to package an Unreal Engine project with both Visual Studio 2017 and 2019 installed, Unreal will default to using the 2017 version. The reason I had both was because I need the 2017 build tools to build the gameliftserversdk dll and lib files. After I did that step, I removed Visual Studio 2017 so that I can continue using Visual Studio 2019 with Unreal Engine.
Make sure to install the Visual C++ redistributable and add them to your packaged build.
Something that the Amazon documentation should have provided was an example install.bat file for the server build. Here's what it would look like,
Also, make sure that the plugins are actually in the packaged build. Sometimes they're not transferred over, so you'll have to copy and paste them.
Source code for an easy example project to follow can be found here: https://github.com/chris-gong/gamelift-example-ue4
I hope this helps, good luck everyone!
Follow this question
Once you sign in you will be able to subscribe for any updates here