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.
Visual novel engine
A Kagari story is written as pushdown fn code over finite data, so the compiler can answer questions a general-purpose script cannot.
#[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!"]);
}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.
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.
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.