Home   >   Industry Voices

Why Heroic Labs built its Nakama real-time server technology for an open source future

Product VP Alim Jaffer offers his thoughts on open-sourcing and games-as-a-service
Why Heroic Labs built its Nakama real-time server technology for an open source future

As games-as-a-service gets taken more seriously by games companies across platforms, Heroic Labs has set about levelling the playing field for developers big and small.

It's open-source real-time server for games and apps, Nakama, is designed to power modern real-time social games in the vein of Clash Royale, typically requiring the technology and expertise in limited supply outside the big studios.

The tech helps developers standardise their live operations and reduce costs and time to market for their games. Key features include user accounts, social login, in-game chat, real-time multiplayer, matchmaking, leaderboards, and much more.

To find out more about Nakama, why it's open source and the rising trend of games-as-a-service, we spoke with Heroic Labs VP Product Alim Jaffer for his thoughts. Could you explain about Nakama and how mobile developers can take advantage of it?

Alim Jaffer: Absolutely - we designed Nakama to be platform agnostic. It can power mobile, PC, AR, VR games and more. We wanted to build something that would be invulnerable to industry shifts, and made sure the fundamental building blocks (user accounts, multiplayer, etc) would work across a variety of platforms.

“We wanted to build something that would be invulnerable to industry shifts.”
Alim Jaffer

We took a look at trends in the industry and noticed similar parallels to that of Unity. Prior to Unity, most studios built their own game engines and that gave them a distinct competitive advantage over those who were unable to make beautiful, experiential games. Then Unity came in and everyone went, “why is everyone still building a bespoke game engine?”. It adds technical debt, and costs significant amounts of time and capital to maintain.

Now online play, particularly for mobile, has become the next frontier in gaming. We view the industry having the exact same problem on the backend infrastructure side - too much focus on building from scratch and sinking time that could be better spent on the games themselves. Instead of re-inventing the wheel every time a new style of gameplay is in vogue, why not standardise around open technology?

Hence Nakama - it’s a productised offering that’s built from the ground up with the games industry in mind, and by open-sourcing it we wanted to offer the community ownership and transparency. It does everything, from user accounts, to real-time chat, multiplayer, IAP validation, matchmaking and so on. It’s your entire backend and is specially designed to scale to allow for millions of players and tens of thousands of concurrent users.

Build a Clash Royale, Candy Crush, Game of War, Subway Surfers, etc. whatever style of game you want, regardless of platform, you can build with Nakama as it stands today. Or if you already have a game out there, and it lacks a social tool like in-game chat, add Nakama to your current tech stack and add it today. We have first-class client libraries for Unity, Unreal, Java, Swift and Javascript.

Nakama aims to empower developers of all sizes to build real-time multiplayer games like <em>Clash Royale</em>
Nakama aims to empower developers of all sizes to build real-time multiplayer games like Clash Royale

With open-source, there’s no fear of losing control over the technology you use to power your games. When Parse was shut down by Facebook, it put a lot of fear into the industry around ownership of technology. A game engine can disappear, and you can still run your game as-is as its pre-packaged. But if your backend disappears? Your game is dead in the water.

“A game engine can disappear and you can still run your game because it’s pre-packaged, but if your backend service disappears, your game is dead.”
Alim Jaffer

The reason some developers would build their own tech is it’s tailored to what they want to do, whereas an external service is more generic and may not be as good for their specific needs. What would say to that?

We come across this line of thinking all the time. Unlike a lot of game studios, we have the luxury to look at the wider market and ensure that Nakama scales for a variety of platforms and gameplay. Many tech stacks are built in-house and are very performant for the singular type of gameplay they’ve been architected for.

This productised approach to infrastructure gives you more flexibility in the long-run to shift to new platforms and types of games. As well, to combat the concern around customisation, we included an embedded scripting engine written in Lua that allows developers to write and run custom logic on the server to modify it to suit their needs.

We have, of course, abstracted a lot of the features within Nakama server into first-class API’s to ensure performance, but the scripting engine offers flexibility for developers to implement the exact game logic they are looking for. Making Nakama both generic and tailored simultaneously.

As an added bonus - Nakama is proven at scale in games with millions of monthly active users. Whereas when you build a new backend - you have no guarantees it will scale until your game is live and in production.

One of the biggest trends since the start of 2016 is real-time gaming on mobile. What do you think is driving that trend?

I think it’s a combination of a couple factors. Technology has advanced - smartphones are more powerful, prevalent, and the cellular networks supporting them have improved. All of this has allowed for a natural progression to good looking, real-time games.

Supercell really made a splash with Clash Royale, it set a bit of an industry standard and now everyone is working on competing in this space. It was such a success that it was inevitable that other studios would want to take advantage of this new space in the market.

The other factor is Games-as-a-Service (GaaS) in that studios no longer simply ship a game and then move on to their next projects. Games have become living projects that require constant updates, community involvement, and events to keep them relevant. This requires a lot more investment from a studio, and building technologies around it to offer over the air updates, fixes, live events, etc.

What considerations should developers look at when running their game as a service? Is the main consideration community, or are there other things developers should think about?

For me, it’s all about community and events. Community means keeping your players engaged which naturally increases retention and your revenue. Direct communication with your playerbase is essential, as players have come to expect it. The guys at Space Ape Games do a wonderful job of this.

“Community means keeping your players engaged which naturally increases retention and your revenue.”
Alim Jaffer

Events are, I think, the most important aspect for driving revenue moving forward for real-time and modern games. You can 10x to 20x your revenue on a regular day by running a high-level event and offering rewards to your players for participating. One important key is to not over-do it and ensure that you don’t burn out your community in the process.

Events and communities are making games more social, people are planning their days around their gaming sessions. This increasing normalisation of games being social and always-on is what’s helping drive forward the need for real-time games.

How can developers alleviate the pressures on their servers, particularly if there are an unexpected number of players?

It’s one of those areas of gaming that can be incredibly hard to predict - how many players are you expecting, will they all join at the same time, will they play for five minutes? 20? Will they focus on chat? Multiplayer? It all adds strain to your servers.

Right now what’s in vogue is micro-services architecture in backends. Running separate VM’s in clusters which power specific and discrete services. One of the troubles is you need to individually scale out each cluster based on demand, manage specific data infrastructure, and ensure it remains accessible to your players. When one cluster goes down, we’ve seen chain reactions end up taking all of them down and causing outages on a large scale.

The best thing you can do is over-provision your servers and have reliable warning systems built in to alert your engineers to scale before the servers begin falling over. This does often entail waking up at all hours of the night to login to your cloud provider and begin provisioning more servers.

With Nakama, we took our learnings from running games at large scale, and built it as a monolith server. All of the core features are found in the same server, no needing to run a specific VM to power X feature.

“Open-source allows communities to gather around and work towards standardising their tools.”
Alim Jaffer

This makes scaling your backend out significantly easier and more predictable as you’re only focusing on one type of game-server. It also reduces the amount of technical debt and needing to upgrade/managed different systems when it comes time to build your next game or project.

You can of course choose to use Nakama server for chat, or multiplayer separately, and run it like micro-services but maintenance is standardised and effortless.

Do you think that most game technology companies, in some form, will start making parts of their technology open source? And if so, how would that make business sense for those companies?

I sincerely hope so - one of the things I really love about the games industry is how everyone is willing to share knowledge with each other and take the time to talk about both things they’ve done right, but also where they’ve failed and learnt from their mistakes.

Open-source allows communities to gather around and work towards standardising their tools. This would be less about directly monetising the tools and more around having everyone pitch in to find bugs, add their own features, and being able to hire experts out of the community which reduces onboarding and hiring problems for internal technologies.

That’s the best way to look at it from a business perspective. Another common open-source business model is to offer it as ‘open-core’ meaning that the core technology is open-source, and the company offers proprietary tech suited for enterprise customers and Service Level Agreements (SLA’s) to ensure uptime at scale. It’s a popular model particularly in the database industry and similar to how we operate.

You can find out more about Nakama on the official website.