CASE STUDY

gaming

Powering Truly Massive Social Gaming Experiences

Heroic Labs is making massive social experiences easy for game developers.

  • “All core data lives in CockroachDB”

  • Largest game: 300M players

  • Community of ~2.5M game devs

About Heroic Labs

Heroic Labs is a company that provides social infrastructure at scale for game developers. Its core products, the Nakama game server and its Heroic Cloud platform, are both aimed at making it easy for game developers to scale their games and provide social experiences for their players. 

In fact, the name Nakama is “Japanese slang for ‘friends who are closer than family,’” says Heroic Labs co-founder and CEO Chris Molozian. “We wanted to be able to provide a piece of game tech that could power extremely large social experiences.”

By any measurement, the company has succeeded in doing exactly that. Its products have been downloaded millions of times, and are powering games from studios such as mobile gaming powerhouse Zynga to PC strategy gaming titan Paradox. The largest game using Heroic Labs infrastructure has roughly 300 million players, Molozian says, and its technology is powering social experiences in games like Words with Friends – a game so social that it has led to more than a few relationships and marriages!

Database requirements

Heroic Labs got started in part because Molozian had been working at database companies, and saw that game developers were repeatedly coming to them with the same sorts of scaling problems. Rather than trying to solve them on a case-by-case basis, Molozian thought it made sense to try to build a more general solution to address these issues. Heroic Labs was born.

Coming from a database background himself, Molozian knew that to be able to offer smooth scaling to customers, Heroic Labs needed to choose a database with the right features. Specifically, some of the things Heroic Labs was looking for included:

  • Support for the same environment in development and production so that game developers could build and iterate locally and then deploy to the cloud without needing to make a lot of application-level adjustments. 
  • Automated fault tolerance and scalability so that game developers can feel confident their games can handle the challenges that come with the spiky, sometimes-unpredictable workloads in online gaming. 
  • Consistent transactions at scale to ensure that their digital wallet APIs offered ironclad transactional consistency to game developers using Heroic Labs’s solutions to process payments.
  • Simplicity and developer familiarity to make life easier for game developers.

While Heroic Labs did consider NoSQL solutions, Molozian says, they ultimately ruled them out. Their need for transactional consistency made a relational database the best choice, and the team also found that while existing NoSQL databases offered resilience and scaling, they were going to be too complex to configure, set up, and manage over time.

Additionally, Molozian says, “I just wanted SQL because I believe that there’s 20 years worth of [recent] knowledge that has been accumulated about how to interact with datasets and data problems through a SQL engine.” For example, Heroic Labs was able to look at existing SQL schema that major social networks use and quickly adapt it for their own social gaming context. 

These requirements led them to CockroachDB, which ticked all of their boxes, and with which Molozian was already familiar.

How they’re using CockroachDB

Long story short? “All core data lives in CockroachDB,” Molozian says.

Heroic Labs’s Nakama technology is provisioned on top of Kubernetes, which makes it cloud-agnostic, enabling developers to use Nakama and deploy to the cloud of their choice, whether that be Azure, GCP, or AWS. Nakama servers run CockroachDB clusters for “all of the core data and persistence,” Molozian says, including “leaderboards, leaderboard records, user accounts, social sign ins, social tokens, friend lists […] all core data lives in CockroachDB.”

In practice, this means that Heroic Labs’s game developer clients are using CockroachDB to scale their gameserver data. 

“We depend on CockroachDB for its core principles: referential integrity, transactional support, all the transaction semantics, ACID compliance,” Molozian says. 

For example, he says, “by establishing foreign key relationships between pieces of data, between users and leaderboard records and everything else, we can efficiently serve aggregate queries for GDPR export requests or GDPR right-to-be-forgotten deletes.” CockroachDB’s referential integrity ensures that Heroic Labs doesn’t have to worry about tracking references between data in one location and data in another.

The automated scaling and resilience provided by CockroachDB also helps Heroic Labs deliver on its promise of making life easier for game developers. From a developer perspective, Molozian says, you deploy your Nakama clusters and your CockroachDB clusters, and then each unit scales as you need it. The patterns that developers use to interact with them doesn’t change over time, and devs get all the benefits of having a relational database (relational integrity, transactional consistency, familiar SQL) in combination with smooth scaling and high availability.

“We depend on CockroachDB for its core principles: referential integrity, transactional support, all the transaction semantics, ACID compliance, [etc.]” - Chris Molozian, Heroic Labs Co-founder and CEO

What's next

So what’s next for Heroic Labs? A new technology that will help game developers delve deeper into data analytics and offer deep levels of player personalization based on their game data. 

“That will also be built on CockroachDB,” Molozian says.

Ready To Get Started?