brainCloud API Documentation

website·Indexed 32 days ago

https://docs-internal.braincloudservers.com/

Technical documentation for the brainCloud backend-as-a-service, covering API methods for game development including authentication, leaderboards, item catalogs, matchmaking, cloud code logging, and social features. Includes implementation details, method parameters, and code examples for C#, Java, JavaScript, Dart, and Roblox.

Tokens
342.9K
Snippets
1.8K
Records
2.5K
Agent score
46%

What's inside brainCloud

  1. Overview of brainCloud Relay Server

    The brainCloud Relay Server (Version 2 Protocol) acts as a non-authoritative relay for packet data between peers. It supports cross-platform communication between clients using UDP, TCP, or WebSockets (WS).

    Key constraints and behaviors:

    • Capacity: Supports up to 40 players, though 8 players is highly recommended due to the high traffic generated by Peer-to-Peer communication.
    • Owner Migration: If the lobby owner leaves or fails to connect, the server migrates the owner role to the member with the best ping, or the next member in the lobby list.
    • Reliability: Relay-Server Messages (RSMG) are sent in JSON format. For UDP clients, the server resends these every 200ms until an RSMG Acknowledge packet is received.
  2. Overview of Group Files

    Group Files allow a specific group to own files and folders, similar to Group Entities. They support a hierarchical folder structure and ACL permissions at both the folder and file levels, allowing access control based on whether a user is the 'owner', a 'member', or 'other'. Group files can be created, moved, copied, and deleted, and there is functionality to move or copy user files into group files. Note that group files are not migrated to downstream apps during deployment.
  3. Overview of User Item Management APIs

    BrainCloud provides several categories of APIs for managing user items:

    Read Items:

    • GetUserItem, GetUserItemsPage, GetUserItemsPageOffset: Retrieve specific items or pages of inventory.
    • GetItemPromotionDetails, GetItemsOnPromotion: Manage and retrieve promotional pricing and eligibility.

    Affect Item Owner:

    • AwardUserItem, AwardUserItemWithOptions: Award items without charge.
    • DropUserItem, SellUserItem: Remove items or sell them for currency.
    • GiveUserItemTo, ReceiveUserItemFrom: Handle gifting between players.
    • PurchaseUserItem, PurchaseUserItemWithOptions: Buy items from a store.
    • SYS_AwardUserItemToUser, SYS_AwardUserItem: Cloud code only APIs for awarding items.

    Edit Item State:

    • UseUserItem: Use or consume an item.
    • UpdateUserItemData: Modify item-specific data.

    Blockchain:

    • PublishUserItemToBlockchain, RemoveUserItemFromBlockchain, RefreshBlockchainUserItems: Sync and manage items on the attached blockchain.
  4. Overview of Promotions Service APIs

    The Promotions service provides several S2S and Cloud Code operations for managing game promotions:

    • SysGetPromotionList: Returns a list of configured promotions (summary only).
    • SysReadPromotion: Returns the full configuration data for a specific promotion.
    • SysCreatePromotion: Creates a new promotion using a provided JSON configuration.
    • SysUpdatePromotion: Updates an existing promotion. Any promotionId inside the promotionJson is ignored in favor of the direct parameter.
    • SysDeletePromotion: Removes a promotion from the server.
    • SysEnablePromotion: A convenience API to toggle a promotion on or off.
  5. Overview of Global Game Statistics

    The Global Game Statistics service manages statistics stored centrally across all of an app's users. These statistics must be pre-defined in the brainCloud portal on the Global Statistics page. Alternatively, you can enable the 'Generate App Statistic Rule Enabled' setting in the Advanced Settings page of the portal to create them dynamically at runtime.
  6. Overview of Global Statistics service

    The Global Statistics service manages predefined statistics stored centrally across all users of an app. Statistics must be pre-defined in the brainCloud portal under the 'Statistics Rules - Global Statistics' page. Alternatively, dynamic runtime creation can be enabled via the 'Generate App Statistic Rule Enabled' setting on the Advanced Settings page of the portal.
  7. Overview of the RoomServer service

    The RoomServer service enables developers to launch hosted servers directly without using lobby matchmaking. It provides a set of system operations to manage server lifecycles, member validation, and custom event triggering for hosted server instances.
  8. Overview of User service administrative operations

    The User service (v4.3+) provides administrative CRUD and iteration capabilities. It is only accessible via Cloud Code or S2S. Key capabilities include:

    • User Creation: Create users via email, Universal ID, or external authentication.
    • User Management: Retrieve user info, delete users, and page through the user list.
    • Password Management: Various methods to send password reset emails (with/without expiry and custom templates) or set passwords directly.
    • Account Deletion: Generate self-service account deletion URLs.
  9. Overview of ProductManagement service APIs

    The ProductManagement service allows developers to manage products and prices programmatically via Server-to-Server (S2S) calls and Cloud Code. Available operations include:

    • SysGetProductList: Returns a summary list of products, optionally filtered by category.
    • SysReadProduct: Retrieves full metadata for a specific product.
    • SysCreateProduct: Creates a new product.
    • SysUpdateProduct: Updates an existing product. Use version -1 to bypass version checking.
    • SysDeleteProduct: Deletes a product item.
    • SysAddProductPrice: Adds a new price to a product.
    • SysUpdateProductPrice: Replaces an existing price for a product.
    • SysDeleteProductPrice: Deletes a price. If the deleted price is the active one, defaultPriceId is set to -1 (not-for-sale).
    • SysSetDefaultProductPrice: Sets the active default price for a product.
  10. Overview of the MatchMaking Service

    The MatchMaking Service is used to locate players for Async or One-Way multiplayer features. To use this service, it must be enabled in the brainCloud portal under the Multiplayer - MatchMaking page, where the starting Player Rating is also configured.

    Important: A player must be explicitly enabled via the EnableMatchMaking method call to participate in matchmaking; this allows developers to exclude players who are still in a tutorial.

  11. Overview of PlaybackStreamService

    The PlaybackStreamService allows developers to create, record, and replay a series of events. It is specifically utilized by One-Way Matches to track event sequences. All APIs prefixed with "Sys" are available to both clients and Server-to-Server (S2S) integrations.