Rust runtime for running Arcweave interactive stories.
Parses Arcweave's JSON export format and evaluates Arcscript — including variables, conditions, branching, and visit tracking — so you can drive Arcweave node trees from a Rust game engine.
use arcweave_rust::{Runtime, project::Project};
// Load a project exported from Arcweave
let project = Project::from_file("my_project.json")?;
let mut runtime = Runtime::new(&project);
// Render the current element's content
if let Some(content) = runtime.render_current_content()? {
// walk the Content tree and display it
}
// Render available options and let the player choose
let options = runtime.render_current_options()?;
// Follow a chosen connection
runtime.follow(&chosen_conn_ref)?;
// Save and restore state
let saved = runtime.save()?;
runtime.load(&saved)?;src/
├── lib.rs — Runtime, RuntimeState, RuntimeVariable, Content
├── project/ — Project deserialization (elements, connections, branches, variables, ...)
└── script/
├── mod.rs — Environment, expression evaluator
├── ast.rs — Arcscript AST types
└── parser.rs — nom-based ArcScript parser
tests/ — Arcweave project JSON files used in integration tests
Export your project from arcweave.com as JSON (File → Export → JSON), then load it with Project::from_file.
nom— ArcScript parserserde/serde_json— project deserialization and state serializationthiserror— error typeshtml-escape— decodes HTML entities in ArcScript strings from the JSON exportrand—random()androll()ArcScript functions
MIT or Apache-2.0