Hi, I'm Baohua. While revising The Birthday Party, I kept opening and changing the same script files, then trying to remember which branch affected what. It was getting tedious. After my internship at Lilith Games, I approached it as a Technical Designer: could I make the story easier to see, configure and extend? StoryGraph is my answer, with a node editor, a playable preview and room for plugins.

— Baohua

StoryGraph

Open-source branching narrative editor
2026 · JavaScript / C# / Unity

Tool design · Data modelling · Implementation
Built with AI assistance

Explore the source on GitHub ↗

A line of dialogue can change a relationship, unlock a later conversation or alter an ending. I built StoryGraph while revising The Birthday Party to make those dependencies visible as I wrote.

The editor combines a node canvas, an inspector and a playable preview. Authors can follow a route, inspect its variables and check the structure before exporting it.

StoryGraph / Narrative editor
The canvas shows connections; the inspector exposes the text, conditions and effects of the selected node.

A writing problem with dependencies

Reading a branching script from beginning to end made it difficult to see what a revision would affect. A clue gathered early in the week might matter several conversations later.

I wanted to inspect a choice together with its conditions and consequences. The revised Birthday Party graph keeps critical-event flags separate from relationship values: a high score alone does not establish that the necessary conversations took place.

Separate speech from state

I used seven core node types: start, dialogue, choice, condition, assignment, ending and note. Dialogue and choices pause for the reader; conditions and assignments advance the story's state.

Variables have number, boolean or string types. Conditions compare values, while assignments and choice effects change them. Notes stay in the editable project and are omitted from runtime output. This gives an author a way to distinguish what a character says from what the system does.

Reuse without losing the connections

Reusable subgraphs preserve their internal links and referenced variable definitions. Inserting one gives its nodes fresh IDs and adds missing variables. Repeated conversation patterns can therefore be revised as a structure rather than rebuilt node by node.

Inspect the route while playing it

The browser preview interprets the exported graph and exposes the current variables. I can choose a reply and inspect its effect before continuing to the next scene.

Validation reports undefined variables, disconnected outputs and unreachable nodes. These checks catch structural mistakes; they cannot establish that every condition is satisfiable or that a scene communicates the intended feeling. Relevant routes still need to be played and read.

Follow a dialogue route and examine its state. The preview does not perform the game's operating-system effects.

Keep the graph and Unity asset in sync

The editable .sg file keeps its layout and groups. Saving it inside Unity's Assets folder lets an importer compile its connections into a playable story asset. Later saves update that asset through Unity's Auto Refresh, preserving scene references. I chose to compile the source directly so authors do not have to maintain a separate export.

Each running session keeps a snapshot of the graph; restarting the supplied runner picks up the latest asset and restores initial variables. Invalid graphs report errors and cannot start a new session. Shared browser and C# examples test typed values, conditions and assignments, while Unity tests check import and reimport.

The released Birthday Party continues to use its existing dialogue and save systems. The package provides a reusable integration for Unity projects; game-specific save/load and rewind rules remain the responsibility of the game.

Try the tool

The repository includes the English editor, Unity package, a playable dialogue sample and technical design notes. Install the package, use Save As to place a graph in Assets, then save further edits to the same file. Core editing, preview and export run locally without an API key.

The tool's code and documentation are MIT-licensed; example narratives retain their separate rights.