# Bevy Dialogue System

Bevy 0.20 dialogue data: line tables in a resource, the current line index on a...

- Repository: https://github.com/thedivergentai/Game-Dev-Agentic-Skills (917 stars)
- Category: Writing
- License: LGPL-3.0
- Last updated: 2026-10-16
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-dialogue-system -g -a claude-code -y`
Codex: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-dialogue-system -g -a codex -y`
Cursor: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-dialogue-system -g -a cursor -y`
Gemini CLI: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-dialogue-system -g -a gemini-cli -y`

## Description

Bevy 0.20 dialogue data: line tables in a resource, the current line index on a component, and choice flags filtered before the write. Use when lines or choices advance. Keywords: Bevy, dialogue, line index, choices, ECS.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Bevy dialogue system

## When to use

Load this when lines, choices, or speaker ids advance. Rendering the line is bevy-ui-text.

## ECS shape

- **Components:** a line id and a speaker id that you define.
- **Resources:** run-wide tables live in a resource (bevy-data-resources), not an autoload.
- **Systems:** mutate those components on `Update` or the fixed timestep. Use `.chain()` when damage must land before death.
- **Messages:** one-shot facts (hit, pickup, quest advance) go through bevy-events-messaging. This file does not add a new event type name.

## Engine counterparts

| Godot idea | Bevy idiom |
| --- | --- |
| Line table | A resource of ids and strings. |
| Current line | A component that stores the line index. |
| Portrait | An image handle via bevy-asset-scenes. Layout is bevy-ui-layout. |

## Scope

Dialogue data is a resource of lines plus a component that stores the current line index. Rich text rendering belongs on bevy-ui-text.

```toml
[dependencies]
bevy = "0.20"
```

```rust
#[derive(Clone)]
struct LineDef {
    speaker: &'static str,
    text: &'static str,
    next: Option<usize>,
}

#[derive(Resource)]
struct DialogueTable {
    lines: Vec<LineDef>,
}

#[derive(Component)]
struct LineMark {
    index: usize,
    open: bool,
}

fn advance_line(
    keys: Res<ButtonInput<KeyCode>>,
    table: Res<DialogueTable>,
    mut marks: Query<&mut LineMark>,
) {
    if !keys.just_pressed(KeyCode::Space) {
        return;
    }
    for mut mark in &mut marks {
        if !mark.open {
            continue;
        }
        let Some(line) = table.lines.get(mark.index) else {
            mark.open = false;
            continue;
        };
        match line.next {
            Some(next) => mark.index = next,
            None => mark.open = false,
        }
    }
}

The rest: https://github.com/thedivergentai/Game-Dev-Agentic-Skills/blob/HEAD/skills/bevy-dialogue-system/SKILL.md
