Plugin for Unreal: Deploy your game to managed EC2 fleets - Amazon GameLift

Plugin for Unreal: Deploy your game to managed EC2 fleets

In this workflow, you use the plugin to modify your game for hosting on cloud-based compute resources managed by Amazon GameLift. You add client and server game code for Amazon GameLift functionality, then upload your server build to the Amazon GameLift service for deployment to the cloud-based resources. When this workflow is complete, you'll have a working game client that can connect to your game servers in the cloud.

To start the Amazon GameLift managed Amazon EC2 workflow:
  • In the Unreal editor main toolbar, choose the Amazon GameLift menu, and select Host with Managed EC2. This action opens the plugin page Deploy Amazon EC2 Fleet, which presents a six-step process to integrate, build, deploy, and launch your game components.

Step 1: Set your profile

Choose the profile you want to use when following this workflow. The profile you select impacts all steps in the workflow. All resources you create are associated with the profile's AWS account and are placed in the profile's default AWS Region. The profile user's permissions determine your access to AWS resources and actions.

To set a user profile
  1. Select a profile from the dropdown list of available profiles. If you don't have a profile yet or want to create a new one, go to the Amazon GameLift menu and choose Set AWS User Profiles.

  2. If bootstrap status is not "Active", choose Bootstrap profile and wait for the status to change to "Active".

Step 2: Set up your game code

In this step, you make a series of updates to your client and server code to add hosting functionality. If you haven't already set up a source-built version of the Unreal editor, the plugin provides links to instructions and source code.

If you integrated your game for use with an Anywhere fleet, you don't need to make any changes to your game code. If you're using the startup game map, this works with EC2 deployments also.

After building your game server, complete the following tasks to prepare it for uploading to Amazon GameLift.

To package your server build for cloud deployment

In the WindowsServer folder, where the Unreal editor packages your server build files by default, make the following additions

  1. Copy the install script, included in the plugin download, into the root of the WindowsServer folder. Look for the file [project-name]/Plugins/Resources/CloudFormation/extra_server_resources/install.bat. Amazon GameLift uses this file to install the server build on each EC2 hosting resource.

  2. Copy the VC_redist.x64.exe file, included in your Visual Studio installation, into the root of the WindowsServer folder. This file is commonly located at C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Redist/MSVC/v142.

  3. Copy the OpenSSL DLLs for your game server build into the folder WindowsServer/MyGame/Binaries/Win64. Make sure the DLLs are for same version used in the server build. Copy the following files:

    • libssl-3-x64.dll

    • libcrypto-3-x64.dll

Step 3: Select deployment scenario

In this step, you choose the game hosting solution that you want to deploy at this time. You can have multiple deployments of your game, using any of the scenarios.

  • Single-region fleet: Deploys your game server to a single fleet of hosting resources in the active profile's default AWS region. This scenario is a good starting point for testing your server integration with AWS and server build configuration. It deploys the following resources:

    • AWS fleet (On-Demand) with your game server build installed and running.

    • Amazon Cognito user pool and client to enable players to authenticate and start a game.

    • API gateway authorizer that links user pool with APIs.

    • WebACl for throttling excessive player calls to API gateway.

    • API gateway + Lambda function for players to request a game slot. This function calls CreateGameSession() if none are available.

    • API gateway + Lambda function for players to get connection info for their game request.

  • FlexMatch fleet: Deploys your game server to a set of fleets and sets up a FlexMatch matchmaker with rules to create player matches. This scenario uses low-cost Spot hosting with a multi-fleet, multi-location structure for durable availability. This approach is useful when you're ready to start designing a matchmaker component for your hosting solution. In this scenario, you'll create the basic resources for this solution, which you can customize later as needed. It deploys the following resources:

    • FlexMatch matchmaking configuration and matchmaking rule set to accept player requests and form matches.

    • Three AWS fleets with your game server build installed and running in multiple locations. Includes two Spot fleets and one On-Demand fleet as a backup.

    • AWS game session placement queue that fulfills requests for proposed matches by finding the best possible hosting resource (based on viability, cost, player latency, etc.) and starting a game session.

    • Amazon Cognito user pool and client to enable players to authenticate and start a game.

    • API gateway authorizer that links user pool with APIs.

    • WebACl for throttling excessive player calls to API gateway.

    • API gateway + Lambda function for players to request a game slot. This function calls StartMatchmaking().

    • API gateway + Lambda function for players to get connection info for their game request.

    • Amazon DynamoDB tables to store matchmaking tickets for players and game session information.

    • SNS topic + Lambda function to handle GameSessionQueue events.

Step 4: Set game parameters

In this step, you describe your game for uploading to AWS;

  • Server build name: Provide a meaningful name for your game server build. AWS uses this name to refer to the copy of your server build that's uploaded and used for deployments.

  • Server build OS: Enter the operating system that your server is built to run on. This tells AWS what type of compute resources to use to host your game.

  • Game server folder: Identify the path to your local server build folder.

  • Game server build: Identify the path to the game server executable.

  • Game client path: Identify the path to the game client executable.

  • Client configuration output: This field needs to point to a folder in your client build that contains your AWS configuration. Look for it in the following location: [client-build]/[project-name]/Content/CloudFormation.

Step 5: Deploy scenario

In this step, you deploy your game to a cloud hosting solution based on the deployment scenario you chose. This process can take several minutes while AWS validates your server build, provisions hosting resources, installs your game server, launches server processes, and gets them ready to host game sessions.

To start deployment, choose Deploy CloudFormation. You can track the status of your game hosting here. For more detailed information, you can sign in to the AWS Management console for AWS and view event notifications. Be sure to sign in using the same account, user, and AWS Region as the active user profile in the plugin.

When deployment is complete, you have your game server installed on an AWS EC2 instance. At least one server process is running and ready to start a game session.

Step 6: Launch client

At this point, you've completed all of the tasks needed to launch and play your multiplayer game hosted with Amazon GameLift. To play the game, launch an instance of you game client.

If you deployed the single fleet scenario, you can open a single client instance with one player, enter the server map and move around. Open additional instances of the game client to add a second player to the same server game map.

If you deployed the FlexMatch scenario, the solution waits for at least two clients to be queued for game session placement before the players can enter the server map.