Nakama Amazon GameLift Plugin

Author profile
Alim
March 25, 2024
Featured image

Following our earlier Nakama and Amazon GameLift integration announcement, this post will dive into some of the more technical details around the Nakama and Amazon GameLift fleet management integration and discuss the benefits it brings to clients in terms of ease of use and centralization of their game data and multiplayer functionality.

Nakama, the powerful open-source game server by Heroic Labs, offers extensive features for social gaming, multiplayer matchmaking, meta gameplay progression, and more. Amazon GameLift, on the other hand, is a dedicated service for deploying, operating, and scaling session-based multiplayer game servers. The new, open-source integration between these two core pieces of game tech is designed to simplify and enhance the developer experience for game studios and allow them to focus instead on creating amazing experiences for their players.

This post aims to demystify the integration, showcasing how the open-source Nakama and Amazon GameLift Plugin can streamline operations and why it’s a game changer for developers.

Why Nakama and Amazon GameLift Integration?

Without diving too deeply into the inner workings of the integration, it’s important to understand the what, why, and how regarding the new Nakama Fleet Manager API and how developers can use it to leverage the strength of both platforms.

Firstly, Nakama has long stood as a comprehensive back end solution for helping game studios foster rich social interactions and create real-time multiplayer experiences within their games, offering features such as Friends, Groups, Real-time Parties, and a sophisticated matchmaking system that seamlessly brings these players together to cooperate or compete.

However, to elevate these experiences into expansive multiplayer realms - be it open worlds with large, globally distributed player bases, or games demanding high-fidelity physics simulations - dedicated servers become essential to manage the complex gameplay physics and maintain game state integrity for players at this scale. This is where the integration between Nakama and Amazon GameLift shines, providing developers with the tools to effortlessly manage their Amazon GameLift fleets with the same level of ease and intuitiveness that Nakama’s existing APIs offer for game feature management.

This plugin fuses Nakama’s robust social infrastructure - where player profiles, friendships, and group dynamics reside - with Amazon GameLift’s efficient session-based game server management capabilities. The result is a system that not only ensures players are matched with appropriate opponents but also swiftly connects them to the optimal game server to suit their needs. This significantly cuts down on wait times and boosts player satisfaction by ensuring a smooth, lag-free multiplayer experience.

Furthermore, this integration streamlines the handling of real-time multiplayer sessions, making Nakama the go-to central hub for coordinating games, handling match data, and storing player information across your servers. This arrangement offers developers the ability to dynamically update player stats during games, process in-app purchases, oversee player inventories, and utilize Nakama’s extensive features to enrich the gaming experience.

The core of this integration is the introduction of the new Fleet Manager API within Nakama. This is an open-source interface and implementation that can be installed by developers, giving them complete control over their headless game server instances, living inside their Amazon GameLift fleet, directly within Nakama.

To get started, developers can simply install the open-source package in their existing Nakama project as follows:

go get github.com/heroiclabs/nakama-gamelift

Once done, they will have access to a fully featured Fleet Manager within their Nakama server code:

fleetManager := nk.GetFleetManager()

This Fleet Manager object is configured automatically via environment variables that allow the Nakama instance to communicate with, and seamlessly manage, the client’s desired Amazon GameLift fleet. Getting Players into Game Sessions Let’s run through the scenario of an individual player looking to jump into a game session with their friends and look at the steps involved.

  1. Matchmaking: The first step is to matchmake the player with their friends. This can be done using Nakama’s powerful matchmaking feature by including the user’s Nakama friend ids as part of the matchmaking query. This allows the player to match with a group of their currently online friends based on whatever other criteria is specified in the matchmaking query, returning a list of match player IDs.
  2. Finding a game session: With the list of player IDs, the Fleet Manager API’s List function can be used to search for an existing game session running within Amazon GameLift that has enough available space for the group of friends to join. If a game session is found, each individual player within the group will be reserved a slot within the game session using the CreatePlayerSession function, and once done, will be sent the connection details via their respective Nakama socket connection.
  3. Creating a game session: Alternatively, if no suitable existing game session was found, one can be created for the group of players by using the Fleet Manager APIs Create function. This function will instruct Amazon GameLift to spin up a new instance of the dedicated server and reserve spots for each player within the group. Once the instance becomes available, connection details will be sent to the client over their respective Nakama socket connections.
  4. Connecting to a game session: Once a player receives the connection details for the dedicated server instance running within Amazon GameLift, they can connect to it directly via their client.
  5. Persisting game session data: During, or after, a game session, player data and match state can be persisted to Nakama storage and player stats, inventory, virtual wallet, etc., can be updated to reflect any changes as a result of the game session.

This approach not only enhances player satisfaction by reducing wait times, but also optimizes server usage and management. Developers can rest assured that the process is handled efficiently, with Nakama and Amazon GameLift working in tandem to respond in real time based on player demand. The result is a dynamic, responsive system that ensures players are always just a few clicks away from joining their next game session.

Conclusion

The integration of Nakama with Amazon GameLift via the new Fleet Manager API represents a significant stride forward in multiplayer game server management. This partnership integration simplifies the technical complexities associated with running and scaling session-based multiplayer games, enabling developers to focus more on creating engaging gameplay experiences rather than the intricacies of managing server infrastructure.

By leveraging the strengths of Nakama for social and matchmaking features, alongside the robust server management capabilities of Amazon GameLift, developers are equipped with a powerful new toolkit to enhance player satisfaction. The seamless process of getting players into game sessions, whether through finding existing matches or creating new ones on the fly, ensures players enjoy minimal wait times and optimized gameplay experiences.

We encourage you to explore the possibilities that this unique integration between Nakama and Amazon GameLift opens up. This solution not only streamlines game server fleet management, but also enables new avenues for creating immersive, large-scale multiplayer games.

For those looking to dive deeper into this integration, you can access comprehensive documentation, and connect with the vibrant Nakama community for insights, support, and discussion. Together, let’s continue to push the boundaries of what’s possible in the world of online multiplayer gaming.

Speak to the Heroic Labs team

Do you have any questions about this blog post or would you like to find out more about any of our products or services?