Skip to content
hikari
RenderingEditorAIToolchainDocumentation
GitHub
hikari

© 2026 Flying Rat Studio.
All rights reserved.

Explore the engineDocumentationContributorsLicenseBack to top
Documentation / Systems
Browse docs
Overview
Tutorials16
OverviewFirst game projectFirst entityAuthored user_data and the inspectorFirst mesh and materialFirst physics body and triggerFirst character controllerFirst session servicesFirst UIFirst input actionFirst messagesPlay, Edit, and scenesFirst runtime spawnFirst motionFirst skeletal animationAssets in Play (soft refs and hot reload)Dynamic editor recompile
Guides16
OverviewDevelopment guideGameplay APIChoosing component storageBuild and packagingProject filePluginsHikari Plugin APIData-driven content, JSON, and pathsScripting with KawaShader authoringTime of dayUser interfaceUI layoutUI widgetsMigration from Unity / UnrealActor and component lifecycle
Systems28
OverviewArchitectureApplication lifecycleFrontends and driversPlatforms and supportSession services and cross-scene stateScenes and gameplayActor communication (hi.actors)Game-facing refsSave / replication wire versionCoordinate space and camera conventionsRenderingRenderer architecture mapFrame governorGPU particlesVisual ZonesVolumetric mediaInputAudioPhysicsMotion KitTemporal KitAssets and ShinraPrefabsAsset residencyAsset formats (Shinra pipeline)UI and editorEditor asset hot reloadEditor Project Selector
Language reference2
OverviewAkari language referenceKawa language reference
Engine overview
Start exploring
  • No matching sections. Try fewer words or another topic.
NavigateEnter Openesc Close
Overview
Tutorials16
OverviewFirst game projectFirst entityAuthored user_data and the inspectorFirst mesh and materialFirst physics body and triggerFirst character controllerFirst session servicesFirst UIFirst input actionFirst messagesPlay, Edit, and scenesFirst runtime spawnFirst motionFirst skeletal animationAssets in Play (soft refs and hot reload)Dynamic editor recompile
Guides16
OverviewDevelopment guideGameplay APIChoosing component storageBuild and packagingProject filePluginsHikari Plugin APIData-driven content, JSON, and pathsScripting with KawaShader authoringTime of dayUser interfaceUI layoutUI widgetsMigration from Unity / UnrealActor and component lifecycle
Systems28
OverviewArchitectureApplication lifecycleFrontends and driversPlatforms and supportSession services and cross-scene stateScenes and gameplayActor communication (hi.actors)Game-facing refsSave / replication wire versionCoordinate space and camera conventionsRenderingRenderer architecture mapFrame governorGPU particlesVisual ZonesVolumetric mediaInputAudioPhysicsMotion KitTemporal KitAssets and ShinraPrefabsAsset residencyAsset formats (Shinra pipeline)UI and editorEditor asset hot reloadEditor Project Selector
Language reference2
OverviewAkari language referenceKawa language reference
Engine overview
Systems2 min read

Temporal Kit

On this page
On this pageGoalNon-goalsWhere it sitsCore typesUsageSingle delay / cooldownMulti-step routine (Flow)Files Back to top

Shared time utilities for gameplay, session services, and host clocks. Implementation lives under src/hikari/sdk/src/temporal/. Exports: hi.temporal plus aliases hi.Timer / hi.Interval / hi.Cooldown / hi.Stopwatch / hi.Deadline / hi.Flow / hi.Timers / hi.nowNs / hi.wallTimeMs / hi.wallTimeSec / hi.wallTimeNs (and the *Io variants).

Goal

Delays, rate limits, intervals, multi-step routines, and clock helpers under hot-path constraints: plain values, no per-frame heap, poll edges — no callback graphs on the hot path.

Non-goals

  • Language async / stackful coroutines / yield keywords (Zig has no built-in suspended iterators; use pollable Flow / Timer instead).
  • Host-mediated scene-load waits (use world.sceneLoadSnapshot / readiness stages).
  • Calendar / timezone / wall-clock scheduling.
  • Replacing Motion Kit duration/delay fields on tweens.

Timer / Cooldown / Interval cover single delays and rate limits. Flow is the multi-step story: explicit phases on caller-owned state, short update steps, no hidden suspension or heap iterators. Coming from another engine's coroutine model? See Migration.

Where it sits

text
entity / GameSubsystem state
        │
        ▼
   temporal.*   (Timer, Interval, Cooldown, Flow, Stopwatch, Deadline, Timers bus)
        │
        └─► tick with TickContext.dt / total_time each frame

Wall/mono “now” lives in sdk/src/time.zig (nowNs, wallTimeMs / Sec / Ns, Io variants; backed by std.Io from the hikari_std module). Temporal re-exports those as hi.nowNs / hi.wallTimeMs / … and as hi.temporal.nowNs. Session sim dt stays session-owned Time — do not call Zig std.Io.Timestamp from product code.

Core types

TypeRole
TimerOne-shot countdown; after, tick, pulse (finish edge)
IntervalRepeating period; tick → fire count (catch-up)
CooldownRate limit; ready / trigger / tick
FlowMulti-step routine; wait / waitUntil / waitFrame / onEnter / advance
StopwatchAccumulator; start/pause/unpause
DeadlineAbsolute threshold vs total_time
TimersDense keyed one-shot bus

Usage

Single delay / cooldown

zig
door_timer: hi.Timer = .immediate(),
fire_cd: hi.Cooldown = .init(0.35),

pub fn update(self: *@This(), _: hi.EntityId, ctx: *const hi.TickContext) void {
    if (self.door_timer.pulse(ctx.dt)) { /* open */ }
    self.fire_cd.tick(ctx.dt);
    if (hi.world().actionPressed("fire") and self.fire_cd.trigger()) { /* shoot */ }
}

Multi-step routine (Flow)

zig
const Phase = enum(u32) { windup, sound, wait_player, open, _ };

flow: hi.Flow = .begin(),

pub fn update(self: *@This(), _: hi.EntityId, ctx: *const hi.TickContext) void {
    const f = &self.flow;
    if (!f.running()) return;

    _ = f.wait(@intFromEnum(Phase.windup), ctx.dt, 0.5);
    if (f.onEnter(@intFromEnum(Phase.sound))) {
        // play sound
        f.advance();
    }
    _ = f.waitUntil(@intFromEnum(Phase.wait_player), playerNear());
    if (f.onEnter(@intFromEnum(Phase.open))) {
        // open door
        f.stop();
    }
}

Keyed session delays: hi.Timers (after / tick / pulse / cancel).

Files

text
src/hikari/sdk/src/temporal/
  temporal.zig   barrel
  clock.zig      unit helpers
  timer.zig      Timer, Interval, Cooldown, Stopwatch, Deadline
  flow.zig       Flow
  bus.zig        Timers
PreviousMotion KitNext Assets and Shinra

Documentation follows the current engine checkout.

Snapshot cc148c75Source docs/systems/temporal-kit.md
On this pageGoalNon-goalsWhere it sitsCore typesUsageSingle delay / cooldownMulti-step routine (Flow)Files Back to top