The difficulty registry
The bounds of the world's difficulty settings: for each setting a world can choose, the lowest and the highest value the game accepts. The game keeps a world's own (Custom) settings inside them when it reads the settings at start; the presets (Default, Relaxed, Hard, Survival) keep their own values. Setting names are the server's enshrouded_server.json "gameSettings" keys, as Kiln's settings service names them. Kiln's settings service (kiln.settings) reports these bounds as each setting's own range (Min/Max) without limiting a mod's value to them (since 0.2.0-dev.32); for a value a mod sets outside them it widens the bound as that mod's own layer here (stage final, source kiln.settings), from the next start, so the game keeps the value: see docs/kiln/services/settings.md. Each bound reaches what its value's type holds (a factor's float32, a duration's 64-bit nanoseconds in whole seconds, flameLevelFogRemoval's byte; since 0.1.1), so any value a mod sets is kept after a restart. The game's admin menu and the launcher's server settings keep the game's bounds.
Schema version 0.1.1, experimental (KILNX031: may change in any release until it is marked stable). C# entry type Kiln.Registry.DifficultyEntry. What registries are, the stages, the conflict rules and how ids are made: README.
Edits per call: 4,096. One OnRegistry callback (one phase of one entry point) or one Registries.Change takes at most this many edits of this registry; a call with more is refused whole, with the reason in kiln.log and registry.json, and nothing of it applies (the other calls do). The default for a registry whose schema declares none (4,096).
Ids
- Game entries:
game:difficulty. Mod entries:(none: one entry). All ids are lower case. The mod idsgameandkilnare reserved: no mod's entries use them. - One entry, game:difficulty.
- Names:
DisplayName(never empty; display names) is the registry's name as words ("Difficulty"): its one entry is no game thing with a name of its own.
Fields
Applies: now = takes effect at the next use; worldLoad = takes effect when a world loads; restart = takes effect after a game restart. Ops: number = a value or the relative operations (mul, add, min, max, raiseOnly, lowerOnly); set = a value; list = clear, append, remove, replace; indexed = a list of fixed length, edited one element at a time (xpPerLevel[2]) with a value or a number operation. A field of a list's elements is named with [] in this table and with the element's index in an edit (entries[3].chance, or [*] for every element). Mapping: whether this Kiln maps the field onto the game; an unproven or unmapped field is refused per entry, with the reason, until a Kiln update maps it. Joined client: when a joined Kiln client consumes a server edit; see README.
Groups of fields:
playerHealthFactor: The setting for players' health (playerHealthFactor).playerManaFactor: The setting for players' mana (playerManaFactor).playerStaminaFactor: The setting for players' stamina (playerStaminaFactor).playerBodyHeatFactor: The setting for players' body heat (playerBodyHeatFactor).playerDivingTimeFactor: The setting for players' diving time (playerDivingTimeFactor).foodBuffDurationFactor: The setting for how long food buffs last (foodBuffDurationFactor).fromHungerToStarving: The setting for the time from hungry to starving (fromHungerToStarving).shroudTimeFactor: The setting for players' time in the Shroud (shroudTimeFactor).miningDamageFactor: The setting for mining damage (miningDamageFactor).plantGrowthSpeedFactor: The setting for how fast plants grow (plantGrowthSpeedFactor).resourceDropStackAmountFactor: The setting for how much resources drop (resourceDropStackAmountFactor).factoryProductionSpeedFactor: The setting for how fast workshops make things (factoryProductionSpeedFactor).perkUpgradeRecyclingFactor: The setting for what salvaging an upgraded perk gives back (perkUpgradeRecyclingFactor).perkCostFactor: The setting for what upgrading a weapon costs (perkCostFactor).experienceCombatFactor: The setting for experience from combat (experienceCombatFactor).experienceMiningFactor: The setting for experience from mining (experienceMiningFactor).experienceExplorationQuestsFactor: The setting for experience from exploring and quests (experienceExplorationQuestsFactor).enemyDamageFactor: The setting for enemies' damage (enemyDamageFactor).enemyHealthFactor: The setting for enemies' health (enemyHealthFactor).enemyStaminaFactor: The setting for enemies' stamina (enemyStaminaFactor).enemyPerceptionRangeFactor: The setting for how far enemies see and hear (enemyPerceptionRangeFactor).bossDamageFactor: The setting for bosses' damage (bossDamageFactor).bossHealthFactor: The setting for bosses' health (bossHealthFactor).threatBonus: The setting for how often enemies attack (threatBonus).dayTimeDuration: The setting for how long a day lasts (dayTimeDuration).nightTimeDuration: The setting for how long a night lasts (nightTimeDuration).flameLevelFogRemoval: The setting for the Flame level from which the Shroud lifts where players build (flameLevelFogRemoval).
| Field | Type | Applies | Ops | Since | Mapping | Joined client | About |
|---|---|---|---|---|---|---|---|
playerHealthFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for players' health. |
playerHealthFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for players' health. |
playerManaFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for players' mana. |
playerManaFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for players' mana. |
playerStaminaFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for players' stamina. |
playerStaminaFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for players' stamina. |
playerBodyHeatFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for players' body heat. |
playerBodyHeatFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for players' body heat. |
playerDivingTimeFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for players' diving time. |
playerDivingTimeFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for players' diving time. |
foodBuffDurationFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for how long food buffs last. |
foodBuffDurationFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for how long food buffs last. |
fromHungerToStarving.min |
time s -9223372036..9223372036 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for the time from hungry to starving. |
fromHungerToStarving.max |
time s -9223372036..9223372036 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for the time from hungry to starving. |
shroudTimeFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for players' time in the Shroud. |
shroudTimeFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for players' time in the Shroud. |
miningDamageFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for mining damage. |
miningDamageFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for mining damage. |
plantGrowthSpeedFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for how fast plants grow. |
plantGrowthSpeedFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for how fast plants grow. |
resourceDropStackAmountFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for how much resources drop. |
resourceDropStackAmountFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for how much resources drop. |
factoryProductionSpeedFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for how fast workshops make things. |
factoryProductionSpeedFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for how fast workshops make things. |
perkUpgradeRecyclingFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for what salvaging an upgraded perk gives back. |
perkUpgradeRecyclingFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for what salvaging an upgraded perk gives back. |
perkCostFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for what upgrading a weapon costs. |
perkCostFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for what upgrading a weapon costs. |
experienceCombatFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for experience from combat. |
experienceCombatFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for experience from combat. |
experienceMiningFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for experience from mining. |
experienceMiningFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for experience from mining. |
experienceExplorationQuestsFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for experience from exploring and quests. |
experienceExplorationQuestsFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for experience from exploring and quests. |
enemyDamageFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for enemies' damage. |
enemyDamageFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for enemies' damage. |
enemyHealthFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for enemies' health. |
enemyHealthFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for enemies' health. |
enemyStaminaFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for enemies' stamina. |
enemyStaminaFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for enemies' stamina. |
enemyPerceptionRangeFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for how far enemies see and hear. |
enemyPerceptionRangeFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for how far enemies see and hear. |
bossDamageFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for bosses' damage. |
bossDamageFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for bosses' damage. |
bossHealthFactor.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for bosses' health. |
bossHealthFactor.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for bosses' health. |
threatBonus.min |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for how often enemies attack. |
threatBonus.max |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for how often enemies attack. |
dayTimeDuration.min |
time s -9223372036..9223372036 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for how long a day lasts. |
dayTimeDuration.max |
time s -9223372036..9223372036 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for how long a day lasts. |
nightTimeDuration.min |
time s -9223372036..9223372036 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for how long a night lasts. |
nightTimeDuration.max |
time s -9223372036..9223372036 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for how long a night lasts. |
flameLevelFogRemoval.min |
int 0..255 | restart | number | 0.1.0 | mapped | restart | The lowest value of the setting for the Flame level from which the Shroud lifts where players build. |
flameLevelFogRemoval.max |
int 0..255 | restart | number | 0.1.0 | mapped | restart | The highest value of the setting for the Flame level from which the Shroud lifts where players build. |
Entries
- Add (stage add, id
<your mod id>:<name>): no. - Remove: no.
- Raw game paths in edits (the Advanced tier): allowed.
Edit it from a data pack
One entry, game:difficulty. For each setting a world can choose, the entry has a min and a max: the bounds the game keeps a
world's own (Custom) settings inside when it reads them at start (restart). The presets (Default, Relaxed, Hard, Survival)
keep their own values. Setting names are the server's enshrouded_server.json "gameSettings" keys.
"field": "enemyDamageFactor.max", "op": 10;"op": {"min": 100, "raiseOnly": true}raises a bound to 100 unless another mod already set it higher.- A time setting (
fromHungerToStarving,dayTimeDuration,nightTimeDuration) is in seconds. - To use a wider bound, set the value in the world's settings (the server file or Kiln's settings service): this registry only moves what the game accepts.
Edit it from C#
[RegistryEntryPoints(RegistryEntryPoint.GameStart)]
public sealed class WiderBounds : Mod
{
public override void OnRegistry(RegistryContext context)
{
if (!Kiln.Registry.Registries.Available) return; // kiln.registry: the host's registry transport
Kiln.Registry.Registries.For(context).Alter(stage =>
{
var bounds = stage.Difficulty.EnemyDamageFactor;
bounds.Max = Math.Max(bounds.Max, 10); // never lower another mod's higher bound
});
}
}
stage.Difficulty is a DifficultyEntry: one group per setting (PlayerHealthFactor, EnemyDamageFactor, DayTimeDuration, ...)
with Min and Max. RegistryEdits sample.
Views
RegistryViews.Find("difficulty") is the stable view. Kiln's settings service reads these bounds too: SettingInfo.Min/Max
report them (a bound a mod set here counts), and a value a mod sets outside them is kept past a restart as that mod's own layer
here, source kiln.settings (OWNER-CALLS: no limits for mods; services/settings.md).
Worked example
The enemy settings may go up to 100 (10,000 %), as XHL's Enemy Difficulty Limits does; a bound another mod set higher stays:
{
"format": 1,
"registry": {
"alter": [
{ "registry": "difficulty", "select": { "id": "game:difficulty" }, "field": "enemyDamageFactor.max", "op": { "min": 100, "raiseOnly": true } },
{ "registry": "difficulty", "select": { "id": "game:difficulty" }, "field": "enemyHealthFactor.max", "op": { "min": 100, "raiseOnly": true } }
]
}
}
This is two of the edits of mods/samples/WorldRules. The values apply at
the next start.
In multiplayer
Every field is restart: nothing syncs, and every player needs the mod (side: both, clients: mod); the join compares the
resolved boot values (join compatibility). The settings screen's slider steps
are a game client's own and not covered here (resource patches still edit them).
Known limits
- A world's own setting outside the new bounds is clamped into them when the game reads the settings at start; a narrower bound than before warns (edits that change existing saves).
- Not covered: what a mod does beyond a number (Enemy Difficulty Limits' wider perception stays its own hook).
- Not yet seen in a real game: a client's settings screen after the bounds move.