Branching stories as state, not as trees. A Petri net decides what can happen next; plain text says how it reads. Two files, kept apart on purpose.
A choice-driven story is usually written as a tree, and a tree is the wrong shape: every branch that rejoins has to be duplicated, every combination of "has the sword" × "told the truth" × "night time" multiplies the nodes until the thing is unmaintainable. Multilinear models the story as a set of independent aspects — location, mood, who knows what — that change in parallel under constraints. An event fires only when its conditions hold. What the player can do next falls out of the state, and never has to be enumerated.
Underneath sits a Petri net, so the story is a simulation you can actually inspect: reachable states, dead ends, events that can never fire.
Structure and Prose Are Separate Files
# Leave home
location: home > outside
mom: > alone
# Sidestory mom
mom: alone > party
# Leave home
So you decide to leave.
You hug your mom and go outside.
multilinear example.mld
story example.pk
The structure file never contains a word of prose, and the prose file never contains a condition. They are matched by heading. Rewrite the text without touching the logic; rewire the logic without touching the text.
The Tools
Build and run Petri nets visually — place transitions, fire them, watch the tokens move. The direct way to see whether a story's state machine does what you think it does.
Visual novel player. Reads a .vng file, runs the multilinear simulation, renders the prose with dialog boxes and choices. The engine games ship with.
Play a story in the terminal — no assets, no renderer, just the branching. The fastest way to test whether a plot actually works before anyone draws anything.
Downloads
- PN Editor: Linux, Windows — visual Petri net editor · source
- VNgine: Linux — visual novel player · source
- mlplay: Linux, Windows — play a story in the terminal
- mlcheck: Linux, Windows — validate a story: unreachable events, dead ends
- multilinear2dot: Linux, Windows — render the story graph with Graphviz
- multilinear2pn: Linux, Windows — convert a story into a Petri net for the editor
The Libraries
Everything above is built on a stack of small crates. Each is usable on its own.
- multilinear — interactive stories as constrained parallel aspects
- multilinear-parser — the
.mldformat: markdown-inspired,from > totransitions - petri-net-simulation — the net underneath: places, transitions, tokens
- event-simulation — the foundation: event-based application state
In the Game
The simulation decides what can happen. These decide how it looks and sounds when it does — a separate layer, deliberately, so the same story runs in a terminal, a visual novel, or a 3D game.
- dialogi — dialog parser: lines, speakers, choices
- femto-dialog — dialog text box rendering on femto-g
- vn-settings — text speed, auto-advance, the usual VN knobs
- Music Tools — the soundtrack layer:
.trackmusic, live-synthesized