See how the world model is defined in the full working example.
Your story/game will have a store, or "world model", of all of the entities that live in your world, and the various properties that describe them. The narrative engine expects your world model to have this shape.
Entities are just IDs coupled with various fields of information. The engine requires that your entities have tags, stats, and links fields.
It uses these fields to track "salience-based" and "quality/stats-based" narratives (described very well in Emily Shot's blog post), which can provide a more flexible and robust story.
Because this is an extensible record, you can have other properties on your entities as well (like "name" and "description" or "sprite" for example), which works well with the "Entity Component System" design pattern.
Note that you are not restricted to the traditional "items/characters/locations" world model. You can define your entities with what ever properties you want, to fit any story world.
"Tags" on an entity.
Examples: "item", "edible", "poisonous", "SmithFamily", etc.
"Stats" on an entity.
Examples: "health", "honor", "plotProgression", "bars of gold", etc.
"Links" on an entity.
Examples: "locatedIn", "knows", "suspects", etc.
A empty starting state for the "tags" property
A empty starting state for the "stats" property
A empty starting state for the "links" property
A helper function to add a tag to an entity when setting up your world model.
A helper function to add a stat to an entity when setting up your world model. A stat is a key and a numeric value on any scale you like.
A helper function to add a link to an entity when setting up your world model. The key is the type of relationship, and the value is intended to be the id of another entity.
Declarative statements of how an entity should change, designed to be used with rules.
Note that you can use $ as the ID to reference the entity ID that triggered the rule (useful for generic rules).
Declarative statements for changing a property on an entity.
Note that you can use $ as the ID in SetLink to reference the entity ID that triggered the rule (useful for generic rules).
Update the world model based on a list of changes. Also takes the id of the entity that triggered the rule to allow changes to use trigger matching (with $).
Queries are run against the world model to assert a condition or select particular entities. This is useful to render a list of characters in a given location for example. The engine uses these when checking rules.
Semantic means for matching entities. Specifies an optional entity ID and a list of queries to match against.
Note that you can use $ as the ID to reference the entity ID that triggered the rule (useful for generic rules).
Semantic queries for checking properties of an entity.
A way to retrieve information from the store.
Asserts if the current state of the world model matches the given queries.
A utility to test an EntityMatcher matcher against a specific entity ID.
Get a specific stat from a specific entity.
Get a specific link from a specific entity.
A unique identifier for each entity.