Godot 4 · GDScript
Setup
Gamdato provides ready-to-use backend services. The Godot client is an addon for Godot 4.5+ (GDScript) that exposes a global node called Gamdato, accessible from any script without importing anything.
Create an Account
Sign up at gamdato.com. An activation link is sent to your email (expires in 24 hours). After verifying your email, log in to access the dashboard.
Register a Game
In your dashboard, create a new game by entering a name. You get a control panel to manage leaderboards, content, rewards, and view your player list.
Save the GAME_ID & API_KEY: you will need them to connect your game to the server.
Enable the Plugin
Copy the addon folder into addons/ in your project and enable it under Project > Project Settings > Plugins > Gamdato > Enable. This registers the global Gamdato node, available from any script.
Initial Setup
Configure the client once at startup, typically in your main scene's _ready(). The order of the tables defines their index (1, 2, 3...).
Gamdato.set_controller("YOUR-GAME-ID", "YOUR-API-KEY")
Gamdato.set_leaderboard(["table_key_1", "table_key_2"])Security: do not hardcode or commit your API_KEY. Read it from an environment variable, var key := OS.get_environment("GAMDATO_API_KEY"), or from a gitignored config file, then pass it to set_controller(). The key still ships inside the exported build, but keeping it out of source control prevents leaks. A clean pattern is a small persistent autoload (e.g. a "GamdatoController" node) that loads the credentials once and calls set_controller() for you.
Connect Signals
You never make network calls: you call functions and listen to signals for the result. Connect signals in _ready() before configuring. The session is kept alive and renewed automatically.
func _ready() -> void:
Gamdato.session_started.connect(_on_connected)
Gamdato.tables_loaded.connect(_on_ready)
Gamdato.submit_completed.connect(_on_score_sent)
Gamdato.set_controller("YOUR-GAME-ID", "YOUR-API-KEY")
Gamdato.set_leaderboard(["scores_normal", "scores_hard"])
func _on_ready() -> void:
for row in Gamdato.get_table_data(1):
print("#%d %s %d" % [row.rank, row.player_name, row.score])Status & Connection
Status functions to react in your UI:
- is_ready(): true when data is ready to display.
- is_session_active(): true while connected (ideal for a status indicator).
- has_connectivity(): true if there is internet right now. Listen to connectivity_changed to react to changes.
- reload_info(): refresh all tables from the server.
Works Offline
Gamdato is designed so your game never feels broken without internet:
- Instant reads: rankings, your best score, and downloaded content are served from local storage.
- Scores are safe: with submit_with_retry, a score sent offline is delivered on reconnect, even if the player closes the game.
- Self-reconnect: the plugin retries on its own and recovers when the network returns.