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:
Add the profile config description to the profile config.
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 |
|---|---|---|
|
Free-form JSON config. Statistics and leaderboards are managed by the UserStat service. |
|
|
Free-form JSON config with an additional required userstats section. Statistics and leaderboards are managed by the Profile service. |
|
|
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
}
}
}
}
userstatsobject required Defines the statistics configuration used by the Profile service for leaderboards.
Contains the following sections:
statsobject required Statistics definitions. Each key is a stat name, and the value defines the stat.
Fields:
modesobject required Mode definitions. Each key is a mode name, and the value defines the mode.
Fields:
tablesobject required Table definitions. Each key is a table name, and the value defines the table.
Fields:
startstring (ISO 8601 UTC) required Start date of the table period.
leaderboardstring optional Type of leaderboard for this table. Defaults to
SIMPLE. OnlySIMPLEis supported in this mode.endstring (ISO 8601 UTC) optional End date of the table period. If not set, the table exists indefinitely.
periodstring 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.indexOffsetnon-negative int optional Index offset. Defaults to
0.metaJSON 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
}
}
}
}