Frostdev

KilnAPI reference Guide

The intro registry

The timing of the start-up logos and the main menu's fade-in on this player's game, in seconds. Client-authored: each player's own game applies it after a restart; it is never sent to a server or compared when a player joins. The logos play right after the game starts: whether Kiln's values are in place before the first logo shows is not known yet. Not checked in a real game yet. Since 0.2.0-dev.32.2.

Schema version 0.1.0, experimental (KILNX031: may change in any release until it is marked stable). C# entry type Kiln.Registry.IntroEntry. 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:intro. Mod entries: (none: one entry). All ids are lower case. The mod ids game and kiln are reserved: no mod's entries use them.
  • One entry, game:intro: the start-up sequence's timing on this player's game.
  • Names: DisplayName (never empty; display names) is the registry's name as words ("Intro"): its one entry is no game thing with a name of its own.

Fields

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

Field Type Applies Ops Since Mapping Joined client About
logoFade time s -9223372036.854776..9223372036.854776 restart number 0.1.0 mapped localOnly How long each start-up logo takes to fade in and out, in seconds (1.6 on this build). Since 0.2.0-dev.32.2. Read by game clients only.
logoHold time s -9223372036.854776..9223372036.854776 restart number 0.1.0 mapped localOnly How long each start-up logo stays on screen between its fades, in seconds (1.5 on this build). Since 0.2.0-dev.32.2. Read by game clients only.
afterLogos time s -9223372036.854776..9223372036.854776 restart number 0.1.0 mapped localOnly The pause after the last logo before the main menu, in seconds (0.6 on this build). Since 0.2.0-dev.32.2. Read by game clients only.
menuFade time s -9223372036.854776..9223372036.854776 restart number 0.1.0 mapped localOnly How long the main menu takes to fade in, in seconds (1.75 on this build). Since 0.2.0-dev.32.2. Read by game clients only.

Entries

  • Add (stage add, id <your mod id>:<name>): no. The game has one start-up sequence: a mod changes its timing, it cannot add another.
  • Remove: no. The game plays its start-up sequence at every start: it cannot be removed.
  • Raw game paths in edits (the Advanced tier): allowed.

Edit it from a data pack

This registry has one entry, game:intro: the timing of the start-up logos and the main menu's fade-in on the player's own game, in seconds. Its display name is Intro.

  • logoFade: how long each start-up logo takes to fade in and out (1.6 on this build).
  • logoHold: how long each logo stays on screen between its fades (1.5).
  • afterLogos: the pause after the last logo before the main menu (0.6).
  • menuFade: how long the main menu takes to fade in (1.75).

"field": "logoHold", "op": 0.2 shows each logo for a fifth of a second; "op": {"mul": 0.5} halves a time. Times are seconds in JSON (the game keeps nanoseconds); the range is the storage's full range, Kiln adds no limits of its own. Every field applies after a restart of the player's game, and only from GameStart.

Edit it from C#

[RegistryEntryPoints(RegistryEntryPoint.GameStart)]
public sealed class QuickStart : Mod
{
    public override void OnRegistry(RegistryContext context)
    {
        if (!Kiln.Registry.Registries.Available) return;
        Kiln.Registry.Registries.For(context).Alter(stage =>
        {
            var intro = stage.Intro;
            intro.LogoFade = TimeSpan.FromSeconds(0.25);
            intro.LogoHold = TimeSpan.FromSeconds(0.2);
            intro.AfterLogos = TimeSpan.Zero;
            intro.MenuFade = TimeSpan.FromSeconds(0.5);
        });
    }
}

RegistryStage.Intro is the one IntroEntry; each time is a TimeSpan. On a dedicated server the stage skips these edits with an informational line (client-only field: it applies on each player's own game): a server shows no intro.

Views

RegistryViews.Find("intro") is the stable view of the one entry and the times the stage composed on this player's game.

Worked example

A quicker start: short logos, no pause, a quick menu fade:

{
  "format": 1,
  "registry": {
    "alter": [
      { "registry": "intro", "select": "game:intro", "field": "logoFade", "op": 0.25 },
      { "registry": "intro", "select": "game:intro", "field": "logoHold", "op": 0.2 },
      { "registry": "intro", "select": "game:intro", "field": "afterLogos", "op": 0 },
      { "registry": "intro", "select": "game:intro", "field": "menuFade", "op": 0.5 }
    ]
  }
}

A pack of these edits alone is a look each player chooses for their own game: give it "side": "client". The server needs nothing.

In multiplayer

The values are client-authored: each player's game composes its own timing from the mods it has, at its own start. They are never sent to a server, never received from one and never compared when a player joins (joinedClient: localOnly; they are not part of the join's registry values). In a mod that runs on both sides ("side": "both"), the dedicated server skips these edits (an informational line in kiln.log and registry.json skipped, never a refusal) and applies its shared ones.

Known limits

  • The logos play right after the game starts. Whether Kiln's values are in place before the first logo shows is not checked in a real game yet: Kiln writes them when the game's data is ready, and the start-up sequence may already be reading the game's own by then.
  • Not seen in a real game: the native tests write each time into a copy of the game's data with Kiln's real boot writer (seconds in, nanoseconds in the copy), and Kiln's offline client proof, run with the release, reads, writes and reverts each one on a copy of the client's own data.
  • The logos themselves (their images, sounds and colours) are not in this registry.

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