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.
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.
- CursorParty (C++, Java, C# (.NET), C# (Godot), GDScript (Godot), C# (Unity), JavaScript (React))
Exercises realtime multiplayer: chat, matchmaking, and relay movement.
- Marketplace (Unity)
Real-money purchases through the platform store, and the cloud-code reference scripts.
- BCChat (JavaScript)
Friends, groups, presence, direct messaging, and profile updates.
- FileUploader (JavaScript)
Uploading a file to a player's account, including a memory-only variant.
- Spider Solitaire (Dart)
Posting and reading leaderboards, with the retention-type gotchas documented inline.
- Bombers (Unity C#)
Tournaments, player-to-player invites, push notification registration, and profile sync.
- TicTacToe (Unity C#)
Turn-based multiplayer with no connection held open between turns.
- BC Clashers (Unity C#)
Offline raid multiplayer: attack while the opponent isn't even connected.
- Unreal Bootcamp (Unreal C++)
Three entity storage services used together in one file.
- C++ S2S (C++)
Your own backend authenticating and calling brainCloud directly.
- Room Server Management (C#, C++)
Launching a custom room server on demand and connecting a client to it.
- bitBuddies (Unity)Not yet released
Economy, accounts, and progression, including the parent–child app pattern.
| # | Article | Tier | brainCloud service(s) |
|---|---|---|---|
| 01 | Setup & Initialize | Foundations | Client Initialization |
| 02 | Authentication | Foundations | Authentication, Identity |
| 03 | Player Stats & XP | Foundations | Gamification, Player Statistics |
| 04 | Entity Storage | Foundations | Entity, Global Entity, Custom Entity |
| 05 | Cloud Code, the pattern | Data & Economy | Script |
| 06 | Virtual Currency | Data & Economy | Virtual Currency, Product, Script |
| 07 | Persistent State | Data & Economy | Entity, Leaderboard, Global App, Script |
| 08 | Player State & User Data | Data & Economy | Player State |
| 09 | File Upload | Data & Economy | File |
| 10 | Item Catalog & Store | Data & Economy | App Store, User Items, Script |
| 11 | Global Properties | Data & Economy | Global App |
| 12 | Global Chat | Social | Chat, RTT |
| 13 | Friends & Presence | Social | Friend, Presence, RTT |
| 14 | Groups | Social | Group, Chat, Presence |
| 15 | Leaderboards | Social | Leaderboard |
| 16 | Tournament | Social | Tournament, Event |
| 17 | Player-to-Player Events | Social | Event |
| 18 | Messaging | Social | Messaging |
| 19 | Push Notification | Social | Push Notification |
| 20 | Async Match | Async Multiplayer | Async Match, RTT |
| 21 | One-Way Match | Async Multiplayer | One-Way Match, MatchMaking, Playback Stream |
| 22 | Lobbies | Matchmaking | Lobby, RTT, Global App |
| 23 | Lobby Signals | Matchmaking | Lobby |
| 24 | Multiplayer / Relay | Realtime & Advanced | Relay |
| 25 | Join-in-Progress | Realtime & Advanced | Relay |
| 26 | Parent–Child Accounts | Realtime & Advanced | App Management, Script |
| 27 | Long-lived Lobbies | Realtime & Advanced | Lobby |
| 28 | Server-to-Server | Server & Infra | S2S |
| 29 | Room Servers | Server & Infra | RoomServer, S2S, Lobby |