Lumberyard & Amazon GameLift Blog

Matchmaking, Your Way: Amazon GameLift FlexMatch and Game Session Queues

One of the crucial parts of any multiplayer game is ensuring that your players are quickly, consistently, and efficiently put into satisfying matches that keep them coming back for more.

To make that process better for you as a developer, Amazon GameLift now offers FlexMatch. This service provides a powerful range of customizable features that you can use to quickly create robust matchmaking. Whether you’re a game designer or backend engineer, FlexMatch’s customizable rules-based syntax simplifies the development process so you can tune your matchmaking exactly how you want it.

Using our analytics and the GUI in our management console, you can also quickly experiment with different settings to see how they affect the quality of the matches being played. The GUI makes data accessible for designers who want to experiment.

In this post, we’ll discuss how FlexMatch works with our game session queues, using flexible rules to create matches and then automatically place those matches into games. We’ll also show you how to use our analytics to track and iterate on your game rules. Finally, we’ll discuss advanced FlexMatch settings that let you customize your game’s matchmaking process even further.

Matchmaking: Questions to Answer

The challenge of matchmaking is striking the right balance between how fast matches are created and how optimal those matches are. As a game developer, you know your players best. Maybe your players want as little wait time as possible. Maybe they are willing to wait a long time for the best possible match. Likely, there is a balance that you need to strike between these two ends of the matchmaking spectrum.

To players, the matchmaking that makes this all happen appears straightforward and simple. You as a developer know that creating and managing a flexible and efficient matchmaking system is anything but simple.

So, where to start? How do you build a system that players will deem a success? Here are some questions to ask when designing your matchmaking system:

  1. How long are your players willing to wait?
    You know your players, so what do your instincts and data tell you about their willingness to wait for a match? Maybe they want to match quickly, or maybe they want to wait for the best match. What does your game session length tell you about matchmaking? For games with short sessions, perhaps your players want to optimize for as many matches as possible in as little time as possible. For games with longer session times, your players might prefer to wait longer to find a better match. Does your player base have both competitive and casual gamers that have different needs? In that case, you may want to have multiple matchmakers – one for casual players that want fast matching, and one for competitive players with more balanced, competitive matches.
  2. How latency-tolerant does your game need to be?
    Generally speaking, players want the lowest latency between game and server as possible, and they want to be in matches with players that share that same low latency. Knowing your players, what’s acceptable for your game when it comes to latency? Are your players willing to wait longer to be matched with players with similar latencies? Do your players prioritize playing with friends regardless of latency? Do you have different populations of players with different priorities when it comes to latency? Knowing the answers here will help you determine how to segment your players.
  3. How important is player skill?
    Players define what makes a game fun in different ways, and many times, playing with other players that have the same skill level can go a long way to keeping the game fun. Do your players value being placed in matches with players of similar skill? Do they prefer to have a challenge and want to play with players better than they are? Do they not care about skill at all and simply want to match as fast as possible? Understanding how player skill fits into your matchmaking will help refine the created matches even further.
  4. How flexible is your matchmaking?
    Wait time, latency, and skill levels all factor into your matchmaking, so how flexible is your system? Can you pick and choose what to prioritize? Do you have analytics that tell you what impact your choices are having on your players? Does your system relax matchmaking requirements over time automatically to find a game even under less-than-ideal circumstances? Does your system allow you to segment your players to provide the best experience for everyone?

In a recent post, we showed you how to create a serverless custom matchmaker using Amazon GameLift and other AWS services. Now we’ve taken the next step by creating a powerful and flexible framework for matchmaking, built right into Amazon GameLift: FlexMatch.

How to Use FlexMatch

On the surface, FlexMatch appears relatively simple, but go “under the hood” and you’ll find a great deal of power and flexibility.

Part of FlexMatch’s power comes from its direct tie into Amazon GameLift’s game session queues. With FlexMatch, you can group players together into matches based on criteria you choose. Then with queues, you can create fleets to place those matches that might represent all players on a given platform, or those in a specific region or game mode or map or language. Working together, FlexMatch and queues can quickly create the best, lowest latency matches for different segments of players, even across regions.

To help you better understand how to use FlexMatch with our queues function, let’s walk through an in-depth example, starting with FlexMatch configuration.

Let’s say your game is a team based shooter that needs equal team sizes with a minimum of 4 players and a maximum of 8 players per team. You also want a competitive match, so the teams need to have an average player skill within 10 points of one another. Finally, you don’t want players to wait too long to find a match, so you want to relax the skill rule to an average player skill within 50 points between teams after 5 seconds and 100 points between teams after 15 seconds.

Below is how you would configure FlexMatch rules to fit your game:

{
    "name": "aliens_vs_cowboys",
    "ruleLanguageVersion": "1.0",
    "playerAttributes": [{
        "name": "skill",
        "type": "number",
        "default": 10
    }],
    "teams": [{
        "name": "cowboys",
        "maxPlayers": 8,
        "minPlayers": 4
    }, {
        "name": "aliens",
        "maxPlayers": 8,
        "minPlayers": 4
    }],
    "rules": [{
        "name": "FairTeamSkill",
        "description": "The average skill of players in each team is within 10 points from the average skill of players in the match",
        "type": "distance",
        // get skill values for players in each team and average separately to produce list of two numbers
        "measurements": [ "avg(teams[*].players.attributes[skill])" ],
        // get skill values for players in each team, flatten into a single list, and average to produce an overall average
        "referenceValue": "avg(flatten(teams[*].players.attributes[skill]))",
        "maxDistance": 10 // minDistance would achieve the opposite result
    }, {
        "name": "EqualTeamSizes",
        "description": "Only launch a game when the number of players in each team matches, e.g. 4v4, 5v5, 6v6, 7v7, 8v8",
        "type": "comparison",
        "measurements": [ "count(teams[cowboys].players)" ],
        "referenceValue": "count(teams[aliens].players)",
        "operation": "=" // other operations: !=, <, <=, >, >=
    }],
    "expansions": [{
        "target": "rules[FairTeamSkill].maxDistance",
        "steps": [{
            "waitTimeSeconds": 5,
            "value": 50
        }, {
            "waitTimeSeconds": 15,
            "value": 100
        }]
    }]
}

Figure 1 – Example FlexMatch rules syntax.

After configuring your matchmaker, next up is configuring your queue.

Let’s say you want all of your players in Asia to be matched together. To do this, you could set up your Matchmaker in either Seoul (ap-northeast-2) or Tokyo (ap-northeast-1), then build a queue that contains fleets located in Seoul (ap-northeast-2), Tokyo (ap-northeast-1), and Singapore (ap-southeast-1). That queue could be configured to use player latencies to find the lowest latency region amongst the three for any given matched set of players.

If you had planned to launch your game in additional regions of the world, you could create additional matchmakers and queues and build different matchmaking rules for each region or group of regions. This approach is particularly useful if you’re releasing different versions of the game in different parts of the world. You could even assign different matchmaker rules to different matchmakers. This would allow you to group players into separate competitive and casual matchmaking queues, for example.

Whatever you decide, FlexMatch uses your rules to assemble a match and your queue configuration to place the match onto a game server.

Once you have configured your matchmaker and queue, you are ready to accept matchmaking requests. If you’ve configured other Amazon GameLift features, they then will be in effect as well. For example, autoscaling can start launching the right amount of servers to accommodate player demand.

We consider this approach holistic game session management, bringing together all the functions you need, in a way that provides “it just works” capabilities for your game backend operations and for your players.

Advanced Rules

The FlexMatch rule set also has advanced features for even more granular control over player experience.

For instance, you can group together players who prefer certain game modes, like Capture the Flag, or certain groups of maps.

You can also create matches with teams that feature at least one each of several classes of player characters. For example, you might decide that a valid team requires at least one warrior, one rogue, and one mage before a game starts. You can also allow asymmetric matches, like 1v5, in order to support new game modes.

Put simply, with FlexMatch, you have options. You’re in control.

Analytics: Understanding How Your Rules Are Working

Monitoring and optimizing your FlexMatch rules is an important part of fine-tuning your game design. To help monitor your rules, Amazon GameLift FlexMatch emits a set of matchmaking metrics that are easily accessible through the management console. As you test your game, you can use these analytics to balance your player experience. These metrics include:

  • Match Success/Failure Rates: Monitor your matchmaker’s ability to group prospective players and get them into games quickly. Track the rate that players are accepting or rejecting the matchmaker’s proposed matches to see how well the matchmaker is meeting player expectations.
  • Player Demand: See the number of matchmaking requests currently being processed. Track the rate of new requests and new players to get advanced notice of surges in player demand, etc.
  • Time to Ticket Success: Monitor the average length of time it takes for the matchmaker to successfully create a new match. Use this data to find the right balance between finding the best possible match and getting players into games fast.
  • Matchmaking Rule Effectiveness: Track the pass/fail rates for individual rules in a matchmaker. Use this data to fine-tune each match rule and optimize the matchmaker performance overall.

For a full list of metrics, visit the Amazon GameLift Developer Guide.

For example, if your analytics show that 80 percent of matchmaking requests are timing out, it might be that your rules can’t match players because they’re too strict. You might even have a problem if only 10 percent of games time out, depending on your definition of a good player experience.

Conversely, maybe only 2 percent of your matchmaking requests time out. Your FlexMatch rules could be perfect. Or they could have another problem: they’re too relaxed, leaving some players routinely playing against much better players.

In our example game, here’s how you use the analytics functions to track key issues such as these:

Figures 2 & 3 – Example FlexMatch analytics dashboard.

You also could use AWS Lambda to run a function in the cloud that monitors those analytics and reacts based on certain actions or notifications.

Rules Relaxation

As shown in the example rules, one very useful FlexMatch feature is rules relaxation. Rules relaxation allows you to control when and how player matching criteria are relaxed as a player waits for a match. It might sound counterintuitive in a rules-based framework, but relaxing rules can help hard-to-match players quickly get into the next best game.

For instance, you probably want each match to include only players within a certain range of skill levels, say, no more than +/-10 skill points of each other. However, if the player pool doesn’t have enough players within that range, you need a fallback. Maybe you allow players +/- 15 skill points to join instead.

In another example, maybe you need to relax matchmaking rules to search for players in more distant regions after players have been waiting for at least, say, 90 seconds. That means West Coast players might get placed in East Coast regions. Latency might be slightly higher, but your players will be playing instead of waiting in a matchmaking lobby.

Ultimately, it’s a question only you can answer: when and by how much should you relax rules for the hard-to-match players? FlexMatch’s framework lets you decide which of these matchups, even the imperfect ones, you’ll allow.

Conclusion

FlexMatch enhances Amazon GameLift’s already broad range of capabilities by giving you a built-in matchmaking framework with the power and flexibility you need to create a deeply customized multiplayer experience while automating a significant piece of game management.

FlexMatch consolidates pieces of multiplayer game management into a set of features that give you power, flexibility, speed to market, and controlled costs.

To get started with FlexMatch, download the Amazon GameLift SDK, upload your game to Amazon GameLift, and start configuring your rules.

About the Author
Bruce Brown is the Software Development Manager of the Amazon GameLift Player Experience team responsible for building the FlexMatch matchmaking service. He has been in the software industry for 12 years including time spent at Microsoft on the Xbox Live Cloud Compute, Xbox Multiplayer teams and at Riot Games working on the League of Legends Live Gameplay and Personalization teams. Currently, he is playing Zelda: Breath of the Wild with his 6 year old son, and he enjoys designing games with his wife in his free time.