Remote Configurations
GameAnalytics' Remote Configurations feature offers the ability to set up and tune values in your game's dashboard.
These values can be changed on the whim without needing to release a new version of the game. The remote configs are a custom set of key-pair values.
Set up your Remote Configurations in the GameAnalytics dashboard.
Check for Remote Config updates
Remote Configurations may not be available immediately, as they need to be retrieved from the server. The GameMaker SDK has no listener or callback for remote configs, so poll ga_is_remote_configs_ready() instead, for example once per second from the Step event of a persistent controller:
// Step event
remote_configs_poll_timer--;
if (remote_configs_poll_timer <= 0) {
remote_configs_poll_timer = game_get_speed(gamespeed_fps);
if (!remote_configs_applied && ga_is_remote_configs_ready()) {
remote_configs_applied = true;
// your code here, read values now that they are ready
}
}
ga_is_remote_configs_ready() will return false if the configs haven't been populated by the server yet.
Remember the remote configs can be populated with an empty dictionary if the device is offline and there are no cached remote configs from a previous session.
Retrieve Remote Config Values
Once ga_is_remote_configs_ready() returns true you can start reading values:
// retrieve a remote config as string with a fallback value
var remote_value = ga_get_remote_configs_value("my_key", "my_default_value");
// retrieve a value as a JSON string
var remote_json = ga_get_remote_configs_value_as_json("my_json_key");
// retrieve the whole payload as a JSON string
var remote_content = ga_get_remote_configs_content();
If the specified key is not found in the Remote Configs it will return the default value, either the one you passed or an empty string.