Profile Config Format

Overview

Profile config is a free-form JSON object passed to the Profile server and made available to game scripts at runtime. Unlike other configs, it has no fixed schema, the structure is defined entirely by the game.

Scripts read the config using load_server_config. See the for details on how to use it in scripts.

The config format depends on the leaderboard source configured for the project. See Config Modes below.


Adding Profile Config

To use profile config, you need to:

  1. Add the profile config description to the profile config.

  2. Deploy configs to services.


Config Modes

Config modes are relevant only if you use the Profile service together with the Leaderboard service. The mode determines which leaderboard source (LbConfigSource) is configured for the project and whether the config requires an additional userstats section.

If you use the Profile service without leaderboards, the config is always free-form, see Profile Mode.

Mode

LbConfigSource

Description

Profile mode

USERSTAT_SERVICE

Free-form JSON config.

Statistics and leaderboards are managed by the UserStat service.

Profile + Leaderboard mode

PROFILE_SERVICE

Free-form JSON config with an additional required userstats section.

Statistics and leaderboards are managed by the Profile service.

Leaderboard only mode

PROFILE_SERVICE_ONLY_LB

Config consists only of the userstats section.


Profile Mode

Used when LbConfigSource = USERSTAT_SERVICE.

The config is a free-form JSON object. There are no required fields, the structure is fully defined by the game. The config must not exceed the maximum allowed size.

{
  "maxLevel": 100,
  "levelUpXp": 1000,
  "welcomeMessage": "Welcome!"
}

Scripts read this config using load_server_config:

options gen2
module config public
require jsonrpc

struct Config {
  maxLevel : int
  levelUpXp : int64
  welcomeMessage : string
}

let shared config <- load_server_config(Config())

Note

Fields not present in the config are initialized with their default values from the daScript struct definition.


Profile + Leaderboard Mode

Used when LbConfigSource = PROFILE_SERVICE.

In addition to the free-form game config, this mode requires a userstats section that defines statistics, modes, and tables used for leaderboards.

{
  "maxLevel": 100,
  "userstats": {
    "stats": {
      "kills": { "type": "INT", "leaderboard": true },
      "score": { "type": "FLOAT", "leaderboard": true }
    },
    "modes": {
      "solo": { "leaderboard": "SIMPLE" }
    },
    "tables": {
      "global": {
        "leaderboard": "SIMPLE",
        "start": "2020-01-01T00:00:00Z",
        "end": "2030-01-01T00:00:00Z",
        "indexOffset": 1
      }
    }
  }
}
userstats object required

Defines the statistics configuration used by the Profile service for leaderboards.

Contains the following sections:

stats object required

Statistics definitions. Each key is a stat name, and the value defines the stat.

Fields:

type string required

Type of the stat: INT or FLOAT.

leaderboard bool optional

If true, the stat is included in the leaderboard. Defaults to true. Stats with leaderboard: false are not allowed in this mode.

meta JSON object optional

Arbitrary data attached to the stat.


modes object required

Mode definitions. Each key is a mode name, and the value defines the mode.

Fields:

leaderboard string optional

Type of leaderboard for this mode. Defaults to SIMPLE. Only SIMPLE is supported in this mode.

premium bool optional

If true, marks this mode as premium. Defaults to false.

meta JSON object optional

Arbitrary data attached to the mode.


tables object required

Table definitions. Each key is a table name, and the value defines the table.

Fields:

start string (ISO 8601 UTC) required

Start date of the table period.

leaderboard string optional

Type of leaderboard for this table. Defaults to SIMPLE. Only SIMPLE is supported in this mode.

end string (ISO 8601 UTC) optional

End date of the table period. If not set, the table exists indefinitely.

period string optional

Repeating period of the table.

Format: a number (1–16 digits) followed by a unit suffix: h (hours), d (days), w (weeks). Example: 1w, 12h.

indexOffset non-negative int optional

Index offset. Defaults to 0.

meta JSON object optional

Arbitrary data attached to the table.


Leaderboard Only Mode

Used when LbConfigSource = PROFILE_SERVICE_ONLY_LB.

The config consists only of the userstats section, no free-form game fields are allowed. The structure of userstats is the same as in Profile + Leaderboard mode.

{
  "userstats": {
    "stats": {
      "kills": { "type": "INT", "leaderboard": true }
    },
    "modes": {
      "solo": { "leaderboard": "SIMPLE" }
    },
    "tables": {
      "global": {
        "leaderboard": "SIMPLE",
        "start": "2020-01-01T00:00:00Z",
        "end": "2030-01-01T00:00:00Z",
        "indexOffset": 1
      }
    }
  }
}