Getting Started
import { Steps, Aside, Tabs, TabItem } from ‘@astrojs/starlight/components’;
Welcome to Kani Game Engine — a visual-novel runtime for Rust built on top of Bevy and driven by KAG scripts with embedded Rhai expressions.
Prerequisites
Section titled “Prerequisites”- Rust 1.80 or newer (install via rustup)
- Cargo (bundled with Rust)
- A Bevy-compatible platform (Windows, macOS, or Linux)
Installation
Section titled “Installation”-
Create a new Bevy project
Terminal window cargo new my-vncd my-vn -
Add
kani-runtimeto your dependenciesTerminal window cargo add kani-runtimecargo add bevyOr edit
Cargo.tomlmanually:[dependencies]bevy = "0.15"kani-runtime = "0.1" -
Write your entry scenario
Create
assets/scenario/first.ks:*start#NarratorWelcome to my visual novel!@lThe adventure begins here.@l@jump target=*start -
Wire up the plugin
Replace the contents of
src/main.rs:use bevy::prelude::*;use kani_runtime::{AssetBackend, KaniRuntimePlugin};use std::path::PathBuf;fn main() {App::new().add_plugins(DefaultPlugins).add_plugins(KaniRuntimePlugin {asset_backend: AssetBackend::FileSystem {base: PathBuf::from("assets"),},entry_script: "scenario/first.ks".into(),}).run();} -
Run
Terminal window cargo run
Project layout
Section titled “Project layout”my-vn/├── Cargo.toml├── src/│ └── main.rs└── assets/ ├── scenario/ │ └── first.ks ← entry script ├── bg/ ← background images ├── chara/ ← character sprites ├── bgm/ ← background music └── se/ ← sound effectsNext steps
Section titled “Next steps”- Read the KAG-Rhai Reference for every tag and expression.
- Set up your editor with the LSP server for syntax highlighting and hover docs.