Kagari
Type to search documentation.

Visual novel engine

Analyzable stories, in a Rust-like language.

A Kagari story is written as pushdown fn code over finite data, so the compiler can answer questions a general-purpose script cannot.

day1.kix
#[scene]
#[entry]
pushdown fn Day1() -> Ending {
    s!(t!["The school festival starts today."]);
    StallA();
    StallA();
    Ending::Normal
}

#[scene]
pushdown fn StallA() {
    if VISITED_A {
        s!(t!["The stall is already packing up."]);
        return;
    }
    VISITED_A = true;
    s!(who = "Hanako", render = at_stall_a, t!["Welcome to stall A!"]);
}

Why Kagari

Analyzable stories

The compiler checks whether every step terminates, whether a choice can get stuck, which scenes are unreachable, and whether the screen at each step is consistent.

A Rust-like language

The story, its presentation and the game system are written in one language. Presentation (const fn) and the game system (fn) stay free to compute.

Complete tooling

Check, build and format with the kagari command, edit with the language server and the Zed extension, and play on the runtime for Windows, macOS and Linux.