SuperNimbusKnowledge Base

Building The GameLift SDK

Introduction

In this section we will be showing how to use GameLift server SDK to allow communication between your server instance and the GameLift fleet

Note
This tutorial is part of a series of tutorials on deploying UE5 multiplayer builds with AWS GameLift.You can see Part 2 of this tutorial below.

In this section we will be building the AWS GameLift Server SDK using CMAKE and MSBUILD.

AWS provides the source code for the server SDK, but it is up to us to build the DLLs and lib files for whatever platform we will be deploying to.

For this example we will be building the server SDK DLL files for Windows. However, before we can do so, we need to install some tools and make sure that these programs are accessible as an environment PATH variable.

Installing OpenSSL

We will first need to install OpenSSL.

OpenSSL is a commonly used open-source software library used to implement secure communication over networks. It is required by the GameLift SDK and the installation also provides required .lib files that we will need to ship with our servers when hosting them on an AWS EC2 instance.

The easiest way to achieve this is to use the Windows installer you can download here.

Make sure that you get the version that GameLift expects. For this example the current version was the 3.0 series which was the current Long-Term Support (LTS) version.

Note
You must keep the version consistent, so whichever version you install here is the one we will be using later when uploading our builds to GameLift. We have successfully used the 1.0 series version of OpenSSL in the past as well, but all GameLift documentation points to the 3.0 series, so we will use that.

After the installation process is complete, we need to set up some additional environment variables that point to the installation directory. These are important when building the server SDK.

Open System Properties and open the Environment Variables window.

Create the following variables:

  1. OPENSSL_ROOT_DIR : path to the open SSL root directory
    C:\Program Files\OpenSSL-Win64″
  2. OPENSSL_LIBRARIES : path to the open SSL lib directory
    C:\Program Files\OpenSSL-Win64\lib”
  3. OPENSSL_INCLUDE_DIR : path to the open SSL include directory
    C:\Program Files\OpenSSL-Win64\include”

We also need to add the OpenSSL bin directory to PATH. Double-click on the Path variable in System variables to expand it. Select new on the right-hand side, and add the binaries directory path.

For this example it is: “C:\Program Files\OpenSSL-Win64\bin”

Installing CMAKE

CMake (Cross-Platform Make) is a tool that helps software developers create and manage the process of building and compiling their projects. CMAKE acts as a kind of “build recipe” that developers write to describe how their code should be turned into a working software application.

We can use it to prep the GameLift source code for a specific type of build.

To install CMAKE, you can download it from here and then install from the downloaded file.

After the installation, make sure that the executable is available from the command line.

This means making sure your CMAKE installation bin directory is added to the PATH environment variable as we did above in the OpenSSL example.

For our setup the directory lives at:

“C:\Program Files\CMake\bin”

To test this, you can run the command “cmake –help” in your shell.

Configuring MSBUILD

Next, we need to add MSBUILD to PATH. MSBUILD should already be installed with your version of Visual Studio.

MSBuild is a tool that takes care of the process of compiling and building software projects, turning your source code into usable programs or libraries by following the instructions provided in project files. It will turn the GameLift source code into usable .lib files that we need to include in the GameLift UE plugin.

In our case  the installation directory is located at:

“C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin”

Make sure that its executable is available from the shell with the command “msbuild -help”.

MSBuild requires another tool (VS Common Tools) which should also be already installed on your machine. We will however, need to set up a new environment variable that points to the installation directory of our VS Common Tools.

Create a new environment variable with the name: VS150COMNTOOLS. The value of this should be the directory where your VS common tools are located.

On our machine they are located at:

“C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools”

Building the Server SDK

Now we should have everything ready to build the AWS GameLift server SDK from the source code.

Download the latest version of the GameLift here.

Important
Make sure to download both the C++ Server SDK and the C++ Server SDK Plugin for Unreal.

Extract the zip file and then open a command prompt session with admin permissions in the “GameLift-Cpp-ServerSDK-5.1.0” sub-directory of the extracted folder.

For this example we extracted the zip file to our desktop to make this easier.

First, let’s make a new folder for the build files using the command:

mkdir out

Then run the CMAKE command:

cmake -G "Visual Studio 16 2019" -A x64 -DBUILD_FOR_UNREAL=1 -S . -B ./out

Next run the MSBUILD command:

msbuild ./out/ALL_BUILD.vcxproj /p:Configuration=Release

Note
We used the Windows command prompt to run all of the commands in this sections as we ran into issues using Git Bash.

Once the build is complete, you should see two required files in the following locations:

  1. aws-cpp-sdk-gamelift-server.dll -> out/prefix/bin
  2. aws-cpp-sdk-gamelift-server.lib -> out/prefix/lib

Copy those two files into the folder of the Unreal Plugin here:

GameLift-Unreal-plugin-5.1.0\GameLiftServerSDK\ThirdParty\GameLiftServerSDK\Win64”

That should be everything ready to implement some GameLift server code in our project.

Summary

Now we are ready to start building GameLift headless builds for our multiplayer example project. In the next section we will start adding some scripts to our server in order for GameLift to communicate with your headless builds.

Jump to section