Storytelling Engine (STEngine?)
Yeah, I don’t have a better name. Yet.
This is the preliminary outline for a Rust / Bevy based, data-driven ‘engine’ which I hope will be suitable for handling basic visual novel stuff, but also be flexible enough to serve a wide variety of purposes and games, hypothetically even complex CRPG dialog trees and dynamic open world exploration type things.
My thesis right now is that writing the engine will be relatively easy (i.e. there will be no Hard or Cursed1 problems, but not that it’s going to be done in an afternoon), but making an editor which would be easy to learn, pleasant to use, and also sufficiently fool-proof will be the harder part.
Current progress (end of October 2026)
Prototype under construction, nothing demo-able yet.
Demo ETA early September - basic VN text display, sprites, and story branching.
No ETA for editor, file format, import tools from other platforms. Might get an early open source release around end of September 2026 (no editor etc).
Design goals - beginning (prototype Q3/2026)
My goals when I started this are to fit my purpose only, but to be flexible enough in design/architecture to be worth upgrading and making universal enough.
- no scripting engine required to make branching, conditional player choices or NPC text, etc
- no DSL required for that either
- no custom scripting language ever
- avoid writing BRE as long as possible (failed)
- Rust, Bevy native, data-driven
- tremendous performance, no runtime reflection other than what Bevy is doing already
- offer a default dialogue runner GUI, even if an ugly one (perhaps egui at first)
- avoid messy string key-value storage for story variables as much as possible
- coding custom game features with normal Bevy code is good and expected (e.g. custom in-game reward for a story dialog option that’s not just a flag/variable)
- support for Conditions and Consequences, e.g.
- hide this dialogue option when energy is low
- grey out this dialogue option when strength < 6
- ask this question and get an answer only for the first time
- show different question and answer every other time
- allow for random-pool answers
- misc Consequence features I want to have
- straightforward dialogue
- sound cue and music change
- sprite animation (“john doe bustup enter screen left”)
- allow for Tracery format sentences
- everything relevant has custom IDs
- mapping domain IDs to Entity id with secondary index
- no storage format at first; Rust only, always-recompile is fine for now
- compile time correctness if possible
- make sure design allows for procedurally added story elements
Not in scope (yet):
- fully featured GUI for everything
- pretty design
- voice narration, lip-syncing, progressive text typing
- easy CRPG dialog trees, although technically possible
- scripting
- articy, renpy, yarn spinner, twine import/export of any kind
- correctness checks for story itself à la https://www.yarnspinner.dev/storysolver
Type of games that should be doable within the first 2 months of development:
- VNs with branching narrative
- Stardew Valley type games with a bit richer integration into the game (date, time, relationship, house status or idk)
Design goals - hypothetical mature stage (2 years of work)
- provides stock egui or bevy_ui implementation, but fully replaceable
- reasonably easily pluggable into any Bevy game
- stable and reliable save format for the whole story
- track discarded IDs so that deleting and adding a character, and then loading a game doesn’t corrupt data
- stable and reliable save format for the game state
- 90% feature parity with Ren’Py and Yarn Spinner
- compatibility or one-way migration tools from Ren’Py and Yarn Spinner
- incremental sync with Articy exports (i.e. adding/removing/renaming characters won’t break everything)
- hot reload option in debug builds
- allow for different pre-defined modalities - DnD, SPECIAL, Scarlet Hollow (Copyright allowing!)
- have a running, fun, non-theoretical, non-trivial example of procgen dynamic storytelling
- i.e. a game prototype where player actions can spawn dynamic story elements that might be a little silly and formulaic, but are still better than whatever Skyrim 18th re-release is doing these days
- no LLMs anywhere in the process
- implement branched quest lines
- synthetic benchmark performance:
- 1000 chapters, 10k characters, 100k story beats,
- 1M story elements, 5M conditions and 5M consequences
- 20M story variables (mix of global and per chapter and per character)
- response time for any given story element <1ms
Type of games that should be doable with this engine
- any not-fully-detailed-3D CRPG
- complex, long dialog trees
- yes: baldur’s gate 2, not yet: baldur’s gate 3
- even Disco Elysium, Fallout
- dialogue based on items / equipment
- dialogue based on past actions / traits (child killer)
- dialogue based on stats
- dialogue based on quest status/progress / past quest completion
- maybe except Disco’s Red Checks, might not be a default feature
- Scarlet Hollow
Types of games that will be possible only later, with more work and thought
- JRPG/CRPG with 3D elements, because a lot of work:
- switching, animating cameras (authoring! editor???)
- character animations
- dynamic animations like “X turns head to Y”
- lip-syncing
- skipping sentences but keeping animation consistent / idempotent state
- different lip-syncing for different languages? I don’t even know
Design goals - open source (2-3 years of work)
- Ideally would have a WASM editor which would allow to create stories and export into a stable+versioned format
- optional human-readable export format (BSN possibly?)
- non-cloud browser only storage
- maybe 3rd party storage integration (google drive .zip upload/download)
- keep “enterprise” features out of open source because I need to pay rent
Design goals - commercial product (2-5 years of work)
- wasm editor above, but more powerful?
- definitely an image editor at least for simple drafts
- publish stories them into a “cloud” for very cheap (free tier? free play for small chapters? storage caps?)
- and generate on demand finished games for android/win/linux and maybe if $$ then mac/ios if feasible at all
- desktop Editor should have powerful integration with Rust codebase, i.e. the ability to track enums and systems and offer these from drop down menus as different Conditions and Consequences
- tablets with physical keyboards should provide a reasonably productive platform to author stories on.
Secret stretch goals mostly for myself
While not core to the project, I’d like to see if this engine can be actually used to run simulations, the ‘dream’ goal being 12000 NPCs being able to move around and make decision based on their individual situations. Story Elements would not be “show GUI or play sound” but instead just empty containers grouping Conditions and Consequences which would change their relationships, location, resources, etc.
In a way it could ??? replace IAUS for some things? I guess maybe even completely if Conditions return floats, but I don’t think I want to do that in the near future.
Design goals - megalomaniac (5+ years)
- rival Ren’Py and Yarn Spinner, but without forcing their text formats
- replace Articy Draft as the industry standard
No that’s it, just two goals, I’m humble like that. /s
Jokes aside, I have a lot of respect for Yarn Spinner and Ren’Py, but I find their text formats ugly and I want to break away from that. (But not to forbid users from using a text-only format.) I have no actual complaints about Articy, I doubt I have a chance of making this into a commercial product, but I want to try anyway because I have a habit of making BREs, and I think the world needs to see a bit more Rust tooling instead of being stuck in 1990s style UIs full of ugly small buttons.
Previous art / To research
- Twine
- Yarn Spinner
- Ren’Py
- Articy
- Inkle
- https://naninovel.com/guide/getting-started
- Interactive Fiction
- Inform 7
- https://github.com/ganelson/inform
- Counterfeit Monkey
- https://narrat.dev/ js open source https://github.com/liana-p/narrat-engine
- https://storysynth.org/
- https://storyflow-editor.com/ 25 euro https://store.steampowered.com/app/4088380/StoryFlow_Editor/
- Dialogic 2
- Dialogue Manager 4
- Arcweave
Business Rule Engines and scripting to research / try / integrate for later maybe
- Lua, LuaJit, Luau - https://crates.io/crates/mlua
- 6-10x faster than Rhai
- seems wasm supported
- probably my best bet, also more likely to make sense to non-coder story writers
- Rhai - 10M dl, stable - https://crates.io/crates/rhai
- slower than V8 JavaScript
- still good enough for scripting events or animations
- should be fine unless we need to run hundreds or thousands of short scripts in sync every frame
- more complex game AI could be handled if it can be ran async / outside of Bevy Schedules.
- there used to be a very old bevy crate for Rhai: https://crates.io/crates/bevy_rhai
- ??? Wasmtime ??? https://crates.io/crates/wasmtime
- idk if it could compile wasm and also run it in wasm??
- fast, updated, but AI slop: https://github.com/KSD-CO/rust-rule-engine/
- year old, handful of downloads only: https://crates.io/crates/rusty-rules
- 250k dl, “microseconds” - https://crates.io/crates/zen-engine
Possible titles
- STEngine - taken by a 12 years abandoned github project <- most likely will use this
- StanGin??? StanJinn?
- ArcBark - taken, dog treat company
- TaleTrail - taken, AI bs
- StoryLorry - taken
- StoryGlory - taken
- talengine - “ai powerever workforce analysis” :vomit emoji:
-
Hard problems are things like physics engines, compilers, dealing with Google, optimizing equally for desktop as well as small screens, etc. Cursed problems are usually game design related, which often have no “right” solution, like making a multiplayer game that groups you with strangers that’s resistant to griefers, or making a chat filter that doesn’t censor “assassin”. ↩