{"id":16181309,"url":"https://github.com/kaosat-dev/bevy_mod_yarn","last_synced_at":"2025-10-13T06:18:42.826Z","repository":{"id":158463005,"uuid":"610521849","full_name":"kaosat-dev/bevy_mod_yarn","owner":"kaosat-dev","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-11T22:02:36.000Z","size":705,"stargazers_count":19,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T13:50:09.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaosat-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE_APACHE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-07T00:01:18.000Z","updated_at":"2025-01-03T01:54:16.000Z","dependencies_parsed_at":"2023-11-11T23:19:10.835Z","dependency_job_id":null,"html_url":"https://github.com/kaosat-dev/bevy_mod_yarn","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaosat-dev%2Fbevy_mod_yarn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaosat-dev%2Fbevy_mod_yarn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaosat-dev%2Fbevy_mod_yarn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaosat-dev%2Fbevy_mod_yarn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaosat-dev","download_url":"https://codeload.github.com/kaosat-dev/bevy_mod_yarn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243960361,"owners_count":20375102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T06:24:34.612Z","updated_at":"2025-10-13T06:18:37.807Z","avatar_url":"https://github.com/kaosat-dev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003e\n    Bevy_mod_yarn\n\u003c/h1\u003e\n\n\u003cimg src=\"./examples/bubbles/bubbles.gif\"  width=\"70%\" height=\"70%\"\u003e\n\u003c/div\u003e\n\nParser + interpreter/runner for the [YarnSpinner](https://github.com/YarnSpinnerTool/YarnSpinner) dialogue file format for the [Bevy Engine](https://github.com/bevyengine/bevy)\nIt allows you to create branching narrative / dialogues for games , ie , Rpgs, Visual novels, adventure games, etc in Bevy !\n\n\nThis project is still in the early stages, but it is already usable as it is for some basic Yarn scripts.\n\nSince I am using it myself and will be relying on it heavilly for some of my projects (yeah for dogfooding :) ), \nI am aiming to be able to parse \u0026 support as much of the Yarn Syntax as possible.\n\n## Usage\n\nHere's a minimal usage example:\n\n```toml\n# Cargo.toml\n[dependencies]\nbevy_mod_yarn = { git = \"https://github.com/kaosat-dev/bevy_mod_yarn\", branch = \"main\" }\n```\n\n```rust no_run\nuse bevy::prelude::*;\nuse bevy_mod_yarn::prelude::*;\n\nfn main() {\n    App::new()\n        .add_plugins(DefaultPlugins)\n        .add_plugin(YarnPlugin)\n        .init_resource::\u003cState\u003e() // only needed for manual loading\n\n        .add_startup_system(setup)\n        .add_system(dialogue_init)\n        .add_system(dialogue_navigation)\n        .run();\n}\n\n// only needed for manual loading, not when using tools like [bevy_asset_loader](https://github.com/NiklasEi/bevy_asset_loader)\n#[derive(Resource, Default)]\nstruct State {\n    handle: Handle\u003cYarnAsset\u003e,\n    done: bool\n}\n\nfn setup(\n    mut state: ResMut\u003cState\u003e, \n    asset_server: Res\u003cAssetServer\u003e, \n    mut commands: bevy::prelude::Commands\n) {\n    // load the yarn dialogue file\n    state.handle = asset_server.load(\"dialogues/single_node_simple.yarn\");\n}\n\nfn dialogue_init(mut state: ResMut\u003cState\u003e, dialogues: Res\u003cAssets\u003cYarnAsset\u003e\u003e, mut commands: bevy::prelude::Commands) {\n    if let Some(dialogues)= dialogues.get(\u0026state.handle) {\n        if !state.done {\n            commands.spawn(\n                DialogueRunner::new(dialogues.clone(), \"Start\")\n            );\n            state.done = true;\n        }\n    }\n}\n\nfn dialogue_navigation(\n    keys: Res\u003cInput\u003cKeyCode\u003e\u003e,\n    mut runners: Query\u003c\u0026mut DialogueRunner\u003e,\n) {\n    if let Ok(mut runner) = runners.get_single_mut() {\n        if keys.just_pressed(KeyCode::Return) {\n            runner.next_entry();\n        }\n        if keys.just_pressed(KeyCode::Down) {\n            runner.next_choice()\n        }\n        if keys.just_pressed(KeyCode::Up) {\n            runner.prev_choice()\n        }\n    }\n}\n\n```\nthis is taken from the 'basic' [example](./examples//basic/basic.rs)\n\nsee the examples below for more details , how to display your dialogues etc\n\n## Examples\n\nThis crate provides different examples for different features/ways to use within Bevy\n\n### [Basic](./examples/basic)\n\n- simplest possible usage\n\n    ![demo](./examples/basic/basic.png)\n\n    run it with \n    \n    ```cargo run --example basic```\n\n### [Commands](./examples/commands)\n\n- using `Yarn` commands with Bevy systems to play audio files during the dialogue flow\n\n    ![demo](./examples/basic/commands.png)\n\n    run it with \n    \n    ```cargo run --example commands```\n\n### [Portraits](./examples/portraits)\n\n- a barebones \"old school rpg dialogue with Character portraits\" ie changing character portraits based on who is talking in your dialogue\n\n    ![demo](./examples/portraits/portraits.gif)\n\n    run it with \n    \n    ```cargo run --example portraits```\n\n### [Bubbles](./examples/bubbles)\n\n- a barebones \"speech bubbles\" (ok, just text, but still :) over characters heads in 3D \n\n    ![demo](./examples/bubbles/bubbles.gif)\n\n    run it with \n    \n    ```cargo run --example bubbles```\n\n## Development status\n\n- [x] basic nodes parsing (header + body)\n- [x] dialogues: with or without character names\n- [x] choices/ options: blank line to close a list of choices\n- [x] choices/ options: nested/ indentation handling \n- [x] commands: basic parsing \u0026 handling\n- [x] tags parsing\n- [ ] tags available inside statements \n- [ ] expressions parsing\n- [ ] conditional expressions\n- [ ] dialogues: conditional branching with expressions\n- [ ] dialogues: interpolated values\n- [ ] dialogues: attributes\n\n\nI will put it on crates.io once I feel it is useable enough.\n\n## What this tool does:\n\n- provide a [parser](./src/parser/) (written with Nom). Not specific to Bevy, will likely be extracted into its own Crate down the line.\n- provide an [asset loader](./src/yarn_loader.rs) for Bevy\n- provide a [plugin](./src/lib.rs) for Bevy\n\n- some additional data structures and functions to deal with the Yarn Format inside bevy, in a minimalistic manner\n\n## What this tool does not:\n\n- provide complex UI or predefined ways to interact with the dialogues inside Bevy, for a few reasons\n    * Bevy's UI is still constantly evolving\n    * Other UI tools for Bevy are very promising, like [Belly](https://github.com/jkb0o/belly), [Kayak](https://github.com/StarArawn/kayak_ui) or [Egui](https://github.com/mvlabat/bevy_egui), they are not \"standard\" however\n    * everyone has their preferences\n- you will find some varied examples for use with Bevy to get you started \n\n## License\n\nDual-licensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](/LICENSE_APACHE) or https://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](/LICENSE_MIT) or https://opensource.org/licenses/MIT)\n\nat your option.\n\n\n## Compatible Bevy versions\n\nThe main branch is compatible with the latest Bevy release (0.10.1), while the branch `bevy_main` tries to track the `main` branch of Bevy (not started yet, PRs updating the tracked commit are welcome).\n\nCompatibility of `bevy_mod_yarn` versions:\n| `bevy_mod_yarn`     | `bevy` |\n| :--                 |  :--   |\n| `0.3`               | `0.12` |\n| `0.2`               | `0.11` |\n| `0.1`               | `0.10` |\n| `main`              | `latest` |\n| `bevy_main`         | `main` |\n\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n\n\n\n[bevy]: https://bevyengine.org/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaosat-dev%2Fbevy_mod_yarn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaosat-dev%2Fbevy_mod_yarn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaosat-dev%2Fbevy_mod_yarn/lists"}