IFEngine is a rust framework for writing interactive fiction. Other projects in this space include Twine and Inkle.
The goal is to enjoy an effortless writing experience, together with all the benefits of the Rust ecosystem.
Note: The firefox cache may cause the page to load forever after the first visit. Press ctrl-shift-r to fix this. If you know a fix, please let me know! story credit: https://antemaion.itch.io/saltwrack (Sorry I haven't asked permission yet as im just using it for testing this project is still just experimental!)
it's cool i like it (todo).
- Story analysis: Travel your story through the API. Generate a graph!
- Nice syntax: Weave together your story elements and code with intuitive macros.
- Powerful state management: The full power of the rust language at your behest.
- Navigable content: Stories link and compose together through elements like link, tunnel, and weave. Jump between them using
Go to definition. - Immediate mode page execution coupled with persisted state enables writing generator-style functions to produce views.
- Initialize your project
mkdir -p ifproject
cd ifproject- Download your frontend template
git clone git@github.com:Squirreljetpack/ifengine.git
mv ifengine/egui .
rm -rf ifengine
or with zsh-dl:
dl - https://github.com/Squirreljetpack/ifengine/tree/main/egui
Currently, your options are: egui .. and nothing else.
- Make a few changes
egui/Cargo.toml:
[package]
# change me
[dependencies]
# ifengineifengine = { path = "../ifengine" } # remove mestory = { path = "../story" }
# ...- Create your library
cargo init --lib story
cd story
cargo add ifengine
# ifproject/# ├── egui# └── story# ├── Cargo.toml# └── src# └── lib.rsstory/src/lib.rs:
pubmod chap1;pubtypeGame = ifengine::Game<State>;pubfnnew() -> Game{
ifengine::Game!(chap1::p1)}// your game state#[derive(Debug,Default,Serialize,Deserialize,Clone)]pubstructState{pubname:String,}story/src/chap1.rs:
#[allow(unused_imports)]use ifengine::{
elements::{ChoiceVariant::*,
choice,
click,
dp,
h,
choice,
mchoice,
p,},
utils::MaskExt,GO,
ifview,
link,};usecrate::{State};#[ifview]pubfnp1(s:&mutState){h!("LET ME TELL YOU WHY I GOT OUT OF BED THIS MORNING...")p!(link!("BEGIN", p3));}- Launch!
cd egui
trunk serveNote
To use this library, you write functions which produce Responses, eventually resolving to a View. The view corresponding to the current game state is retrieved by calling Game::view.
A view is a sequence of Objects which you can attach by calling the provided elements and macros within a function decorated by #[ifview].
Ideas and contributions welcome. There is a rough todo as well.