How Amazon GameLift FlexMatch works - Amazon GameLift

How Amazon GameLift FlexMatch works

This topic provides an overview of the GameLift FlexMatch service, including the core components of a FlexMatch system and how they interact.

You can use FlexMatch with games that use GameLift managed hosting or with games that use another hosting solution. Games that are hosted on GameLift servers, including Realtime Servers, use the integrated GameLift service to automatically locate available game servers and start game sessions for the matches. Games that use FlexMatch as a standalone service, including GameLift FleetIQ, must coordinate with the existing hosting system to assign hosting resources and start game sessions for the matches.

For detailed guidance on setting up FlexMatch for your games, see .

Matchmaking components

A FlexMatch matchmaking system includes some or all of the following components.

GameLift components

These are GameLift resources that control how the FlexMatch service performs matchmaking for your game. They are created and maintained using GameLift tools, including the console and the AWS CLI or, alternatively, programmatically using the AWS SDK for GameLift.

  • FlexMatch matchmaking configuration (also called a matchmaker) – A matchmaker is a set of configuration values that customizes the matchmaking process for your game. A game can have multiple matchmakers, each configured for different game modes or experiences ass needed. When your game sends a matchmaking request to FlexMatch, it specifies which matchmaker to use.

  • FlexMatch matchmaking rule set – A rule set contains all the information that is needed to evaluate players for a potential matches and approve or reject. The rule set defines a match's team structure, declares the player attributes that are used for evaluation, and provides rules that describe the criteria for an acceptable match. Rules can apply to individual players, teams, or the entire match. For example, a rule might require that every players in the match choose the same game map, or it might require that all teams have similar player skill average.

  • GameLift game session queue (for FlexMatch with GameLift managed hosting only) – A game session queue locates available hosting resources and starts a new game session for the match. The queue's configuration determines where GameLift looks for available hosting resources and how to select the best available host for a match.

Custom components

The following components encompass functionality that's required for a complete FlexMatch system that you must implement based on the architecture of your game.

  • Player interface for matchmaking – This interface enables players to join a match. At a minimum, it initiates a matchmaking request through the client matchmaking service component and provides player-specific data, such as skill level and latency data, as needed for the matchmaking process.

    Note

    As a best practice, communication with the FlexMatch service should be done by a backend service, not from a game client.

  • Client matchmaking service – This service fields the player join requests from the player interface, generates matchmaking requests, and sends them to the FlexMatch service. For requests in process, it monitors matchmaking events, tracks matchmaking status, and takes action as needed. Depending on how you manage game session hosting in your game, this service may return game session connection information back to players. This component uses the AWS SDK with the GameLift API to communicate with the FlexMatch service.

  • Match placement service (for FlexMatch as a standalone service only) – This component works with your existing game hosting system to locate available hosting resources and start new game sessions for matches. The component must get the matchmaking results and extract the information needed to start a new game session, including player IDs, attributes, and team assignments for all players in the match.

FlexMatch matchmaking process

This topic describes a basic matchmaking scenario and interactions between the various your game components and the FlexMatch service.

Request matchmaking for players

A player using your game client clicks a "Join Game" button. This action causes your client matchmaking service to send a matchmaking request to FlexMatch. The request identifies the FlexMatch matchmaker to use when fulfilling the request. The request also includes player information that your custom matchmaker requires, such as skill level, play preferences, or geographic latency data. You can make matchmaking requests for one player or multiple players.

Add requests to the matchmaking pool

When FlexMatch receives the matchmaking request, it generates a matchmaking ticket and adds it to the matchmaker's ticket pool. The ticket remains in the pool until it is matched or a maximum time limit is reached. Your client matchmaking service is periodically notified about matchmaking events, including changes in ticket status.

Build a match

Your FlexMatch matchmaker continually runs the following process on all tickets in its pool:

  1. The matchmaker sorts the pool by ticket age, then begins building a potential match starting with the oldest ticket.

  2. The matchmaker adds a second ticket to the potential match and evaluates the result against your custom matchmaking rules. If the potential match passes evaluation, the ticket's players are assigned to a team.

  3. The matchmaker adds the next ticket in sequence and repeats the evaluation process. When all player slots have been filled, the match is ready.

Matchmaking for large matches (41 to 200 players) uses a modified version of the process described above so that it can build matches in a reasonable time frame. Instead of evaluating each ticket individually, the matchmaker divides a pre-sorted ticket pool into potential matches, and then balances each match based on a player characteristic that you've specified. For example, a matchmaker might pre-sort tickets based on similar low-latency locations, and then use post-match balancing to make sure that the teams are evenly matched by player skill.

Report matchmaking results

When an acceptable match is found, all matched tickets are updated and a successful matchmaking event is generated for each matched ticket.

  • FlexMatch as a standalone service: Your game receives match results in a successful matchmaking event. Result data includes a list of all matched players and their team assignments. If your match requests contain player latency info, the results also suggest an optimal geographic location for the match.

  • FlexMatch with a GameLift hosting solution: Match results are automatically passed to a GameLift queue for game session placement. The matchmaker determines which queue is used for game session placement.

Start a game session for the match

After a proposed match is successfully formed, a new game session is started. Your game servers must be able to use the matchmaking result data, including player IDs and team assignments, when setting up a game session for the match.

  • FlexMatch as a standalone service: Your custom match placement service gets match result data from successful matchmaking events, and connects to your existing game session placement system to locate an available hosting resource for the match. After a hosting resource is found, the match placement service coordinates with your existing hosting system to start a new game session and acquire connection information.

  • FlexMatch with a GameLift hosting solution: The game session queue locates the best available game server for the match. Depending on how the queue is configured, it tries to place the game session with the lowest-cost resources and where players will experience low latency (if player latency data is provided). Once the game session is successfully placed, the GameLift service prompts the game server to start a new game session, passing on the matchmaking results and other optional game data.

Connect players to the match

After a game session is started, players connect to the session, claim their team assignment, and begin gameplay.

  • FlexMatch as a standalone service: Your game uses the existing game session management system to provide connection information back to players.

  • FlexMatch with a GameLift hosting solution: On a successful game session placement, FlexMatch updates all of the matched tickets with game session connection information and a player session ID.