# hathora-gaming-devex
Source: https://speakeasy.com/blog/hathora-gaming-devex


If you're wondering why on earth Speakeasy has Unity plugins as a generation target, you can thank me and one of our early customers, [Hathora](http://hathora.dev). Before joining Speakeasy, I had a long career in the games industry, working on backends for multiplayer games.

One of our goals at Speakeasy is to make a great developer experience possible, no matter what vertical a developer works in. I've pushed hard for Gaming to be one of the verticals we focus on because of the industry's proud history of innovation in the dev tooling space and because we're in a period of profound change within gaming. The development of tools like Hathora and Speakeasy is helping to establish a higher benchmark for developer experience and democratizing access to tooling that makes it possible.

In this post, I will walk through some of my war stories, look at how the industry has changed over the last 15 years, and how tools like Hathora and Speakeasy catalyze another wave of change.

## Building Gaming Infrastructure the Old Way

In the 2000s, connecting millions of gamers across the globe was a monumental engineering undertaking reserved for only the most successful studios with the biggest budgets. Behind every multiplayer game was an army of gaming infrastructure professionals wielding massive budgets to build a platform capable of supporting their players all across the globe.

I was one such engineer working on projects as varied as the wave of multiplayer mobile games, MMORPGs, and AAA games like Halo and Gears of War. My teams were generally tasked with the creation of all the core components of the multiplayer platform:

1. Account Management - Creation and synchronization of accounts across all platforms and devices.
2. Game Synchronization - Netcode to ensure that all players would see the same game state at the same time, which meant managing differences in individual network speeds and latencies.
3. Matchmaking - Creating a system that matched players together based on variables such as skill level, geographical location, and latency.
4. Games Server Orchestration - The biggest piece of the puzzle, managing the servers that hosted the games themselves. For mass multiplayer games this included elements such as:
   - Load balancing - Distributing player traffic across multiple servers to ensure that no single server becomes overloaded, accounting for regional latency.
   - Game lifecycle management - Ensuring that games were started and stopped as needed, and that players were matched to the right game.
   - Fleet management - Ensuring that there were enough servers to handle the load of players. Scaling up and down as needed.

Here's a simplified diagram of the multiplayer infrastructure we would've been building in the 2000s that would have been typical for a game like Halo or Gears of War:

![Image of Multiplayer Infratructure](/assets/blog/hathora-gaming-devex/hathora-infra-1.png)

At every studio, resources were sunk into building similar systems and trying to figure out cost-effective hosting options. Cloud technology was just entering the picture, so for a lot of games, servers were tucked away in the back corner of the studio office until you could find dedicated locations for them. Some studios could afford hosting partners to cover the US and Europe. But that still meant players from other continents were out of luck (growing up in Cairns, Australia, my >200ms latency was painful).

Needless to say, but building this infrastructure was a huge drain on resources and time that could have been spent on the actual game.

## The Standard Game Dev Technology Stack

Fortunately, in the last ten years, the secular trend that reduced the cost of things like web hosting has finally started to move the needle in gaming. Services like: account management, cloud saving, cross-region networking are all now available to buy off the shelf. The catalyst has been the consolidation around a common technology stack for games:

- Cloud Compute: The rise of the cloud was certainly a significant boost for developers and gamers - ping times dropped, and studios could better manage server costs as games rose and faded in popularity. You still needed to rebuild the core components of the multiplayer platform for each game, but removing the burden of server management was a huge win.

- Gaming Engines: Even more important than the cloud has been the emergence of gaming engines as platforms to build on, Unity for mobile games & Unreal for PC/consoles. This consolidation has made the whole industry more efficient. Instead of reinventing the wheel, studios can focus on differentiating their gameplay experience.

But even more exciting than the productivity boost realized by these developments is what it sets the table for… An explosion in tooling for game developers that is about to reshape the industry.

## The New Age of Building Multiplayer Games

With consolidation around common primitives, it's now more feasible to build game development platforms (server hosting, matchmaking, live ops) that are instantly usable by the industry as a whole. This previously wasn't realistic because every studio's environment was so unique and filled with custom code that integration was impossible.

Hathora, one of Speakeasy's earliest customers, is one such platform. They offer an API that makes deploying and scaling multiplayer servers worldwide a realistic weekend project. Reading through their site was equal parts exciting and frustrating. If Hathora had been an option when I was in gaming, they could have replaced entire pieces of infrastructure that were being maintained by my team. Those efforts could have instead been reinvested into the actual gameplay. Having a service provider completely changes the cost calculation of building a multiplayer game.

The same goes for the other pieces of the multiplayer stack:

| Feature Category              |        Description                    | Platforms                          |
|-------------------------------|---------------------------------------|------------------------------------|
| Account Management            | Creation and synchronization of accounts across all platforms and devices                         | [LootLocker](https://lootlocker.com/), [Pragma](https://pragma.gg/), [Beamable](https://beamable.com/), [PlayFab](https://playfab.com/)    |
| Game Synchronization          | Ensure that all players would see the same game state at the same time, managing network speeds and latencies | [Photon](https://doc.photonengine.com/pun/current/gameplay/synchronization-and-state#), [Heroic Labs](https://heroiclabs.com/), [Mirror](https://mirror-networking.com/)          |
| Matchmaking                   | Creating a system that matched players based on skill level, geographical location, and latency  | [Beamable](https://beamable.com/), [Pragma](https://pragma.gg/), [Playfab](https://playfab.com/), [IDEM](https://www.idem.gg/), [Heroic Labs](https://heroiclabs.com/)                   |
| Games Server Orchestration    | Load balancing, game lifecycle management, and fleet management                                   | [Hathora](https://hathora.dev/), [Multiplay](https://unity.com/products/game-server-hosting)               |

Here's what my multiplayer architecture would look like in 2024. Much simpler:

![Image of Multiplayer Infratructure with Hathora](/assets/blog/hathora-gaming-devex/hathora-infra-2.png)

The availability of off-the-shelf services is going to trigger an explosion in creativity as smaller and smaller studios can execute increasingly grand visions. However, there's still work to be done to make platforms like Hathora as impactful as possible. That's where my work at Speakeasy comes in.

## The Role of API Integration Experience in Game Dev

You can build the most incredible tool in the world, but if it's not easy to integrate with, it's not useful. And that's what Speakeasy is working to solve. We want it to be trivially easy to integrate with every game development platform's API. To make that happen, we're building our code gen platform to support library creation for every popular language in the game development space. We've started with C# & Unity and are planning support for Unreal and C++.

We make library creation easy by using an OpenAPI spec as the only required input. Maintain a spec, and you'll get a published library ready to put in the hands of your users without additional work. Providing libraries will remove the need for your users to write the tedious boilerplate code required to connect with your API platform: auth, retries, pagination, type checking, everything is taken care of by the library. API integrations that use a library are on average 60% faster and require less maintenance over time.

That allows the gaming platforms to stay focused on developing their core functionality without having to worry about the last mile of integration into their user's code base.

Here's what integration with Hathora looks like with Speakeasy in the mix. The amount of code required to complete the integration is dramatically reduced:

![Image of Multiplayer Infratructure with Speakeasy](/assets/blog/hathora-gaming-devex/hathora-infra-3.png)

## The Future of Gaming APIs

We're really excited to be doing our part to help the growth of APIs in gaming development.  And gaming platforms are just the start. Increasingly, Public APIs are an important part of the games themselves. An API platform enables communities to expand and build upon their favorite games. Community building opens up a new world of viral opportunities: social interactions, continuous updates, and customized experiences. This will only help increase engagement and attract more players. The future for APIs in gaming is full of possibilities!