Image: Clone Drone in the Danger Zone – Doborog
You don’t necessarily need to use an off-the-shelf matchmaker for your game. You might want to create your own. Here are the best practices.
At some point, you’ll probably want a matchmaker for your multiplayer game. It’s a critical part of making sure that your players can actually join a match. There are plenty of matchmakers out there, like PlayFab and FlexMatch. But there’s no reason you can’t make your own.
In fact, Brian Jordan, co-founder and CTO at Doborog, did just that. They had a short deadline and very specific requirements, so they decided to bite the bullet and create their own. Jordan now shares his insights into the different kinds of matchmaker, what’s best for different studios and games, and how to integrate it with an orchestrator.
There are four types of matchmaking
How you allow players to join a match is an integral part of the matchmaker itself. There are essentially four tiers. The more players you have, the further down the tiers you might want to go.
“If you’re an indie, it’s worth thinking about whether you have enough players to justify the type of matchmaking you want,” Jordan explains. “We actually disabled automatic matchmaking for duels, because we didn’t want to cannibalise from our own playerbase when we launched our mini battle-royale mode.”
So what are the tiers?
- Manual search. This is where you don’t have a matchmaker. You show all the servers and players pick which one to join. If you’re just starting out, this is sometimes enough.
- Embed your matchmaker. If you’re a little bigger, you can embed some matchmaking within the game client itself. But this is risky. Cheaters will cheat – they could potentially join matches that aren’t theirs.
- Automated lobbies. This is where the players join a lobby and you fill the slots until the game is ready. If there’s not a lobby matching the player’s preferences to join, the matchmaker creates a new one.
It’s a simple user experience, which gets players into the action quickly. They instantly join a lobby – and once there are enough players, the game starts. If you’ve got over 20 concurrent users, you’ll want to start doing this.
- Ticket-based. In this case, rather than immediately joining a lobby, the matchmaker creates a pool of candidate players seeking matches over time. This is better for skilled-based matchmaking, but inherently takes a little longer to establish a match.
You don’t really need to start using this approach to scale until you’ve got at least 100 concurrent players or if your multiplayer mode relies completely on competitive ranking matches. Any fewer and you don’t have the skill variety for it to work.
What makes a good matchmaker?
Regardless of what type of matchmaker you use, there are a few parameters it’ll need to consider, Brian explained.
- Game mode. The matchmaker needs to know what game mode your player is trying to join.
- Player skill. A good matchmaker on a popular game checks for skill. You don’t need to reinvent the wheel, though. Brian recommends just sticking with ELO, as it’s a tried and tested method and a lot of matchmakers will have support for it.
- Blocks. Certain platforms let players block other players – making sure that they’re not matched with them again. So it’s important that your matchmaker takes these into account.
- Cross-platform choices. Similar to the blocking point, some players don’t want to play across platforms and might opt out. So your matchmaker will need to take this into account, too.
- Player latency. It’s good to check the player’s ping to the location to make sure that they’re going to have a good match. Brian explained that they have red, yellow, and green thresholds for ping which determine when to create new matches versus joining existing ones.
Make your API endpoint configurable
From a backend perspective, it’s really important to make sure that you don’t hard code things like what API, ping, and STUN/TURN endpoints your game clients will call. If you do, these can be a challenge to change in an emergency – forcing you to release a new version of your game just to change a URL.
“Use things like remote configs / feature flags – a configuration the player downloads when the game starts,” Jordan says. “We use that for things like game news, but also to configure in the URL of the matchmaker we’re using. That way, if something goes wrong with a web provider or domain name, we don’t need to update the entire game across all client platforms. We just switch it out.”
This is particularly important for console games, where it can take weeks, if not months, to release an update to a game.
Think about how you’ll scale
“The challenge is how do you scale?” says Jordan. “You’re going to need a database that can handle a lot of concurrent, very fast writes as players join and leave matches. So you need to make sure you use a data store that can handle it.”
Jordan recommends using tools designed for rapid in-memory updates like Redis or Google Firebase to facilitate matchmaking. And completely avoiding SQL databases for highly-synchronous matchmaking, as you’ll hit a bottleneck. At first, you’ll likely want to run the matchmaker in a single location to avoid conflicts due to concurrency. But eventually you may wish to run regional matchmakers closer to each player.
This can cause issues. If you have lots of instances of a matchmaker web service running – and no single-point-of-truth cache to synchronise them — instances could all try and fill the same lobby at the same time. So it’s important to make sure that you have a way to manage concurrent match join attempts.
Host your matchmaker sensibly
“You typically don’t need to worry about the latency of the matchmaker itself,” Jordan says. “It’s going to take a little while to connect to the match server anyway. You want to find a match quickly, but you don’t need to hyper-optimise regional latency and execution time like you might for serving a webpage.” So you can often host your matchmaker without needing to worry about its distance to the player.
Test with your orchestrator
Jordan: “Before you launch your game, make sure that everything is working with your orchestrator. That piece of the integration doesn’t take long. We were able to build our own matchmaker and get set up with Gameye in less than a month. And now I don’t feel like I’m at the mercy of the orchestrator or another provider, the job of spinning game servers up is a simple API call and some parameters to pass the game client.”
When getting set up to launch game servers from the matchmaker, use a tool like Postman to manually make the API call to start a server and see if you get the correct response and can connect to your game server at the returned IP/port.
“You can usually take the API call code and just copy it straight into your matchmaker and you’re good to go,” says Jordan.
If you’d like to learn more about how to integrate your matchmaker, check the Gameye website.