Godot SDK

A GDScript addon for Godot 4.2+ with the same services as the Unity SDK.

On this page

Requirements#

  • Godot 4.2 or newer, GDScript. Desktop, mobile and Web exports.
  • No dependencies: only Godot's HTTPRequest, Crypto and FileAccess.

Install#

  1. Download the Godot SDK .zip from your project page or the downloads page.
  2. Unzip it into your project so the folder is res://addons/majacloud (keep the name).
  3. Project ▸ Project Settings ▸ Plugins: enable Majacloud. The plugin adds the Majacloud autoload.

Project settings#

The plugin adds these entries under Project Settings ▸ General ▸ Majacloud:

SettingDefaultMeaning
connection/base_urlThe address of this install.
connection/project_idDashboard ▸ API keys.
connection/client_keyThe public pk_live_… key.
connection/config_public_keyFilled by Test connection; pins Remote Config verification.
advanced/timeout_seconds15Seconds before a request fails with timeout.
advanced/max_retries2Retries for safe requests on network and server errors.
advanced/fetch_config_on_starttrueFetch remote config when the game starts.
advanced/log_requestsfalsePrint every request to the output.

Test connection#

Project ▸ Tools ▸ Majacloud: Test connection calls the API with your settings, shows the project name and plan, and stores the Remote Config public key in majacloud/connection/config_public_key.

Configure from code#

Call configure() to switch environments from code. It replaces the settings for the rest of the session:

GDScript
# Switch environments from code; the last argument pins the Remote Config key (PEM)
Majacloud.configure("https://staging.yourstudio.com", "<project id>", "pk_live_…", public_key_pem)

MajacloudResult#

Every call is awaited and returns a MajacloudResult. It never crashes on network or server errors.

FieldMeaning
oktrue when the call succeeded.
valueThe REST response as a Dictionary (see the REST reference); whole numbers arrive as int.
errorEmpty on success, otherwise a stable code such as conflict or network (see errors).
messageA readable explanation.
statusHTTP status, 0 when the server was not reached.
request_idSearch for it on the Logs page.
detailsExtra data from the server, e.g. next_claim_at.
is_retryable() and is_not_found().

Signals#

Connect to these signals to update your UI:

GDScript
func _ready() -> void:
	Majacloud.auth.player_changed.connect(_on_player_changed)
	Majacloud.auth.session_expired.connect(func(): show_sign_in_screen())
	Majacloud.remote_config.updated.connect(func(): apply_balance())

func _on_player_changed(player: Dictionary) -> void:
	$NameLabel.text = player.get("display_name", "")

Storage on the device#

The guest session is stored encrypted in user://majacloud/<project id>.session and restored on the next launch. The verified remote config is cached next to it for offline play, and user://majacloud/device.id holds a random installation ID (not hardware based).

Web exports#

  • Serve the export over HTTPS; the API sends the CORS headers browsers need.
  • user:// is kept in the browser's storage, so sessions survive page reloads.
  • Call link_account() from an input event (for example a button press) so the browser allows the new tab.

Search page titles, headings and text.

↑↓ to navigate ↵ to open Esc to close