Godot SDK
A GDScript addon for Godot 4.2+ with the same services as the Unity SDK.
Requirements#
- Godot 4.2 or newer, GDScript. Desktop, mobile and Web exports.
- No dependencies: only Godot's
HTTPRequest,CryptoandFileAccess.
Install#
- Download the Godot SDK
.zipfrom your project page or the downloads page. - Unzip it into your project so the folder is
res://addons/majacloud(keep the name). - Project ▸ Project Settings ▸ Plugins: enable Majacloud. The plugin adds the
Majacloudautoload.
Project settings#
The plugin adds these entries under Project Settings ▸ General ▸ Majacloud:
| Setting | Default | Meaning |
|---|---|---|
connection/base_url | The address of this install. | |
connection/project_id | Dashboard ▸ API keys. | |
connection/client_key | The public pk_live_… key. | |
connection/config_public_key | Filled by Test connection; pins Remote Config verification. | |
advanced/timeout_seconds | 15 | Seconds before a request fails with timeout. |
advanced/max_retries | 2 | Retries for safe requests on network and server errors. |
advanced/fetch_config_on_start | true | Fetch remote config when the game starts. |
advanced/log_requests | false | Print 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:
# 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.
| Field | Meaning |
|---|---|
ok | true when the call succeeded. |
value | The REST response as a Dictionary (see the REST reference); whole numbers arrive as int. |
error | Empty on success, otherwise a stable code such as conflict or network (see errors). |
message | A readable explanation. |
status | HTTP status, 0 when the server was not reached. |
request_id | Search for it on the Logs page. |
details | Extra data from the server, e.g. next_claim_at. |
is_retryable() and is_not_found(). |
Signals#
Connect to these signals to update your UI:
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.