# Remote Config

Read game settings (difficulty, drop rates, feature flags, A/B values) from the platform at runtime. This lets you change behavior without shipping a new build. Optional; available on a subset of platforms.

Fetch once at startup before gameplay, and **always provide hardcoded defaults** for every key. The request can fail, or the platform can return only part of your config.

#### Support <a href="#support-2" id="support-2"></a>

Check this before requesting remote values. If unsupported, use your local defaults.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.remoteConfig.isSupported
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.remoteConfig.isSupported
```

{% endtab %}

{% tab title="Construct 3" %}

<figure><img src="/files/1WdHKPqoidZK3wfuvIul" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="GDevelop" %}

<figure><img src="/files/ejSENJwwUtH3D7x08hwm" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Godot" %}

```gdscript
Bridge.remote_config.is_supported
```

{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_remote_config_is_supported()
```

{% endtab %}

{% tab title="Defold" %}

```lua
bridge.remote_config.is_supported()
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
bridge.remoteConfig.isSupported
```

{% endtab %}
{% endtabs %}

#### Load Values <a href="#load-values" id="load-values"></a>

Load remote values and merge them into your local defaults before gameplay starts.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
let options = { }

switch (bridge.platform.id) {
    case 'yandex':
        options = {
            clientFeatures: [ // optional parameter
                { name: 'levels', value: '5' }
            ]
        }
        break
}

bridge.remoteConfig.get(options)
    .then(data => {
        // your custom data, example: { showFullscreenAdOnStart: 'no', difficulty: 'hard' }
        console.log(data)
    })
    .catch(error => {
        // error
    })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
private void Start()
{
    var options = new Dictionary<string, object>();

    switch (Bridge.platform.id)
    {
        case "yandex":
            var clientFeatures = new object[]
            {
                new Dictionary<string, object>
                {
                    { "name", "levels" },
                    { "value", "5" },
                }
            };

            options.Add("clientFeatures", clientFeatures);
            break;
    }

    Bridge.remoteConfig.Get(options, OnRemoteConfigGetCompleted);
}

private void OnRemoteConfigGetCompleted(bool success, Dictionary<string, string> data)
{
    if (success)
    {
        foreach (var keyValuePair in data)
        {
            Debug.Log($"key: { keyValuePair.Key }, value: { keyValuePair.Value }");
        }
    }
}
```

{% endtab %}

{% tab title="Construct 3" %}

<figure><img src="/files/Jn66PDDFQyErN7SagTB5" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"yandex\""}}],"actions":[{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"clientFeatures.0.name\"","value":"\"level\""}},{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"clientFeatures.0.value\"","value":"\"42\""}}]},{"eventType":"block","conditions":[],"actions":[{"id":"send-remote-config-get-request","objectClass":"PlaygamaBridge"}]}]},{"eventType":"block","conditions":[{"id":"on-remote-config-got-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-last-action-completed-successfully","objectClass":"PlaygamaBridge"},{"id":"has-remote-config-value","objectClass":"PlaygamaBridge","parameters":{"key":"\"example_key\""}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"PlaygamaBridge.RemoteConfigValue(\"example_key\")"}}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}

<figure><img src="/files/V0cEFFTWysrlsfVkwlOz" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::CompareStrings"},"parameters":["PlaygamaBridge::PlatformId()","=","\"yandex\""]}],"actions":[{"type":{"value":"PlaygamaBridge::AddActionParameter"},"parameters":["","\"clientFeatures.0.name\"","\"level\"",""]},{"type":{"value":"PlaygamaBridge::AddActionParameter"},"parameters":["","\"clientFeatures.0.value\"","\"42\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"PlaygamaBridge::SendRemoteConfigGetRequest"},"parameters":["",""]}]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnRemoteConfigGotCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]},{"type":{"value":"PlaygamaBridge::HasRemoteConfigValue"},"parameters":["","\"example_key\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["PlaygamaBridge::RemoteConfigValue(\"example_key\")","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "yandex":
            options = {
                "clientFeatures": [
                    { "name": "player_coins", "value": "42" },
                    { "name": "player_level", "value": "dungeon_123" },
                ]
            }

    Bridge.remote_config.get(options, funcref(self, "_on_remote_config_get_completed"))

func _on_remote_config_get_completed(success, data):
    print(success)
    print(data)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "yandex":
            options = {
                "clientFeatures": [
                    { "name": "player_coins", "value": "42" },
                    { "name": "player_level", "value": "dungeon_123" },
                ]
            }

    Bridge.remote_config.get(options, Callable(self, "_on_remote_config_get_completed"))

func _on_remote_config_get_completed(success, data):
    print(success)
    print(data)
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
var options
switch playgama_bridge_platform_id() {
    case "yandex":
        options = {
            "clientFeatures": [ // optional parameter
                { name: "levels", value: "5" }
            ]
        }
        break
}

playgama_bridge_remote_config_get(json_stringify(options))

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_remote_config_get_callback" {
    if async_load[? "success"] {
        var values = json_parse(async_load[? "data"])
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
    local options = {
        yandex = {
            clientFeatures = { -- optional parameter
                { name = "levels", value = "5" }
            }
        }
    }

    bridge.remote_config.get(options, function (_, data)
        -- success
    end, function ()
        -- error
    end)
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
let options = { }

switch (bridge.platform.id) {
    case 'yandex':
        options = {
            clientFeatures: [ // optional parameter
                { name: 'levels', value: '5' }
            ]
        }
        break
}

bridge.remoteConfig.get(options)
    .then(data => {
        // your custom data, example: { showFullscreenAdOnStart: 'no', difficulty: 'hard' }
        console.log(data)
    })
    .catch(error => {
        // error
    })
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.playgama.com/playgama/sdk/api/remote-config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
