Development of multiplayer games has reached an inflection point: game developers have started supporting cross-platform play across all devices. This is a significant shift that can create better player experiences while introducing new challenges for game developers. What makes this new development in cross-platform play so significant is that it challenges some long held beliefs and assumptions in multiplayer games:
Why should you consider supporting cross-platform play for your game?
This last point is what we are going to address in the remainder of this post by walking through an example using Amazon Web Services (AWS) and Amazon GameLift, the dedicated game server hosting and matchmaking solution.
To get into the specifics of how your game can support cross-platform play on AWS, let’s explore the requirements of an end-to-end solution:
Figure 1 (below) shows a multiplayer back end architecture that supports cross-platform play.
Let’s take a closer look at how to achieve these three steps.
First, you need to accept game requests from players on any gaming device the game supports and use the data from those requests to generate matchmaking requests.
In our multiplayer backend service architecture, we have a game service that acts as a front door to game clients. The game service is a custom part of the end-to-end process, and there are many options for implementing this service. One solution is to use Amazon API Gateway with AWS Lambda, but you may already have your own service that interacts with clients which can be extended.
This game service provides a means to:
Cross-platform play data is specifically provided in the matchmaking request to FlexMatch, so let’s dive into that integration next.
Now that integration between your game service and FlexMatch is complete, your game service can create StartMatchmaking requests for FlexMatch. The information Amazon GameLift FlexMatch will need for your cross-platform solution includes:
The StartMatchmaking request gets a MatchmakingTicket in response. This ticket includes the information that was part of the original request, including Ticket ID and a status of “SEARCHING”. For more information about integrating a game service with Amazon GameLift FlexMatch please see this guide.
Now that you have integrated with FlexMatch and are successfully making matchmaking requests, you now need to configure FlexMatch to use the request data to match players across gaming devices. Configuring FlexMatch is done via the rule set. Here is an example of a simple rule set that configures FlexMatch to match across gaming devices, considering latency as well:
Let’s look at each section of the rule set.
This first section is a bit of booking that includes the name of the rule set and the rule set language:
Next, you tell the rule set what player attributes to expect. Latency is actually a special attribute that is passed directly from the matchmaking request to the rules engine that evaluates rule sets, so you only need to include the platform data in the playerAttributes.
acceptablePlatforms is a string list of the platforms that the player has opted-in to playing with others on, and myPlatform is the platform of the player.
Next, you define the teams for the match. In this case, there are two teams – a “red” team and a “blue” team – with two players required for each team (minPlayers and maxPlayers are equal):
After that, you define the rules used to match players with the passed in player data. The rules sections is where the core part of the cross-platform play evaluation happens:
In this case, we have defined two rules:
Finally, you can also tune the rules to relax their constraints over time to find the sweet spot in balancing matchmaking for your players by utilizing the expansions section of the rule set:
This section indicates that if a match has not been found after evaluating the current set of players for 10 seconds, relax the rules[FastConnection].maxLatency requirement from the original 50 milliseconds defined in the FastConnection rule to 100 milliseconds. If no match has been found after 20 seconds, relax that constraint again to 150 milliseconds.
Now that you are processing requests from multiple gaming devices and matching players across them, you need to connect the players in those matches to game servers.
Once FlexMatch has found a group of players that meet your matchmaking rule set requirements, it will create a game session placement request and place this in to a queue to find the lowest latency game server for the match. FlexMatch is wired up to Amazon GameLift Queues to automate the process of efficiently allocating new game sessions onto game servers.
Queues are configurable and allow you to determine several options that are used when Amazon GameLift places a session onto a game server:
Your rule set used player latency data to match players that had a similar latency value to one another. You can then use that same latency data to find an Amazon GameLift Fleet in your Queue with the lowest average latency value for the match. To do this, you set a latency policy.
Like the expansions section of the rule set, latency policies define how long you want the Queue to spend trying to meet a specific latency target for the match of players, and policies can be made up of one or more rules.
Once the Queue has determined the best Fleet for the game session to be placed in, Amazon GameLift will request that a server in that Fleet reserve sessions for our group of players.
Fleets in Amazon GameLift represent the deployed state of your game server. They enable you to define how your build should be hosted within Amazon GameLift including:
Now that Amazon GameLift has a game session for the players to connect to on a game server, it associates the server ip address and port number of the game server with the players in the MatchmakingTicket. This data is ready to be retrieved by the game service either through polling or via an SNS notification once the session has been placed.
Once the game clients have the server ip address and port, they can connect directly to the game server using that information. As a result, Amazon GameLift adds no latency between your game clients and the dedicated server when playing a game.
The design explored here allows you to start with a cross-platform configuration that works for you and evolve it over time with minimal overhead and impact. If you would like to learn more about supporting cross-platform play for your multiplayer game, join AWS and Gamasutra on April 24th at 2 PM EST (11 AM PST) for a live webinar. We’ll explain design patterns and backend architecture that allow you to accept game requests from multiple gaming devices, match players into games, and route player groups to suitable game servers. Register here >>
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 and 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.
Peter Chapman is a Solutions Architect in the Amazon GameLift and Lumberyard teams. He has over 13 years of software development and architecture experience. He has designed solutions in many industry sectors including Retail, Healthcare, and Gaming. Currently, he is having a great time playing Axiom Verge on his Switch.