Integrate Amazon GameLift FleetIQ into a game client - Amazon GameLift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Integrate Amazon GameLift FleetIQ into a game client

This topic describes the tasks required to prepare your game client or matchmaking service to communicate with Amazon GameLift FleetIQ in order to acquire a game server to host a game session.

Create a method that allows your game client or matchmaker to request a game server resource for players. You have a couple of options for how to do this:

  • Have Amazon GameLift FleetIQ choose an available game server. This option takes advantage of Amazon GameLift FleetIQ optimizations to use low-cost Spot Instances and for automatic scaling.

  • Request all available game servers and select one to use (often referred to as "list and pick").

Let Amazon GameLift FleetIQ choose a game server

To have Amazon GameLift FleetIQ choose an available game server, call ClaimGameServer() without specifying a game server ID. In this scenario, Amazon GameLift FleetIQ does exercise its logic to find a game server on an instance that is viable for game hosting and optimized for automatic scaling.

Amazon gamelift claim-game-server \ --game-server-group-name MyLiveGroup

In response to a claim request, Amazon GameLift FleetIQ identifies the GameServer resource, connection information, and game data, which clients can use to connect to the game server. The game server's claim status is set to CLAIMED for 60 seconds. Either your game server or client service needs to update the game server's status on Amazon GameLift FleetIQ after players connect or gameplay starts. This ensures that Amazon GameLift FleetIQ does not provide this game server in response to subsequent requests for game server capacity. Update game server status by calling UpdateGameServer().

Amazon gamelift update-game-server \ --game-server-group-name MyLiveGroup \ --game-server-id UniqueId-1234 \ --health-check HEALTHY \ --utilization-status UTILIZED

Choose your own game server

With the "list and pick" method, your game client or matchmaker requests a list of available game servers by calling ListGameServers(). You might want to use game server data to provide additional information that players or your matchmaker can use when selecting a game server. To control how results are returned, you can request paginated results and sort game servers by registration date. The following request returns 20 active and available game servers in the specified game server group, sorted by registration time with the newest game servers listed first.

Amazon gamelift list-game-servers \ --game-server-group-name MyLiveGroup \ --limit 20 \ --sort-order DESCENDING

Based on the list of available game servers, the client or matchmaking service selects a game server and claims it by calling ClaimGameServer() with the specific game server ID. In this scenario, Amazon GameLift FleetIQ does not exercise any of its instance type optimization logic, as described in Amazon GameLift FleetIQ logic.

Amazon gamelift claim-game-server \ --game-server-group-name MyLiveGroup \ --game-server-id UniqueId-1234