Building and Scaling a Multiplayer AI Game on Discord with Playroom

Imagine building a multiplayer game that can reach millions of users within weeks, scale seamlessly, foster a highly engaged community, and, of course, generate a nice chunk of revenue. That's exactly what Playroom achieved with their game, "Death by AI," on Discord.

Playroom’s mission is to make social gaming accessible and enjoyable for everyone by crafting engaging multiplayer experiences. They also offer a zero-setup backend solution for social games to developers worldwide, allowing fellow developers to easily create their own social experiences.

Why Discord?

Discord's large and active user base, robust developer tools, and social dynamics made it the perfect home for their new AI driven party game "Death by AI." The entire process was simple and ultimately a no brainer for Playroom to adopt. As CEO Tabish Ahmed put it:

"The Embedded SDK was very easy to get started with. We had a build of our game running within a day of getting access to the platform."

Launching "Death by AI" as an Activity on Discord allowed Playroom to achieve impressive milestones such as:

  • Reaching almost 7 million users within weeks.
  • Scaling their platform to support the generation of 1.2 billion AI tokens.
  • Achieving thousands of daily game sessions.

Integration and Development

As Playroom was building “Death by AI,” they quickly found that integrating with Discord's Embedded App SDK was straightforward and provided numerous benefits. 

"The Embedded App SDK gives instant access to the social graph of gamers that reduces many friction points for a multiplayer game,” explains Playroom’s CTO, Assad Ali. “We didn’t have to develop a custom UI for inviting friends and users have multiple ways to share or join the game."

Discord provided an incredible distribution channel to reach a global audience of people who love to play games. Within a week of launch, over 70% of the game’s play sessions had more than three friends participating in each session. Friends were able to easily organize and play games thanks to the integrations provided by the Embedded App SDK without needing to install the game manually - it was already in chat and ready to roll!

The integration flow included several key steps:

  1. Profile Management: The first step required handling OAuth authentication. Playroom managed this by hosting a Node.js webhook to generate tokens, allowing Playroom to request user permissions and retrieve profiles from Discord into the game. Once the profile was on the client side, it was integrated into the game's synced player state.
  2. Rooms Concept: The game needed to have a concept of Rooms, which could be created based on Activity sessions. Playroom used their own ‘Playroom Kit’ that already had a concept of rooms/parties. By simply mapping the activity session ID to the game's room ID, everything just worked.
  3. Proxy Setup: Discord Activities don’t allow direct access to third-party domains from within the game. Instead, Discord proxies the game's URL and lets developers set up individual domains to be proxied via relative paths. If a multiplayer backend like Quantum is used, the server domain is likely dynamic (e.g., http://random-server-123.backend.com). This domain cannot be mapped to a relative path directly. Therefore, Playroom set up a backend service to manage a proxy server that could redirect requests to the dynamic domain by reading the domain from the query parameter (e.g., https://my-proxy.com/?domain=random).
  4. Debugging: Following the official documentation, Playroom relied on Cloudflare to expose the local server to Discord, making local development easier. By opening Discord’s web app in Chrome and using the browser’s developer tools to debug the game's iframe, the team could see console logs and network requests, streamlining the debugging process.

Discord’s Embedded App SDK allowed Playroom to focus on what they’re best at: delivering a high-quality gaming experience, without the need for extensive customizations or additional user acquisition efforts.

Technical Considerations

One of the primary reasons for leveraging artificial intelligence in "Death by AI" was to provide a fresh and unique social game experience each time you play. Playroom managed AI usage efficiently through volume deals with enterprises and by routing it to their game modes, using models from OpenAI, LLAMA, and Inworld for text input and output, and ElevenLabs and Inworld for text-to-speech.

Playroom faced several technical challenges while building “Death by AI,” including:

  • Cost Management: AI models can be expensive to run, and Playroom carefully manages costs through volume deals and efficient usage. At its peak, "Death by AI" generated over 1.2 billion text tokens and 35 million voice characters per day.
  • Language Support: Current-gen AI models aren’t great with non-English languages, so Playroom implemented checks to use different models for different languages. Non-English models also require more tokens on average per word than English, leading to higher costs and slower generations.
  • Prompting: Ensuring prompts consistently generate reliable responses was crucial. To do this, Playroom had to implement different prompts depending on which model was being utilized.
  • Region: Some AI models, like OpenAI, are blocked in certain regions. Playroom implemented exception handling and retry mechanisms in case of unexpected results from the AI service.
  • Fetching: Playroom avoided parsing the AI textual response manually by using OpenAI's JSON response type to fetch responses in a consistent JSON format.

Playroom believes AI has immense potential in delivering novel gameplay experiences, despite the high costs associated with running these models today. However, the cost of running and using AI models is rapidly decreasing, making it more accessible for innovative game development.

Prelaunch, Launch, and Success

Before launching globally, Playroom tested an early, web-based version of the game and invited influencers to play in a browser, which led to massive engagement in sessions where players could chat and laugh together. This highlighted Playroom’s mission of social gaming and reinforced the idea of using Discord as its platform of choice.

For the global launch, Playroom had to make sure their game servers could spin up globally nearest to users playing the game, effortlessly handling spikes in traffic. Unlike most games that run servers in specific regions, Playroom went the extra mile and had game servers that were running in multiple cities worldwide to help minimize latency and provide a smooth experience for players, regardless of their location.

As Ali explains: "We had already solved scaling when making Playroom Kit, and this exercise was proof it worked just fine. We didn’t face any downtimes or scalability issues whatsoever."

Playroom's unique approach to managing its Kubernetes cluster for multiplayer was crucial. While reminiscing about their journey building “Death by AI,” they stressed that many game studios’ clusters would likely not survive the increase in traffic or users from Discord without robust scalability to accommodate it. Discord’s existing platform infrastructure allowed Playroom to focus on avoiding any downtime by keeping the backend lean and ready to scale.

They also implemented a rigorous development workflow with staging and production builds to test new features before their global launch. Additionally, they maintained preview branches for experimental features so they wouldn’t disrupt the live version. (No one likes to break prod on a Friday.) 

Data played a key role in Playroom's success. Playroom built and implemented their own analytics for every interaction. Understanding the usage of features and game modes helped shape the product. High Day 7 retention, long game sessions, global sustained usage, and solid subscription behaviors indicated where there was potential for adding more features and improvements to the game. 

After a few weeks of polishing the gameplay, Playroom launched the game in one region on Discord. Within days, they saw a surge in users joining the Playroom server and sharing positive feedback.

They focused on top user requests such as new game modes, more characters, a stronger sense of competition, a voice reader, and localization. Thanks to the usage analytics they collected, they found that pushing game updates between 11pm and 2am PST was optimal when traffic was lowest.

Before going global, they ensured "Death by AI" worked in over 10 languages, added new AI voices, introduced new prompt packs, and incorporated a few in-app purchases. This meticulous attention to user feedback and continuous improvement led to more than 30% Day 7 engagement for many weeks.

Monetization and Engagement

Discord’s Monetization APIs empowered Playroom to implement subscriptions, one-time purchases, and game credits into “Death by AI.” They gained thousands of subscribers within the first month, allowing them to reinvest their revenue and build out a dedicated live service team to make new game content and maintain player engagement.

Specifically, the three components of their monetization strategy included:

  • Subscription Models: Offering various subscription tiers to cater to different user preferences.
  • In-Game Purchases: Enabling one-time purchases and game credits for users to spend as they like.
  • Global Reach: Ensuring the game worked in multiple languages to reach a broader audience, and in turn, expand the amount of potential buyers.

Playroom's Advice for Future Discord Developers

Playroom's success with "Death by AI" on Discord shows off the immense potential of building on the platform, and their journey uncovers valuable insights and knowledge for developers looking to create engaging and innovative games of their own on Discord. As Ahmed stated: "Discord is an emerging platform, and our first advice is: experiment, learn, grow!"

Playroom offers a handful of specific tips and strategies for developers looking to build and scale games on Discord:

Tips:

  1. Multilingual Support: Discord users are all over the world! Implement multilingual support to reach a broader audience. This ensures that players around the globe can enjoy your game in their native language, increasing engagement and satisfaction.
  2. Moderation: Ensure a safe and enjoyable experience by implementing moderation functionality for social games. Utilize Discord Automod for server-level actions to maintain a positive community. In social games like "Death by AI," it’s crucial for hosts or groups to have the ability to kick disruptive individuals. This is an area Playroom recognizes as essential and plans to improve. For open matchmaking games, include a reporting feature to capture in-game data for appropriate moderator action.
  3. Monetization and API Rate Limits: Make use of Discord's Entitlement API for purchases and combine client-side and server-side validation to avoid API rate limits. This ensures a smooth purchasing experience for players and helps in managing your game's economy efficiently.
  4. Scaling: While you can leverage Discord’s platform, it’s still good to ensure your backend can handle global traffic and scale efficiently to accommodate varying internet qualities and user volumes. This involves setting up robust infrastructure that can dynamically adjust to the number of active players, reducing latency and providing a smooth gaming experience.

Strategies:

  1. Server Dynamics: Develop games that can be enjoyed in small groups, but also consider larger audiences in servers to unlock true virality in the game. Get feedback directly from your users where they’re playing by creating an official Discord server for better product-market fit. Utilize Discord's server features to create events, challenges, and Activities that encourage larger groups to participate and share their experiences. 
  2. Persistence: Encourage players to return by implementing Guild-based persistence or Global stats for game progression. This can include leaderboards, achievements, and rewards that motivate players to continue playing and improving.
  3. Asynchronous Play: Make sure your game is fun, even when played at the players' leisure. Async experiences where players can catch up on what happened while they were away can significantly enhance weekly and monthly retention. Features like turn-based gameplay, notifications, and updates on friends' progress can keep players engaged long-term.
  4. Engagement: On Discord, there's an exciting opportunity to develop mechanisms to re-engage users with game updates. Utilizing your Activity’s Bot User can keep players informed of new content, events, and updates for your game, even when they are not actively playing. 

By adopting these tips and strategies, your team can create more engaging and successful games on Discord and tap into the platform's unique social dynamics and large, active user base.

Future Plans and Vision

"Death by AI" is just the beginning for Playroom. They have ambitious plans to continue innovating and expanding their presence on Discord and create more social and AI-driven games that captivate players worldwide.he

As Ahmed concluded: "As Discord implements more discovery and engagement features, we believe that more users will start playing native games embedded on the platform. The potential is immense, and we are excited to be part of this journey."

In addition to its own Activities on Discord, Playroom has also launched a kit with tutorials for others to build multiplayer Activities on Discord. Playroom’s multiplayer-game backend infrastructure originally used to create 'Death by AI' is now accessible to any developer, enabling them to quickly build and efficiently manage Discord games, with more features in development.

Ready to Build Your Own Game on Discord?

Join the ranks of successful developers like Playroom and start building your game on Discord! With robust tools, a constantly growing user base, and community-driven dynamics, Discord offers a unique opportunity to create and scale engaging multiplayer games.

Playroom's experience with "Death by AI" on Discord shows the incredible possibilities for devs on the platform. Embrace Discord's tools and community and create games that reach millions, scale effortlessly, and earn a good chunk of revenue while you’re at it!

So, what are you waiting for!? Start building today and unlock the potential of a truly social gaming experience.

Topics:
No items found.