Skip to main content

Story Structure

story.json contains one top-level key per language. Each language object holds the story title, perks, nodes, items, UI strings, and credits.

{
"en": {
"title": "Your Adventure Title",
"perks": [],
"nodes": {},
"items": {},
"ui": {},
"credits": {}
}
}

The example project uses it and en. See Languages for translation details.

Nodes​

Each node is identified by a unique key:

{
"start": {
"text": "You stand before the entrance of an ancient crypt.",
"image": "src/images/scene.jpg",
"music": "src/music/ambient.mp3",
"musicLoop": true,
"choices": [
{
"text": "Enter carefully",
"next": "entrance"
}
]
}
}
FieldRequiredDescription
textYesStory text. Supports colors and dialogue boxes.
imageNoPath to a story image.
musicNoPath to a background track.
musicLoopNoWhether the track loops.
choicesYesArray of choices. Can be empty for terminal nodes.

Choices​

{
"text": "Force the door open (Strength test)",
"next": "force_door",
"oneshot": true,
"requirements": {
"items": ["crowbar"],
"flags": ["found_door"],
"notFlags": ["alarm_triggered"],
"perks": ["strong_back"]
},
"test": {
"stat": "strength",
"difficulty": 9
},
"effects": {
"health": -1,
"sanity": 1,
"items": [
{
"id": "torch",
"name": "Torch",
"type": "permanent"
}
],
"flags": ["door_opened"]
}
}
FieldDescription
textLabel shown on the choice button.
nextID of the target node.
oneshotIf true, the choice disappears after being selected.
requirementsConditions that must be met for the choice to appear.
testStat test. On failure the engine looks for <next>_fail.
effectsChanges applied when the choice is selected.

When a choice has a test, the engine navigates to the target node on success and tries to navigate to <target>_fail on failure. Always create the failure node:

{
"force_door_fail": {
"text": "The door does not budge. You hurt your shoulder.",
"choices": []
}
}

Effects​

KeyDescription
healthAdds or subtracts health points.
sanityAdds or subtracts mental health points.
itemsGives items to the player.
flagsSets story flags.

See Requirements and Items for the complete conditions and item format.