⌘K
↑↓ Navigate ↵ Open Esc Close

Code Examples

29 articles on brainCloud's feature set, ordered simple to complex. It opens with the handful of calls every game needs on day one and ends with the multiplayer, account-architecture, and server-side patterns you reach for once the basics are solid. Every sample here is real, working source, pulled from the actual reference apps.

29 articles7 tiers CursorParty / RelayTestAppbitBuddiesbcchatTicTacToeBCClashersS2S / Room Servers

What this page is for. Getting a developer who is new to brainCloud, or new to one corner of it, to the example code that already solves their problem. Each article takes a single feature, explains it in about a page, and links line-for-line into the working app the code came from, so the step after reading is opening real source rather than a blank file.

It is not the API reference. The API Reference is the authority on every method, its parameters, and its response shape, and it's linked in the bar at the top of this page. This document sits in front of it, answering what a reference can't: which service to reach for, what the call looks like inside an app that shipped, and which mistakes are worth knowing about before you make them.

How to use it. Starting out, read from the top: Tier 1 is the handful of calls every app needs on day one. Later tiers lean on earlier ones in places, and each article names what it builds on. Looking for one specific thing instead, the map below lists every article against the brainCloud services it touches, and the rail on the left jumps straight to any article.

The apps the code comes from
  • CursorParty (C++, Java, C# (.NET), C# (Godot), GDScript (Godot), C# (Unity), JavaScript (React))

    Exercises realtime multiplayer: chat, matchmaking, and relay movement.

    ChatRTTLobbyRelay
  • Marketplace (Unity)

    Real-money purchases through the platform store, and the cloud-code reference scripts.

    App StoreUser ItemsPlayer StateScript
  • BCChat (JavaScript)

    Friends, groups, presence, direct messaging, and profile updates.

    FriendPresenceGroupChatMessagingPlayer State
  • FileUploader (JavaScript)

    Uploading a file to a player's account, including a memory-only variant.

    File
  • Posting and reading leaderboards, with the retention-type gotchas documented inline.

    Leaderboard
  • Bombers (Unity C#)

    Tournaments, player-to-player invites, push notification registration, and profile sync.

    TournamentEventPush NotificationPlayer State
  • TicTacToe (Unity C#)

    Turn-based multiplayer with no connection held open between turns.

    Async MatchRTT
  • BC Clashers (Unity C#)

    Offline raid multiplayer: attack while the opponent isn't even connected.

    One-Way MatchMatchMakingPlayback Stream
  • Unreal Bootcamp (Unreal C++)

    Three entity storage services used together in one file.

    EntityGlobal EntityCustom Entity
  • C++ S2S (C++)

    Your own backend authenticating and calling brainCloud directly.

    S2S
  • Room Server Management (C#, C++)

    Launching a custom room server on demand and connecting a client to it.

    RoomServerS2SLobby
  • bitBuddies (Unity)Not yet released

    Economy, accounts, and progression, including the parent–child app pattern.

    AuthenticationIdentityGlobal AppGamificationPlayer StatisticsPlayer StateVirtual CurrencyApp Management
The map
#ArticleTierbrainCloud service(s)
01Setup & InitializeFoundationsClient Initialization
02AuthenticationFoundationsAuthentication, Identity
03Player Stats & XPFoundationsGamification, Player Statistics
04Entity StorageFoundationsEntity, Global Entity, Custom Entity
05Cloud Code, the patternData & EconomyScript
06Virtual CurrencyData & EconomyVirtual Currency, Product, Script
07Persistent StateData & EconomyEntity, Leaderboard, Global App, Script
08Player State & User DataData & EconomyPlayer State
09File UploadData & EconomyFile
10Item Catalog & StoreData & EconomyApp Store, User Items, Script
11Global PropertiesData & EconomyGlobal App
12Global ChatSocialChat, RTT
13Friends & PresenceSocialFriend, Presence, RTT
14GroupsSocialGroup, Chat, Presence
15LeaderboardsSocialLeaderboard
16TournamentSocialTournament, Event
17Player-to-Player EventsSocialEvent
18MessagingSocialMessaging
19Push NotificationSocialPush Notification
20Async MatchAsync MultiplayerAsync Match, RTT
21One-Way MatchAsync MultiplayerOne-Way Match, MatchMaking, Playback Stream
22LobbiesMatchmakingLobby, RTT, Global App
23Lobby SignalsMatchmakingLobby
24Multiplayer / RelayRealtime & AdvancedRelay
25Join-in-ProgressRealtime & AdvancedRelay
26Parent–Child AccountsRealtime & AdvancedApp Management, Script
27Long-lived LobbiesRealtime & AdvancedLobby
28Server-to-ServerServer & InfraS2S
29Room ServersServer & InfraRoomServer, S2S, Lobby