Configs
This API is used to retrieve configurations from the Gamebeast platform.
For more information about Configurations, visit the Configurations Guide.
Values are addressed by dot-path where the first segment is the configuration alias: "MyConfig.PlayerSpeed" reads the PlayerSpeed key of the MyConfig configuration. Paths can reach deeper ("MyConfig.UI.ButtonColor") and index arrays ("MyConfig.Levels.0"). A bare alias ("MyConfig") is the whole configuration document.
Configurations are evaluated for the local player: if they are enrolled in an active experiment, the values already include the assigned group's changes.
Configurations load on demand: the first read fetches the configuration. Listing configurations in configurations (setup options or Project Settings) also loads them at startup and makes configs_ready wait for them. Every configuration is cached on the device, so values are there instantly on the next launch and offline. A cache written by a different build (application/config/version in Project Settings) or for a different player is discarded.
Loaded configurations stay current on their own. Every 60 seconds in release exports (the status_poll_interval_sec setting) the SDK asks Gamebeast whether anything changed, and re-evaluates only the configurations that did. Every configuration is also re-evaluated every 120 seconds (config_refresh_interval_sec), so a change to one player, such as moving them to another group, reaches them mid-session. In the editor and debug exports they run every 5 and 15 seconds. Use on_changed or observe to run your code when a value changes.
get_float, get_int, get_bool, get_string, get_dict, get_array (path, default)
float / int / bool / String / Dictionary / Arrayreturn type
Reads a value. Returns default when the configuration hasn't loaded yet, the path is missing, or the value can't be read as that type. Numbers and booleans stored as strings ("1.5", "true") are converted. Always pass the value your game uses today as the default, so it behaves the same offline.
Godot's JSON parser reads every number as a float. get_int converts it for you; integers above 2^53 lose precision.
pathStringThe path of the value, starting with the configuration alias.
defaultfloat / int / bool / String / Dictionary / ArrayReturned when the value isn't available. Optional: 0, false, an empty string or an empty
collection.
Usage
var player_speed := Gamebeast.configs.get_float("MyConfig.PlayerSpeed", 600.0)
var starting_coins := Gamebeast.configs.get_int("MyConfig.Economy.StartingCoins", 100)get_value(path, default)
Variantreturn type
Returns any value as Godot parsed it from JSON (numbers are floats), or default (null if omitted) when it's unavailable. Dictionaries and arrays are copies, so changing them doesn't affect the SDK.
try_get(path) and has_value(path)
Dictionary / boolreturn type
try_get returns {"found": bool, "value": Variant} without logging when the value is missing. has_value returns whether the path resolves to a value right now.
is_ready() and configs_ready
boolreturn type
Whether every configuration listed in configurations has loaded (from the network or the device cache). True right after setup when none are listed. The configs_ready signal fires when it becomes true.
on_ready(callback)
GamebeastSubscriptionreturn type
Calls callback once is_ready is true, immediately if it already is.
Usage
Gamebeast.configs.on_ready(func():
speed = Gamebeast.configs.get_float("MyConfig.PlayerSpeed", 600.0))on_changed(path, callback)
GamebeastSubscriptionreturn type
Calls callback with the new value whenever the value at path changes. It does not fire for the first load; use observe for that. The value is null when the path was removed.
Usage
Gamebeast.configs.on_changed("MyConfig.PlayerSpeed", func(value):
print("PlayerSpeed is now ", value))observe(path, callback)
GamebeastSubscriptionreturn type
Like on_changed, but also calls callback with the current value as soon as there is one. The best fit for values that may still be loading.
Usage
var _speed_subscription: GamebeastSubscription
func _ready() -> void:
_speed_subscription = Gamebeast.configs.observe("MyConfig.PlayerSpeed", _on_speed_changed)
func _exit_tree() -> void:
_speed_subscription.cancel()Call cancel() on the returned GamebeastSubscription to stop. A subscription to a method of a node is dropped by itself once that node is freed; inline lambdas aren't, so cancel those.
configuration_updated
Signal, with the alias of a configuration that just loaded new values. Read the values you need again.
refresh()
voidreturn type
A coroutine. Checks every known configuration now instead of waiting for the next check. Unchanged configurations cost almost nothing: the SDK sends the hash it has, and the server answers "unchanged". The SDK does this by itself when the game returns from the background.
get_known_aliases()
PackedStringArrayreturn type
The configurations the SDK is tracking, preloaded and loaded on demand.