Skip to content

Data Scheme

During the Deploy, Balancy generates JSON files and uploads it to our CDN. For each template we create an individual file with the version suffix.

The main file, where you can find the latest versions for all the JSONs is located here:

https://data.un-cdn.unnyplay.com/entities/{game_id}/{environment}/versions.json
Parameter Description
{game_id} guid of your game; You can find it the dashboard
{environment} Environment: dev, stage, production

For example, if you deployed from the DEV environment for the game with guid 11111111-1111-1111-111111111111, then the address of your versions file is next:

https://data.un-cdn.unnyplay.com/entities/11111111-1111-1111-111111111111/dev/versions.json

Versions file structure:

{
    "dictionaries": [
        {
            "version": "3",
            "name": "EnemyInfo",
            "id": "10587"
        },
        {
            "version": "5",
            "name": "DamageInfo",
            "id": "12"
        }
    ]
}

The value by the key dictionaries contains the list of all the templates' info.

Key Description
version the latest version of the template; the version increases only if there were any changes in the template itself or in any of its documents
name Name of the Template
id System information. Never changes comparing to the name

The link to the EnemyInfo data will be available at:

https://data.un-cdn.unnyplay.com/entities/11111111-1111-1111-111111111111/dev/EnemyInfo_v3.json

Template data file structure

{
    "list": []
}

The value by the key list contains the list for all the documents of the current Template. Each document contains all the parameters by the name and some system information. For example:

{
    "list": [
        {
            "unnyId": "3398",
            "unnyIdDamageInfoOfEnemy": "122",
            "probabilityInt": 1,
            "probabilityFloat": 1.2,
            "stringParam": "test",
            "count": {
                "unnyId": "3399",
                "min": 1,
                "max": 1
            },
            "limitedBool": true,
            "myEnum": 1
        }
    ]
}
  1. Each document has its unique unnyId. It's generated by Balancy and never changes.
  2. Simple types are stored by the parameter Name (in camelCase). For ex: "stringParam": "test".
  3. Enum stored by its int value.
  4. Reference types (Document or List of Documents) have a harder logic. The key of such parameters have prefix unnyId. For example parameter DamageInfoOfEnemy is stored in JSON as unnyIdDamageInfoOfEnemy. The value contains the unnyId of the reference. In our example the reference is to the Document from DamageInfo, which currently has version 5. It means that you can find the document with the unnyId = 122 in the JSON file, located at this address: https://data.un-cdn.unnyplay.com/entities/11111111-1111-1111-111111111111/dev/DamageInfo_v5.json.
  5. Component types work the same as Documents from p.4.
  6. Injected Component are being injected into the value. They don't generate an additional JSON file. In our example parameter Count.

Code Generator

You can study the code generated by Balancy to understand better how everything works.

  1. At launch it downloads Version file.
  2. Compares the remote Version file with the cached one.
  3. If any of the Template JSONs file were changed - we download the newest versions and cached them as well.
  4. Then all the JSON file are being read, mapped to the classes and added to Global Dictionary by the key unnyId.
  5. All the links are resolved from the Global Dictionary when they are requested.