Registries
Kiln's registries are the game's data as Kiln-owned names: items.maxStack, recipes.inputs, loot.stack.max,
drops.entries[3].chance, balance.levelCap. A mod edits a field by its Kiln name and an entry by its Kiln id
(game:material_t1_wood_logs); it never names a game function, member, offset or reflection path. Kiln maps each field
onto the game for every game build it supports, so a game update breaks Kiln's mapping (which a Kiln update fixes), not
your mod.
Registries hold data only. Services and events (Kiln.Content, Kiln.Items, Kiln.World, ...) stay as they are: a registry replaces raw data paths, not services.
Status: experimental (KILNX031), schema version 0.1.x. The schemas, the generated C# types (Kiln.Registry), the field
catalog (Kiln.Registry.RegistrySchema) and these pages ship. The registry stage reads a data pack's registry section at start
(fields that apply now or at world load also follow a pack's hot reload). Since mod API 0.2.17, C# mods author through
Mod.OnRegistry(RegistryContext) and make explicit owner-scoped live changes through Kiln.Registry.Registries.Change. The
entry class is Registries since 0.2.0-dev.32; Registry, also its namespace's name, keeps the 0.2.0-dev.31 members for mods built
against them: it is [Obsolete], so such a mod builds with a warning that names Registries and runs as before, and it is removed
no earlier than 1.0. The context types (RegistryContext, RegistryEntryPoint, RegistryPhase) are in namespace Kiln with
Mod.OnRegistry, so every mod names them without the registry service; the typed data (RegistryId, the entries, the stage) is
Kiln.Registry's. GameStart entry operations add items and recipes through Kiln's content definitions and hide items, recipes and
loot without deleting the game's records. Unsupported or unproven operations are refused with their reason in kiln.log and registry.json. Until a registry is
marked stable its shape may change in any release; from API 1.0.0 the stable registries' contract is frozen (additive only).
Versions. Experimental schemas are 0.x; a schema reaches 1.0.0 when it is frozen with API 1.0.0. Within one breaking
line (0.schema/registry/migrations/<registry>-<from>-<to>.json, Kiln ids and field paths old -> new). schema/registry/ids.lock.json
keeps every field's contract and every registry's version history; tools/registrygen/registrygen.py refuses the rest.
What a migration does. registrygen builds every migration into Kiln (one row per rename), and Kiln reads every edit
through them before it checks and matches it: a data pack's registry section, a C# or native mod's batch, a live change,
the plan a rollback starts on. A field path the running schema does not have (an edit's field, the fields of an add's
fields and of a where, the leaves of a list's elements), and a Kiln id (an exact selector, a like, a reference value
such as a recipe input's item, plain or as {"set": ...}), that a step renames is read as the new name, through every later
step too. Old names are never reused, so this is right whatever schema version the edit was written for, and a name the
running schema has is never renamed. A glob selector is not renamed. An edit that names one field twice, by its old name and
its new one, is refused (which value it meant is unknown). kiln.log (registry: migrated ...) and registry.json
migrated name every rename of a start's edits (a live change's: kiln.log, registry (live): migrated ...); a name no migration knows is refused as before ("items has no field ..."). C# mods name fields
through the generated properties of the Kiln.Registry they run with, so their edits always carry the running names. No
registry has a breaking step yet: every schema is 0.1.x (balance 0.1.1 widened a range), and Kiln ships no migration rows.
Other names (since 0.2.0-dev.32.1, EMBER Q2). A schema may give a field another name ("aliases"): balance.playerLevelMax
is balance.xpCurve.levelMax, balance.shroudTime.base and .perFlameLevel are balance.fogResistance.base and
.perFlameLevel. Kiln reads an edit naming one as the field, always and with no note: in every place an edit names a field
(its field, an add's fields, a where), in RegistrySchema.Find, and in C# through the entry's property of that name
(BalanceEntry.PlayerLevelMax, BalanceEntry.ShroudTime), which is the field's. The stage, conflicts, kiln.log and
registry.json name the field; an edit that names one field by both names is refused, as for a migration. The old names stay
the fields' own. Each registry's page lists its other names (Other names).
Selecting entries. An edit's select is an id, a glob over ids (game:material_*), or {"id": ..., "where": {...}, "has": [...], "hasNot": [...]}. where compares the entry's own fields, read-only ones included: items by their slot, category
or ammunition ("where": {"equipSlot": "terrainMaterial"}, {"category": "ammunition"}, {"ammunition": "spell"}), recipes by
their station. has / hasNot name the registry's traits (each page's Traits) and, since 0.2.0-dev.32.1, in the registries whose
entries are templates (storage, creatures, impacts, spawns), the components a template holds or lacks:
"has": ["component:inventoryCraftingStock"], the kind's name as the template view
lists it. So a pack selects what it needs without shipping lists of ids. A template's components are read for the kinds the
start's data packs and batches submitted before the stage name; a stage callback's edit, a live change, a pack reload and the
stage's select read (kiln.registry select) select by those kinds only: any other kind reads as held by no template.
Every registry
Each registry has one page, the same on all of them: what it holds, its ids and fields (made from the schema), then how a data pack edits it, how C# edits it, its views, a worked example, what multiplayer does and its known limits.
| Registry | What it holds | Edit | Page |
|---|---|---|---|
items |
every item: stacks, rarity, levels, power, speed, damage, armour, costs, perks, sockets; what it launches: speed and lift; a gem's damage and debuff, a food's buff time and bonuses, a potion's or bandage's restore; its category, equipment slot and placed and visual templates read-only | fields; add, hide | items.md |
recipes |
every crafting recipe: inputs, outputs, duration, unlock; its station read-only | fields; add, hide | recipes.md |
loot |
random loot per item: stack sizes, rarities | fields; hide | loot.md |
drops |
the game's drop tables (default inventories): counts, chances, weights | fields, stacks | drops.md |
balance |
the balance table: experience, levels, flame, durability, sockets, perk costs, what a salvage gives back (one entry, restart) | fields | balance.md |
creatures |
every creature (enemies, wildlife, farm animals, villagers): level, faction, size, health and damage scaling, resistances, speeds, loot, sight, taming steps | fields | creatures.md |
arsenals |
the enemies' arsenals: each attack's chance, threat and ranges | fields | arsenals.md |
perks |
every perk: its value, the armour and damage bonuses of the simple perks | fields | perks.md |
skills |
the skill tree's nodes: cost in skill points, how much each gives and how that grows with its level (levels, kind, class, linked nodes and unlocked ability read-only) | cost, amount, amountPerLevel |
skills.md |
stations |
the crafting stations (workbench, production stations, villagers' stations) | read-only | stations.md |
storage |
what a base's containers give its crafting: which are its crafting stock (its linked storage, from the next start), which take area deposits (at once); its water sources read-only | fields | storage.md |
materials |
the game's building materials: what digging each one takes (hardness, health, the class of tool that breaks it best) and gives back (restart; a MaterialTweakBlock lies below) | fields | materials.md |
terrainMaterials |
the game's terrain materials (soil, stone, ores, sand): the same, per terrain material | fields | terrainMaterials.md |
spawns |
the game's natural spawners (the spawn points that bring enemies and wildlife near players): how many each brings, how far, how often, how many may live at once (read at each spawner's update) | fields | spawns.md |
movement |
the player characters' movement (since 0.2.0-dev.32.1): the step they walk up, the falls that hurt and kill, how much of the map their game reveals (now); the slopes they slide down or fall from (restart: every player needs the mod) | fields | movement.md |
buffs |
every buff and debuff: duration, what applying it again does, its magnitude and tick interval; raw, every config it carries by id | fields, raw map | buffs.md |
abilities |
every timed action: first moments and length; since abilities 0.1.2, later events by kind and index, impulse pushes and durations, hit lifetimes, event costs and buff durations | fields, fixed-membership event lists | abilities.md |
impacts |
every projectile and area an ability or a creature spawns (a spell's bolt, an arrow, an explosion, a zone): its lifetime, push-back, size and gravity; its kind read-only | fields | impacts.md |
world |
the world's build rules from its scene: no-build zones, the big dungeons' playable areas (restart) | fields, boxes | world.md |
difficulty |
the bounds of the world's difficulty settings: each setting's lowest and highest value (restart) | fields | difficulty.md |
difficultyPresets |
the four named world-setting presets (since 0.2.0-dev.32.2): Default, Relaxed, Hard and Survival, each with 38 settings (restart; only the host needs the mod); the menu has separate copies | fields; identity read-only | difficultyPresets.md |
difficultyUi |
the world settings menu's slider steps on each player's own game (since 0.2.0-dev.32.2): the ordered numbers each difficulty slider offers (restart; client-authored, never sent or compared at the join) | lists | difficultyUi.md |
fog |
how the world's volumetric fog looks on each player's own game (since 0.2.0-dev.32.2): the five fog materials' density and extinction, the weather's and the Shroud barriers' extinctions (restart; client-authored) | fields | fog.md |
mapZoom |
the map's zoom levels on each player's own game (since 0.2.0-dev.32.2): each level's scale, written in place (restart; client-authored) | list of levels | mapZoom.md |
intro |
the start-up logos' and the main menu's timing on each player's own game (since 0.2.0-dev.32.2), in seconds (restart; client-authored) | fields | intro.md |
mapMarkerLooks |
how the map treats each kind of map marker on each player's own game (since 0.2.0-dev.32.2), by the kind's own id: its fast-travel action (presentation, not permission; restart; client-authored) | fields | mapMarkerLooks.md |
limits |
numbers the game's code holds: the most Flame Altars, the gifting distance (restart) | fields | limits.md |
lootRules |
the world-wide rarity weights of random loot (one entry, game:loot) |
fields | lootRules.md |
randomLoot |
every random loot table: its level rules and its own rarity weights | fields | randomLoot.md |
assets |
the Gate's asset registry (KILNX032, round 3): references to the game's and the mods' models, textures, materials, sounds, VFX, animations, Impact programs, icons and blobs, each with its layers (every mod or Kiln service that serves bytes for it) and the served one; listed in registry.json's assets member |
override through Kiln.Gate (AssetRegistry.Override), or the older Kiln.Assets calls and assets.json; no data-pack registry section |
assets.md |
<mod>:<name>, kiln:<name> |
a registry a mod declares (registries/<name>.json, Registries.Declare), and Kiln's own data (rarity rolls, loot tables, station menus, player rules, mod values) |
as its declaration says | declared.md |
The asset registry on a joined client (assets, a Gate kind of kiln.assets, not the stage's): its fields are
joinedClient: localOnly. Each game serves the layers of the mods it has installed itself: a server's layers (its resources) are
the server's, a player's game builds its own from its own mods (textures, icons and models are a game client's), and no Gate view
sends them across. loaded is serverOnly: the run-time writers' loaded scalars are the server world's.
items, recipes, loot, drops and balance ship since 0.2.0-dev.31; the other fourteen since 0.2.0-dev.32; movement since 0.2.0-dev.32.1; difficultyPresets, difficultyUi, fog, mapZoom, intro and mapMarkerLooks since 0.2.0-dev.32.2. buffs and abilities are kiln.gamedata's data under Kiln names: the data packs'
older buffs and sequences sections (the game's paths) keep working, and a registry edit is the later layer and wins (reported).
They take no raw paths (a buff's configs are its raw map instead, buffs.configs below).
Abilities 0.1.2 (since 0.2.0-dev.32.2) also names every existing event of these kinds by its original index within its kind:
releases[1].time, hits[2].duration, impulses[0].upright.y, costs[0].ignore. Membership stays fixed; absent own costs and
buff durations cannot be created. An event with its own list time edit is excluded from the matching timing.* first moment;
if all events of that moment are claimed, the timing edit is refused. Other leaf edits do not claim a time. Hit-event config
maps remain unmapped, and the game drops a fifth impulse started while four run. See abilities
for fields, typed C# and data-pack examples.
Client-owned kinds of the Gate (since 0.2.0-dev.32, experimental KILNX032)
Instance registries of the Gate (Kiln.Gate, not the registry stage) for what only a game client has: one value per
world key (local names it too), views to read and actions to ask through Gate.Read / Gate.Act. They live only in
the client's own Gate: an action applies at the client world's turn under your mod, is never sent, and a server refuses it
(gate:client_owned); Kiln's older APIs for them (Kiln.Camera, Kiln.Vfx's screen effects, Kiln.Audio, Kiln.Markers,
Kiln.Ui, Kiln.Client) work as before and their calls are recorded with your mod for Conflicts. Server sends to one player
(playerCamera, playerMarkers) are server-owned, keyed by the player (e:<entity>). A dedicated server knows every
client-owned registry, also those whose service runs only in a game client (localScreen, localAudio, localRender,
localUi, localMap, localPlayer): a server mod's write and a client's request of one are refused gate:client_owned
alike, before any server mod sees the request.
Their fields' joinedClient (the generated pages' Joined client column) says how the Gate's views treat them:
localOnly on every client-owned kind (the value is this client's own, read through its own binder; nothing of it is sent
to the server or to another player, and the server has no view of it), serverOnly on playerCamera and playerMarkers
(counts the server keeps; a joined client gets no view of them, its requests for their actions go to the server as
GateRequestEvents).
| Registry | What | Page |
|---|---|---|
localCamera |
the camera the client drew; render-only leases (a lens, a shake) | localCamera.md |
playerCamera |
a player's stock camera mode and remote visual, from the server | playerCamera.md |
localScreen |
full-screen effects | localScreen.md |
localAudio |
sounds, voice-over, narration | localAudio.md |
localMarkers |
local markers | localMarkers.md |
playerMarkers |
markers the server sends to a player | playerMarkers.md |
personalPins |
the player's own map pins, which the game saves with the character (a count view; remove by pin id; since 0.2.0-dev.32.2; calls through Kiln.Markers' Pins are not recorded) | personalPins.md |
localUi |
the game's UI as mods change it (providers, the Gem Forge's grid, the details window) | localUi.md |
localMap |
the world map as the client draws it | localMap.md |
localRender |
outlines, the overlay, Kiln's menu lines | localRender.md |
localPlayer |
the local player, its crosshair; building input | localPlayer.md |
playerAnimation, localSurfaces |
what kiln.playeranim and kiln.surfaces merged and cooked (views) | playerAnimation.md, localSurfaces.md |
clientStations, clientSkills |
a joined client's copies of its station cache and skill tree (views of server data) | clientStations.md, clientSkills.md |
localTexts |
the game's own texts per language, as its loca tables hold them (a view, keyed by language and page: localTexts[de-de:3].texts; in the main menu too; since 0.2.0-dev.32 G3b) |
localTexts.md |
The per-registry pages are generated: the reference from schema/registry/<registry>.json and the sections after "Entries" from
schema/registry/<registry>.guide.md, by tools/registrygen/registrygen.py. Edit those two, never the page. Kiln maintainers
adding a registry: adding-a-registry.md.
World rules and limits (since 0.2.0-dev.32)
world and difficulty are data the game reads at start (the world scene's boxes, the settings'
bounds); limits are numbers the game keeps in its code, which Kiln answers through hooks of its own, installed only
for a value that is not the game's. What existing mods do that these cover: EMBER's build anywhere and no boundary
(world.noBuildZones, world.playableAreas cleared), XHL Enemy Difficulty Limits' raised bounds (difficulty.<setting>.max),
XHL Unlimited Gifting Range (limits.giftingRange), More Flame Altars' altars above 16 (limits.maxAltars with
balance.altarsPerFlameLevel above 16: the game's check answers the smaller of the two, and they stay two on purpose, the
table being the progression and the cap the explicit step past the game's 16 with its costs, so a table edit never crosses
16 by itself; kiln.log says when a table asks for more than the cap allows). Not covered: the settings screen's slider steps (only a game client has them; resource
patches still edit them), and what those mods do beyond a number (Enemy Difficulty Limits' wider perception, More Flame Altars'
merged bases): those stay their own hooks.
Kiln's settings service (Kiln.Settings, kiln.settings) reports the difficulty bounds as each setting's own range
(Min/Max, a bound another mod set here included) and, since 0.2.0-dev.32, limits no mod's value to them: for a value a
Kiln 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 (services/settings.md).
Named presets (difficultyPresets, since 0.2.0-dev.32.2) are separate from those bounds: the four
complete settings blocks game:default, game:relaxed, game:hard and game:survival. Their read-only presetId names them,
never an array position; they cannot be added or removed. Edit them at GameStart through RegistryStage.DifficultyPresets
or a data pack, then restart the host. The host sends the chosen settings block to clients, so joining players need no mod
for these edits (clients: "none" for a registry-only pack). Custom settings are not a fifth preset. The settings menu has
its own preset copies: it can still show the old numbers. These edits do not change its slider steps (the separate
difficultyUi registry, on each player's own game) or a running world's active settings.
A mod's own hook of the same game check as a limits value (More Flame Altars' altars above 16 with beyondSixteen, next to
limits.maxAltars) is never refused: both hooks stay in one chain and the first one answers. Kiln warns in kiln.log and reports
it in registry.json conflicts and the launcher's Conflicts view as a conflict with an older path (certain for a hook made
through Kiln's hooks, best effort for another module's jump), naming which one answers. Use one of the two.
Loot odds and loot levels (since 0.2.0-dev.32)
lootRules (the world-wide rarity weights) and randomLoot (each table's level rules and own
weights) are read by the server world at each roll, so an edit reaches the next roll; loot already rolled keeps what it got. The
tables of the chests placed in the world are game:world_*, those of enemies and generic containers game:labels_*. Select
tables by these prefixes and their values (table.Rarity.Legendary.Mode == RandomLootMode.Set: the elite, boss and chest
tables with their own odds), not by a table's full id from another build. A data pack that doubles the world-wide legendary weight
and gives every enemy and generic-container table two levels more is the randomLoot page's example.
To follow a settings change while a world runs: Registries.Reauthor()
(below; RegistryEdits sample).
One view over every registry and resource type (since 0.2.0-dev.32): views.md. RegistryViews reads any
registry by name (stable) and any other resource type of the running build under Kiln names derived from the game's
reflection (advanced: verified per game build, read-only); RegistryStage.Entries(name) edits any registry of the schema by
name, typed by its fields, including registries without a typed property.
Buff strength and ticks, ability length, projectiles and areas (since 0.2.0-dev.32)
A buff's amounts are its program's own configs, and no one config means the same in every buff, so the registry names two things Kiln can say for any buff:
buffs.magnitudeis the buff's one amount, whatever it changes: a slow's share of movement speed (below 0), a burn's fire damage per tick, a shock's damage modifier, a regeneration's points, an attribute buff's change. 56 of the game's 274 buffs carry exactly one; a buff with none (its program's literals act) or with several (the food buffs, an explosive debuff's damage and radius) readsnulland refuses an edit for that buff alone. A relative op needs a selection of buffs that have one (by id, or by the value's sign in C#). An item that applies a buff with an amount of its own replaces the buff's amount every time it applies it (the game starts the buff with the buff's configs, then the used item's). A food buff's amounts are its food's (the buff readsnull); the buffs of the bandages and of the health and fog potions carry 0 for their item to fill, and a bad food's slow carries its food's: an edit of such a buff's magnitude is applied to the buff, and reported applied, but changes nothing where its item applies it (the mana potions' buff: only for the over-time potions, which carry their own). On this game build 7 of the 56 buffs with one amount are applied only by items that carry their own. Edit the item's own amount there (since 0.2.0-dev.32's items 0.1.3 and 0.1.4, below): a health potion'sitems.restore.health, a bandage'srestore.healthShare, a mana-over-time potion'srestore.manaGain, the bad butter's slowbonus.movement, an attribute flask'sbonus.attribute, the bleed and burn gems'gem.debuffDamageMod, the Fog Elixir's damage against the Fellbonus.fellDamage(items 0.1.5).buffs.tick.intervalis the time a ticking buff waits between two ticks (a burn, a shock, a poison that spawns its damage). It is the config of the buff's program that the program waits on, which differs per program: Kiln maps the programs it has read (regmap "programs"), so a buff of another program, or one whose record leaves the time to its program, readsnull.- Both are read when the buff starts: the next application takes an edit; a buff already running keeps what it started with.
abilities.lengthis how long an ability plays: the next playback takes a change, and a moment after the new end never comes.impactsare the templates that run an impact program: projectiles (has: ["projectile"]) and areas (has: ["area"]):lifetime(a projectile's reach with its speed, an area's duration) andpushBackreach impacts that spawn after the edit. A projectile's speed is the item that launches it:items.launch.speed(straight ahead) anditems.launch.lift(upward, a throw's arc), read at each launch; a cast whose spawn sets a speed of its own (the Lightning Ball spells') ignores the item's, so an edit of those items' speed changes nothing. Since 0.2.0-dev.32's impacts 0.1.1,impacts.radiusis an impact's size (the radius of its sphere, the first sphere of its normal collider: explosions, zones, most projectiles; an impact shaped as a box or a capsule reads null) andimpacts.gravityhow strongly gravity pulls it (a factor of the world's: Fireball I's bolt 0.1; only the 60 impacts with a factor of their own have one, all but one of them projectiles). Both reach impacts that spawn after the edit; a radius also reaches one in the world at its next move.
An item's own numbers: gems, food, potions, gear bonuses (items 0.1.3 and 0.1.4)
Many of an item's numbers are its impact configurations: what its effect starts from. The registry names the ones mods edit:
items.gem.damageanditems.gem.debuffDuration: a gem's damage (per hit or per tick) and the time its debuff (a bleed, a burn) lasts, at the gem's first level; the game grows both with the gem's level, by the gem's own factor, so a level 20 gem still does more than a level 1 one. A gem takes its numbers when its effect starts: when the weapon is equipped or taken into the hand, or its gem changes (players: switch the hotbar away from the weapon and back).items.buff.duration: how long the buff an item gives lasts (a food's status after it is eaten, times the world's food duration setting).items.bonus.*(health,stamina,mana, their*Regen,meleeDamage,rangedDamage,magicDamage): what an item adds to its user: a food's buff while it lasts, a ring or armour while it is worn. A food or potion buff's own amounts read 0 inbuffs.magnitude: the item that applies the buff gives them, so these are the fields to edit.items.restore.healthanditems.restore.mana: what a use of a potion gives back;restore.healthSharea bandage's share of maximum health,restore.manaGaina mana-over-time potion's mana per tick (a mana leech beam spell's per hit).- The amounts of the buffs items apply (items 0.1.4):
items.bonus.movement(a slow below 0: the bad butter's),bonus.attribute(an attribute flask's amount, in the unit of the attribute it names),gem.debuffDamageMod(the damage modifier a bleed or burn gem's debuff hits with). An item's own amount replaces the buff's (buffs.magnitude) whenever that item applies the buff.
Each is read when the item's effect starts (the next use, the next time gear is put on); an item without the value reads null and
refuses an edit for that item alone (select by id, or by a trait or a value in C#). The whole-number ones (a gem's damage, the
point bonuses, a mana potion) refuse a fraction with not_exact and are never rounded. Their tooltip rows follow on Kiln clients;
the effects run on the server, so they are right for every player; a vanilla client shows the game's tooltip numbers. The
older paths (items sections' impactValues.0x5e34f09b, impactValues.Scaled_Damage_Cut, ...) keep working; KILN124 names the
registry field for them. Example: GemSample (the Gem of Bleeding's bleed)
and RegistryEdits (a food, a potion, a gem).
In multiplayer, buffs fields are the server's alone (serverOnly: a client shows the time the server gave the buff), except that
a buff's tooltip row that shows its magnitude follows on Kiln clients through the content sync (buffs.magnitude is now). An
abilities.timing.* edit makes the server spawn, hit, pay, apply buffs and make noise at the new time (its sound and camera
shake moments it takes at the new time too; what a dedicated server does with them is not traced); a vanilla client keeps playing
the ability's animation and effects at the old times, and a Kiln client gets the new time through the content sync.
abilities.timing.effect (the first visual effect) is the clients' alone: a dedicated server never reads it, so on one only Kiln
clients show the new time. The indexed event leaves use the same content sync: Kiln clients get the new values, while vanilla
clients keep their own values for local movement, effects and cost prediction. One exception (P65): a time moved past another
event of the same kind in that ability is not sent, whether a timing.* edit or an indexed time moving earlier or later. Kiln
clients keep the old time for that slot (the server still acts at the new one); moves that keep the same-kind order are sent.
abilities.length acts on the server the same way (the server ends the ability; a vanilla client plays its own length, a Kiln
client gets the new one). impacts fields are the server's: it spawns and ends the impacts and applies their push-back.
items.launch.* launches the server's projectile at the new speed; the content sync carries it to Kiln clients like the other item
fields, and what a vanilla client shows of its own launch is not verified.
Raw configs: buffs.configs (the raw tier)
For power users, every config a buff's record carries, by the
game's config id, each valued by its own kind on that buff. It is raw: what a config does is the buff's program's, and one id
means different things in different programs (a tick interval in one, a one-time wait in another). Kiln proves on each game build
that an edit of a key is read, written and taken back, never what the key means (the field's Mapping says "raw", and so does its
capability row registry.buffs.configs; its regmap row's meaning is unproven by design). Use a named field (magnitude, tick.interval) where one fits; use the raw map at your own risk.
- A read of
configsgives every key with its kind and value:{"0x765574f2": {"kind": "time", "value": 0.9}, "0xfe2ff8bc": {"kind": "sint32", "value": 3}, "0xe5254945": {"kind": "enum", "value": "Small", "values": ["None", "Small", "Big"]}}. Kinds:sint32anduint32(whole numbers: a fraction is refused withnot_exact, never rounded),float,time(seconds),bool,enum(one of the config's own value names, as the game names them), and the read-onlyreference(a buff, a template, an attribute),scaledandother(a material id is one). The kind is the record's: one id can be a whole number on one buff and a float on another. A key that is a named field's place on that buff in this world says which ("field": "magnitude", below), and its value is that field's. - An edit names one key,
"field": "configs.0x<8 hex digits>", with a value or (for a number kind) a relative op; never the whole map. A buff that does not carry the key refuses the edit (at the stage the whole edit, at an entry point that buff alone): the raw map edits the configs a buff has, it adds none (kiln.gamedata'sbuffssection adds one). - One value, two names. A key that is the buff's magnitude (its one Sint32 or float config) or its tick interval (the time its
program waits on) is that field on that buff: an edit of
configs.0xfe2ff8bcand one ofmagnitudeare one target, composed in the magnitude's chain, the later one wins and Conflicts shows both (the raw writer names its key: registry.jsonrawMap). Which key that is comes from the game's own records. A data pack that switches a buff's program or gives it another amount (kiln.gamedata'sbuffssection) moves the field to another key, or to none, in that world. Kiln checks this as each edit is written. A raw edit is never written into another config: where its key is no longer the field's place, that buff's field is refused, named. Where a key turns out to be the place of a named field that is edited too, the named field writes the config and the raw edit is refused. A key always reads its own config. - registry.json marks the raw map's rows
"rawMap": a key's own row ("rawMap": true), a writer that named a named field by its key ("rawMap": "configs.0xfe2ff8bc"), its conflict lines and refused edits; the launcher's Conflicts view shows them as raw. - When it applies: every config is copied into the buff as it starts, so the next application takes an edit; a running buff keeps what it started with, and an item that applies the buff with a config of its own (a food, a potion) overrides it.
{ "registry": { "alter": [
{ "registry": "buffs", "select": { "id": "game:buff_748645cd" }, "field": "configs.0xf76e2e08", "op": { "mul": 2 } } ] } }
In C#, BuffEntry.Configs is a RegistryRawMap: burn.Configs[0xf76e2e08] is the config (Kind, Value, Values) or null,
burn.Configs.Set(0xf76e2e08, TimeSpan.FromSeconds(0.1)) sets it (Set takes a number, a TimeSpan, a bool or an enum's value
name, checked against the key's kind). RegistryEntry.Get("configs.0x...") and Set reach keys by path. In one callback the two
names stay one value: after burn.Magnitude = 5 the magnitude's key reads 5, and after a Set of that key burn.Magnitude reads it. The raw map is the
registry's form of a config edit; round 3's raw entries (game paths and addresses, the Native tier) will see a buff config's game
path impactValues.0x<id> as this key.
C# authoring (API 0.2.17)
Reference Registry in KilnServices and opt into experimental diagnostic KILNX031. Published entry types remain in
Kiln.Registry; the context and Mod.OnRegistry live in Kiln.Api. See the complete
RegistryEdits sample.
[RegistryEntryPoints(RegistryEntryPoint.GameStart | RegistryEntryPoint.WorldLoad)]
public sealed class Stacks : Mod
{
public override void OnRegistry(RegistryContext context)
{
if (!Kiln.Registry.Registries.Available) return; // kiln.registry: the host's registry transport
var registry = Kiln.Registry.Registries.For(context);
registry.Alter(stage => stage.Items["game:material_t1_wood_logs"].MaxStack = 500);
}
}
Registries.For(context) gives the callback's stage (RegistryStage): its typed entries read the registries as this pass
sees them, and what you assign is the callback's edits, buffered until it returns. Add, Alter, Final, Registries.Change and
Registries.Read hand their lambda the same stage. (The registry views of RegistryViews are another thing: one read-only view
of each registry and resource type, views.md.)
The class attribute is constant metadata; Kiln reads it without running the mod. No attribute on a real override means
GameStart. Declaring points without an override (KILN122), zero/unknown flags, or automatic Manual (KILN123) is invalid.
| Point | Invocation and inputs |
|---|---|
GameStart |
A retained author instance, once per Add/Alter/Final pass at resources-ready. Global settings only. It is not the transient OnBoot instance. |
ModLoad |
Runtime instance after OnLoad, once the base registry exists. Global settings only, even when a world already exists. |
WorldLoad |
Runtime instance for each native world token, including a new world with no save id yet. Per-world settings remain unavailable until bound. Adoption reauthors this point with the bound id, replacing its earlier id-less layers. |
HotReload |
Replacement runtime instance, after the old owner's live changes are removed. When declared, it replaces ModLoad on reload; the two points never both run for the same replacement. A pass that replaces ModLoad keeps ModLoad's process lifetime (its layers follow the process into later worlds); if any of its phases read per-world settings, all of the pass's layers belong to that world and the pass runs again once the next world's settings are bound, replacing them. A HotReload pass of a mod without ModLoad is world-bound when a world exists. |
Manual |
Explicit Registries.Change, not an automatic class flag. Requires an active world. |
GameStart authors get the registry context, not cross-mod runtime exports. Declared dependencies still order the edits:
a dependency's edits run first. A mod that needs another mod's runtime export chooses ModLoad or later. A declared export
lookup at GameStart is refused with RegistryContextError.RuntimeExportUnavailable (assembly loading can wrap that error).
Private helper assemblies in the mod's own folder remain loadable; they are not another mod's runtime export graph.
Automatic points run all selected mods' Add, then Alter, then Final in load order. Ordinary property assignments are absolute and target
Alter; registry.Final(...) and registry.Items.Final(pattern, ...) explicitly target Final. At GameStart, Final handlers read the
Add+Alter view, never another mod's Final commit. A callback's own pending writes are projected into its typed read view;
they are submitted only after successful return.
What runtime reads see. A runtime point (ModLoad, WorldLoad, HotReload) works like GameStart's stage: every
callback of one pass, in every phase, reads the same pre-pass values, whatever the load order, and a mod's reads leave out
its own registry layers (its GameStart edits and its earlier live changes). So item.MaxStack = item.MaxStack * 2 restates
the mod's intent at each point (10 becomes 20 at ModLoad and stays 20 at WorldLoad) instead of doubling again, and two mods
doing it in one pass both read 10. The pass's edits are committed only after every callback ran: all Adds, then all Alters,
then all Finals, each in load order (dependencies first), so an earlier mod's Final still beats a later mod's Alter. Between
passes the later commit wins (a ModLoad Final of 70 loses to a later Manual Alter of 80; reverting that restores 70).
Registries.Change and Registries.Read read the live values as they are, the mod's own layers included.
Refusals per entry. At ModLoad, WorldLoad and HotReload an edit that one selected entry cannot take refuses that entry
alone, named in kiln.log and registry.json, and applies to the others: an exclusive claim on that entry, an entry missing
in this world, a config the entry lacks, or a value its storage cannot hold exactly (an items.manaCost x1.5 over
Select("*") where one item stores whole numbers: that item's reason starts with not_exact: ). The result is Applied
with Refused > 0 and the first reason. An entry refused at binding is left out for that world only; a ModLoad change
tries it again in the next world. GameStart edits bind per entry the same way at world load (a conflict at the stage itself
still refuses the edit). Registries.Change stays all-or-nothing: a binding or evaluation failure of any entry refuses the
whole transaction with the same reason, and nothing of it is written. A game memory write that fails after every retry is
different in kind: it takes back the whole change that owns the slot for that world, at an entry point too (never another
change), so a change is either all written or not at all; a take-back Kiln cannot prove is Unverified. A throwing callback submits none of that turn's buffered edits and
reverts that author's earlier commits from the same point. Other points' retained layers remain; a later point or world
can retry the author. When Kiln itself cannot take the pass yet (its begin or commit is refused because the live back-end is
still being installed, a budget is full, or the base is still being prepared), the point is not a fault: Kiln undoes that
pass's commits and authors the same point again on a later tick (the next tick first, then backing off to 5 s), logged once;
after ten tries it is logged as a fault with the real error. An exception from the author's own code is always a fault, a
KilnUnavailableException from a read inside OnRegistry (an unmapped field, an entry without that config) included.
Select(pattern) returns entries by Kiln id; list properties use the generated clear/append/remove/index APIs.
All three passes are invoked; entry operations are accepted only at GameStart. Runtime points wait for the host tick;
native resources-ready callbacks never execute runtime authors inline. Layers from distinct declared points compose:
for example, a WorldLoad append stacks on a retained GameStart append. Prefer absolute assignments or list replacement
when the same intended value is authored at several points.
Contexts carry EntryPoint, Phase, World (Kiln token, kind and bound save id), and Identity. Code, point/pass,
world identity and settings actually observed in that callback contribute to Identity. The stage keeps each start's plan
("Plans and rollback" below) but never starts from a kept plan by itself: only a rollback someone asks for does. The plan
cache ("The plan cache" below, 0.2.0-dev.32) stands in for a GameStart callback only for a mod built for the Gate, when its
code and inputs are those of the kept plan's start: the callback is then not called, and the edits it made at that start are
taken. Any other GameStart callback runs at every start.
Global Config.Register<T>() and WorldConfig<T>() can be used as inputs; fallback authoring snapshots do not install
watchers or write defaults. Register live settings in OnLoad to get ordinary change events. Per-world settings are
refused at GameStart/ModLoad, and while a world's settings are unbound. Later points never write restart-only fields:
they return/report RestartRequired rather than silently applying them.
Keep copied values, not contexts/entries/lists. Their operations fail with RegistryContextException.Code after return
(Closed), unload (Unloaded), on another thread (WrongThread), or a world switch (WorldChanged). Metadata and copied
results remain snapshots. A resolved Registries.Read(stage => ...) frame is expiring and read-only.
Entry add and remove (GameStart only)
| Registry | Add | Remove |
|---|---|---|
items |
AddLike(id, like, configure) on the stage's Items collection |
Hide from random-loot candidates and recipes; disable direct-drop slots that name the item. |
recipes |
AddLike(id, like, configure) on the stage's Recipes collection |
Hide from station lists and the all-recipes/crafting view. |
recipes (at a station) |
AddLike(id, like, station, configure): a game station or one a mod adds |
as above |
loot |
AddLike(id, like, configure): the item the same mod adds (same id) drops as random loot like the like item, with the stack sizes set (0.2.0-dev.32) |
Remove(pattern) on the stage's Loot collection excludes random-loot candidates; it does not remove the item, its recipes or direct drops. |
creatures, impacts, buffs, perks, abilities |
AddLike(id, like, configure): a kiln.gamedata clone of the like game entry (0.2.0-dev.32); the fields set are its own |
Not supported |
drops, balance, world, difficulty, limits |
Not supported | Not supported; ordinary mapped field/list edits remain separate. |
skills |
AddLike(id, like, links, configure) (or without links: linked as its like node): a node of the game's tree like a game node, built by Kiln's skill tree service (skills.md) when the world loads; characters' saves stay valid with or without it (0.2.0-dev.32) |
Not supported: a character whose save holds a removed node, or a node linked to it, would get the game's free reset of the whole tree |
stations |
AddLike(id, like, item, configure): a workshop of the mod's own placed by that item (one a mod adds); the recipes that name it are its recipes (0.2.0-dev.32) |
Not supported: placed stations in a saved world name it. Hide its recipes instead (recipes remove with where: {station: ...}) |
storage |
Not supported: entries are the game's templates; a new container is a template of its own (a kiln.gamedata clone or a block), made crafting stock here by its id | Not supported: placed containers need their template. craftingStock: false takes a container out of the base's stock |
materials, terrainMaterials |
Not supported: a mod adds a material with a buildingMaterials or terrainMaterials block (kiln.worldtables gives it one of the free ids) |
Not supported: every saved world's cells name it |
spawns |
Not supported: a spawner is a template the world's scene places; a mod adds one as a template of its own placed by its code | Not supported: the scene places it (maxAlive: 0 is the game's "no limit", not off) |
movement |
Not supported: the game makes every player's character from its own player template (game:1_player) |
Not supported: every player's character is made from it |
difficultyPresets |
Not supported: the four named preset identities are fixed; Custom is a separate settings mode | Not supported: the host must be able to find each named preset |
A registry that takes no add or remove refuses one with its reason, in kiln.log and registry.json (skills: entries are not added to this registry (A mod adds skill nodes through Kiln's skill tree service ...)); each registry's page lists it under
"Entries" (since 0.2.0-dev.32, the schema's entry.addDoc and removeDoc).
if (context.EntryPoint == RegistryEntryPoint.GameStart)
{
if (Capabilities.Is("registry.items.add")) // adding and removing have their own rows
registry.Add(stage => stage.Items.AddLike(new("my-mod:logs"), new("game:material_t1_wood_logs"),
item => item.MaxStack = 100));
if (Capabilities.Is("registry.loot.remove"))
registry.Alter(stage => stage.Loot.Remove("game:material_t1_wood_logs"));
}
One definition path (0.2.0-dev.32). An added entry is made by the back-end Kiln's older APIs use (kiln.content's definitions,
kiln.gamedata's clones, kiln.skills' nodes), and what those APIs, data packs' add lists and blocks define is a registry entry
too: <mod>:<its name without "<mod>."> in each registry its base is an entry of, listed in registry.json's added with its
source (front-end:kiln.gamedata define, front-end:NewContent.Register, front-end:a block (boot generation), ...), reachable by
other mods' edits through the live back-end (Registry.Change) and at GameStart; it is adopted when the world begins, so one
defined after that is an entry from the next world. Such an entry keeps its own definition and
timing (its GUID, bytes and values are what its API made); an edit of one of its restart fields is refused RestartRequired for the
start, as it is defined after the start's restart fields were written.
AddLike requires an explicit present Kiln like id; clone chains end at a game entry (for creatures, impacts, buffs, perks,
abilities and skills the like is a game entry itself: a copy of another added one is refused). A recipe inherits its base's station,
inputs, outputs, duration and unlock rule. Configure uses the ordinary typed fields/lists, buffered as one add; a throwing
configure publishes nothing. New ids belong to the bound mod, are lower case, and cannot use a game's clash suffix.
Identity reuses Kiln's deterministic registry GUID rule; zero/colliding native ids are refused, never silently reminted.
Later stages can read/select the added id and later field-only changes can target it. An unmapped explicit override or
inexact whole-number config refuses the definition before its private clone is published. A native registration failure
refuses the entry for that world and propagates its root reason to dependent definitions; process intent retries next world.
Removal hides; it never deletes. Item and recipe records and id lookups stay intact. Already-owned removed items remain usable in inventory, equipped slots and containers, including after save/load. Removing a recipe does not cancel an existing crafting job. Existing game recipes needing or producing a removed item are hidden, not converted into input-free recipes. A new entry depending on a removed/refused entry is refused whole, to a fixed point. A field edit introducing a bad reference is refused for that target without dropping unrelated valid edits.
Direct-drop arrays keep their physical slots and indices: removal layers set affected chance and weight to zero rather
than resizing the list. Every required drop row and recipe dependency row must be proven on the running build; otherwise
item removal is refused whole, with no partial loot/recipe hiding. In particular, drop tables not proven on this build
means no item removal was applied. The server build records of 26430253 (svn 1287369) and 27054986 (svn 1313305) prove the drop rows (content.drops), so
item removal applies there; a later game build Kiln has not proven yet refuses it whole again. Missing/invalid group
metadata, or removing the last safely spawnable stack in a selector group, also refuses the whole item removal. A later
registry chance/weight edit cannot reactivate a disabled slot: removal wins and the conflicting edit is reported.
These are process decisions, not world settings. ModLoad, WorldLoad, HotReload and Manual entry requests report
RestartRequired; automatic later passes retain unrelated valid field edits. A Manual draft containing any entry-operation
refusal writes none of its valid field edits. Field-only drafts keep the existing filtering behavior: parse, mapping,
composition-conflict and restart-field refusals can coexist with accepted live field edits. A binding/evaluation refusal or
the candidate's own failed write, however, rolls back the whole Manual candidate; a failed rollback is Unverified.
A pack reload preserves the original GameStart adds/removes, including changed/deleted operations and deleted files, while
reporting RestartRequired for changed entry intent. A retiring mod does not undo committed GameStart changes; restart
without it to remove that intent. Live field reloads continue normally, but a later field edit that would leave a drop
group protected by an active removal with no viable candidates is refused.
Compatibility and missing mods. Before publishing an addition Kiln pins its registry kind, stable GUID and terminal game
base in the install-wide, Kiln-owned kiln/data/registry/entry-compat.json, keyed by mod id and Kiln entry id (one record across
worlds). This is separate from per-build content caches and the game's own files/saves. Reusing an id with another structural
base is refused; choose a new Kiln id instead. Corrupt/unwritable records fail closed per affected entry and are not pruned when
a mod disappears. Definitions saved through Kiln.Content retain flattened canonical game bases and normalized effective fields.
Without the adding mod, MissingContent restores the same item identity and shape without requiring missing clone ancestors;
placeholder replay adds no recipes or distribution. Returning mods adopt that identity. Restart without a removing mod restores
the game's original visibility; no save tombstone or equipment/storage migration is written.
The report's added/removed rows include Kiln ids and author/source provenance. pendingWorld is intent, not a claim that native
bytes changed; registered, hidden and disabled describe reconciled world outcomes. Refused entries are not also counted as successful
additions/removals. Hidden recipes use compared store layers; failed/foreign visibility writes refuse the related removal
rather than claiming an unapplied hide. Dedicated-server and synthetic-memory tests do not establish real-client menu behavior,
already-equipped save round trips or multiplayer parity. Existing content synchronization/look-alike rules still apply; vanilla
clients do not acquire Kiln registry views merely by joining a Kiln server.
Explicit changes and ready
Inside a loaded mod callback on the active world's thread:
if (!Kiln.Registry.Registries.Available) return; // kiln.registry.live: the host's back-end
var change = Kiln.Registry.Registries.Change(stage =>
stage.Items["game:material_t1_wood_logs"].MaxStack = 500);
if (!change.Result.Ok) Log.Warn(change.Result.Reason ?? "registry change not applied");
// Keep the owner-bound handle if needed. Revert recomposes the remaining layers, not an old memory snapshot.
var reverted = change.Revert();
if (!reverted.Ok) Log.Warn(reverted.Reason ?? "registry revert not applied");
Inside Registries.Change, Final(...) is an ordinary Alter edit in that one transaction; it does not schedule a
separate all-mod Final pass. The transaction still applies in commit order over earlier retained changes.
RegistryChangeResult copies outcome, accepted/refused/skipped counts, world token, generation and reason. Ok means
Applied or Reverted with no refused edits or skipped foreign bytes. PendingWorld/PendingResource do not claim bytes were
changed. A drop table the game has not loaded yet (it loads them as it needs them; an edit of one is PendingResource)
reads, through Registries.Read and inside a pass, the value it takes when it loads: its base and the writers' layers, a
pass leaving out its own (0.2.0-dev.32; before, such a read threw KilnUnavailableException, which faulted the whole pass). RestartRequired, WorldRequired, Refused, Skipped and Unverified stay distinct. A change is not disposable:
only explicit Revert() on the tick thread or owner retirement removes its layer, never leaving a scope. Process ModLoad layers persist across worlds; world-bound layers expire with
their world. Already committed GameStart layers stay until process restart, including through a runtime hot reload.
Edits per call (0.2.0-dev.32). One call (one OnRegistry callback, that is one phase of one entry point, one
Registries.Change, one batch a native plugin submits) takes at most a registry's cap of edits of that registry, declared by
its schema (editsPerCall; each registry page says it; RegistrySchema.EditsPerCall in C#): 16,384 for randomLoot
(every field of every table of the current game data, with room), 4,096 for the others. Each registry is counted on its
own, so a Loot Rarity Leveler pass (about 4,000 table edits, 433 drop chances and the world-wide weights) fits one call. A
call over a registry's cap is refused whole: nothing of it applies, registry.json has a row for each registry it names (the
over-cap one with its count and the cap), and the mod's log says so; the mod's other calls (its other phases, its other
points) still apply. Kiln never throws for it in the mod's code: before 0.2.0-dev.32 an edit past 4,096 threw, so a mod
that caught the exception kept a cut call and one that did not lost its whole pass. Split edits over the point's phases
(Alter, Final) or several Registries.Change calls when one registry needs more.
Authoring the WorldLoad point again (0.2.0-dev.32). Edits made from settings or from the game's state (a config file, a
player's level) can follow a change at once: Kiln.Registry.Registries.Reauthor() asks Kiln to run
the mod's declared WorldLoad pass again, starting on the next host tick, in the same world. The pass runs as at a world load: every
callback reads the pre-pass values without the mod's own layers (so a value is derived from the game's data and other mods'
edits again, never from the mod's own last result), entries refuse one by one, and its commits replace the layers that point
made in this world once they are in, so the game never sees a moment without the mod's values; a pass that throws keeps the
earlier layers (logged as a fault), a transient refusal asks again on a later tick. Requests before the tick are one pass.
Only WorldLoad is authored again on request, so the call names no point. Its answer (RegistryReauthorResult, an IKilnResult)
is not Ok, with the reason (also in kiln.log), for a mod that declares no WorldLoad point, a call from inside an OnRegistry callback (ask when settings or game state change; from the
pass itself it would run the pass again on every tick), or no live back-end; with no world loaded the next world's load
authors the point anyway. A split pass (Alter, then Final for what one call's cap does not take) is re-authored whole.
Off the world tick (0.2.0-dev.32). A re-authored pass costs the world tick almost nothing, whatever its size: its
OnRegistry callbacks run on a worker thread of Kiln's, Kiln prepares the pass's turn there (the edits parsed, composed over
the other mods' layers, bound to the game's data and evaluated), and the world tick only lands it: the pass's new layers in
and the layers that point made before out, in one turn, and one write of the bytes that change. A table is never half
written and the game never sees a moment without the mod's values (nor both the old and the new ones). registry.json is
rebuilt off the tick afterwards. A Loot Rarity Leveler sized pass (every field of the game's ~800 random loot tables, 12,752
edits) lands in a few milliseconds where it took 0.5 s (and 0.6 to 2.1 s on a loaded server) before. So, in the pass:
- Read your own settings and the game state you need (a player's level) before asking, in the event or tick handler
that saw them change, and keep them in fields the pass reads. A tick-thread API called inside a re-authored pass throws
(
InvalidOperationException, "... a re-authored registry pass (Registries.Reauthor) runs off it"), whichever check it has (the analyzers' KILN101 list:Game.AssertTickThread, the services' own checks). Kiln notices whether the mod catches it or not, never lands that pass (nor logs it as the mod's fault), runs it again on the world tick and from then on runs that mod's re-authored passes on the tick (slower: the pass's own time is on the tick again; kiln.log says so once). APIs marked[AnyThread]are fine (Players.All,Progression.Get: the last snapshot off the tick). The world-load pass itself still runs on the world thread, as before. At build time KILN101 warns about such a call inOnRegistryof a mod that callsRegistries.Reauthor, and in a GameStart pass, which runs before the first world tick (analyzers.md; since 0.2.0-dev.32). - The pass reads the registry as it is when it starts. If the registry moves before its turn lands (another mod's change, a data pack, a world's end, or only what its edits bind to: a drop table the game loads meanwhile), Kiln drops that turn and runs the pass again; after three such turns in a row the next pass runs whole on the tick (the pass, its preparation and its landing in one step, nothing moving under it; at the cost re-authors had before 0.2.0-dev.32), so it always lands.
- The mod's unload (a hot reload too) waits for a pass running on the worker: its
OnUnloadnever runs beside itsOnRegistry, and once the unload began no pass of it starts (its earlier layers stay until the unload takes them back). context.Passsays which pass a callback is (since dev.32):Point(the entry point's own: the world load's, on the tick),ReauthoredOffTick(on Kiln's worker:context.OffTickis true and a tick-thread API is refused) orReauthoredOnTick(Kiln runs the mod's re-authored passes on the tick). Kiln runs one pass of a mod at a time, across a world change too: a new world's pass (and a HotReload pass replayed for the new world's settings) waits for a re-authored pass of the world before that is still on the worker (the tick waits up to 10 s, then the world goes on and that mod's pass runs on a later tick, once the old one ended; the old one lands nothing). A mod's pass state need not be thread-safe.
Coalescing. Kiln runs one re-author at a time. Requests made while one runs (or before the next tick) become one more pass after it, never one each: a burst of requests (a settings file saved several times, a level-up and a join in the same second) costs at most two passes, the last one with the newest inputs. A mod needs no debounce of its own for Kiln's sake; it should still not ask on every tick, nor for a change its edits do not depend on (Loot Rarity Leveler asks when its settings or the highest player level change, and checks levels every 2 s).
The re-authored layers are the newest: live layers compose in commit order, so they win over other mods' WorldLoad edits of
the same fields (Final ones too) until those mods' points are authored again, and the pass reads those mods' layers as the
values below it. At a world load every mod's callbacks read before any of them commits (Alters before Finals, in load order);
a re-authored pass sees what the others committed. Two mods that both set the same field from what they read give a
different result after one of them re-authors: keep re-authored edits to fields other mods leave alone, or derive them from
the game's values (Registries.Read the base).
Loot Rarity Leveler (Kiln) uses it for its live settings and the character level:
[RegistryEntryPoints(RegistryEntryPoint.WorldLoad)]
public sealed class Leveler : Mod
{
public override void OnLoad() => Config.Register<Settings>().Changed += _ =>
{
if (!Kiln.Registry.Registries.Available) return; // kiln.registry.live: the host's back-end
var again = Kiln.Registry.Registries.Reauthor();
if (!again.Ok) Log.Warn($"not authored again: {again.Reason}");
};
public override void OnRegistry(RegistryContext context)
{
if (context.Phase != RegistryPhase.Alter || !Kiln.Registry.Registries.Available) return;
var r = Kiln.Registry.Registries.For(context);
var w = r.LootRules.RarityWeights; // the values below this mod: the game's, or other mods' edits
w.Legendary = w.Legendary * 4; // never stacks: each pass reads below its own last edit
}
}
Subscribe to Registries.Ready in OnLoad for copied stage/live ready notifications; the Host removes the handler at unload.
Its RegistryReady.Phase uses RegistryReadyPhase.Start or WorldLoad, not the author's RegistryPhase passes.
Notifications are posted through the owner's scheduler, never run inline on a native loader thread or inside a commit.
A late subscriber likewise receives the last snapshot on its next tick. This event reports readiness/generation, not proof that
every field in a transaction applied: inspect results and the registry report. Registries.Available checks the transport;
per-field capability rows still decide whether a field is mapped.
Offline authoring tests
KilnHarness.Registry.Seed(registry, id, field, valueJson) supplies copied JSON. Author(mod, point, phase, world) invokes
one loaded instance's OnRegistry pass and returns copied IR (or null for no edits). Contexts expire before it returns.
Since dev.32 a call over a registry's cap of edits per call returns null too, as Kiln refuses it whole, and Refused says why;
RunReauthored(mod, offTick, phase, world) runs the WorldLoad pass as a re-authored one: by default off the tick, on a thread
of its own (context.OffTick), where a tick-thread API throws as in a game and the pass is never taken (Refused names the API).
This is a recording-only fake: seed the next pass explicitly. It does not simulate live application, pass composition,
mapping proof or automatic scheduling, and leaves native registry availability false. Host transport/lifecycle tests and
native backend tests cover those separate paths; offline authoring is not real-game byte proof.
Capabilities
At resources-ready, the registry stage loads the regmap and reports registry.<name> for each registry and
registry.<name>.<field> for each schema field. A field is available when its mapping is verified for the running
executable and the field applies to this side. A registry is available when at least one of its fields is available.
Check the field you need with Capabilities.Is("registry.items.power") or use Capabilities.Get to read its reason
and detail. The detail includes the field's applies value even when the field is unavailable. The host resolves
manifest features before the stage, so use these rows in runtime checks after resources-ready.
Capability states and reasons
Capability names preserve the field's case and dots and omit the [] list marker. Use the schema path in edits and
the capability name when querying Capabilities.
| Capability name | Schema field path |
|---|---|
registry.recipes.inputs.item |
recipes.inputs[].item |
registry.recipes.inputs.category |
recipes.inputs[].category |
registry.recipes.inputs.count |
recipes.inputs[].count |
registry.recipes.outputs.item |
recipes.outputs[].item |
registry.recipes.outputs.count |
recipes.outputs[].count |
registry.drops.entries.item |
drops.entries[].item |
registry.drops.entries.count.min |
drops.entries[].count.min |
registry.drops.entries.count.max |
drops.entries[].count.max |
registry.drops.entries.chance |
drops.entries[].chance |
registry.drops.entries.weight |
drops.entries[].weight |
registry.arsenals.attacks.chance |
arsenals.attacks[].chance |
registry.arsenals.attacks.threat |
arsenals.attacks[].threat |
registry.arsenals.attacks.minRange |
arsenals.attacks[].minRange |
registry.arsenals.attacks.maxRange |
arsenals.attacks[].maxRange |
registry.arsenals.attacks.maxHeight |
arsenals.attacks[].maxHeight |
registry.balance.buildzoneSizesPerAltarLevel.x |
balance.buildzoneSizesPerAltarLevel[].x |
registry.balance.buildzoneSizesPerAltarLevel.y |
balance.buildzoneSizesPerAltarLevel[].y |
registry.balance.buildzoneSizesPerAltarLevel.z |
balance.buildzoneSizesPerAltarLevel[].z |
registry.world.noBuildZones.min.x (.y, .z) |
world.noBuildZones[].min.x (.y, .z) |
registry.world.noBuildZones.max.x (.y, .z) |
world.noBuildZones[].max.x (.y, .z) |
registry.world.playableAreas.min.x (.y, .z) |
world.playableAreas[].min.x (.y, .z) |
registry.world.playableAreas.max.x (.y, .z) |
world.playableAreas[].max.x (.y, .z) |
Creatures, arsenals and perks (since 0.2.0-dev.32, experimental)
Three registries over the game's creature and perk data (creatures, arsenals, perks;
KILNX031, schema 0.1.x). What they share:
- A creature is one entry per template: enemies, wild animals, farm animals and villagers (705 on the current build, 689 before Patch #2), with the
template's id (
game:enemy_vukah_melee), the id pets, taming and spawning name it by. An edit is global to the creature's kind, never one creature. Fields a creature copies as it spawns reach creatures that spawn after the edit; health and damage scaling, sight and taming steps are read at once by every creature of the entry. - Not every creature has every field (most have no size of their own; only enemies have sight and an arsenal): such an entry
reads
null, a typed C# property reads 0 or false there (tell such creatures byKindor id, never by a 0, which forresist.*would mean immune), an absolute value is refused for it alone, and a relative operation over it refuses that edit. Select the creatures that have the field ("has": ["enemy"]) or name them (a plain string,"select": "game:enemy_vukah_melee", is the short form of{"id": ...}in every edit, andkiln linttakes both). - An arsenal is what an enemy chooses its attacks from. Enemies of one kind share one, named after the first creature that uses it; an edit reaches every enemy that uses it, at its next decision. It keeps its attacks (only their values change).
- A perk's
valueis read when its effect starts (the item equipped, the perk unlocked): an effect already running keeps its value. A perk whose game value is a whole number takes whole numbers only (not_exact: ..., never rounded). The simple armour perks'armor.*is read whenever armour is computed;damage.*is refused until a Kiln update traces when the game reads it.
creatures and arsenals are serverOnly (clients: "none"); perks.value and perks.armor.* follow the content sync to Kiln
clients (clients: "kiln" for matching tooltips and armour; a vanilla client keeps its own numbers). The
RegistryEdits sample edits all three from C# and from a data pack.
When an edit takes effect: applies
Every field of every registry says when an edit of it takes effect, in the schema, on the C# property
([RegistryField("items.maxStack", RegistryApplies.WorldLoad)]), in RegistrySchema.Find(...).Applies and on its page:
| Applies | Means | Typical fields |
|---|---|---|
now |
at the next use (the next craft, roll, hit, payment) | gear numbers, recipe inputs, loot stack sizes, drop chances |
worldLoad |
when a world loads: in place before the world's save is read | items.maxStack (a lower value cuts stacks in that save) |
restart |
after a game restart: Kiln writes it at the start (the game reads it only then, or Kiln has no live back-end for it yet: the balance table) | the balance table |
A field whose read time Kiln has not traced yet ships with the more cautious value (worldLoad or restart, never now) and an
unproven mapping (refused per entry, with a reason, until a Kiln update proves it). Twelve fields are in that state on the
current build, each because no game code reads it, so an edit would change nothing: items.fuel.burnTime, five of the
perks.damage.* bonus fields (healing, wood, stone, metal, explosion) and, since 0.2.0-dev.32.1, movement.slope.steepFloor and
the five movement.slide.* values.
recipes.station is mapped since 0.2.0-dev.32 (read-only: it names a stations id, null for a recipe of the player's
own crafting), so data packs and C# can select recipes by station ("where": {"station": "game:prop_production_t1_forge"}).
Each page's Mapping column says which fields this Kiln maps, which are unproven and why.
Stations, recipes and the base's storage
A station (stations, since 0.2.0-dev.32) is what a recipe names: the workbench, a production station such as the forge, a
villager's crafting station. A station's recipes are the recipes that name it (recipes.station), so a selector over recipes
picks them; the stations themselves are read-only on this build. One station can have many placed forms (the game has 17 for
the workbench), so what a placed chest or station does for its base is not a station's data: which containers count as a
base's crafting stock (the Magic chests) and which take area deposits are the containers' templates, the storage registry
(since 0.2.0-dev.32, storage.md):
craftingStockmakes a container (any template with an inventory: a chest, a production station, a villager) part of its base's linked storage, or takes the game's own out of it: the Magic chests too (a mod may; Kiln does not stop it). The game decides which placed things are stock when it loads the templates: a change in the start's edits applies from that start, to every placed container of the template, also in a saved world; since 0.2.0-dev.32.3 a change after the start applies at once through Kiln's own list of each base's crafting stock (a container made crafting stock that way takes no area deposits until a start makes it crafting stock). What a container holds stays in it either way and the world loads as before (a lab took the five Magic chests out of a saved base and put them back: every chest kept its items); only a player's own deposit switch on a container taken out is not kept (put back, it followsareaDepositagain). An entry without an inventory (a well) is refused.areaDepositis a crafting stock container's switch for the quick stack station's area deposit, read at every deposit (now). A container newly made crafting stock starts with it off (as the game's refilling plants are); turn it on withareaDeposit. A container that is not crafting stock has none: it reads null and an edit of it is refused for that entry, so a pack makes a container crafting stock and gives it area deposits in one section (two edits, as the example below and the BaseStorage sample do). A player's own switch on one placed container can still turn its deposits off, never on: withareaDepositfalse the container takes none, whatever its switch says (the game's own rule; before 0.2.0-dev.32.3 Kiln'sBases.Storage(deposit: true)let a switch set on count).water(read-only): the wells and water barrels a base's seedling beds and recipes draw water from.- A crafting stock container counts for the base whose build zone it stands in; the zone sizes are
balance.buildzoneSizesPerAltarLevel.
{ "format": 1, "registry": { "alter": [
{ "registry": "storage", "select": { "id": "game:prop_decoration_t*_storage_*", "has": ["container"] }, "field": "craftingStock", "op": true },
{ "registry": "storage", "select": { "id": "game:prop_decoration_t*_storage_*", "has": ["container"] }, "field": "areaDeposit", "op": true } ] } }
The older paths keep working below the registry: a boot resource patch that copies the Magic chest's crafting stock onto a
template (resource-patches.md, its copyComponents example; EMBER's area deposit) is an older writer
under craftingStock, a templates section's InventoryCraftingStock.canReceiveAreaDeposit one under areaDeposit.
Bases.Storage(id, deposit: true) in Kiln.Blocks lists the placed containers that take deposits
(stations.md). Examples: BaseStorage sample
(a data pack), RegistryEdits sample (C#: stage.Storage[...]).
What a joined client sees
applies describes when the local game consumes a value. The separate, per-field joinedClient marker in the
schema, RegistrySchema.Find(...).JoinedClient, the generated property's RegistryFieldAttribute.JoinedClient and
each generated page's Joined client column describe the multiplayer path (since 0.2.0-dev.31.17, mod API 0.2.24). Keeping it separate is additive:
RegistryApplies and its three existing values keep their meaning, and no existing property constructor changes.
| Joined client | Server edit on an already joined Kiln client |
|---|---|
now |
ContentSync transfers the effective item/recipe layer (for abilities, kiln.gamedata's sequence values); the client uses it at the next use after receipt. Not instantaneous: generation/changed-count updates are checked periodically, and value-only changes are exported at least every 10 seconds while sync is enabled. |
worldLoad |
ContentSync transfers the layer, but a consumer that read it at world load (notably stack clamping) is not replayed. The next client world load consumes it. |
restart |
Not transferred by ContentSync. Both sides need the same boot values at process start; the join compares the resolved values when both peers send them (network.md). A rejoin alone is not enough. |
serverOnly |
The client needs no copy for this field; server outcomes apply. There is no client-held value to refresh. |
localOnly |
The server does not author/sync this field (for example client-side recipe unlock rules). The client's own mod authors it locally. |
rejoin |
A client-held field would refresh only at the next join, not during the current connection. No shipped registry field currently uses this marker. |
unknown |
Read timing/mapping is unproven or missing; the edit is refused, not promised to become visible on rejoin. |
These are field contracts, not proof of a specific UI refreshing or an equipped/save-backed instance being rebuilt. ContentSync must be enabled on both sides; vanilla clients keep their own UI/prediction numbers.
skills.cost (since 0.2.0-dev.32) is now: the server's edit is kiln.gamedata's skills slot of that node, which ContentSync
carries; a Kiln client writes it into its own skill tree resource, which the client's tree reads through its node map, so its
skill screen and its own point count follow at the next draw. A vanilla client keeps its own costs on its screen (the
server's unlock check decides). Nodes a mod adds through kiln.skills (skills/*.json, GameTree.Define) are not registry
entries: each side builds them from its own files, and a joined client sees a changed definition only after rejoining with
matching files (data-pack caveat).
skills.amount and skills.amountPerLevel (0.2.0-dev.32) are a node's amount config (what the node gives: an attribute node's
+1, a passive's 0.2 for 20 %) and, for a node with levels, how much it grows at each level. They go the same way as the cost
(kiln.gamedata's skills slot, ContentSync), but the game reads them when the node's effect starts: when a character
unlocks the node and when the character comes into a world. An effect that is already running keeps what it started with
until then, as a perk's value does. A node with levels has its amount in amountPerLevel (its amount is 0); a node without
such an amount (a root, most active skills) reads null for both, and an attribute node reads null for amountPerLevel:
an edit of a node without the value is refused for that node alone, and a relative one (mul, add) over a selection that
holds such a node is refused whole (there is no number to change there), so select the nodes that have it: "has": ["gives"]
for the amount (six of the game's 65 attribute nodes give none), "has": ["grows"] for the growth. A whole-number amount takes whole numbers only (a
fraction is refused, never rounded). skills.links (read-only) lists the nodes a node is linked with: a node can be
unlocked once one of them is. Example: SkillCosts sample.
{ "format": 1, "registry": { "alter": [
{ "registry": "skills", "select": { "id": "game:skill_*", "has": ["gives"], "where": { "kind": "attribute" } }, "field": "amount", "op": { "mul": 2 } },
{ "registry": "skills", "select": { "id": "game:skill_*", "has": ["grows"] }, "field": "amountPerLevel", "op": { "mul": 1.5 } } ] } }
Instance kinds (0.2.0-dev.32: creatureState, petState) are Gate kinds of live
values, not registry layers: ContentSync never carries them, and a joined client asks the server through the Gate (its write
is a request the server refuses unless a server mod accepts it). There now means a joined client sees the server's value
now: the game replicates it (a creature's health, its attribute pairs, its scale), or the Gate's client view carries it
(invulnerable's holds; a pet's and a taming attempt's state through kiln:pets and kiln:taming to its owner). serverOnly
means a client never gets the value (kiln.creatures' factors, resistances, loot and faction, the relations, the held taming
refunds): what the client sees is the outcome, a hit that hurt less, a creature that does not attack.
Registry-only packs: choosing clients
clients: "kiln" always bars vanilla clients by the normal join policy, even if every edit is server-only. For a
data-only pack with only a registry section, choose the strictest requirement of the fields it edits:
| Fields / operation | clients |
Why |
|---|---|---|
loot, drops, creatures, arsenals, buffs (but buffs.magnitude), impacts, lootRules, randomLoot, difficultyPresets; any serverOnly field (including the read-only balance gear constants, which cannot be edited) |
none |
Only the server needs the values. |
Synced items / recipes / abilities fields (now or worldLoad), perks.value and perks.armor.*, skills.cost, buffs.magnitude (its tooltip row), movement.stepHeight.*, fallDamage.*, discoveryRange |
kiln for matching UI/prediction; none deliberately permits vanilla UI/prediction |
Kiln clients get server layers; vanilla clients do not. |
Client-needed balance, world, difficulty and limits fields (restart), movement.slope.* |
mod, with side: "both" |
Each process must bake its own matching value/settings and load order; kiln alone cannot transfer it. |
Client-only fields (localOnly: recipes.unlock; since 0.2.0-dev.32.2 difficultyUi, fog, mapZoom, intro, mapMarkerLooks) |
mod, with side: "both"; a pack of only a player's own looks (difficultyUi, fog, mapZoom, intro, mapMarkerLooks) is side: "client" |
The client's own mod supplies them; a dedicated server refuses client-only edits of recipes.unlock and skips a look registry's (informational). |
| Item/recipe entry add/remove | At least kiln; mod for custom assets or other client-local content |
Definitions and visibility are not just scalar server rules. Existing content/look-alike rules still apply. Loot removal alone remains server-only (none). |
| Unproven/unknown or raw fields | Inspect the field/refusal first | No automatic safety claim; lint does not guess. |
For items, rolled, socket and the read-only hasDamage / hasArmor are serverOnly under the current
mapping (staminaCost follows ContentSync like manaCost: the server charges it, but a client's tooltip and prediction
read their own copy); block, comfort and fuel.burnTime are unknown until their read timing is proven. Other item
fields follow ContentSync. recipes.station is read-only/server-only; the remaining recipe fields sync except
unlock. loot/drops never require a client copy. skills.cost, amount and amountPerLevel follow ContentSync; the other
skills fields and every stations field are read-only. storage.areaDeposit follows ContentSync (a client's inventory
screen shows the switch); storage.craftingStock's start value is made at each side's own start (clients: "mod", side: "both"), a later change
reaches Kiln clients through kiln:craftstock (now; a vanilla client counts the game's own stock). Of
buffs, only magnitude is now (a buff's tooltip row); impacts are serverOnly; items.launch.* follows ContentSync. The
generated pages are the per-field reference.
kiln lint / kiln-manage lint reports KL213 for a registry-only pack whose effective clients requirement differs
from those fields, with a suggested value. It does not silently change admission, lower a mixed/code mod's policy, or
infer that raw/unknown fields are safe. A mixed pack follows the requirements of all its content, not just registry
edits. A server operator may intentionally admit vanilla clients for synced existing-item/recipe tweaks; retain that
choice knowingly rather than assuming vanilla clients acquire the server's numbers.
Lists. A list of plain values (items.perks) takes clear, append, remove (by value) and replace, and one element set
by index (perks[1]; C# item.Perks[1] = id, since dev.32); a list of entries with fields (recipes.inputs) takes clear,
append (a new entry with its fields) and remove (the entries a condition picks, named by their values), so two mods'
appends and removals stack. An element names a struct of its own as a nested object, as the C# types show it:
{"item": "game:material_stone", "count": {"min": 1, "max": 3}, "chance": 0.5} appends a drop entry (the dotted leaves
"count.min" of earlier data packs still read; one element names a leaf once). A leaf that is the element's identity (a drop
entry's item) is given in the append and read-only after it. In C#, AppendNew() gives the new element: what you set on it
(its item too) goes in the append itself, by value, until a later clear, removal or replace of that list names its elements
(since dev.32). The section's schema checks each element, so kiln lint names a leaf the element lacks. A list of fixed length (balance.xpPerLevel,
exactly 5; balance.altarsPerFlameLevel, one value per flame level) is edited one element at a time
(xpPerLevel[2]). A reference that may be absent (a recipe input's item or category) can be cleared. The world's lists (world.noBuildZones,
world.playableAreas, restart fields) take clear, append, remove and replace whole at game start: Kiln gives the list its new
length in the copy of the world scene the game reads (since dev.32). An element that stays keeps the game's bytes; an appended
element has only the corners you give (a playable area appended is a plain box: not a big dungeon, no map marker).
balance.buildzoneSizesPerAltarLevel is still edited in place: an edit that changes its length is refused at start.
What a reload changes
A reload <id> (or an unload and a load) of a mod with registry edits changes what its applies allows now, and says
what waits for the next start (since 0.2.0-dev.31.17). The rest of the mod's kiln.mod.json: architecture.md.
| The mod's edit | After the reload |
|---|---|
a data pack's registry section, a field that applies now or worldLoad |
composed again with every other mod's, in load order, at kiln.content's next Pre; registry.json has the new chain |
... a field that applies restart |
the start's value stays; the reloaded value applies at the next start. registry.json: RestartRequired: <registry>[<id>].<field> is read at game start; the reloaded value applies at the next start |
| ... a field the start never read (no mod edited it at the start) | not applied: RestartRequired: <registry>.<field>: the base was read at start; this edit was not applied |
| ... an entry add or remove the start did not have, or one it changed or dropped | the start's entry operation stays: RestartRequired: <registry> entry intent changed after GameStart; ... |
| ... a section of a mod that had none at the start | not applied: RestartRequired: a registry section added after the start needs a restart; ... |
C# HotReload / ModLoad / WorldLoad |
runs again (see the entry points above); a restart field or a field the start never read is refused for that pass with RestartRequired: ..., like a live edit |
C# GameStart only |
does not run again: the start's edits stay. When the reloaded code differs from the code the start ran, the reload reply and kiln.log say RestartRequired: <id>'s OnRegistry runs at GameStart only ([RegistryEntryPoints] has no HotReload or ModLoad): ... |
Every edit that waits starts with the stable token RestartRequired: in registry.json's refused list, with the mod and
the place (registry, id, field), and counts.restartRequired counts them all (also those the list's cap leaves
out). Where they show:
- the
kiln/controlreply ofreload <id>:reloaded <id> <version>; registry: 2 edits need a restart: <mod> balance.levelCap, <mod> items[game:wood].levels.min (kiln/state/registry.json has each reason), anddata.registry(restartRequired,edits[]) for tools such as the Web Admin mod (architecture.md); kilnctl status:registry 2 registry edits wait for a restart: ...(kilnctl.md);- the launcher's Conflicts view, first, as "Waits for a restart";
- kiln.log, with each refused row.
A restart (of the game, or of the server) applies them; nothing else does. A pack that throws while it applies leaves none of its mod's new registry section behind (services/content.md).
Stages and conflicts
At each start Kiln runs three stages, each across all mods (in the load order players see) before the next: every mod's
add, then every mod's alter, then every mod's final.
- Later in load order wins, and the report says so ("overridden").
- Relative changes stack ("composed": x4 then x2 = x8).
exclusiveon an edit keeps the strict rule: another mod's edit of the same field is a conflict and the later one is refused whole.yieldapplies an edit only where no earlier writer set the field.finalfollows alter's rules; a mod's final sees the result of add and alter, not other mods' finals.- Registry edits layer on top of Kiln's older paths (boot resource patches, data packs) and on top of values another loader wrote into the game's archive before Kiln, and are reported with them. Old mods are never refused because of a registry edit. Conflicts inside the registry and with Kiln's older paths are found for certain; other loaders' DLL patches and hooks are best-effort and labelled so.
Content.*changes made by code (Content.Apply,ContentEntry.Set, another loader's change through Kiln's content service) sit above registry edits and win, as they win over data packs. A relative op such code gives (mul,add,min,max,raiseOnly,lowerOnly) is computed by kiln.content on the game's original value, as for any data pack (services/content.md), never on what a registry edit made of it: BigStacks'{"mul": 4, "max": 9999, "raiseOnly": true}gives wood logs 250 x 4 = 1000 even where a registry pack made them 2000 (raiseOnlymeans "never below the game's value", not "never below the value under the layer"). That has been so since registry edits exist and stays so, since changing it would change what existing mod sets get. registry.json says so (0.2.0-dev.31.18): the code writer is the field's winner and one certainoverriddenline names it, the registry edit it replaced and both values ("... (a Content change made by code) sets 1000 over registry-mixed-test's 2000 (code wins over registry edits; a relative change made through Content is computed on the game's value, 250, not on the registry's)"). A mod that wants its change to stack on the registry's value makes it a registry edit (a relative op there composes on the value below it).- Mods built for the Gate (generation 1, since 0.2.0-dev.32 round 3). A mod built with the Gate's SDK says
"gate": 1in its kiln.mod.json (manifest.md). Its registry edits lie in one band above everything an older mod writes, code included, in load order, and each relative op stacks on the value beneath it: BigStacks built for the Gate gives wood logs 2000 x 4 = 8000 over a registry pack of 2000, whatever the load order. A mod without"gate": 1(every mod built before the Gate) is generation 0 and keeps the rules above, number for number (BigStacks built before the Gate still gives 1000 next to registry-mixed-test). Its data packs' rules, boot documents andContent.*code writes of a one-to-one path are its registry edits too, in the same band and order (services/content.md). At the stage, every mod'saddruns first, in load order, whatever its generation: an added entry is a definition, not a layer, so an older addon still edits the entries of a library rebuilt for the Gate, alikecopy is the entry as the add stage sees it, and the values an add gives are the entry's own, below every edit (as the game's values are for its own entries). Then every generation-0 mod's alter and final run, then every generation-1 mod's alter and final over that result.exclusiveandyieldclaims hold across the two: a generation-1 edit after an exclusive generation-0 edit of the same field is refused. registry.json lists the generation-1 rows after the rows below them (code included). "base": "game". A relative op of a generation-1 mod that wants the game's value as its base, as an older mod's data pack op has it, says so:{"mul": 4, "max": 9999, "raiseOnly": true, "base": "game"}computes on the game's value (the archive's, with older boot patches and other loaders' archive values; not another mod's data pack or registry edit) and still takes its place in load order. For a whole number field's relative op only: a list element's op, a raw member path or a plain value with"base"is refused with the reason.
Who else wrote a field
Every field row in kiln/state/registry.json (and the launcher's Conflicts page) lists its writers, lowest first, each
with a certainty (below). A mod reads the same for its own edits from C# with Registries.Outcomes() (since 0.2.0-dev.32.1):
one RegistryFieldOutcome per field it wrote, with the mod whose value is in force (Winner, null when the game's or an older
path's stands; Won when it is this mod), its own value (Mine), the value in force (Applied), the entry's name
(DisplayName) and when the field applies; and one per edit the stage refused, with the reason (Refused). So a mod whose
player set a value can say why another one is in force. Read it after Registries.Ready, not per frame (it reads
registry.json's body); a field past the report's row cap is not listed.
Registries.Ready += _ =>
{
foreach (var o in Registries.Outcomes().Where(o => !o.Won))
Log.Info(o.Refused is { } why ? $"{o.DisplayName}: not applied ({why})" : $"{o.DisplayName}: {o.Winner ?? "the game"} sets {o.Applied}");
};
| Writer | Certainty | Where Kiln learns it |
|---|---|---|
Kiln's older paths (boot resource patches, data packs, Content.* code) and registry edits |
certain |
Kiln applies them itself |
A change made through Kiln's content service by code, also another loader's (an EMF DLL mod's set_item_max_stack) |
certain |
named <who>: <Kiln place>, <who> being the mod, else the loader's own name for its mod (emf:big_stacks); a label the mod gave its change (Content.Apply(json, "bigstacks x4")) stays as it wrote it (0.2.0-dev.31.18; before, such a row named the game's item and member, owner 67: items Material_T1_Wood_Logs.maxStackSize) |
A ShroudForge or EML package that wrote the entry or the field before Kiln (archiveWriter, who shroudforge:<package> or eml:<package>) |
named |
the change journal of the start's archive writer: kiln-eml's, or Kiln's hosted ShroudForge's (below) |
A ShroudForge package of kiln mode (Kiln's interpreter) changed the game's value at run time (runtimeWriter, who shroudforge:<package>; since 0.2.0-dev.32) |
named |
kiln.assets' records of the run-time writes the package made through it (below) |
Something outside Kiln changed the game's value (drift, who outside Kiln (best effort; suspects: ...)) |
bestEffort |
the drift probe at each world load and pack reload (below) |
Archive-writer packages. The start's archive writer keeps a change journal of its startup pass: which package wrote or created which of the game's resources, and where in them, in the order the packages ran. Three kinds of start write one:
- EML mods (kiln-eml's own EML pass, a start with EML mods and without Kiln's interpreter for ShroudForge mods;
0.2.0-dev.31.18): per EML mod, the resources it wrote and the member paths it wrote in each, at their places in the
data the game reads (format 2), beside kiln-eml's ownership receipt (
kiln/eml/ownership/<exe name>.change-journal.json). A start that changed nothing keeps the journal of the start that published. - Kiln's interpreter for ShroudForge mods (kiln mode), in the same place: per ShroudForge package (and the EML packages
its pass ran) the resources it changed, each with the member paths it changed (format 2 of dialect
shroudforge, since 0.2.0-dev.32; before, format 1: the resources it wrote, per resource). A kiln-mode start of EML mods only (EML's pass in kiln mode) journals its pass too (format 2 of dialecteml, since 0.2.0-dev.32; before, it kept none). - Hosted ShroudForge (the default for ShroudForge mods: Kiln's bundled ShroudForge, since 0.2.0-dev.32): ShroudForge's own
pass writes the same record beside its record of the pass,
<exe name>.kfc.change-journal.jsonin the game folder (format 2 of dialectshroudforge,writershroudforge), bound to the SHA-256 of the<exe name>.kfcit published. A start that skips the unchanged pass keeps it; a pass that changes the game files again replaces it.
"Changed" (the ShroudForge dialect, both writers): after each package's entrypoint the resources it wrote are compared with what they held before it ran, member by member; a package is named on the members whose values differ, so one that writes a value back as it was is not named there. A list whose length changed (an element appended, inserted, removed) names the list's membership and the elements between its unchanged first and last ones, and what earlier packages changed in that list moves with the elements to their published places.
The registry stage reads it once per start, only when it belongs to this start's archive (the generation kiln-eml
published or found live this start; for hosted ShroudForge, the live <exe name>.kfc; a journal left by an earlier start
is stale and names nobody), and names each package where it wrote: a row below every Kiln writer, valued at the base
(what the package wrote is the archive Kiln reads), and a conflict line such as items[game:material_stone].maxStack: betterstacks (EML package) wrote this field in the game's archive before Kiln; bigmod's edit wins (D1): 25 -> 100.
Registry edits always win over these values, and relative edits compose on them. exclusive and yield do not count a
package as an earlier writer (its value is the base). A journal may also list the packages whose Lua the pass did not
apply (notApplied: the one that failed and those that need it), which effect replay reads (below).
- Per field (EML mods; ShroudForge packages from a format-2 journal). A package is named on the Kiln fields its member
paths hold or lie in: a mod that set an item's
maxStackSizeis named onitems.maxStackonly; one that wrotedamageSetup.dmgModonitems.power(the field Kiln computes from it); one that replaced a struct or a list on every field inside it; one that replaced the resource whole on every field of the entry. A recipe or a loot entry (an element of the recipe list or the loot list) is named by its element (recipes[37].craftingDurationnamesrecipes.durationof the 38th recipe; a recipe put in place whole names that recipe on every field; the recipe list replaced whole names every recipe). Inserting, removing or clearing elements of a list names no other element. A mod that wrote a member before another mod replaced the value holding it (a struct, an element, the resource's data) stays named there, since the new value can be a copy of the old one; its write moves with the member of the copy (a recipe inserted in front of it afterwards moves it too). A mod's own entry module (src/mod.lua) writes as that mod, even when another mod requires it first. The field row's writer has"named": "field". - Per entry (format-1 journals, created entries). A format-1 journal (kiln mode before 0.2.0-dev.32) names a
package per entry: a package that wrote one member of an item is listed on every field of that item a mod edits
(
"named": "entry"). Only items, drops and balance are named from it: their entries are each one whole resource, which is what that journal lists; a recipe or a loot entry is an element of a resource its whole registry shares and that journal does not say which element a package wrote, so no package is named on recipes or loot from it (base.journal.textsays so). A package that created an entry is named on the whole entry. - "Wrote" means written, not changed: a package that set a value to what it already was is listed too. The journal can
name a package that did not change a field; it never misses one that did, within its bounds (4,096 rows per package,
32,768 in all, 16,384 member paths per resource and 8 MiB of paths in all;
base.journal.truncatedsays when it ran out of rows; more paths than that name the whole resource). So a package's row has noop(the journal does not say what the package did to the field; itsvalueis the archive's, the base) and a package is never a field'swinner: with no Kiln writer left, the archive's value stands as the base. base.journalinregistry.jsonsays what happened:read(with how many packages and entries),none,stale(a journal left by an earlier start, which names nobody) orunreadable, with a sentence.- No names without a journal. The player's own installed ShroudForge (not Kiln's bundled one), a ShroudForge older
than this Kiln's, and other loaders (EML's own
dbghelp.dll/dinput8.dll, other DLL engines) keep no journal: what they wrote is still in the base, and registry edits still win over it, but no row names them; the report says so (base.journal.statenone).base.journal.writersays whose journal was looked for (kiln-eml, orshroudforgefor hosted and installed ShroudForge). Hosted ShroudForge's journal names every package of its pass a ShroudForge package (it runs EML packages as its own), with a digest of each package's files (contentSha256; since 0.2.0-dev.32). EML's own pass gives each mod folder's digest too (since 0.2.0-dev.32; before, null). (The first start after a Kiln update runs the EML mods again, as kiln-eml's change cache belongs to one kiln-eml build, so an EML start gets its journal then.) - Who published the base (0.2.0-dev.31.18; before,
base.writersaidnoneon every start but a kiln-mode one, also where kiln-eml or hosted ShroudForge had patched the archive):base.writeris this start's archive writer:kiln-eml(its EML pass, or Kiln's interpreter in kiln mode),shroudforge-hostedorshroudforge-installed(ShroudForge reserved the startup data writer),external(another loader's proxy ran instead of kiln-eml, or the game data differs from kiln-eml's vanilla backup and is not its output) ornone(the game's data as shipped, as far as kiln-eml can tell).base.archivesays what that rests on: kiln-eml's state of the start (phase,patched,cached,restored,mods), the name of kiln-eml's ownership receipt (receipt,kiln/eml/ownership/<stem>.json) or of ShroudForge's record of its pass (record,<stem>.kfc.prepared.json; named, never read), and a sentence. kilnctl's values diff still takes onlynoneas the game's own data (regmap/README.md).
The drift probe (best effort). At each world load and each pack reload Kiln compares, for every field it writes live,
the game's value just before Kiln's first write in that world with what the stage read at start plus the writers Kiln knows
below the packs. When they differ, something outside Kiln changed the value (another DLL engine, a hook, a memory write):
the row says so and names the suspects Kiln can see, the modules that patched game code before Kiln hooked it (the hook map,
kiln/state/hooks.json) and hosted ShroudForge when it runs. A slot another writer changes after Kiln's layer gets the same
row (Kiln's edit is then skipped for that world, as before). The probe never refuses anything. It runs whenever Kiln
rebuilds registry.json's live rows (at each world load and pack reload, and when a live change or a drop table the game
loads later changes them; never per tick) and costs one more read of each field it writes live, about a tenth of what
rebuilding the rows costs anyway.
Run-time writers of kiln mode (since 0.2.0-dev.32). A ShroudForge package run by Kiln's interpreter (kiln mode)
changes a loaded resource's field at run time through kiln.assets (game.assets.write_loaded_field, a resource
override, a template component's write_field), and kiln.assets keeps a record of each place's newest write with the
package that made it. Where the drift probe, a later write or a skipped write finds the game's value changed outside
Kiln's layers, Kiln asks those records first: when taking the package's recorded writes back gives exactly what Kiln
expected there (what the stage read, or Kiln's own last write), the package changed it, and the field's row names it as
a runtimeWriter writer (shroudforge:<package>, certainty named, its value what the game holds after its writes)
instead of the best-effort drift row. A skipped write names it too (items[game:material_t1_wood_logs].maxStack was written by shroudforge:big_stacks at run time after Kiln's layer: Kiln's edit not applied), and so do the lines (... shroudforge:big_stacks changed it at run time after Kiln's last write in this world (40 -> 777)). The Conflicts page
names the package as it names an archive-writer package (big_stacks (ShroudForge package), kind "Run-time writer").
A record's writer is what its caller said: Kiln shows only a ShroudForge package's name (shroudforge: and a plain id, as
Kiln's interpreter writes it), any other text names nobody. Anything the records do not prove keeps the drift row: a
value something else wrote over the package's, a package that wrote over another value than Kiln's, writes of a Kiln interpreter or
kiln.assets older than 0.2.0-dev.32 (their records name no package), hosted or installed ShroudForge (its run-time
writes go to memory outside Kiln). kiln.assets keeps 16,384 places for the process; the place written longest ago goes
first. The records are asked for only when a row needs a name, once per report.
Writes after the last report (0.2.0-dev.31.18; before, they stayed out of registry.json until the next pack reload or
world load: the compat rehearsal saw wood logs at 300 there while EMF's big_stacks had made them 1200). Kiln also looks
again between those rebuilds, never per tick: about 2 s after a change through Kiln's content service (code, another
loader's change through Kiln) and every 10 s for a write outside it, comparing each field it writes live with what the last
report saw. When one changed, registry.json and the Conflicts view get the field's new writers and result (a code writer
as above; a write outside Kiln as a best-effort row last, with a line: "the game's value changed outside Kiln after Kiln's
last write in this world"); no new generation, no ready event, nothing written into the game. A field that keeps changing
is looked at less often (up to once a minute). kiln.log says so once. A look reads each slot Kiln writes live, at most
1,024 of them a tick (a pack over every entry's stacks or drops writes tens of thousands: its look takes a few dozen ticks),
and rebuilds nothing when nothing changed; when something did, the rebuild costs what a pack reload's report costs. The rebuild itself stays on the world tick; registry.json's JSON and file are made on a thread of Kiln's own, never on the tick (0.2.0-dev.31.19), for this rebuild and every other report after the start: a newer report replaces one not yet written, kiln.registry's report text is the newest report even before its file is written, and a report still waiting for that thread is written before the server or game exits normally (Kiln waits up to 2 s). A write
outside Kiln that comes back to Kiln's value between two looks is not seen. A suspect list is a hint, not proof: a writer that hooks nothing is not
seen, and a field nobody edits through the registry is not checked. Neither is an entry an old boot resource patch (an
OnBoot or resourcePatches document) writes: the game holds Kiln's own patch there, and many of its paths (a formula's
input, an element of a list of structs, [*] over every recipe) have no field row to explain it, so a change there is
never called another loader's.
Effect replay of ShroudForge and EML packages (opt-in, since 0.2.0-dev.32)
A ShroudForge or EML package edits the game's data by its own Lua, which names the game's types, member paths and GUIDs. After a game update that Lua can fail, and the package then changes nothing until its author updates it. Effect replay keeps every package's last effect in registry terms and, for a package the player opts in, applies it through the registry on a later game build where its Lua was not applied. Recording is on by default; replaying is opt-in per package (owner decision D6: mechanism, not policy).
- Opting in:
kilnctl registry replay <server> --opt-in <mod>(and--opt-out <mod>;<mod>isshroudforge:<id>,eml:<id>, or an id the last start names once; without a flag it lists the file and the last start's packages), or the toggle per package on the launcher's Conflicts page (Effect replay). Both writekiln/data/content/registry/replay/opt-in.json(the registry's data folder), on each side that runs the package:{"format": 1, "packages": {"shroudforge:<id>": true, "eml:<id>": true}}.false(or leaving it out) opts a package out. A file Kiln cannot read opts nothing in, andregistry.jsonreplaysays so; the tools refuse to write over it. - Recording (every package, cached): in a start whose change journal names a package as having run (format 2, above),
Kiln keeps the registry fields the journal names it on, with the values the base holds there (what its write left in the
game's archive), its identity (id, version, content digest), the journal's writer and generation, the game build and the
side, in
kiln/data/content/registry/replay/replay.sf.<id>.json(replay.eml.<id>.jsonfor an EML package; an id with a capital letter gets 8 hex digits of its SHA-256 after it, so two ids never share a file). What of its effect no proven Kiln field holds is listed as the record's residue: a member no field covers or one wider than the fields under it, a list's membership (a recipe or loot element added or removed), a resource that is no registry entry, an entry or content it created, an entry named whole (a format-1 journal), a field another package changed too, a journal cut short.replay/index.jsonsays which journal generation, game build and side the records were taken from: a start where the journal names the same generation (no package, package file or game build changed, so its writer did not publish again) reads the journal and the index and nothing else, not even a hash of the archive. A start that records reads the whole base once for all its packages (about 4 to 5 s on a dedicated server, the cost of a registry start with a live registry user); it happens after a pass that published a new generation, which itself took longer. - Replaying: in a start whose journal lists an opted-in package as not applied (
notApplied: its Lua failed, or it needs a package that did), on another game build than the one its record was made on, from the same archive writer's journal, with the same id, version and content digest (hosted ShroudForge's journal carries a digest of each package's files since 0.2.0-dev.32, EML's own pass each mod folder's, the digest kiln mode's launch plan freezes; a folder it cannot digest has none: id and version), Kiln adds the record's values as absolute registry edits of a stand-in writer,replay.sf.<id>, before every mod, in the journal's (the plan's) order. Registry mods' edits win over them and relative edits compose on them, as on the package's own archive values (D1); a stand-in edit never makes another mod'sexclusiveedit a conflict or itsyieldedit stand back. The package's value lay below Kiln's older paths, and so does the stand-in: a field an old boot document of a Kiln mod sets keeps that document's value (the row says how many), and a package whose field an old boot document changes relatively (it composed on the package's own value) is refused whole. On a live field the stand-in stands below every data pack too (since 0.2.0-dev.32): it is a layer of kiln.content's own, in a band below every pack's, put at each world's load before the packs apply, so a data pack's absolute value wins over it and a pack's or code's relative change (mul,add,raiseOnly, a condition) is computed on it, as kiln.content computed it on the package's own archive value; registry edits compose over the packs as before. The order is the one the registry guide gives every writer (later wins): the game's value, the package's (or its stand-in), Kiln's older paths (boot documents, base rules, data packs), registry edits,Content.*code. Wood logs a replayed BigStacks-style package set to 25 under a pack's{"mul": 4}are 100, as they were while its Lua ran; under a pack's30and a registry mod's{"mul": 2}, 60. The Conflicts page lists the stand-in below the packs, with a line (oldstacks: content/a.json's value 30 lies over the replayed value of replay.sf.betterstacks (25)). kiln.log says so as a warning, andregistry.jsonreplaylists it (replayed, its fields, the build its effect was recorded on); its writer rows say"standIn": true. The start's plan keeps its edits (the input says"standIn": true), so a rollback to that plan brings them back as stand-ins with the plan, with no installed mod needed for them; a rolled-back start replays nothing else. - Refused whole, never in part: a record with residue, a value that no longer fits its field, an entry or field this
build's mapping has not proven, any of its edits the stage refuses, a package that changed since its record, a record
from another archive writer's journal, the same game build its record was made on (its Lua failed for another reason than
an update), the other side's record, a record that names another package, a Kiln mod whose id is the stand-in's
(
replay.sf.<id>), an old boot document's relative change of one of its fields, or no record at all: nothing of the package is replayed, andreplaysays why (refused). A start that cannot read the base records nothing (none; the next start tries again). - Saves checks, whole: a replayed package's own values are judged against the value under them on every field of it,
restart and live, at the stage (since 0.2.0-dev.32; before, a live field only at the world's load, field by field): a field
whose edit would change what saves hold in a way Kiln refuses (a raised minimum item level) refuses the package whole. At
each world's load its live fields are judged again, whole: a field of it the saves check refuses there, a lowered max
stack or maximum item level where its own guard is unavailable, or a field this world cannot write (an entry it lacks, a value that no
longer converts) takes every live layer of the package off for that world.
registry.jsonreplaythen saysrefused("refused in this world: ..."), one refusal row names the package and the field, and kiln.log says so once; its restart fields keep what the start wrote until the next start, which judges the package again. Those words say so ("its 1 restart field(s) keep what this start wrote until the next start"), and the Conflicts page still names the package, with the value the game has, on those fields. A drop table the world loads later, after the package's other values are in the game, can refuse it too (its recorded stacks no longer fit the table): taking those values off a running world is then judged as any write is. Where it would lower a stack or maximum item level without its matching guard, or raise a minimum item level, the package stays replayed in that world and only that table keeps its own values (the refusal row andreplaysay "the package stays replayed in this world"); otherwise the guard goes on first where needed and the package comes off whole. - What it cannot do: run the package's Lua, create entries, replay contents or anything outside the registries, or follow the game's own new values where the package set a field (the recorded value is set as it was). Each side keeps its own records, so a joined client replays only what it recorded and opted in itself; boot fields a replay changes take part in the join's comparison as any registry edit does. The join names every package one side replays and the other does not, and a server (or a mod on it) can turn on replay sync, so joining Kiln clients opt in what it replays and they have a record of, also a package the player switched off (the server's sync wins) (network.md, since 0.2.0-dev.32). A joined Kiln client gets the server's live values through ContentSync, a stand-in's included.
Native callback and owner lifetime
kiln.registry keeps submitted batches and callbacks under their caller's owner. Revoking that owner removes its queued
batches (including parse refusals) and its stage/ready subscriptions, even before any world exists. Another live owner of
the same mod keeps its own batches. Admission and dispatch also check the core's current owner state, so a retiring
notification still being delivered cannot admit or start another callback into the dead owner.
The stage takes the surviving queued batches at startup. Edits it already took remain until the next process start; revocation is not a rollback of committed registry layers. A stage callback already in flight may finish, but if its owner was revoked, that turn's uncommitted edits are dropped and the report names the reason. A fault in either kind of native callback removes that subscription; a faulted stage turn is dropped as well.
Unsubscribe and revoke never wait for callback quiescence. A callback whose dispatch already started on another thread
may still finish, so its native function and user state must stay valid until that dispatch has completed. Ready dispatch
rechecks each subscription, including when an earlier callback in the same START or WORLDLOAD event unsubscribes or
revokes a later one. These lifetime rules add no members to kiln.registry, which stays 88 bytes. Live transactions
use the separate 56-byte kiln.registry.live v1 table. The managed Host owns these subscriptions and their retirement.
Live values in the report
After world load or a pack reload, kiln/state/registry.json shows the live result and writer chain for recipe inputs
and outputs, drop-table entries, item perks, and power and armor. The chain shows older packs below the registry edit.
composedOn names the pack whose value a relative edit used, and overridden names the pack an absolute edit replaced.
Drop-table rows refresh within the current generation when the world acquires their tables.
List values are arrays of entries in game order. The report keeps the first 64 entries per array and includes the omitted
count in resultEntriesLeftOut, base.entriesLeftOut, or the writer's valueEntriesLeftOut, listEntriesLeftOut, or
opEntriesLeftOut as applicable. Formula rows keep the numeric result and include formulaInputs in evaluation order.
Power lists the damage factor, attack speed factor, and minimum level. Armor lists the armor share and minimum level.
The plan cache (0.2.0-dev.32)
A start's plan cache keeps what composing its registry edits gave, so the next start with the same inputs does not compose
them again. It never changes what a start does: a start that takes a kept plan writes the same registry.json, the same
boot values, the same join part and the same plans/<sha256>.json as one that composes.
What a kept plan is keyed by: everything the composition reads, as one SHA-256:
| Input | What changes it |
|---|---|
| the mods' registry edits | a data pack's registry section, a batch submitted before the stage, an edit refused before the stage, a mod's version, the load order, a mod added or removed |
| the mods' generations | a mod built for the Gate ("gate": 1, a build with the current SDK), or one that no longer is: its edits compose above every older mod's |
a GameStart callback's code and inputs |
a mod built for the Gate whose OnRegistry runs at GameStart: Kiln.Host's fingerprint of every input file of its folder (its code included, by content) and its configuration files (<configDir>/<id>.json, every <configDir>/<id>-*.json: Config.Register's named and -server/-client files, and <configDir>/<id>/) |
the load order, with a keyed GameStart callback |
every mod Kiln.Host loads and its version, also one without registry content (a callback may add its edits only when another mod is installed) |
| the older paths | the boot documents below the registry (resource patches, base rules, front-end candidates: gearRules) |
| the game data | any byte of any resource the stage's base was decoded from, a resource of a listed type added or removed (a game update, a ShroudForge or EML package), a value Kiln's hooks read from the game's code (limits: no resource holds it) |
| the archive writer | the ShroudForge or EML packages its change journal names on the game's entries |
| the mapping | regmap/common or this build's record (a re-proof, --mark) |
| Kiln | its version and build stamp, the registries' schema, the decoder and the composer |
| the build | the game exe, the side |
Any of them changed and the start composes, as before; kiln.log says what differs from the newest kept plan
(registry: plan cache: no kept plan for this start's inputs (they differ from the newest kept plan's in the mods' registry edits ...)), and the start keeps its own plan for next time. The same inputs give registry: plan cache: this start's inputs have a kept plan (<key>, <n> field(s)): the edits are not composed again, and registry: stage times: ... compose 0.4 ms (plan cache).
A start composes every time (kiln.log registry: plan cache: this start composes its edits (<why>)) when its plan cannot
be keyed soundly: a GameStart callback (OnRegistry code) of a build older than the Gate is there (it may read the clock, a
random roll or another folder, so it runs every time, as before), or Kiln.Host gave no fingerprint of a callback's code and
inputs, a rollback request is there, effect replay records or
replays an archive-writer package that start, an edit names raw member paths (the Advanced tier), or
kiln/data/content/registry/plan-cache.off is there (support and labs: no plan is used or kept while it is). A data-only start
(no mod's code uses the registry API) reads only the part of the game data its edits change and composes; it needs no plan.
Older mods' boot documents beside it (More Flame Altars, XHL's world limits) add only what they name to that part (since
0.2.0-dev.32 round 3; before, they made the stage read the whole game data, 12.8 s on a lab server). A mod built for the Gate with
code or blocks files counts as a mod whose code uses the registry API here: its Content.* writes and block rules are its
registry edits, so the stage reads the whole game data at resources-ready for them, never on the tick at their first write.
A GameStart callback served from the plan (a mod built for the Gate): kiln.log says registry: plan cache: the stage callbacks of <mods> (OnRegistry at GameStart) were not called: .... The edits the callback made at the kept plan's start are its
edits again: the same values, the same plans/<sha256>.json, the same live edits a later change recomposes. Its code is not run
at that start, so an OnRegistry override that must run at every start for something other than its registry edits (a field it
sets, a log line) does that in OnLoad, or keeps kiln/data/content/registry/plan-cache.off for testing. What the callback
reads besides its folder, its configuration and the registry (the clock, a random roll, the network, another mod's files) is not
part of the key: such a callback's edits are those of the start that kept the plan.
Files: <game>/kiln/data/content/registry/plan-cache/<key>.json, one per kept plan, and plan-cache/index.json. At most
8 plans and 64 MiB are kept, the most recently used first; a plan over 32 MiB is not kept. A file Kiln did not write there, or
a plan whose text does not match the digest it carries (cut short, edited), is ignored with a warning and written again:
never trusted. Deleting the folder loses nothing but the next start's time.
Cost (a dedicated server, 0.2.0-dev.32 lab, the PC under load): a start with registry edits spends 1.2 to 1.8 s reading the game's base from the base cache, then composing: 242 ms for 9 fields (most of it a fixed cost of indexing the whole base), 364 ms for 6,812. A kept plan is read and checked in 0.6 ms (8 KiB) and 108 ms (1.6 MiB) and the stage's other steps take 45 to 60 ms, so the plan cache saves about 180 and 210 ms of those starts. See limits.md.
Plans and rollback
Each start's stage writes its plan: <game>/kiln/data/content/registry/plans/<sha256>.json (format 2), named by the
SHA-256 of its content. It holds what the stage composed: each mod with its version and its lowered edits (data sections,
batches submitted before the stage and its GameStart OnRegistry turns, in the order they composed, as IR), the values
they resolved to (values, "<registry>[<id>].<field>", restart fields as the boot back-end wrote them; live fields as the
stage composed them over the base), the entries added and removed, and the game build, side and Kiln version. The same mods
with the same edits give the same plan.
Which plans are kept (0.2.0-dev.31.18; before, none was ever removed, so the folder grew by one file for every changed set of
mods and settings). At the end of a successful start Kiln keeps the last good plan and the good plan before it, the plan the
last world ran on, this start's plan and its previous, every plan a pending rollback.json names (its plan and from,
read again at that moment), and the newest 10 other plans (by the file's last write: a start on the same edits writes its plan
again), and removes every other plans/<sha256>.json; kiln.log says how many (registry: plans: removed ...). Only plan files
are removed: plans/index.json, a kept plans/index.unreadable.json and any other file stay. Nothing is removed by a start
that failed or whose state is not known: one whose stage had no base to read, whose rollback request was refused (or cannot be
read), whose plans/index.json could not be read, or that wrote no plan (a rolled-back start runs on a plan that is already
there and writes none, so it removes none either). kilnctl registry rollback --to <hash> can name
only a plan that is still there (a removed one is refused: "not in kiln/data/content/registry/plans").
The last good plan is the last one a world started on without a refused edit (plans/index.json keeps it, the good one
before it, the plan the last world ran on, and the highest stack and item-level maxima a world started with per item); a start whose stage had
no base to read applied nothing and is never good. registry.json plan.previous names the last good plan that is not this
start's: what a rollback goes back to. On a rolled-back start it is the previous that plan was written with. An index that
cannot be read is kept as plans/index.unreadable.json with a kiln.log warning; that start has no previous plan, and since
the highest stacks and item levels are unknown Kiln asks both guards to turn on, warning separately if either is unavailable. An index entry that names no plan hash is ignored.
Rollback. kilnctl registry rollback <server instance> (a client: --dir <game folder>, or the client Steam knows with
--real) says what changes back, then writes kiln/data/content/registry/rollback.json. From the next start on, until
kilnctl registry rollback --clear:
- the stage runs the plan's edits instead of the mods' current registry edits: data sections, queued batches and
GameStartcallbacks (those are not called; the plan holds their edits). Old paths (packs, boot patches,OnBoot, hooks) run as always; - registry.json
rollbacksaysapplied, lists every value that changed back (changedBack: field, from, to; also in kiln.log) and the mods with registry edits the plan does not hold (leftOut: not applied while the rollback holds); ModLoad,WorldLoad,HotReloadpasses andRegistries.Changeof the plan's mods still run as the mods make them (they are not part of a plan); a left-out mod's live changes areRestartRequired, and so is a pack reload's changedregistrysection.
The plan is refused whole, and the start runs the mods' current edits (registry.json rollback.state refused, with the
reason, and a kiln.log warning), when the request cannot be read, the plan file is missing, was written by an older Kiln
(format 1), or does not match its name, it is the other side's, one of its mods is not loaded (<mod> is gone) or not at
its version (<mod> changed (1.0.0, now 1.1.0)), or one of its edits is refused on this start (a field this build does not
map, an entry this build does not have, a save check below). The save checks judge every value of the plan twice: against
the value without the registry (as for any edit) and against the plan it rolls away from (the request's from; without one,
the plan the last world ran on), since a world ran on those values and its saves can hold them. A raised minimum item level or a
shorter build-zone list than that plan's refuses the rollback whole; lower stack and item-level maxima need their matching guards at the stage. It
is never half-applied. Refusals that only a world's load can make (an entry that world lacks) stay per entry, as on any start.
A plan made on another game build may start when every edit of it maps there (rollback.madeOnExe says so); schema
migrations apply to it like to any edit.
A rollback never touches saves: it writes one file beside the plans. When it gives an item a lower max stack than a world
already started with, or than the value under it, Kiln's stack guard keeps the bigger stacks a save holds whole. A lower maximum item level similarly needs Kiln's separate level guard so saved items keep their level. Where the required guard is unavailable the rollback is refused. kilnctl registry status shows the plan of the last start, the previous one and any rollback. The
launcher's Conflicts view has the same as its Registry plan card (since 0.2.0-dev.31.17): the plans, the last start's
rollback and a waiting request; Roll back shows the dry run's changes first and writes the request only on confirm,
Clear removes it (launcher/registry-conflicts.md).
Edits that change existing saves
A registry edit changes the game's data, never a save. Some fields are read against what a save holds, so Kiln checks each edit of them against the value without it (the game's, or what an older path wrote) and decides:
| Class | Edit | What it would do to saves | Kiln |
|---|---|---|---|
stackCut |
items.maxStack lower |
the game deletes the part of a saved stack above the new cap at its next move | guard: applied, the stack guard keeps such stacks whole (new stacks hold at most the new cap); refused for that entry where the guard is not available |
stackCut |
any start (or rollback) giving an item a lower max stack than a world already started with (plans/index.json stacks: the highest per item, never lowered) |
the same, for stacks such a world saved | guard; where the guard is not available, a warning (nothing is left to refuse), and a rollback is refused whole |
levelRange |
items.levels.max lower |
saved items above the new maximum would lose their level | guard: allowed; saved items above the new maximum keep their level (Kiln turns off the game's upper level clamp while needed); refused for that entry if level protection is unavailable |
levelRange |
items.levels.min higher, or a resulting minimum above the maximum |
the upper-clamp guard cannot protect against a raised minimum; the game makes no item with an inverted range | refused for that entry |
listShape |
balance.buildzoneSizesPerAltarLevel shorter |
a saved altar at a higher level has no build-zone size | refused |
perkSlots |
items.perks: a filled slot changed or emptied |
saved copies keep rarity and unlocked count, and have the slot's new perk (perks are read from the item's slots while it is used) | warning, applied |
progressionCap |
balance.levelCap, balance.skillPointsPerLevel lower |
saved characters keep their level and spent points; what the game does past the new cap is not traced | warning, applied |
experienceCurve |
balance.xpPerLevel, balance.xpCurve.* changed |
saved characters keep their experience; a level whose threshold moved is not recomputed by Kiln | warning, applied |
baseLimits |
balance.altarsPerFlameLevel, waterSourcesPerFlameLevel, buildzoneSizesPerAltarLevel values lower; limits.maxAltars lower (dev.32) |
saved bases keep what they hold above the new limit; what the game does with it is not traced | warning, applied |
durability |
balance.durability.*, balance.rarityDurability.* |
each saved copy keeps its share of durability; max and current follow the new value at load | reported, applied |
creatureLevel |
creatures.levelMax lower (dev.32) |
a creature's level is clamped to its highest, so a saved creature of that kind (a villager, a farm animal) above the new value may load lower; whether a save keeps a creature's level is not traced | warning, applied |
skillTree |
skills.cost higher (since 0.2.0-dev.32), also than the cost the last world ran on (a lowered cost taken back up) |
a character in a save whose unlocked nodes now cost more than their skill points gets the game's free reset of the whole skill tree at their next join (the points come back; the nodes have to be unlocked again) | warning, applied |
settingsRange |
difficulty.<setting>.max lower, difficulty.<setting>.min higher (dev.32) |
a world's own (Custom) setting outside the new bounds is clamped into them when the game reads the settings at start; whether the game then saves the clamped value is not traced | warning, applied |
| (none) | everything else: recipes, loot, drops; an item's rarity, rolled, socket, power, speed, damage, armour, costs; the balance table's gear, unlock, socket chance and fog numbers; every other creature field, arsenals and perks; buffs (an edit changes no saved buff; whether a buff loaded from a save starts its program again with the values of then is not traced), an ability's timing and length, impacts, an item's launch; a lower skills.cost (until a later start takes it back up: skillTree above); a skill node's amount and growth (skills.amount, amountPerLevel: a save keeps unlocked nodes, never what they give); a container's crafting stock and area deposits (storage: template data, no copy in a save; what a container holds stays in it); a player character's movement (movement: template data; a character file keeps none of it); the world's no-build zones and playable areas; a difficulty setting's wider bounds |
read at use, or only for new copies | applied |
Refusals are in registry.json refused and kiln.log (saves: ...; this edit was not applied), the rest in registry.json
saves (field, class, decision, text) and kiln.log (registry: saves: ...). Restart fields are checked at the stage, live
fields at each write over the value under them (an older pack's included), so a ModLoad, WorldLoad or Manual edit is checked
too. A new entry's first values (its add's fields, over the entry it is like) are not checked: no save holds a copy of it
yet; its later edits are. The value under an edit is the game's (or an older path's), not what an earlier start gave it, so
a mod that lowers its own earlier raise of items.levels.max is protected by the level guard. Kiln keeps the
highest applied maximum per item in plans/index.json levels, never lowered, and enables level protection when a
raising mod is removed, even if no registry mod remains. Unavailable protection warns on such a start (there is no
edit left to refuse), and refuses a rollback whole. Raising levels.min is still refused; a start whose minimum is
higher, or whose build-zone list is shorter, than the last world's plan gets a warning in saves instead. A warning class is judged against that plan too, where this
start's own value gets no warning against the value without the registry (since 0.2.0-dev.32): a skill node's cost lowered to 1
for that world and 2 now is a skillTree warning (characters spent their points at 1), though 2 is below the game's 3; so is a
level cap lower than that world's (progressionCap). A start where no mod has registry content reads no base unless a stack or level high-water mark still needs protection. A rollback is judged against the plan it rolls away from and
refused whole ("Plans and rollback"). Balance fields stay restart-only.
Ids
Every entry has a Kiln id: game:<stable name> for the game's entries, <mod id>:<name> for a mod's. The grammar is
<namespace>:<name> with the namespace [a-z0-9][a-z0-9_.-]*, the name [a-z0-9_.-]+, and for a game entry an optional
clash suffix ~<8 to 32 hex digits>; the mod ids game and kiln are reserved. A debug name with other characters
(spaces, apostrophes, letters outside ASCII) has each of them as _ and is pinned. Ids are lower case,
never reused, and keep working across game updates: Kiln keeps an alias table per game build (keyed by the entry's GUID)
that follows renames, so a game entry keeps the id it had when the game renames it. A game entry a game update removes
refuses every edit that names it ("removed by game build ..."). The old debug-name selectors of data packs keep working.
Names for players. An id is no name: since 0.2.0-dev.32 final every entry (ItemEntry.DisplayName, RegistryEntry,
IRegistryEntry) and every view entry has a DisplayName that is never empty and a DisplayNameSource, by the rule each
registry's page states under Ids ("Names"); display names has the table.
Show the name; keep the id for edits, selectors and searches.
How a game entry's stable name is made (each registry's page repeats its own rule):
| Registry | Stable name | On game build 1287369 (server) |
|---|---|---|
| items | the item's debug name in lower case; item_<item id, 8 hex> when it has none |
4,268 items: no empty name, no clash (also none ignoring case); levels run to 105 (gems), so the formulas take the field's whole 1..105 |
| recipes | the recipe's debug name in lower case; recipe_<recipe id, 8 hex> when it has none (the name kiln.content gives such a recipe today) |
2,542 recipes: no empty name, no clash; 703 share a name with an item (different registries: no clash) |
| loot | the id of its item | 4,213 entries |
| drops | see "Drop tables" below | 420 tables |
| balance | game:balance (one entry) |
1 |
| skills | skill_<node id, 8 hex> (a node has no debug name; kiln.gamedata's and the catalogs' name) |
243 nodes |
| impacts | its template's id (as creatures: the template's debug name in lower case, the clash suffixes the templates have) | 863 templates with an impact program: 339 projectiles, 524 areas |
| movement | the id of its template (game:1_player, the one every player's character is made from; game:1_player_ag2, game:automatedplayer): the templates with a player character's locomotion |
3 templates |
| storage | the id of its template (the template's debug name in lower case; template_<first 8 hex digits of its GUID> when it has none), the same id the creatures registry gives a template |
608 templates (595 with an inventory, 13 water sources); one name held by two templates: the second gets ~<GUID8> |
| stations | the id of the item that builds the station (a villager's: the villager's item); station_<station id, 8 hex> when it has none |
51 stations, 7 without an item; no two share an item |
| world | game:world (one entry: the world's scene; the game's menu and character scenes are not entries) |
1 |
| difficulty | game:difficulty (one entry) |
1 |
| limits | game:limits (one entry: no game resource; its values are Kiln's hooks of the game's code) |
1 |
| lootRules | game:loot (one entry) |
1 |
| randomLoot | a table of the label collection (enemies, generic containers): labels_<its 32-bit id, 8 hex>; a table of a world's scene loot: world_<the first 8 hex digits of that resource's GUID>_<the scene node id of the first chest that uses it (the smallest), 8 hex>, never its index, so a game update that inserts a table moves no id (a table whose first chest changes gets a new id, and edits naming the old one are refused); a table no chest uses has no id |
797 tables: 99 labels_ (23 set all five rarities) and 698 world_ (all in world_509feadb_*, every one used by a chest); no clash |
Two entries with one name. The entry that held a stable name first keeps it for good; a later entry whose name is the
same (also when the two differ only in case) gets game:<name>~<first 8 hex digits of its GUID> (more digits if those
are taken as well), and the plain name as a selector means only its holder. "First" on the first game build Kiln maps is
the order of the game's archive (the order the boot snapshot and boot resource patches see, which already keep the
first and report the later one as a duplicate); from then on Kiln's alias table records every suffix it gave, so a later
game build never moves a name to another entry. Templates are the case today: 12,269 templates on 12,229 names on build
1287369, 40 later entries with a name taken before them plus 1 that differs only in case, on 39 names. They get the suffix
when a templates registry exists; no R1 registry has a clash on this build.
Drop tables have no names in the game. A table is named after the templates that use it (their DefaultInventory
component): game: + the first of their stable names in ordinal order, in lower case
(game:lootcontainer_enemy_scavenger_melee01 for the scavenger's table that 12 templates use). A table no template uses is
game:drops_<first 8 hex digits of its GUID>. Two tables can only get one name if a template used two tables; then the
clash rule above applies. On game build 1287369 (client data): 837 templates use 357 distinct tables (242 tables by one
template, 115 by several, up to 68), the rule gives no clash, and the server's 420 tables leave about 63 unused by any
template, which take the drops_ form. The table's GUID also selects it, as data packs' drops section does today.
Older paths as front-ends (0.2.0-dev.32)
An older path is a front-end of a registry where Kiln writes what it says through the registry's own mapping and back-end, and only where that gives the game the same bytes. The mod keeps its file and its behaviour; what changes is that its values pass through the proven mapping (after a game update, a Kiln update of the mapping carries them) and that registry.json shows them.
| Older path | Registry | Front-end | Where not |
|---|---|---|---|
a data pack's gearRules (boot values) |
balance: rarityDurability.*, socketChance.*, durability.*, unlockCost.* (19 fields of the same names) |
yes: the registry's boot back-end writes the file's values, at every start compared byte for byte with its resource patch | a value of a field not proven on the running build, an operation whose min is above its max, or copies that differ: the resource patch writes it, as before (registry.json frontEnds says why) |
a data pack's gear section |
items: every gear key is the items field of the same meaning (power, speed, damage.*, armor.*, block, staminaCost, rarity, levels.*, rolled, perks, socket, maxStack) |
no: it stays a data pack | one registry edit per key does not always mean the same: content.md lists the cases; a registry section can say the same as a rule (the lab gives the same item bytes) |
Content.Gear(...) in C# |
items |
no: it is code (Content.*), which sits above registry edits by design |
A front-end keeps the older path's place in the composition: below every registry edit, an earlier writer for exclusive and
yield, conflicts with the other older paths as before; registry.json names it on each field it writes (kind: oldPatch,
frontEnd: true) and lists it under frontEnds (state: registry or resourcePatch with a reason). It is no registry
edit: the join's registry part (kiln.registry.boot) and the counts.edits do not count it, so peers of older Kiln
versions compare as before. <game>/kiln/data/content/registry/front-ends.off switches the front-ends off for the starts
while it is there: a support and lab switch, no player setting. It is read once at each start; making or deleting it while
the game runs takes effect at the next start, and is safe either way (the same bytes, the same join parts).
Tiers
| Tier | What | Promise |
|---|---|---|
| Stable | registry schemas, Kiln ids and fields, Kiln.Registry C# and data sections, typed blocks, stable registry views |
survives game updates: Kiln updates the mapping; frozen by API 1.0.0 |
| Advanced | raw reflection paths (raw in an edit), raw maps (buffs.configs: every config by the game's id, its meaning per key not proven), resource patches, GameFields/GameTypes, boot.GameData keys, advanced registry views |
works while the game's names hold; checked and refused per entry, never silent corruption |
| Native | hooks by address, raw memory, native plugins | the mod's own risk |
Every public surface with its tier, what API 1.0.0 freezes, and how to move a mod up a tier: tiers.md. The analyzers point old paths at the registry field that covers them (KILN124, with a fix for one-to-one data pack values) and mark Native-tier code (KILN125), info level only (analyzers.md).
Files
| File | What |
|---|---|
schema/registry/<registry>.json |
a registry's schema: fields, types, ranges, ops, applies, ids rule (Kiln names only) |
schema/registry-schema.schema.json |
the schema of those files |
schema/registry/ids.lock.json |
every published registry and field name with its numeric id; never reused |
schema/registry/migrations/ |
id and field renames a breaking schema version ships (applied to every edit, "Versions" above) |
<game>/kiln/data/content/registry/plans/<sha256>.json, plans/index.json |
each start's plan (the ones still needed and the newest 10 others are kept: "Which plans are kept"); the last good plan and the plan the last world ran on ("Plans and rollback"); plans/index.unreadable.json: an index that could not be read, kept |
<game>/kiln/data/content/registry/rollback.json |
a rollback request (kilnctl registry rollback), kept until --clear |
<game>/kiln/data/content/registry/plan-cache/<key>.json, plan-cache/index.json |
the plan cache (0.2.0-dev.32): the newest 8 plans (64 MiB) by their inputs' key ("The plan cache") |
<game>/kiln/data/content/registry/plan-cache.off |
support and labs: while it is there, no start uses or keeps a plan |
<game>/kiln/data/content/registry/front-ends.off |
support and labs only: while it is there, the older paths stay off the registry from the next start ("Older paths as front-ends") |
schema/registry-section.schema.json |
the data section's schema (generated) |
regmap/ |
how each field maps onto the game, per game build (Kiln's part: mods never read it) |
tools/registrygen/registrygen.py |
the generator; --check fails on stale output, lock and retire keep the ids |
regmap/views.json |
the advanced views' alias table: Kiln names kept across a game's renames, members a build removed (deltas only; views.md) |
managed/Kiln.Analyzers/src/Kiln.Analyzers/RegistryHints.g.cs |
registrygen's table of the old paths and game functions each registry field covers (KILN124, KILN125) |
Instance registries: what joinedClient means for the Gate's values
An instance registry ("kind": "instance", the Gate's live values: playerState, itemState, inventoryState, creatureState,
...) marks every field with joinedClient too. now: a joined client sees the value now, through what the game replicates
itself (an item's durability in its tooltip, a player's level) or through the Gate's client views (kiln:gate: the holds
and owners of keys in its interest set). serverOnly: the value acts on the server only and no client is sent it (an item's
power scale, which the game's tooltip does not show; a player's Kiln rules set through the Gate, whose client prediction
comes from Kiln.Rules' own messages). localOnly: a client-owned kind that stays on that client. unknown needs a reason.