Next Games, is a fast growing gaming company based in Helsinki, Finland. On October 7, 2015, AMC and Next Games released The Walking Dead: No Man’s Land, the official mobile game based on AMC’s record-breaking TV series, for iOS. Within a week, the game quickly skyrocketed to the #1 spot on Apple’s Top Free App chart.
To handle the massive scale and performance requirements for their highly anticipated game (over 1,000,000 downloads and 31M minutes played on opening weekend alone), the Next Games development team chose to implement their backend services on Azure. For their persistence layer, which needed to ingest massive volumes of game profile and state metadata while serving low latency queries (under 10 ms), they selected Azure DocumentDB, the fully managed NoSQL JSON database.
The Walking Dead: No Man’s Land is a turn-based mobile strategy game that supports single player and multiplayer campaigns. In the game, you build bases, find more survivors, upgrade your skills and weapons and carry out successful missions, much like in the popular TV show. You play with an online connection; player and guild metadata must be persisted and retrieved frequently during gameplay.
Why Azure DocumentDB?
A key requirement for the Next Games development team was a database that could respond seamlessly to the massive scale and performance demands of this hotly anticipated game.
With millions of users expected to be online on day one, the database had to handle numerous real time player metadata updates as players logged in and logged out, AND elastically scale performance up or down as required.
Responsiveness was critical to user experience. Saving player profiles and score information had to complete within milliseconds to avoid any lags during game play.
In addition to simple key-value lookups, the data tier needed to filter against different properties in real-time, e.g. locate players by their internal player IDs, or their GameCenter, Facebook, Google IDs, or query based on player membership in a guild.
The game includes social features including in-game chat messages, player guild memberships, challenges completed, and a social graph, which required a flexible schema. Next Games also need to perform ordering against various groupings of players (ex. by country, or social network) to build real-time “high score” leaderboards.
Time to market was critical for Next Games, and the team made a conscious decision to develop only with platform-as-a-service (PaaS) offerings. It was important that the database required minimal setup and management work to allow for rapid iteration.
After evaluating various solutions, Next Games chose Azure DocumentDB as a core component of the game since it met and exceeded all these requirements.
How they used DocumentDB
Next Games created DocumentDB accounts for their development, load testing and production environments to store player metadata and social grouping data. For partitioning data within these accounts, the Next Games team used the DocumentDB .NET SDK and the hash partition resolver to distribute data among DocumentDB collections using consistent hashing. DocumentDB collections were configured with the S3 performance level for the highest throughput and best performance, setup with string range indexing policy for efficient and flexible sorting.
The Next Games team implemented a repository class that performed writes using atomic upserts, and reads using one of the following three query patterns:
Single partition queries based on a single player ID
Multi-partition queries with a fixed page size/maximum item count that scanned DocumentDB partitions in series (to list the top N groups or friends for a player)
Multi-partition queries that scanned partitions in parallel for lowest latency using ResolveForRead, e.g. locating players through a “secondary index” e.g., their Facebook ID, Google ID, or GameCenter ID
Another key feature in the game was displaying the highest scores in real-time. This included global high scores, high scores by a gamer’s country, and among their group of friends. This was implemented as a service which performed intra-collection sorting using DocumentDB query, and subsequently aggregated results as separate “high score” documents also stored as JSON documents within separate collections.
If you’re looking for a backend database that can stand up to the demands of the next viral game or mobile app, try out DocumentDB using your free trial, or schedule a 1:1 chat with the DocumentDB engineering team. Don’t forget to try No Man’s Land by downloading it from the iTunes App Store!