Frostdev

KilnAPI reference Guide

The abilities registry

Every action the game plays as a timed sequence: spell casts, weapon attacks, abilities (the double jump, the dodge, blink), item uses and creature attacks. Their timing: when a cast releases what it spawns, when a hit lands, when the cost is paid and when a buff is applied, and how long the ability lasts; since 0.1.2 each of its events of these kinds by its place (hits[2].time), and what some of them do: an impulse's push, a hit's lifetime, a buff's duration, the costs an event pays itself or skips. Costs are otherwise the item's (items.manaCost, items.staminaCost); the game has no cooldown for players beyond this timing.

Schema version 0.1.3, experimental (KILNX031: may change in any release until it is marked stable). C# entry type Kiln.Registry.AbilityEntry. What registries are, the stages, the conflict rules and how ids are made: README.

Edits per call: 4,096. One OnRegistry callback (one phase of one entry point) or one Registries.Change takes at most this many edits of this registry; a call with more is refused whole, with the reason in kiln.log and registry.json, and nothing of it applies (the other calls do). The default for a registry whose schema declares none (4,096).

Ids

  • Game entries: game:<stable name>. Mod entries: <mod id>:<name>. All ids are lower case. The mod ids game and kiln are reserved: no mod's entries use them.
  • The stable name starts as the name of the ability's first part in lower case (Attack_Player_Staff_FixedAnim_Fireball_fast is game:attack_player_staff_fixedanim_fireball_fast). When two abilities would get the same name, the one that held it first keeps it and the other is game:~<first 8 hex digits of its GUID>.
  • Names: DisplayName (never empty; display names) is a name made from the ability's id (the name of its first part): the game has no name for players for an ability.

Fields

Applies: now = takes effect at the next use; worldLoad = takes effect when a world loads; restart = takes effect after a game restart. Ops: number = a value or the relative operations (mul, add, min, max, raiseOnly, lowerOnly); set = a value; list = clear, append, remove, replace; indexed = a list of fixed length, edited one element at a time (xpPerLevel[2]) with a value or a number operation. A field of a list's elements is named with [] in this table and with the element's index in an edit (entries[3].chance, or [*] for every element). Mapping: whether this Kiln maps the field onto the game; an unproven or unmapped field is refused per entry, with the reason, until a Kiln update maps it. Joined client: when a joined Kiln client consumes a server edit; see README.

Groups of fields:

  • timing: When the ability does things, in seconds from its start. Each field is the first such moment of the ability; every event of the same kind at that moment moves with it, and every other event stays where it is (later moments of that kind, the other kinds, animation events). The next time the ability plays takes the new time. An ability without such a moment refuses the edit; a time after the ability ends never comes.
  • impulses[].upright: The push turned with the character's facing but kept upright (y is always up), about how far it moves the character, in metres. Since 0.2.0-dev.32.2.
  • impulses[].oriented: The push turned with the character's whole orientation (or the direction the ability aims at), about how far it moves the character, in metres. Since 0.2.0-dev.32.2.
Field Type Applies Ops Since Mapping Joined client About
timing.release time s 0..9223372036 now number 0.1.0 mapped now When the ability releases what it spawns: a spell's projectile, a thrown item, a summon.
timing.hit time s 0..9223372036 now number 0.1.0 mapped now When the ability's first hit or area effect starts (a weapon swing's hit, a slam's area).
timing.cost time s 0..9223372036 now number 0.1.0 mapped now When the ability pays its cost (mana, stamina, a charge of the item).
timing.buff time s 0..9223372036 now number 0.1.0 mapped now When the ability applies its first buff.
timing.sound time s 0..9223372036 now number 0.1.1 mapped now When the ability's first sound plays (a cast's whoosh, a swing's sound).
timing.effect time s 0..9223372036 now number 0.1.1 mapped now When the ability's first visual effect plays (a cast's flash at the hand). Only clients show it: a dedicated server has no use of it, Kiln clients take the server's value, a vanilla client keeps the game's.
timing.shake time s 0..9223372036 now number 0.1.1 mapped now When the ability first shakes the camera.
timing.noise time s 0..9223372036 now number 0.1.1 mapped now When the ability first makes a noise creatures can hear (a cast's or a swing's noise that draws enemies).
length time s 0..9223372036 now number 0.1.1 mapped now How long the ability plays, in seconds from its start: when it ends, the character can act again (as far as the ability's own timing has not let it act earlier). The next time the ability plays takes the new length; one already playing keeps the end it started with. A moment set after the new end never comes. A looping ability or one kept going by its input (a held bow or staff) ends by its own rules, not at its length.
releases list of entries, at most 4096 now list 0.1.2 mapped now The ability's releases (what it spawns: a projectile, a thrown item, a summon) in the game's order: index i in a field path (releases[1].time) is the i-th release, and releases[0] is the first. The ability keeps its events: only their values change (none is added, removed or reordered by an index). Since 0.2.0-dev.32.2.
releases[].time time s 0..9223372036 now number 0.1.2 mapped now When this event happens, in seconds from the ability's start. An edit moves this event alone; when timing.release is edited too, an event with a time of its own keeps it and timing.release moves the others of its moment. A time after the ability ends never comes.
hits list of entries, at most 4096 now list 0.1.2 mapped now The ability's hits and area effects in the game's order: index i in a field path (hits[1].time) is the i-th hit, and hits[0] is the first. The ability keeps its events: only their values change (none is added, removed or reordered by an index). Since 0.2.0-dev.32.2.
hits[].time time s 0..9223372036 now number 0.1.2 mapped now When this event happens, in seconds from the ability's start. An edit moves this event alone; when timing.hit is edited too, an event with a time of its own keeps it and timing.hit moves the others of its moment. A time after the ability ends never comes.
hits[].duration time s 0..9223372036 now number 0.1.2 mapped now How long the impact this hit spawns lives, in seconds (a swing's hit volume, a slam's area); 0: its impact's own lifetime (impacts.lifetime). The next spawn takes an edit; an impact already in the world keeps its own.
costs list of entries, at most 4096 now list 0.1.2 mapped now The ability's payments of its cost in the game's order: index i in a field path (costs[1].time) is the i-th payment, and costs[0] is the first. The ability keeps its events: only their values change (none is added, removed or reordered by an index). Since 0.2.0-dev.32.2.
costs[].time time s 0..9223372036 now number 0.1.2 mapped now When this event happens, in seconds from the ability's start. An edit moves this event alone; when timing.cost is edited too, an event with a time of its own keeps it and timing.cost moves the others of its moment. A time after the ability ends never comes.
costs[].ignore flags (stamina, mana, fuel, fuelCharges, specialAbility) now set 0.1.2 mapped now The costs this event does not pay, whatever its item's or its own configs say (an ability that skips its mana: ["mana"]). Read at each payment. Since 0.2.0-dev.32.2.
costs[].stamina int -2147483648..2147483647 now number 0.1.2 mapped now The stamina this event pays of its own, which replaces its item's stamina cost (a negative cost gives it back). Only an event that carries such a cost of its own has one (the glider's updraft skill: mana 100); another reads null and refuses an edit, and pays its item's (items.manaCost, items.staminaCost).
costs[].mana int -2147483648..2147483647 now number 0.1.2 mapped now The mana this event pays of its own, which replaces its item's mana cost (a negative cost gives it back). Only an event that carries such a cost of its own has one (the glider's updraft skill: mana 100); another reads null and refuses an edit, and pays its item's (items.manaCost, items.staminaCost).
costs[].fuel int -2147483648..2147483647 now number 0.1.2 mapped now The fuel (a burner's or a lamp's) this event pays of its own, which replaces its item's fuel (a burner's or a lamp's) cost (a negative cost gives it back). Only an event that carries such a cost of its own has one (the glider's updraft skill: mana 100); another reads null and refuses an edit, and pays its item's (items.manaCost, items.staminaCost).
costs[].fuelCharges int -2147483648..2147483647 now number 0.1.2 mapped now The fuel charges (times the item's charge factor) this event pays of its own, which replaces its item's fuel charges (times the item's charge factor) cost (a negative cost gives it back). Only an event that carries such a cost of its own has one (the glider's updraft skill: mana 100); another reads null and refuses an edit, and pays its item's (items.manaCost, items.staminaCost).
costs[].specialAbility int -2147483648..2147483647 now number 0.1.2 mapped now The special ability charge this event pays of its own, which replaces its item's special ability charge cost (a negative cost gives it back). Only an event that carries such a cost of its own has one (the glider's updraft skill: mana 100); another reads null and refuses an edit, and pays its item's (items.manaCost, items.staminaCost).
buffs list of entries, at most 4096 now list 0.1.2 mapped now The ability's buff applications (a food's, a potion's, an ability's buff on its user) in the game's order: index i in a field path (buffs[1].time) is the i-th buff application, and buffs[0] is the first. The ability keeps its events: only their values change (none is added, removed or reordered by an index). Since 0.2.0-dev.32.2.
buffs[].time time s 0..9223372036 now number 0.1.2 mapped now When this event happens, in seconds from the ability's start. An edit moves this event alone; when timing.buff is edited too, an event with a time of its own keeps it and timing.buff moves the others of its moment. A time after the ability ends never comes.
buffs[].duration time s 0..9223372036 now number 0.1.2 mapped now How long the buff this event applies lasts, in seconds: the event's own time, which replaces the buff's (buffs.duration) and its item's; 0: theirs. Only an event that carries a time of its own has one (67 of the game's 119); another reads null and refuses an edit. The next application takes an edit; a buff already running keeps its end.
sounds list of entries, at most 4096 now list 0.1.2 mapped now The ability's sounds in the game's order: index i in a field path (sounds[1].time) is the i-th sound, and sounds[0] is the first. The ability keeps its events: only their values change (none is added, removed or reordered by an index). Since 0.2.0-dev.32.2.
sounds[].time time s 0..9223372036 now number 0.1.2 mapped now When this event happens, in seconds from the ability's start. An edit moves this event alone; when timing.sound is edited too, an event with a time of its own keeps it and timing.sound moves the others of its moment. A time after the ability ends never comes.
effects list of entries, at most 4096 now list 0.1.2 mapped now The ability's visual effects (only clients show them) in the game's order: index i in a field path (effects[1].time) is the i-th visual effect, and effects[0] is the first. The ability keeps its events: only their values change (none is added, removed or reordered by an index). Since 0.2.0-dev.32.2.
effects[].time time s 0..9223372036 now number 0.1.2 mapped now When this event happens, in seconds from the ability's start. An edit moves this event alone; when timing.effect is edited too, an event with a time of its own keeps it and timing.effect moves the others of its moment. A time after the ability ends never comes.
shakes list of entries, at most 4096 now list 0.1.2 mapped now The ability's camera shakes in the game's order: index i in a field path (shakes[1].time) is the i-th camera shake, and shakes[0] is the first. The ability keeps its events: only their values change (none is added, removed or reordered by an index). Since 0.2.0-dev.32.2.
shakes[].time time s 0..9223372036 now number 0.1.2 mapped now When this event happens, in seconds from the ability's start. An edit moves this event alone; when timing.shake is edited too, an event with a time of its own keeps it and timing.shake moves the others of its moment. A time after the ability ends never comes.
noises list of entries, at most 4096 now list 0.1.2 mapped now The ability's noises creatures can hear in the game's order: index i in a field path (noises[1].time) is the i-th noise, and noises[0] is the first. The ability keeps its events: only their values change (none is added, removed or reordered by an index). Since 0.2.0-dev.32.2.
noises[].time time s 0..9223372036 now number 0.1.2 mapped now When this event happens, in seconds from the ability's start. An edit moves this event alone; when timing.noise is edited too, an event with a time of its own keeps it and timing.noise moves the others of its moment. A time after the ability ends never comes.
impulses list of entries, at most 4096 now list 0.1.2 mapped now The ability's impulses (pushes that move the character itself: a lunge, a jump attack's leap, the glider's updraft) in the game's order: index i in a field path (impulses[1].time) is the i-th impulse, and impulses[0] is the first. The ability keeps its events: only their values change (none is added, removed or reordered by an index). A character holds at most four impulses at once: one started while four run is dropped (the game's own limit). Since 0.2.0-dev.32.2.
impulses[].time time s 0..9223372036 now number 0.1.2 mapped now When this impulse starts, in seconds from the ability's start. A time after the ability ends never comes.
impulses[].duration time s 0..9223372036 now number 0.1.2 mapped now How long the push lasts, in seconds (at least 0.01 s, whatever is set): the game spreads the push over it as a speed.
impulses[].upright.x float m -3.4028234663852886e+38..3.4028234663852886e+38 now number 0.1.2 mapped now Its x part, in metres (sideways).
impulses[].upright.y float m -3.4028234663852886e+38..3.4028234663852886e+38 now number 0.1.2 mapped now Its y part, in metres (up).
impulses[].upright.z float m -3.4028234663852886e+38..3.4028234663852886e+38 now number 0.1.2 mapped now Its z part, in metres (forward).
impulses[].oriented.x float m -3.4028234663852886e+38..3.4028234663852886e+38 now number 0.1.2 mapped now Its x part, in metres (sideways).
impulses[].oriented.y float m -3.4028234663852886e+38..3.4028234663852886e+38 now number 0.1.2 mapped now Its y part, in metres (up).
impulses[].oriented.z float m -3.4028234663852886e+38..3.4028234663852886e+38 now number 0.1.2 mapped now Its z part, in metres (forward).

Entries

  • Add (stage add, id <your mod id>:<name>): yes. GameStart only. A copy of a game ability's timed sequence under the mod's id (kiln.gamedata's sequence clones); the fields given are the entry's own. Sequence clones a mod makes through kiln.gamedata or an ability block are entries of their mod too.
  • Add requires GameStart and an explicit present Kiln like id; clone chains end at a game entry. Kiln retains the stable identity and pins the structural base install-wide. Use a new id for an incompatible base.
  • Remove: no. Abilities are never removed: items and creatures play them by their sequences.
  • Raw game paths in edits (the Advanced tier): refused.

Edit it from a data pack

abilities is kiln.gamedata's sequence data under Kiln names: every action the game plays as a timed sequence. An id is the name of the ability's first part in lower case (game:attack_player_staff_fixedanim_fireball_fast is Fireball I's quick cast). Times are seconds from the ability's start. The existing fields name the first moments of each kind:

Field The moment
timing.release the ability releases what it spawns (a projectile, a thrown item, a summon)
timing.hit its first hit or area effect starts
timing.cost it pays its cost (mana, stamina, a charge)
timing.buff it applies its first buff
timing.sound its first sound plays (a cast's whoosh, a swing's sound; abilities 0.1.1)
timing.effect its first visual effect plays (a cast's flash at the hand; only clients show it; abilities 0.1.1)
timing.shake it first shakes the camera (abilities 0.1.1)
timing.noise it first makes a noise creatures can hear, which draws enemies (abilities 0.1.1)

length (abilities 0.1.1) is how long the ability plays, in seconds: the next playback takes a change (one already playing keeps its end), and a moment after the new end never comes. Since abilities 0.1.3 (0.2.0-dev.32.2) timing.* and length take any duration the game's time type holds, 0 to 9223372036 seconds, as the event lists' times do (they were 0..600 seconds); a negative time is refused.

  • "field": "timing.release", "op": 0.45, or {"mul": 0.8}. Each field is the first such moment: every event of the same kind at that moment moves with it, except events with their own list time edit (below). Every other event stays: later moments of that kind, other kinds and animation events.
  • An ability that has no such moment refuses the edit; a time after the ability ends never comes.
  • Costs normally come from the item (items.manaCost, items.staminaCost); an event's own cost replaces that item's cost for that kind, and an ignore flag skips it altogether. The game has no cooldown for players beyond this timing.
  • No raw paths and no entry remove. Entry add (0.2.0-dev.32, GameStart only): {"registry": "abilities", "entry": "add", "id": "<mod>:<name>", "like": "game:<ability>"} (C# Abilities.AddLike) is a kiln.gamedata sequence clone of the like ability; the fields given are its own. A sequence clone a mod makes through kiln.gamedata or an ability block is an entry of its mod too (<mod>:<its name without "<mod>.">), listed in registry.json's added, and other mods' edits reach it. The old sequences data-pack section (the game's own paths) keeps working; a registry edit is the later layer and wins (reported).

Later events and what each does

Since 0.2.0-dev.32.2 (abilities 0.1.2), events of each kind are a list: releases, hits, costs, buffs, sounds, effects, shakes, noises, impulses. Index 0 is the first event of that kind in the game's original order, not the first event of any kind and not its position after a time edit. hits[2].time is the third hit, even after another hit moves. hits[*].duration edits every existing hit's duration. Events have no registry ids of their own.

List Fields of each event
releases time: when it spawns its projectile, thrown item or summon
hits time; duration: the spawned hit or area's lifetime (0 uses the impact's own impacts.lifetime)
costs time; ignore: a set of cost kinds to skip; stamina, mana, fuel, fuelCharges, specialAbility: its own costs
buffs time; duration: this application's own buff duration (0 uses the buff's or item's duration)
sounds, effects, shakes, noises time: when that event happens
impulses time; duration; upright.x, .y, .z; oriented.x, .y, .z

These lists keep the ability's existing events: adding, removing or changing membership is refused, including Clear and AppendNew through the generic C# list API. Use an indexed leaf or wildcard leaf edit, not a whole-list replacement that also touches optional values you did not mean to change. A whole element or list may leave out (or null) a cost or buff duration an event does not carry; giving one a value is refused.

An impulse moves the character itself (a lunge, a leap, the glider's updraft). Its vectors are approximately the push distance in metres: upright follows the character's facing with y always up; oriented follows its whole orientation or the ability's aim. The game spreads the push over duration, using at least 0.01 seconds whatever is set.

costs[i].ignore takes any of "stamina", "mana", "fuel", "fuelCharges", "specialAbility", for example "op": ["mana"]. An event's own cost is instead of, not added to, the item's cost of that kind; a negative cost gives it back. Only an event already carrying an own cost or buff duration has that value: another reads null in the registry's generic view and refuses a write to it. A write cannot create a missing config. For example, the glider's updraft skill carries its own mana cost of 100; most cost events carry none and use the item instead.

Mixing an event time with a first moment

A list time edit takes that event out of the matching timing.* moment, including when another mod made the list edit. releases[0].time claims only that release; releases[*].time claims every release. A whole-element edit claims that element's time, and a whole-list edit claims all its times. Editing only costs[0].ignore, a duration or an impulse vector does not claim the event's time. A list edit Kiln refuses (one that adds or removes events, or gives an event a cost or buff duration it does not carry) claims nothing.

timing.release then moves only the unclaimed releases at the original first release moment; it never jumps to a later moment. Its read and relative operations use the first remaining event's time below the registry layer. If list edits claim every event of the moment, the timing edit waits: it is not refused and stays applied, but writes nothing, reads null, and registry.json says why (every event of this moment is set by a list edit (<mod>)). As soon as a claim ends (the list edit is reverted or removed, or its mod unloads), the timing edit applies again in the same world, with no restart. The same rule applies to hit, cost, buff, sound, effect, shake and noise moments. For example, with two releases originally at 0.65 s, setting releases[0].time to 0.5 s and timing.release to 0.45 s leaves the first at 0.5 s and moves the second to 0.45 s, whichever mod is applied first. That example crosses their order; see the multiplayer limitation below.

Edit it from C#

Kiln.Registry.Registries.For(context).Alter(stage =>
{
    var cast = stage.Abilities["game:attack_player_staff_fixedanim_fireball_fast"];
    cast.Timing.Release = TimeSpan.FromSeconds(0.45);      // the projectile leaves earlier...
    cast.Timing.Cost = TimeSpan.FromSeconds(0.45);         // ...and the mana is paid at the same moment
    if (cast.Releases.Count > 1)                         // an ability with a second release
        cast.Releases[1].Time = TimeSpan.FromSeconds(0.8);

    var updraft = stage.Abilities["game:movement_tool_hangglider_updraft_skill"];
    if (updraft.Impulses.Count > 0)
    {
        updraft.Impulses[0].Upright.Y = 30.0;             // a stronger upward push, in metres
        updraft.Impulses[0].Duration = TimeSpan.FromSeconds(2.25);
    }
    if (updraft.Costs.Count > 0)
        updraft.Costs[0].Ignore = Kiln.Registry.RegistryAbilityCostKinds.Mana;
});

stage.Abilities is a RegistryEntries<AbilityEntry>. Timing has Release, Hit, Cost, Buff, Sound, Effect, Shake, Noise; Length and all event times and durations are TimeSpans. The event lists are typed RegistryEntryList<T>s: Impulses[i].Upright.Y is a double, Costs[i].Ignore is RegistryAbilityCostKinds, and the own cost amounts are ints. The existing SpellRegistry sample shows the first-moment API.

Views

RegistryViews.Find("abilities") is the stable view; the buff an ability applies is the buffs registry's (views.md). AbilityEntry already has DisplayName and DisplayNameSource; the event and vector wrappers are indexed values, not new game things with names.

Worked example

Fireball I releases its projectile at 0.45 s instead of 0.65 s and pays its mana at the same moment:

{
  "format": 1,
  "registry": {
    "alter": [
      { "registry": "abilities", "select": { "id": "game:attack_player_staff_fixedanim_fireball_fast" }, "field": "timing.release", "op": 0.45 },
      { "registry": "abilities", "select": { "id": "game:attack_player_staff_fixedanim_fireball_fast" }, "field": "timing.cost", "op": 0.45 }
    ]
  }
}

This is mods/samples/SpellRegistry's pack (SpellTweaks moves each event by its kiln.gamedata path instead).

An indexed edit changes the glider updraft's first upward impulse, and lowers the mana cost the event already carries (unlike ignore in the C# example, this still pays mana):

{
  "format": 1,
  "registry": {
    "alter": [
      { "registry": "abilities", "select": { "id": "game:movement_tool_hangglider_updraft_skill" }, "field": "impulses[0].upright.y", "op": 30.0 },
      { "registry": "abilities", "select": { "id": "game:movement_tool_hangglider_updraft_skill" }, "field": "costs[0].mana", "op": 50 }
    ]
  }
}

In multiplayer

The server uses its edited ability values when it spawns, hits, pays, applies buffs and makes noise (its sound and camera shake moments it takes at the new time too; what a dedicated server does with them is not traced). A Kiln client gets the new values through the content sync and uses them on its next playback. A vanilla client keeps its own values for its animation, effects, local movement and cost prediction. Visual effects are clients' alone: a dedicated server never reads them, so only Kiln clients show an edited effects[i].time or timing.effect on one.

P65, order crossing: a time moved past another event of the same kind in that ability is not sent. This includes an indexed event moving earlier past its predecessor, or later past its successor, as well as a timing.* edit. The server still acts at the new time, but Kiln clients keep the old time for that slot: sending it by its now-different index could change the wrong event. Moves that keep the same-kind order are sent. The registry's indices remain the original ones on the server; that stable addressing does not remove this sync limitation.

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). A pack of these ability edits is clients: kiln for matching values and prediction (choosing clients); vanilla clients do not receive the content layer.

Known limits

  • Only the sequence's first part is exposed, as before. Animation event kinds are not fields of this registry.
  • Lists cannot create or remove events, and absent own costs or buff durations cannot be created by a write.
  • Hit-event config maps are not mapped here: raw maps inside list elements are not supported yet. hits[i].duration is the hit's lifetime, not access to its damage configs.
  • The character holds at most four impulses at once. A fifth started while all four run is dropped by the game; this is not a four-event limit on the ability's list.
  • Moving a time across another event of its kind does not sync that time (P65 above); vanilla clients keep their own values.
  • Not yet verified in a real game client: later-event edits, the timing/list overlap, impulse pushes and durations, event costs and buff duration overrides, and their behaviour on a joined client and against the animation.

Enshrouded is a trademark of Keen Games GmbH. Kiln is unofficial.