All Collections
Portal Pages
Design | Custom Config | Global Properties
Design | Custom Config | Global Properties

A brainCloud Power tool for tuning your game

Paul Winterhalder avatar
Written by Paul Winterhalder
Updated over a week ago

An example of a top-down airplane dog-fighting game.

You can create these global properties for your game on the brainCloud dashboard.


Creating a Global Property

  • Click the [Add Item] button with the plus icon.

  • Enter the Name, Category, Type, and Description.

  • Property values can be simple strings or JSON objects. In either case, the data itself is stored as a String, and left to the client to interpret.

  • The Preserve flag is used to signal whether the value should be overwritten during deployment.

  • [Save] your new Global Property!

Design Examples: 

Global Properties are highly effective at rapidly tuning the feel of the game and finding the fun.

An example of a a duelling card game.

Design Suggestions

  • Global Properties that use a number range are generally the most useful in the long run. Text-based Global Properties tend to be less useful over time. 

  • Agree with your developer in advance if your value will be a float, integer or boolean, or something more complex. 

  • Group related variables together with Categories to make it easy to find the values later.

  • Designers should create brief descriptions that represent how changing the value changes the feel of the game. 

  • Mention a good default and range in the Description.
    ​  

Writing the code

Now that you set up those global properties, you and your dev team will be able those use those variables in your app to tweak settings and gameplay.

In your client code

  • Add the brainCloud client to your app.

  • Pair the client with the dashboard.

  • Authenticate your user into brainCloud.

  • Request your Global Properties via ReadProperties API call

  • Capture those properties, and pass them into your game's configuration.

void Start() {
    // Unity
    GameObject go = new GameObject();
    _bc = go.AddComponent<BrainCloudWrapper>();
    _bc.WrapperName = _wrapperName; // optionally set a wrapper-name
    _bc.Init(); // extra data, such as: _appId, _secret and _appVersion, is taken from the brainCloud Unity Plugin.
    DontDestroyOnLoad(go); // keep the brainCloud game object through scene changes
 
    _bc.ResetStoredAnonymousId();
    _bc.ResetStoredProfileId();
   
    _bc.AuthenticateAnonymous((response, cbObject) => { CustomAppSetup(); });
}
 
void CustomAppSetup() {
    _bc.GlobalAppService.ReadProperties((response, cbObject) =>
    {
        var jsonMessage =
            (Dictionary<string, object>) BrainCloud.JsonFx.Json.JsonReader.Deserialize(response);
        var jsonData = (Dictionary<string, object>) jsonMessage["data"];

        var PlayerHPCap = int.Parse(((Dictionary<string, object>) jsonData["PlayerHPCap"])["value"].ToString());
        var turntime = int.Parse(((Dictionary<string, object>)jsonData["turntime"])["value"].ToString());
        var EnergyStart = int.Parse(((Dictionary<string, object>)jsonData["EnergyStart"])["value"].ToString());
        var MaxOnBoard = int.Parse(((Dictionary<string, object>)jsonData["MaxOnBoard"])["value"].ToString());
        var PlayerHPStart = int.Parse(((Dictionary<string, object>)jsonData["PlayerHPCap"])["value"].ToString());
        var DeckAllowNCopies = int.Parse(((Dictionary<string, object>)jsonData["DeckAllowNCopies"])["value"].ToString());
        var deckSize = int.Parse(((Dictionary<string, object>)jsonData["deckSize"])["value"].ToString());

        // TODO your custom setup logic for your game
        setupCardGameConfigurations(PlayerHPCap, turntime, EnergyStart, MaxOnBoard, PlayerHPStart, DeckAllowNCopies, deckSize);
    });
}


Did this answer your question?