BLOGAnnounced at MongoDB.local NYC 2024: A recap of all announcements and updates — Learn more >

Gaming Player Profiles Solution

Seamless game data management with MongoDB Atlas including global profiles, records and real-time dashboards.
Start Free
Gamepad illustration.
Solution Overview

In the gaming industry, managing player profiles, inventory, and game states on a global scale is a challenge. MongoDB Atlas combined with Leafsteroids offers a solution. Global Clusters handle player profiles seamlessly, regardless of geography and MongoDB, with its flexible document model, offers advanced data management, enabling detailed game recordings. Real-time player dashboards via Atlas Charts and user-friendly interactions with Atlas Search enrich the player experience. With MongoDB Atlas, the future is now, where global scalability, efficient data management, and user-focused design coexist harmoniously in the gaming industry.

Reference Architectures
Without Atlas:
Reference architecture without Atlas illustration.

Traditional approach to managing gaming data and profiles at a global scale involves building a global query router, replication services between multiple nodes across the globe, and integrating into distinct warm storage options. The architecture also requires a separate search engine and visualization tool, with a serverless query service to federate our data into the visualization tool.

With Atlas:
Reference architecture with Atlas illustration.

With Atlas, a single connection to the MongoDB Atlas Developer Data Platform suffices. By leveraging global clusters, Online Archive, Atlas Search, Atlas Charts and Data Federation; we have a comprehensive set of capabilities required for managing gaming data at a global scale.

Data Model Approach
Data model approach illustration.

A recording signifies a player's gameplay from an event, including scores, moves, and statistics. Using .net (C#), a subset of the player and event is stored in the recording through the extended reference pattern, employing subclassing and custom serialization. This design enhances query performance by allowing selective field embedding and offers future flexibility. In massive online games like "PUBG," with billions of players, data locality is critical for optimal experience and to satisfy legal requirements. Players and recordings are globally sharded, utilizing location-based ISO codes. Atlas Global Clusters enable superior performance and easy scalability, allowing shard and zone additions without service disruptions.

Building the Solution

At the core of the engaging Leafsteroids gaming platform lies the robustness of MongoDB Atlas. Designed as a demonstration, the game is a harmonious blend of interactive user experiences and meticulous data management.

Features & Integration
  • MongoDB Atlas: Leafsteroids fully harnesses the capability of Atlas Global Clusters. This ensures that player profiles are efficiently managed on a massive scale, ensuring an uninterrupted gaming journey regardless of the player's geographical location. For data precision, player information is stored employing ISO country codes and shard/zone assignments.
  • At the foundation of data processing lies the flexible document model. Not only does it support in-depth game recordings, but it also embodies the ethos "data that works together lives together." Adhering to the concept of operational simplicity, other data sets are organized within uncomplicated collections.
  • Over time, as games become wildly successful with millions of players and game runs, the amount of data generated can increase costs and impact performance. Leafsteroids uses a data tiering strategy through Atlas Online Archive to automatically offload game data older than 90 days to optimized storage. Atlas Data Federation then allows seamless access to both recent and historic data.
User Experience Highlights
  • Player Dashboard: A standout feature, the bespoke player dashboard, available online through Atlas Charts, ensures real-time updates on in-game achievements and progress. Using the filtering and embedding features of Atlas Charts, the same dashboards can be repurposed for player- or event-level dashboards. This elevates the overall player experience.
  • Atlas Search: Another pivotal component adding to the game's user-centricity, players can swiftly locate their nicknames within the Web UI using the autocomplete and fuzzy matching features, fostering a more intuitive user interaction.
Architecture
  • Game Client: Developed using Unity3D, .NET, C#
  • Game Server: Built on ASP.NET Web API, .NET, C#
  • Website: Crafted as a Blazor Server Application using .NET, C#
Setting up your clone
  • Prerequisites: Install the .NET SDK 7 and set up the MongoDB Atlas database
  • Run REST Service: Navigate to the rest_service folder, modify the .env file, and execute using the given command
  • Launch the Website: Access the website folder, adjust the .env file, and run using the provided command
  • Game Client Execution: In the game_client directory, tweak the .env in Assets, and initiate the game
Game Aspects
  • Game Plays (recordings): These are representations of a player's in-game activity during an event. Stored using the extended reference pattern, these recordings can be linked to the full Player and Event objects, although only selective fields are serialized at the time of persistence.
  • Player Profiles and Game Plays: In massively multiplayer games, data localization is pivotal. The Leafsteroids solution globally shards the Players and Recordings collections. With Atlas Global Clusters, ISO Country and Subdivision codes are connected to Zones, optimizing query and write request routing. Benefits include limitless scalability and hassle-free data distribution upgrades.
Technologies and Products Used
MongoDB Developer Data Platform
Partner Technologies
  • Unity Game Engine
  • AWS EC2
Key Considerations
  • Use global clusters, read from secondary, and write to primary to scale horizontally and cater to a global audience without side effects and latency.

  • Leverage the document model to store all data for a single game run in a single document, but serialize a subset during run time for boosting performance.

  • The Players and Recordings collections are “globally sharded.” The first segment of the shard key is the location. Atlas Global Clusters associates ISO Country and Subdivision codes (ISO-3166-1,ISO-3166-2) to Zones where a zone is 1+ shards hosted on a cloud region and used to route query and write requests, ensuring the best performance. Global queries are also supported.

Authors
  • Sigfrido Narvaez, MongoDB
  • Dominic Frei, MongoDB
  • Hubert Nguyen, MongoDB
Related Resources
general_content_developer

GitHub Repository: Leafsteroids

Create this solution yourself with the associated sample data, functions, and code.

industry_mobile_gaming

MongoDB for Gaming

Learn how MongoDB’s developer data platform supports various gaming use cases.

mdb_migration_success

Customer Story - SEGA

SEGA HARDlight migrates to MongoDB Atlas to simplify ops and improve experience for millions of mobile gamers.

Get started with Atlas

Get started in seconds. Our free clusters come with 512 MB of storage so you can experiment with sample data and get familiar with our platform.
Try FreeContact sales
Illustration of hands typing on a laptop in the foreground and a superimposed desktop window and coffee cup in the background.