Integrate Amazon GameLift FleetIQ into a game server - Amazon GameLift

Integrate Amazon GameLift FleetIQ into a game server

This topic describes the tasks required to prepare your game server project to communicate with Amazon GameLift FleetIQ. Refer to Amazon GameLift FleetIQ best practices for additional guidance.

Register game servers

When a game server process is launched and ready to host live gameplay, it must register with Amazon GameLift FleetIQ by calling RegisterGameServer(). Registering allows Amazon GameLift FleetIQ to respond to matchmaking systems or other client services when they request information on server capacity or claim a game server. When registering, the game server can provide Amazon GameLift FleetIQ with relevant game server data and connection information, including the port and IP address that it uses for inbound client connections.

AWS gamelift register-game-server \ --game-server-id UniqueId-1234 \ --game-server-group-name MyLiveGroup \ --instance-id i-1234567890 \ --connection-info "1.2.3.4:123" \ --game-server-data "{\"key\": \"value\"}"

Update game server status

Once a game server is registered, it should regularly report health and utilization status in order to keep the state of server capacity in sync on Amazon GameLift FleetIQ. Report health and utilization status by calling UpdateGameServer(). In the example below, the game server is reporting that it is healthy and is not currently occupied with hosting players or gameplay.

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

Health status

If your game server has a mechanism for tracking health status, you can use this mechanism to trigger a game server health update to Amazon GameLift FleetIQ.

Utilization status

Reporting game server utilization status keeps Amazon GameLift FleetIQ informed on which game servers are currently ideal and available for new game sessions. Your game server must have a mechanism that triggers a utilization status update to Amazon GameLift FleetIQ. For example, you might trigger the update when players connect to the game server or when a game session starts.

When starting a game session, client or matchmaking services claim an available game server (by calling ClaimGameServer()), prompt players to connect to the game server, and trigger the game server to start gameplay. This process is described in Integrate Amazon GameLift FleetIQ into a game client. A game server "claim" is valid for 60 seconds, and the game server must be able to update utilization status withing this window. If utilization status is not updated, Amazon GameLift FleetIQ removes the claim, assumes that the game server is available, and may reserve the game server for another client claim request.

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

Deregister game servers

When a game concludes, the game server must deregister from Amazon GameLift FleetIQ using DeregisterGameServer().

AWS gamelift deregister-game-server \ --game-server-group-name MyLiveGroup \ --game-server-id UniqueId-1234