Skip to main content
The Flock Godot SDK connects your game to the Flock backend: player auth, save data, economy, remote config, leaderboards, notifications, downloadable assets and analytics — set up from one window in the editor, with typed GDScript and C# classes generated from your own dashboard content.

Download the Godot SDK

Get the latest addon release from GitHub.

Requirements

  • Godot 4.4.1 to 4.7.2, the standard build, or the .NET build for C#. Every change to the SDK is tested on 4.4.1, 4.5.2, 4.6.3 and 4.7.2; Godot 4.3 and older are not supported.
  • Nothing else: the addon brings everything it needs, C# included.

Setup

1

Install the addon

Download flock-godot-sdk-v<version>.zip from the latest release (not GitHub’s Source code archive) and extract it into your project’s folder, so you have res://addons/flock/.Then turn on Flock under Project → Project Settings → Plugins. That adds a global Flock object to your project (an autoload), so there is no node to add to a scene. A C# project needs no extra step: your .csproj picks up the C# files inside the addon by itself.
2

Configure

Open Project → Tools → Flock → Open Flock setup. On a new project, press Create config on its Setup tab: that makes res://flock_config.tres, the file the SDK reads its settings from. Then fill in the fields from your game’s page on the dashboard:Every edit is saved into flock_config.tres when you leave the field or press Enter. The SDK finds that file when the game starts and initializes itself.
3

Resolve the game version

Press Resolve version. The version name is looked up and its id is written into flock_config.tres, so the game never has to ask the server for it, and a game started offline still gets a working SDK. The SDK will not start without this id.The same press checks that the Game name matches the game your API key belongs to, and writes nothing when it does not, so a key from the wrong game is caught here.The window’s checklist shows what is still missing. Test connection (also under Project → Tools → Flock) checks the API URL and key (and the Game name, when you typed one), before you know a version name.
Flock setup window, Setup tab, with the credentials filled in and the checklist

The Setup tab: the credentials with the version resolved, the Create config, Resolve version and Test connection buttons, and the checklist.

The API key ships inside your exported game: flock_config.tres is part of it and can be read. Use a key for the right environment, and rotate it on the dashboard if it leaks.

Your first call

With flock_config.tres in place, the SDK starts by itself when the game starts. Add this script to a node in your first scene: once the SDK has started, it picks up the player’s saved sign-in, and signs the player in with this device only when there was none.
Success is Signed in as and the player’s id in the Output panel. With no id passed, the device calls use the id Godot gives for this device (OS.get_unique_id()). Godot has none on the Web and on iOS, so there the calls fail with flock.invalid_argument and send nothing: make an id yourself, save it in the game’s files, and pass it to sign_in_with_device(id) and register_with_device(id). Two copies of the game on one computer have the same device id, and so are one player: pass a different id in one of them. A new device means a new player, so offer account linking (an email or a platform account) to players who want to get back in on another device.

Initialization

The SDK can start two ways. Automatic is the default and fits most games; manual gives you control over when it starts (after a splash screen, or once a player has answered a consent question).
Nothing to call: when the game starts, the Flock autoload reads res://flock_config.tres and initializes from it. The SDK sends its signals on the next frame, so a handler connected in _ready() still gets what the SDK announced while it started. Flock.events.when_initialized() runs its callable even when the SDK started before it was called, which a plain connect() cannot.
Restoring a saved sign-in is yours to start: call Flock.auth.restore_sign_in(), as Your first call does.
A config the SDK cannot start from (no API URL or key, no game version id) fails initialize() with flock.not_initialized and a message naming what is missing, and the automatic start raises Flock.events.initialization_failed. Until the SDK has started, its services do not exist: in GDScript Flock.auth and the others are null, and in C# FlockClient.Auth and the others throw an InvalidOperationException saying to initialize first. Check Flock.is_initialized() (FlockClient.IsInitialized in C#), or wait for when_initialized() as above.

GDScript and C#

The SDK is one client with two ways in. Its core is GDScript, reached through the Flock autoload; C# gets a typed layer, FlockClient, generated from that core and shipped inside the addon. Both use the same client, so a player signed in from GDScript is signed in for C#, and the other way round. Every call that reaches the server returns a FlockRequest in GDScript: await its completed signal (not the method), or connect to it. The answer is a FlockResult with ok, value and error. In C# the same call is an …Async method that returns a FlockResult<T> with Ok, Value and Error, and takes an optional CancellationToken.
Once the SDK has started, calls do not throw. A failed call is a result whose ok is false, in both languages, so a project that uses both handles a failure the same way on each side. Check ok: a successful call can still answer null (a player with no saved data yet, for example). Names map one to one, so a GDScript name tells you the C# one: C# code needs using Flock;, and using Flock.Generated; for the classes made from your dashboard content (Work with your game data). A project without the .NET build ignores the C# files in the addon.

Authenticate a player

Signing in does not create an account: registering is a separate register_with_* call, and a register that creates the account also signs the player in.
Sign in, and register on the first launch, as Your first call shows.
Every sign-in and register call completes with a FlockAuthInfo (the player’s id, how they signed in, and whether the sign-in was restored). The tokens stay inside the SDK. A player can add more ways to sign in to one account (link_email, link_device, link_oauth), list them (list_linked_accounts) and remove one (unlink); see Account linking. Keeping the sign-in. The sign-in is saved in an encrypted file under user:// (not the platform’s secure storage, which Godot has no access to), and Flock.auth.restore_sign_in() picks it up on the next launch. Untick persist_sign_in to keep the sign-in in memory only, so players sign in on every launch. A saved sign-in belongs to the API key it was made with: after the key changes, the player signs in again. Expired tokens are renewed for you, and only the server refusing the sign-in signs the player out: a lost connection or a server that is restarting never does. Connect to the events to drive your UI:

Work with your game data

Project → Tools → Flock → Generate content code turns your dashboard’s configs, player templates, shop items, currencies and achievements into typed classes. It reads the game version set in flock_config.tres with your API key (no player sign-in) and writes into the config’s Generated code path, res://flock/generated by default. In a C# project it writes the same classes in C# (namespace Flock.Generated) beside them; build the project afterwards. The example below assumes a player template named PlayerProgress (with a level field), a config named Gameplay (with spawn_rate) and a shop item Gem Pack on your dashboard. They are examples: create them first (Player Data, Remote Config, Shops and Inventory), or use your own names.
fetch() gives a config’s values with its patch applied. With a player signed in, a gameplay or feature config comes as the server works it out for that player: its newest patch, then the overrides of the segments the player is in, then the player’s own. save() writes every field, because the server refuses a write that leaves one out.
These classes do not exist until you generate them. Run Generate content code again whenever the dashboard changes (a new template, a renamed field, a new shop item); the setup window says how many files it wrote and removed. It only replaces the files it wrote itself, so a file of your own in that folder is kept.

Checking in CI

The generated files can fall behind the dashboard. This command, for your build pipeline (CI), tells you when they have, without opening the editor. Import the project first, as a fresh checkout has no class list yet:
-- --write instead of -- --check generates the files without the editor. Use the same Godot version you generate with in the editor. A price or a value changed on the dashboard does not count as a change: no price or value is written into the code.

Explore features

Players & auth

Account linking

Player data

Shops & inventory

Leaderboards

Notifications

Remote config

Assets

Analytics & events

Achievements

Currencies & wallets

Bans

Game patches

Not in the Godot SDK yet: multiplayer, real-money purchases and web checkout, typed tracking-plan calls, the launch events and standard event parameters, and automatic exception capture. The guides’ Godot tabs say where each stands.

Advanced settings

The setup window’s Configuration tab holds the settings a project must get right (connection, HTTP and initialization); its Advanced tab holds the rest: the offline cache, the asset cache, analytics, the content code folder, the editor checks and debug logs. Each field is a setting on flock_config.tres, and the inspector edits the same values. The defaults are sensible — change them only when you need to.
Flock setup window, Advanced tab

The Advanced tab, top to bottom: Offline Cache, Assets, Analytics, then Content Code, Editor and Diagnostics further down.

Offline cache enabled (on by default) saves game content to disk as it is read, so a game that has been online once still starts offline, and keeps the player data writes queued while offline across a relaunch. Money never waits in that queue: a fund grant or a purchase is sent once. Each guide’s Godot tab says what its feature keeps offline; Player data covers the queue. Two editor checks are on by default. Play mode guard enabled stops a run from the editor that could not start the SDK (no autoload, no game version, an invalid config) and shows a dialog with a button that opens the setup window. Fail export if version unresolved checks the game version on export; see Platform notes. Verbose logging prints the SDK’s diagnostics to the Output panel, never the request and response bodies, which carry passwords and tokens. For analytics (sessions, events, consent, quit and crash reports), see Analytics & events.

Platform notes

Exported games are tested on Windows, Linux, Android and the Web, in the standard and .NET builds (the Web in the standard build only, as Godot has no .NET export for the Web). macOS and iOS are not tested yet.
  • Android: nothing to set up. Godot’s Android export leaves the internet permission off, so while the addon is enabled it turns permissions/internet on for every Android export.
  • The Web and iOS: there is no device id, so pass your own to the device sign-in calls (see Your first call).
  • Every platform: an export whose flock_config.tres has no game version, or another version than the content code was generated for, ends with an error naming the fix. The export still writes its files (Godot gives an addon no way to stop it), so read the export’s result, or run the check in CI.

Error handling

Every failed call answers a FlockResult whose error is a FlockError. describe() gives what is wrong (the server’s own reason when it gave one), then a Fix: line telling you what to do next. In C#, Error.ToString() gives the same with the code in front.
describe() on a Web export, where Godot has no device id
In C# these are Message, Hint, Code and Status.
Branch on the code, never on message text. Codes are a stable contract; wording is not and will change between versions.
result.error_code() (ErrorCode in C#) is the code, or an empty string on success, so you can compare it directly:
Server codes are named by feature (shop.insufficient_funds, player.invalid_login_credentials). The SDK’s own codes start with flock., so a log line says which side found the problem:
The fix is written for you, not your players — it names SDK calls, settings and dashboard steps. Show it in your own logs or debug overlay, and write separate copy for your players. In GDScript, FlockErrorHints.for_code(code) gives a code’s own advice, or an empty string when it has none.
The full API reference and a guide per feature live in the SDK README.