Nuclide
Software Development Kit for id Tech
|
Skill/Difficulty related APIs. More...
Functions | |
void | Skill_Init (void) |
Called by Nuclide in init() before entities, or even EntityDef are initialized. More... | |
float | Skill_GetValue (string, float) |
Return a skill variable's value or return a defaultvalue if it's undefined. More... | |
bool | Skill_ParseConfig (string fileName) |
Parses a specified config file. More... | |
Skill/Difficulty related APIs.
The skill/difficulty APIs are used to retrieve variables that change depending on the selected game difficulty setting.
The setting is controlled via the skill
console variable, which is represented by three different modes:
The framework will then query the active skill variables. If a skill value isn't set, a fallback value will be used. If the console variable skill
is empty, or 0
it will assume the default setting of 2
- the medium difficulty.
You can technically query higher values then 3
, just ensure you set them all up in your skill manifest.
Default values are loaded from <gamedir>/cfg/skill_manifest.cfg
.
The format looks like this:
While you can set these in the skill_manifest.cfg
file directly, it is encouraged to put your own values in a separate config.
That way when people mod your game, they can inherit updates from the other, separate config without having to duplicate the variables every time your game updates.
Developers can query the variable set in the skill system using Skill_GetValue():
And entity declarations can query skills like so:
Return a skill variable's value or return a defaultvalue if it's undefined.
bool Skill_ParseConfig | ( | string | fileName | ) |
Parses a specified config file.
This should ideally be done before entities spawn. You are only allowed to parse files from a sub-directory such as gamedir/cfg/
. Some directories are blocked by the engine for security reasons.