The fog registry
How the world's volumetric fog looks on this player's game: the density and extinction of its five fog materials (decorative fog, the dangerous and deadly Shroud, clouds and the fog around trees), how much rain, snow and blizzards thicken it, and how thick the walls of fog at the Shroud's borders look. A look, not a rule: the server has no fog, and the Shroud's danger, its timer and where it is are not here. Client-authored: each player's own game applies it after a restart; it is never sent to a server or compared when a player joins. The height fog's two values are listed but refused: the game replaces them every frame. Not checked in a real game yet. Since 0.2.0-dev.32.2.
Schema version 0.1.0, experimental (KILNX031: may change in any release until it is marked stable). C# entry type Kiln.Registry.FogEntry. 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:fog. Mod entries:(none: one entry). All ids are lower case. The mod idsgameandkilnare reserved: no mod's entries use them. - One entry, game:fog: the world's fog settings on this player's game.
- Names:
DisplayName(never empty; display names) is the registry's name as words ("Fog"): 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:
decorative: The fog material of decorative fog. Since 0.2.0-dev.32.2.dangerous: The fog material of dangerous Shroud fog. Since 0.2.0-dev.32.2.deadly: The fog material of deadly Shroud fog. Since 0.2.0-dev.32.2.cloud: The fog material of clouds. Since 0.2.0-dev.32.2.trees: The fog material of the fog around trees. Since 0.2.0-dev.32.2.weather: How much the weather thickens the fog: the extinction each kind of weather adds. Since 0.2.0-dev.32.2.barrier: The walls of fog at the Shroud's borders: how thick each kind looks (its extinction). Since 0.2.0-dev.32.2.height: The height fog's material. The game replaces both values with its own every frame on this build: an edit of them is refused (unproven). Since 0.2.0-dev.32.2.
| Field | Type | Applies | Ops | Since | Mapping | Joined client | About |
|---|---|---|---|---|---|---|---|
decorative.density |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much of it there is: a scale of its density (0.3 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
decorative.extinction |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much light it takes away per metre: how thick it looks (0.1 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
dangerous.density |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much of it there is: a scale of its density (1 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
dangerous.extinction |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much light it takes away per metre: how thick it looks (0.35 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
deadly.density |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much of it there is: a scale of its density (0.4 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
deadly.extinction |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much light it takes away per metre: how thick it looks (0.5 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
cloud.density |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much of it there is: a scale of its density (1 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
cloud.extinction |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much light it takes away per metre: how thick it looks (0.5 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
trees.density |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much of it there is: a scale of its density (0.1 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
trees.extinction |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | How much light it takes away per metre: how thick it looks (0.015 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
weather.rain |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | The fog's extinction in rain (0.00095 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
weather.snow |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | The fog's extinction in snow (0.0018 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
weather.blizzard |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | The fog's extinction in a blizzard (0.0018 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
barrier.dangerous |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | The extinction of the wall of dangerous Shroud fog (0.35 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
barrier.deadly |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | The extinction of the wall of deadly Shroud fog (0.5 on this build). Since 0.2.0-dev.32.2. Read by game clients only. |
height.density |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | unproven: the game replaces the height fog's density and extinction with values of its own every frame on this build, so an edit of them would change nothing | localOnly | The height fog's density scale (0.0012 on this build); refused: see the height group. Since 0.2.0-dev.32.2. Read by game clients only. |
height.extinction |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | unproven: the game replaces the height fog's density and extinction with values of its own every frame on this build, so an edit of them would change nothing | localOnly | The height fog's extinction (0.15 on this build); refused: see the height group. Since 0.2.0-dev.32.2. Read by game clients only. |
Entries
- Add (stage add, id
<your mod id>:<name>): no. The game has one fog setting: a mod changes its values, it cannot add another. - Remove: no. The game's renderer needs its fog setting: it cannot be removed.
- Raw game paths in edits (the Advanced tier): allowed.
Edit it from a data pack
This registry has one entry, game:fog: how the world's volumetric fog looks on the player's own game. Its display name is
Fog. It is a look, not a rule: the server has no fog, and where the Shroud is, how long a player can stay in it and what it does
to them are not here.
- The five fog materials are named structs, each with
density(how much of it there is: a scale) andextinction(how much light it takes away per metre: how thick it looks):decorative(the world's ordinary fog),dangerousanddeadly(the Shroud),cloudandtrees. Each is its own material of the game's, never another's:"field": "deadly.density", "op": 0.8. weather.rain,weather.snowandweather.blizzardare the extinction each kind of weather adds.barrier.dangerousandbarrier.deadlyare the extinction of the walls of fog at the Shroud's borders.height.densityandheight.extinctionare the height fog's material. The game replaces both with values of its own every frame on this build, so an edit of them would change nothing: it is refused with that reason, never silently kept.- A relative edit (
"op": {"mul": 0.5}) works on every value:{"mul": 0.5}ofdecorative.densityhalves the world's fog.
The numbers are the storage's full range (a 32-bit float): Kiln adds no limits of its own. Every field applies after a
restart of the player's game, and only from GameStart.
Edit it from C#
[RegistryEntryPoints(RegistryEntryPoint.GameStart)]
public sealed class ClearerAir : Mod
{
public override void OnRegistry(RegistryContext context)
{
if (!Kiln.Registry.Registries.Available) return;
Kiln.Registry.Registries.For(context).Alter(stage =>
{
var fog = stage.Fog;
fog.Decorative.Density = fog.Decorative.Density * 0.5; // the value below this mod
fog.Weather.Rain = 0;
fog.Barrier.Deadly = 0.8;
});
}
}
RegistryStage.Fog is the one FogEntry; each material is a struct (FogDecorative, FogDeadly, ...) of two doubles. On a
dedicated server the stage skips these edits with an informational line (client-only field: it applies on each player's own game): the server has no fog.
Views
RegistryViews.Find("fog") is the stable view of the one entry and the values the stage composed on this player's game.
Worked example
Half the ordinary fog, no extra fog in rain, and thicker walls at the deadly Shroud's borders:
{
"format": 1,
"registry": {
"alter": [
{ "registry": "fog", "select": "game:fog", "field": "decorative.density", "op": { "mul": 0.5 } },
{ "registry": "fog", "select": "game:fog", "field": "weather.rain", "op": 0 },
{ "registry": "fog", "select": "game:fog", "field": "barrier.deadly", "op": 0.8 }
]
}
}
A pack of these edits alone is a look each player chooses for their own game: give it "side": "client". The server needs
nothing.
In multiplayer
The values are client-authored: each player's game composes its own fog from the mods it has, at its own start. They are never
sent to a server, never received from one and never compared when a player joins (joinedClient: localOnly; they are not part
of the join's registry values). A server cannot change a player's fog, and thinner fog on one player's screen changes nothing for
the others. In a mod that runs on both sides ("side": "both"), the dedicated server skips these edits (an informational line in
kiln.log and registry.json skipped, never a refusal) and applies its shared ones.
Known limits
- Not checked in a real game yet: the native tests write each value into a copy of the fog's data with Kiln's real boot writer, and Kiln's offline client proof, run with the release, reads, writes and reverts each one on a copy of the client's own data; fog that looks different on a player's screen has not been seen.
- The game copies these values when its fog data changes (at the start, after Kiln's edit), not every frame: an edit needs a restart.
height.densityandheight.extinctionare replaced by the game every frame: their edits are refused.- The fog's other settings (its noise, the camera fade, the height fog's heights, the clouds' scattering) are not in this registry.