Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be πŸ“–

brainCloud Client SDK

An asset by bitheads_inc
The page banner background of a mountain and forest
brainCloud Client SDK hero image

Quick Information

0 ratings
brainCloud Client SDK icon image
bitheads_inc
brainCloud Client SDK

Official brainCloud client SDK for Godot 4 (GDScript). Adds a brainCloud editor dock for one-click credential setup, and registers a global brainCloud autoload singleton giving you instant access to all brainCloud services β€” authentication, player entities, leaderboards, cloud scripts, virtual currency, RTT WebSocket events, lobby matchmaking, and real-time relay multiplayer. All API calls are async/await compatible.

Supported Engine Version
4.1
Version String
6.0.0
License Version
MIT
Support Level
community
Modified Date
1 month ago
Git URL
Issue URL

brainCloud GDScript SDK

Official brainCloud client SDK for Godot 4 (GDScript).
Supports all brainCloud services β€” authentication, leaderboards, entities, RTT, relay multiplayer, and more.


Requirements


Installation

  1. Open your Godot project.
  2. Go to AssetLib tab β†’ search for brainCloud.
  3. Click Download then Install.
    The addon lands at addons/braincloud/.
  4. Enable it: Project β†’ Project Settings β†’ Plugins β†’ brainCloud β†’ Enable.

Manual install

  1. Copy the addons/braincloud/ folder from this repo into the root of your Godot project.
  2. Enable the plugin via Project β†’ Project Settings β†’ Plugins.

Plugin Setup

Once the plugin is enabled a brainCloud dock appears on the right side of the editor. Enter your app credentials here and click Save.

Dark theme Light theme
README brainCloud panel – dark README brainCloud panel – light
Field Description
App ID Your app's ID from the brainCloud portal
App Secret Your app's secret key
Server URL Leave as default unless using a private deployment
App Version Your game version string (e.g. 1.0.0)
Debug Logging Prints all API traffic to the Godot output panel

Credentials are saved to addons/braincloud/braincloud.cfg, which the plugin automatically adds to your .gitignore so secrets are never committed.


Autoload Singleton

When the plugin is enabled it registers brainCloud as a global autoload singleton (BrainCloudWrapper). It reads your saved credentials at startup and initialises itself automatically β€” no code required for basic setup.

Access it from any script:

brainCloud          # the BrainCloudWrapper singleton
brainCloud.authentication_service
brainCloud.entity_service
brainCloud.leaderboard_service
# … and every other brainCloud service

Authenticating

All authentication calls are await-able and return a Dictionary with the full server response.

Anonymous (simplest)

func _ready() -> void:
    var response = await brainCloud.authenticate_anonymous()
    if response.status == 200:
        print("Authenticated! Profile ID: ", response.data.profileId)
    else:
        print("Auth failed: ", response.reason_code)

Email / Password

var response = await brainCloud.authenticate_email_password("[email protected]", "password", true)
if response.status == 200:
    print("Logged in as: ", response.data.profileId)

Universal (username + password)

var response = await brainCloud.authenticate_universal("my_username", "my_password", true)

Re-authenticate (restore previous session)

var response = await brainCloud.reauthenticate()

Other supported providers: authenticate_google, authenticate_apple, authenticate_facebook, authenticate_steam, authenticate_nintendo, authenticate_twitter, and more β€” see BrainCloudWrapper.gd for the full list.


Calling Services

Every brainCloud service is available through the singleton. All calls are await-able.

# Read a player entity
var response = await brainCloud.entity_service.get_entities_by_type("profile")
if response.status == 200:
    var entities = response.data.entities
    print("Got %d entities" % entities.size())

# Write a global statistic increment
await brainCloud.global_statistics_service.increment_global_statistics({"gamesPlayed": 1})

# Run a cloud script
var result = await brainCloud.script_service.run_script("MyCloudScript", {"param": "value"})
print(result.data.response)

RTT & Relay Multiplayer

Real-Time Tech (RTT) must be enabled on your brainCloud app before use.

Enable RTT

# Register event callbacks before enabling
brainCloud.rtt_service.register_rtt_lobby_callback(func(data): print("Lobby event: ", data))
brainCloud.rtt_service.register_rtt_event_callback(func(data): print("Event: ", data))

var response = await brainCloud.rtt_service.enable_rtt("WEBSOCKET")
if response.status == 200:
    print("RTT connected")

Connect to a Relay Server

var connect_options = {
    "host":    lobby_data.connectData.host,
    "port":    lobby_data.connectData.ports.ws,
    "ssl":     false,
    "lobbyId": lobby_data.lobbyId,
    "passcode": lobby_data.passcode
}

brainCloud.relay_service.register_relay_callback(func(net_id, data): _on_relay_data(net_id, data))
brainCloud.relay_service.register_system_callback(func(data): print("System: ", data))

await brainCloud.relay_service.connect(connect_options,
    func(_r): print("Relay connected"),
    func(_r): print("Relay failed"))

# Send to all players
var payload = "hello".to_utf8_buffer()
brainCloud.relay_service.send(payload, BrainCloudRelay.TO_ALL_PLAYERS, true, true, BrainCloudRelay.CHANNEL_HIGH_PRIORITY_1)

Manual Initialisation

If you prefer not to use the plugin panel you can initialise the SDK in code instead:

func _ready() -> void:
    brainCloud.init("YOUR_APP_SECRET", "YOUR_APP_ID", "1.0.0")

Example Project

See the brainCloud Godot Examples repo for a complete GDScript Relay Test App demonstrating login, lobby, RTT, and relay multiplayer.


Links

Official brainCloud client SDK for Godot 4 (GDScript). Adds a brainCloud editor dock for one-click credential setup, and registers a global brainCloud autoload singleton giving you instant access to all brainCloud services β€” authentication, player entities, leaderboards, cloud scripts, virtual currency, RTT WebSocket events, lobby matchmaking, and real-time relay multiplayer. All API calls are async/await compatible.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
brainCloud Client SDK icon image
bitheads_inc
brainCloud Client SDK

Official brainCloud client SDK for Godot 4 (GDScript). Adds a brainCloud editor dock for one-click credential setup, and registers a global brainCloud autoload singleton giving you instant access to all brainCloud services β€” authentication, player entities, leaderboards, cloud scripts, virtual currency, RTT WebSocket events, lobby matchmaking, and real-time relay multiplayer. All API calls are async/await compatible.

Supported Engine Version
4.1
Version String
6.0.0
License Version
MIT
Support Level
community
Modified Date
1 month ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers