AWS for Games Blog
Local testing to cloud deployment: development workflows in HAQM GameLift
In today’s competitive gaming landscape, delivering a seamless multiplayer experience is crucial for an optimal game play experience. Game developers face numerous challenges in managing game servers such as scaling servers to meet player demand, managing game deployment pipelines and optimizing server fleets for costs. From initial development to scaling for global player bases, HAQM GameLift addresses these challenges by providing robust server hosting and scaling solutions.
Let’s explore available development workflows using HAQM GameLift Anywhere. It helps game developers choose and implement the optimal approach to meet business, game and development environment requirements.
Understanding HAQM GameLift Anywhere: local development streamlined
HAQM GameLift Anywhere takes advantage of HAQM GameLift features with developer hosted resources. Anywhere fleets are commonly used as test environments for iterative development or alongside managed fleets in a hybrid hosting solution. The local development and test workflow begins on a local workstations, where development and testing game servers occur before deploying to an HAQM GameLift managed HAQM Elastic Compute Cloud (HAQM EC2) fleet or a container fleet.
Setting up a local HAQM GameLift Anywhere fleet is quick. You will need to create a custom location for a local workstation, and register the local workstation as a fleet compute source. An HAQM GameLift temporary authentication token (AuthToken) is required to connect to HAQM GameLift APIs. The AuthToken is generated with the HAQM Web Services (AWS) Command Line Interface (AWS CLI). Game session activity is replicated by creating a local game session and a test client that connects to the game session. Once you’re ready to transition to HAQM GameLift managed fleets, create an HAQM GameLift managed fleet, then change the game server InitSDK() code call to remove HAQM GameLift Anywhere fleet parameters. Finally, create a build resource and deploy to an HAQM GameLift managed fleet.
The following details steps for local game server development with HAQM GameLift Anywhere.
Local environment prerequisites
- Have local development resources in place to build with HAQM GameLift server SDKs or HAQM GameLift plugins for Unreal Engine or Unity.
- NOTE: Local development with Unreal Engine requires Unreal Editor built from source to package the server components for a multiplayer game.
- Download the latest version of AWS CLI, install, and configure credentials.
- Download appropriate HAQM GameLift server SDK or available HAQM GameLift plugin for Unreal or Unity.
- Install HAQM GameLift plugin for Unreal or plugin for Unity.
Create an HAQM GameLift Anywhere fleet
- In the AWS Management Console navigate to HAQM GameLift, then to Anywhere fleets in the console and select Create Anywhere fleet.
- Enter a Name for the fleet, a Metric group name, and select
- Choose Create location to create custom location.
- Name the location to reflect a local development environment and select Create.
- Choose the created Custom location you just named and select Submit.
- An HAQM GameLift Anywhere fleet will launch with compute type Anywhere.
Alternatively, you can use the AWS CLI to create locations and HAQM GameLift Anywhere fleets. To start, enter the following code:
aws gamelift create-location -–location-name custom-MyLocalMachine
aws gamelift create-fleet --name MyAnywhereFleet --compute-type ANYWHERE –locations “Location=custom-MyLocalMachine”
With the HAQM GameLift Anywhere fleet and custom location created, register the local workstation as a fleet compute using the AWS CLI to connect a local workstation to the HAQM GameLift Anywhere fleet. The IP address should reflect the public IP of the local development workstation.
aws gamelift register-compute --compute-name MyLocalMachine --fleet-id arn:aws:gamelift:us-west-2: 111122223333:fleet/fleet- 2222bbbb-33cc-44dd-55ee-6666ffff77aa --ip-address 10.1.2.3 --location MyLocalMachine
To connect to the HAQM GameLift Anywhere fleet, use the AWS CLI to get an AuthToken for the HAQM GameLift Anywhere fleet. The command response includes the AuthToken string and an ExpirationTimestamp value. Note the ExpirationTimestamp value. It is important to plan to refresh the token before expiration.
aws gamelift get-compute-auth-token --fleet-id arn:aws:gamelift:us-west-2:111122223333:fleet/fleet- 2222bbbb-33cc-44dd-55ee-6666ffff77aa --compute-name MyLocalMachine
Response syntax should read as:
Use the value for webSocketUrl returned by the register-compute command, the AuthToken string, the local location name, HAQM GameLift Anywhere fleet ARN and string for processId as serverParameters in the game server code to connect to the HAQM GameLift Anywhere fleet.
The follow HAQM GameLift C++ SDK integration code snippet uses example values for HAQM GameLift Anywhere serverParameters.
To transition to HAQM GameLift managed fleets, remove or comment out the server parameters and the serverParameter variable in the InitSDK() call. Generate a build resource and deploy to HAQM GameLift managed fleets. ServerParameter values are set with launch, or environment, variables with game server logic determining when to use them.
Local game server testing
With the HAQM GameLift Anywhere fleet created, the local workstation registered and game server integration work done, game servers can be built locally and run while using the HAQM GameLift Anywhere fleet as a compute resource. The fleet supports game server backend integration with HAQM GameLift and allows provisioning of game sessions locally for testing.
HAQM GameLift features such as queues, sessions, and HAQM GameLift FlexMatch are available for use while testing the game server. To launch HAQM GameLift features for testing, create a queue, a FlexMatch matchmaking rule set, a matchmaking configuration, a game session and a player session.
Start with HAQM GameLift queues and create an HAQM GameLift session queue with the AWS CLI.
aws gamelift create-game-session-queue --name "MyQueue" --destinations DestinationArn=arn:aws:gamelift:region: 111122223333:fleet/fleet- 2222bbbb-33cc-44dd-55ee-6666ffff77aa --timeout-in-seconds 600
Create an HAQM GameLift FlexMatch matchmaking rule set and matchmaking configuration.
With a matchmaking rule set defined, create an HAQM GameLift FlexMatch matchmaking configuration referencing the previously created rule set and queue.
aws gamelift create-matchmaking-configuration --name "MyMatchmakingConfig" --description "Basic matchmaking configuration" --game-session-queue-arns "arn:aws:gamelift:us-west-2: 111122223333:gamesessionqueue/MyQueue" --request-timeout-seconds 60 --rule-set-name "MyRuleSet" --notification-target "arn:aws:sns:region:account:MyMatchmakingTopic"
To start matchmaking with a straightforward multi-player scenario using the AWS CLI, reference the previously created matchmaking configuration. Identify test player Ids and a unique ticket-id.
The HAQM GameLift Anywhere fleet now has a queue, matchmaking rule set and a matchmaking configuration. The fleet is ready for game and player sessions.
Create game and player sessions in an HAQM GameLift Anywhere fleet.
aws gamelift create-game-session --fleet-id "fleet- 2222bbbb-33cc-44dd-55ee-6666ffff77aa" --maximum-player-session-count 2
Use the game session ID generated from the create-game-session command to create a player session.
aws gamelift create-player-session --game-session-id "game-1234" --player-id "player-1"
Local testing advantages
The local testing workflow begins with launching your game server process on your development machine. Once running, HAQM GameLift Anywhere provides fleet resources, allowing testing of points of integration. During local testing, game session management implementation is validated confirming proper handling of player connections, disconnections, and session state changes. The test cycle includes verifying the complete player session lifecycle, from initial connection through gameplay and eventual disconnection. Throughout this process, HAQM GameLift Anywhere supports monitoring server logs and metrics to identify issues and optimize performance.
A local development environment offers key advantages for developers. Game server code debugging occurs in near real-time using individual development environments (IDEs) and tools, while testing runs alongside production-like infrastructure resources. This environment allows developers to validate session management logic thoroughly and simulate production game scenarios.
Additionally, monitoring server-client communication patterns and profiling performance metrics verifies that your game meets its performance targets. Developers can execute integration testing with actual HAQM GameLift APIs, validating game servers operate as expected when deployed to production. Player session validation confirms proper authentication and authorization flows, maintaining security and preventing unauthorized access.
Container-based development with HAQM GameLift Anywhere
Developing multiplayer game servers using containers and HAQM GameLift Anywhere combines containerization flexibility with the game infrastructure capabilities of HAQM GameLift. This integration enables consistent environments from development to production. The workflow utilizes Docker containers to package game servers and dependencies, allowing identical operations across environments. This approach supports rapid local testing cycles while maintaining production configurations. Container rebuilds are efficient, and shared configurations eliminate environment inconsistencies.
The development architecture combines Docker containers stored in HAQM Elastic Container Registry (HAQM ECR), HAQM GameLift Anywhere for local testing, HAQM GameLift SDK for service integration, and AWS CLI for resource management. As the development cycle progresses from local testing to cloud deployment, developers can test containerized servers locally using HAQM GameLift Anywhere. Validated containers are pushed to HAQM ECR for deployment to HAQM GameLift managed container fleets. This consistent environment between local and cloud reduces troubleshooting overhead, allowing teams to focus on feature development and optimization.
For local development with containers, HAQM GameLift Anywhere and HAQM GameLift container fleets builds on the requirements of local game server development and adds the need for an HAQM ECR repository. While not required for local development, the repository hosts container images used by HAQM GameLift managed container fleets for production deployments.
If developing with the HAQM GameLift 2.0 plugins for Unreal Engine or Unity, the plugin expands on HAQM GameLift Anywhere integration while streamlining the transition to HAQM GameLift managed HAQM EC2 or container fleets.
In the following example, the Unreal Engine plugin is used to create an AWS user authentication profile, deploy an HAQM GameLift Anywhere feet, and transition a game server build to HAQM GameLift managed container fleets.
Unreal Engine plugin prerequisites
- You’ll need GitHub and Epic Games accounts for accessing the Unreal Engine project on GitHub.
- Unreal Editor versions 5.1, 5.2, 5.3, 5.4, 5.5 built from source.
- Install the HAQM GameLift plug for Unreal.
- For existing AWS accounts and users, an AWS Identity and Access Management (IAM) user with Access key ID and Secret access key is needed.
- An Unreal game server build.
- Docker installed.
In Unreal Editor
- Choose the HAQM GameLift
- Select AWS Access Credentials.
If an AWS account and user are needed:
- Select Go to AWS Management Console.
- If an account and user are available to complete profile setup, choose Add new profile.
The first option will direct you to the AWS Console to create an account and user. Note for existing AWS accounts and users, using Add new profile requires an IAM username, access key ID and Secret access key. These credentials are used to create HAQM GameLift resources.
After successfully adding a profile, bootstrap the profile by clicking on the bootstrap prompt. If bootstrapping was successful, a message will indicate success and a bootstrap status as Active.
With an active profile, local development can use an HAQM GameLift Anywhere fleet, which is supported with the plugin. Utilize existing HAQM GameLift Anywhere fleets or new fleets created with the plugin. Set the game server path and follow the Anywhere fleet workflow path.
After the fleet Is available:
- connect to an Anywhere fleet.
- Register your workstation as fleet compute.
Once the local workstation registration process completes, launch and test the game server using HAQM GameLift Anywhere fleets with queues, HAQM GameLift FlexMatch and game sessions.
When you are ready to transition a game server build to either an HAQM GameLift managed HAQM EC2 or container fleets, the plugin supports these workflows. For containers, the plugin creates a container using Docker, if one does not already exist, and optionally stores the container image in HAQM ECR. Developers then deploy the container to single or multi-location HAQM GameLift container managed fleets by selecting Deploy Container Fleet.
Conclusion
The choice of using HAQM GameLift development workflows fundamentally shapes game development lifecycles and operational efficiency. HAQM GameLift Anywhere serves as an ideal starting point, offering the flexibility developers need for local development and testing. This approach allows teams to iterate quickly using their local development environment.
Container-based solutions build upon this foundation by providing consistency across environments and supporting scalable deployment patterns that grow with your needs. HAQM GameLift Anywhere, combined with HAQM GameLift managed HAQM EC2 and container fleets, offers seamless transitions. Developers can progress from game server local development, to testing in a production-like environment, to production fleets without the cost of production replicated testing and staging environments.
Try out the workflows and tools and let us know what you think. Contact an AWS Representative to know how we can help accelerate your business.
Further reading