--- name: bevy-genre-visual-novel description: "Thin Bevy genre router for Visual novel. Keywords: Bevy, Visual novel, genre, ECS, router." --- # Bevy Visual novel (thin router) Genre router. Domain work lives in the Bevy skills below. ## When to use Load this for dialogue, portraits, and choice flags. ## ECS shape - **Components** hold the genre's per-entity flags as plain data. This file does not name new engine types. - **Resources** hold run-wide counters (score, wave index, seed) via bevy-data-resources. - **Systems** read those components on `Update` or the fixed timestep from bevy-master. Order them with `.chain()` when a later system must see the result. - **Schedule:** gameplay mode changes go through bevy-state-machines. Do not invent a genre plugin. ## Routing - [bevy-dialogue-system](https://github.com/thedivergentai/Game-Dev-Agentic-Skills/blob/main/skills/bevy-dialogue-system/SKILL.md) - Lines. - [bevy-ui-text](https://github.com/thedivergentai/Game-Dev-Agentic-Skills/blob/main/skills/bevy-ui-text/SKILL.md) - Body text. - [bevy-ui-layout](https://github.com/thedivergentai/Game-Dev-Agentic-Skills/blob/main/skills/bevy-ui-layout/SKILL.md) - Choice buttons. - [bevy-save-load](https://github.com/thedivergentai/Game-Dev-Agentic-Skills/blob/main/skills/bevy-save-load/SKILL.md) - Route flags. ## Scope Lines, the visible character index, and route flags are resources. Choice rows are entities. A full script parser stays data you load into those resources. ## Examples ```toml [package] name = "visual-novel" version = "0.1.0" edition = "2021" [dependencies] bevy = "0.20" ``` One resource owns the script index and the flags later scenes read. ```rust #[derive(Clone)] struct Line { speaker: String, body: String, } #[derive(Resource)] struct Script { lines: Vec, index: usize, flags: Vec, } fn current_line(script: &Script) -> Option<&Line> { script.lines.get(script.index) } fn advance(script: &mut Script) { if script.index + 1 < script.lines.len() { script.index += 1; } } fn set_flag(script: &mut Script, flag: &str) { if !script.flags.iter().any(|f| f == flag) { script.flags.push(flag.to_string()); } } ``` Space advances. Number keys pick a choice and write its flag. ```rust #[derive(Component)] struct Choice { key: KeyCode, flag: String, next_index: usize, } #[derive(Clone)] struct Line { speaker: String, body: String, } #[derive(Resource)] struct Script { lines: Vec, index: usize, flags: Vec, } fn advance(script: &mut Script) { if script.index + 1 < script.lines.len() { script.index += 1; } } fn set_flag(script: &mut Script, flag: &str) { if !script.flags.iter().any(|f| f == flag) { script.flags.push(flag.to_string()); } } fn read_advance(keys: Res>, mut script: ResMut