Creating a Scalable Matchmaking Service

In this tutorial we will use Google App Engine, the Datastore, Memcache and Cloud Endpoints to create a scalable Matchmaking service to be used with multiplayer video games. The service is written in Java and the full source code is available here on Github.


A matchmaking service is responsible for pairing players with one another when they want to play your game online. When a player’s game client connects to the service, the service finds all available matches that aren’t full and connects them to the match. The matchmaking service we design in this tutorial can be used in either a peer-to-peer or a client server model.
Online matches can’t happen if your matchmaking service is down, so designing your service for scalability and reliability is very important. We’ll discuss some of the basic philosophies used when designing your service and discuss why some of the technologies used in this tutorial were chosen.

Why Google App Engine?

A lot of factors need to be considered when determining the infrastructure for your matchmaking service. It’s a critical part of your multiplayer game – if it fails, players won’t be able to play your game. Since reliability is likely your top priority, you know you’ll likely be using a scalable cloud solution. The cloud provider you choose will likely be based on whether you need an IaaS or a PaaS cloud model.

For your matchmaking service, a PaaS approach makes a lot of sense. As a PaaS, this is where Google App Engine comes in. GAE lets you deploy your service rapidly and with minimal maintenance required afterwards. There’s no need for database administration, monitoring instances, or updating server software for years after release. During development, this also lets you focus on your matchmaking code instead of strategies for maintaining it.

GAE works for a matchmaking service because it’s very simple and has low requirements. If pricing is an issue, latency is a major factor (every millisecond counts), or your clients need to use UDP, then GAE might not be for you.

Cloud Endpoints

Another benefit from using GAE is that Google provides some very useful tools to aid in developing your services. Cloud Endpoints is one of them. Cloud Endpoints aids in creating an API for your service. In this example, we generate the API for our game clients to interface with using Cloud Endpoints.
Cloud Endpoints speeds up API development greatly. It also provides some pretty nifty tools for debugging and generating documentation for your API.

The Data

Typically, a matchmaking service doesn’t need a complex database to drive it. I like to keep things simple, so that I can take advantage of the speed and scalability of a NoSQL solution. GAE’s Datastore is great option for this and that’s what we’ll use in this tutorial. If your project needs a relational db, look into Google’s Cloud SQL.


About Me

I’m a game developer who’s extremely passionate about video game development and games in general. I've worked in the industry for quite some time and I like to share things I’ve learned and anecdotes from the industry here on this website. I work as a Network Programmer, but I have a deep rooted interest in level design.


Subscribe for your newsletter

Stay in touch and get updates whenever Quantum Rarity is updated.