A tool for building interactive story games.
See the full working example.
The engine has two main parts: the world model, and the rules.
Define your "World model"
worldModel =
Dict.fromList
[ entity "PLAYER"
|> stat "fear" 1
, entity "TORCH"
|> tag "item"
|> stat "illumination" 7
|> link "location" "PLAYER"
, entity "CAVE"
|> tag "place"
|> tag "dark"
, etc...
]Define your rules
rules =
Dict.fromList
[ rule "too dark to enter"
{ trigger = MatchAny [ HasTag "place", HasTag "dark" ]
, conditions = []
, changes = []
, narrative = "It's too dark to go in there!"
}
)
, rule "entering the cave with torch"
{ trigger = Match "CAVE" []
, conditions = [ Match "TORCH" [ HasLink "location" ( Match "PLAYER" [] ) ] ]
, changes = [ Update "PLAYER" [ SetLink "location" "CAVE", IncStat "fear" 2 ] ]
, narrative = "You enter the cave, your heart pounding..."
}
)
, etc...
]From there, you can query the world model to build your view, and you can find the best matching rule when a player interacts with an entity given the current state of the world, to update the world and show side effects like story text.
Read the dev blog