Development roadmap for hosting with Amazon GameLift Anywhere
This roadmap guides you through how to develop a hosting solution for your multiplayer game to use with your own resources (on-premises hardware or virtual machines). Amazon GameLift offers several game hosting options; for more information on these options, see Amazon GameLift solutions.
With Amazon GameLift Anywhere hosting, your game server is hosted on computing resources that you supply and manage. You can create an Anywhere fleet with the configurations that you need and geographically located wherever your players are. Amazon GameLift delivers the following features for an Anywhere fleet:
-
Handles the game session placement process for you based on your configuration, including:
-
Tracking game server availability across your Anywhere fleets.
-
Processing game requests from your game client service and matching game requests with available servers.
-
Prompting game servers on Anywhere fleets to start game sessions.
-
Communicating connection details back to game clients.
-
-
Collects performance metrics for the session placement process and usage metrics for game sessions and players.
-
Supports the full FlexMatch matchmaking feature set, so that you can build a matchmaker and integrate it with the game session placement system.
-
Offers the Amazon GameLift Agent to handle key host management tasks on an Anywhere fleet.
-
Supports combining with Amazon GameLift managed fleets for a flexible hybrid solution.
An Amazon GameLift Anywhere solution is composed of the following components:
-
One or more Amazon GameLift Anywhere fleets with your on-premises or other hosting resources, managed with your existing configuration management and deployment tooling. (You can optionally use the AWS Systems Manager.)
-
A game server build, integrated with the Amazon GameLift server SDK, to deploy across all fleets.
-
A game client and backend service, integrated with the AWS SDK, to interact with the Amazon GameLift service and request game sessions.
-
An Amazon GameLift queue to place new game sessions with available game servers across all fleets.
-
(Optional) A FlexMatch matchmaker to create multi-player matches and set up game sessions for them.
This roadmap presents a streamlined path to getting your multiplayer game up and running successfully with Amazon GameLift Anywhere hosting. After you have the necessary components in place, you can continue to iterate on game development and customize your hosting solution. As you get closer to launch, see these Preparing your game for launch with Amazon GameLift hosting for help with preparing your hosting solution for production-level usage.
Get a jump start with the Amazon GameLift plugin
If you're developing projects with Unreal Engine or Unity, start setting up your game for hosting with the Amazon GameLift plugin. With the plugin, you can add the Amazon GameLift SDKs to your game project and use the guided workflows to build a simple working version of a hosting solution with Amazon GameLift Anywhere. You can then use these fundamentals to build on and customize as needed.
Add functionality to your game server so that it can communicate with the Amazon GameLift service when it's deployed for hosting.
-
Get the Amazon GameLift server SDK (version 5.x) for your game project. The server SDK is available in C++, C#, and Go. Download a Amazon GameLift server SDK
. -
Modify your game server code to add server SDK functionality. For guidance, see Integrate games with custom game servers. At a minimum, do the following:
-
Add code to initialize the Amazon GameLift SDK and establish a WebSocket connection with the Amazon GameLift service. Use the server SDK action
InitSdk()
and include server parameters, which are required for an Anywhere fleet. -
Add code to report to the Amazon GameLift service when the server process is ready to host game sessions. Use the server SDK action
ProcessReady()
. -
Implement the required callback functions
OnRefreshConnection()
,OnProcessTerminate()
, andOnStartGameSession()
. With these functions, game server processes can maintain a connection with the Amazon GameLift service, initiate a game session when prompted by Amazon GameLift, and respond to a prompt to end the game server process. -
Add code to report to the Amazon GameLift service when the server process is ending a game session. Use the server SDK action
ProcessEnding()
.
-
-
Package your game server build. Create an install script with your build files, dependencies and supporting software. See Package your game build files. We recommend using an Amazon Simple Storage Service (Amazon S3) bucket to store versions of your game build.
-
Test your game server integration. For this task, we recommend setting up an Amazon GameLift Anywhere fleet for a local workstation, as described in Set up local testing with Amazon GameLift Anywhere. For this step, manually install your game server build onto the test device and start a server process. Use the AWS CLI to request a new game session, and verify that the Amazon GameLift service successfully prompts your server process to start a game session.
Create a way for your game client to request to join a game session, get connection info, and then connect directly to a hosted game session. The most common approach is to set up backend service functionality that serves as a middleman between your game client and the Amazon GameLift service. This approach protects your hosting resources and gives you greater control over how players are placed into game sessions.
-
Build backend service functionality for hosting. The backend service communicates with the Amazon GameLift service and delivers connection information to a game client. This functionality includes starting game sessions, placing players into games, and retrieving game session information. For guidance, see Integrate games with custom game servers. At a minimum, do the following:
-
Get the AWS SDK for Amazon GameLift and add it to your backend service project. See Amazon GameLift SDK resources for client services.
-
Add code to initialize an Amazon GameLift client and store key settings. See Set up Amazon GameLift on a backend service.
-
Add functionality to call the AWS SDK action
CreateGameSession()
and provide game session connection information to a game client. See Create a game session on a specific fleet.Calling
CreateGameSession()
is a convenient starting point for requesting new game sessions, After you have a game session placement system in place (see Step 3), you'll replace this code with a call toStartGameSessionPlacement()
(orStartMatchmaking()
if you're using FlexMatch).For guidance on designing your backend service, see Design your game client service.
-
-
Add functionality to your game client that lets players join a hosted game session. The game client makes requests to your backend service, not directly to Amazon GameLift. After the backend service provides game session connection information, the game client connects directly with the game session to play the game.
-
Test your game client integration. You can use the same Amazon GameLift Anywhere fleet with local workstations for testing.
Customize how you want Amazon GameLift to process requests for new game session and locate available game servers to host them. Amazon GameLift automatically tracks the availability of all game servers on all fleets. When a game client sends a request to join a game session, Amazon GameLift looks for the "best possible" placement based on a set of defined priorities such as minimum latency, cost, and availability.
-
Create a game session queue for placing new game session with available game servers. Queues are the primary mechanism for game session placement. For guidance, see Create a game session queue.
-
At minimum, add your Anywhere fleets as destinations in your queue. All other settings are optional.
-
-
In your backend service code, convert the
CreateGameSession()
call toStartGameSessionPlacement()
. See Create a game session in a multi-location queue. -
Create a mechanism to notify a game client when a game session is ready to join. While in development, you can poll for game session status using a call to DescribeGameSessionPlacement. Before using a queue to process high volumes, however, you'll need to enable event notifications. See Set up event notification for game session placement.
-
(Optional) Add FlexMatch matchmaking components. For guidance, see the Amazon GameLift FlexMatch developer guide.
Up to this point you've been working with local devices (registered as Anywhere fleet computes) to test and iterate on your game components. The next step is to set up the type of fleet you'll need for a production system. For these resources, use the Amazon GameLift Agent to manage some key on-compute host management tasks. For more details, see Work with the Amazon GameLift Agent.
-
Get the Amazon GameLift Agent and add it to your game server install package. Get and build the Agent source code, available in the Amazon GameLift Agent Github repository
. Place the resulting JAR file executable into the same directory as your game build executable. -
Modify your startup script for the Agent as needed. Ensure that Agent executable launches as soon as a compute starts running. See the readme file in the Agent repo for help with installing and running the Agent on your hosting computes. Your launch command should include options to specify, at minimum, the Anywhere fleet ID and AWS Region, a custom location, and a compute name.
The Agent automatically handles the following tasks for you, so if you've been handling these tasks with scripts, you can remove them:
-
Calls
RegisterCompute()
to add the compute to an Anywhere fleet. -
Calls
GetComputeAuthToken()
to authenticate game servers when they connect to the Amazon GameLift service. The Agent manages getting and refreshing the auth token, which can be used by all game server processes that are running on the compute. -
Starts new server processes on the compute based on a set of runtime instructions.
-
-
Create a runtime configuration for computes in your Anywhere fleet. You can use the Amazon GameLift console or the AWS CLI to create or modify runtime instructions for the fleet. The Agent carries out these instructions and periodically requests updates from the Amazon GameLift service.
-
Set up or modify your game session queue as needed. Create a new queue (or update an existing one) to use the Anywhere fleets that are deployed with the Amazon GameLift Agent.
-
Test the Agent integration with your Anywhere fleets. Check that the Agent is properly starting server processes based on the runtime configuration.
As you prepare for game launch, you'll need to fine-tune your managed hosting resources. Some of the decisions to consider include:
-
Automate the process of starting and shutting down computes as needed, including installing and running game server software. Recycling computes is useful to ensure that they are updated regularly, and shutting down computes can save costs when they're not needed.
-
If your game server needs to communicate other AWS resources, set up IAM roles to manage access. See Communicate with other AWS resources from your fleets.
-
Determine where geographically you want to position game servers. Add remote locations to your managed fleets. See Customize your Amazon GameLift EC2 managed fleets.
-
Optimize fleet performance by selecting compute resource configurations, then configure the runtime instructions to run an optimal number of server processes per compute.
-
Experiment with game session placement options for managed fleets, including customizing prioritization settings. See Design a game session queue.
-
Create mechanisms to handle manual or automated capacity scaling to meet expected player demand. Consider what factors should prompt the system to increase or decrease the number of computes that are available to host game sessions.
-
Design and implement failover to other resources if needed.
-
Set up hosting observability tools, including analytics and logging. See Monitoring Amazon GameLift.