Quest archetypes & exports
Reference for what @kiberon-labs/quests ships: the archetype cores, the module stage layers, and the package’s public exports.
Archetypes
Section titled “Archetypes”Each archetype is a seeded core: an abstract spine that reifies against world state and is filled out by the stage and structure layers. Compose one with composeQuest / composeGrammar, or load its pre-built grammar at @kiberon-labs/quests/grammars/<pattern>.grammar.json.
| Pattern | What it is |
|---|---|
compete | Enter a contest for a prize: bouts and preparation against a field of rivals. |
defend | Hold a place against an assault, driving back successive waves. |
escape | Break out of captivity and get clear, often with fellow prisoners in tow. |
escort | Get a charge safely to a destination against threats on the road. |
explore | Chart an unknown or sealed place and reveal what it hides. |
fetch | Recover a specific item and return it to the one who wants it. |
heist | Infiltrate a guarded vault and take the prize without raising the alarm. |
hunt | Track and bring down a mobile quarry: a fleeing beast, a runaway, or cunning prey. |
investigate | Uncover the culprit behind a wrong by weighing suspects and evidence. |
negotiate | Broker terms between two parties, sometimes with leverage or a hidden position. |
provision | Gather → refine → craft → deliver goods (a fetch with a production chain). |
rescue | Free a captive and bring them home, often against a clock or a cruel choice. |
slay | Kill a foe that threatens the giver or something the giver cares about. |
survive | Outlast a killing environment and reach a haven. |
QUEST_ARCHETYPES exports these 14 pattern tags as a readonly tuple; coreFor(pattern) returns a core by tag.
Module stage layers
Section titled “Module stage layers”Modules live under src/modules/, grouped by the quest stage they act on (the number prefix is load order). A core lays down the spine; the stage and structure layers compete (weighted-random) to fill it in.
| Folder | Provides |
|---|---|
0-core | The 14 seeded quest archetypes. |
1-exposition | Opening beats that ground the situation and stakes. |
2-inciting | The hook that sets the quest in motion. |
3-rising-action | The body: travel legs, obstacles, and grounded complications. |
4-climax | The decisive beat that resolves the goal. |
5-complication | Re-spawnable setbacks that deepen the rising action. |
6-falling-action | Consequences and twists after the climax (e.g. a double-cross). |
7-denouement | The return, the reward, and concrete aftermaths. |
8-structure | Cross-cutting structure: branches, prerequisites, parallel objectives, rare gated scenarios. |
Every registered module carries a capability requirement (requires): the mechanics a game must be able to present for the beat to be coherent, such as Combat or Dialogue. manifest.json lists these; filter REGISTRY on them to include only beats your game supports.
Package exports
Section titled “Package exports”Entry points
Section titled “Entry points”| Import specifier | Contents |
|---|---|
@kiberon-labs/quests | The TypeScript API (composition, registry, authoring DSL). |
@kiberon-labs/quests/grammars/<pattern>.grammar.json | A pre-built, runnable grammar for one archetype. |
@kiberon-labs/quests/data/* | The raw generated data: per-module JSON, index.json, manifest.json. |
Composition
Section titled “Composition”| Export | Signature / type | Description |
|---|---|---|
composeQuest | (core: CoreDescriptor, seed?: number) => { nodes, edges } | Compose an archetype and run it into a finished, scaffolding-stripped quest graph. |
composeGrammar | (core: CoreDescriptor, seed?: number) => Grammar | Compose an archetype into a runnable graph-grammar grammar (run it yourself). |
coreFor | (archetype: QuestArchetype) => CoreDescriptor | Look up a shipped archetype core by its pattern tag. |
cores | CoreDescriptor[] | All 14 archetype cores. |
QUEST_ARCHETYPES | readonly QuestArchetype[] | The 14 pattern tags. |
stripTransitions | (nodes, edges) => { nodes, edges } | Remove empty-stage transition no-ops and bridge their neighbours. |
Registry
Section titled “Registry”| Export | Signature / type | Description |
|---|---|---|
REGISTRY | RegisteredModule[] | Every core and beat, with key, folder, requires. |
modulesForCore | (pattern: string) => RegisteredModule[] | The layers affine to an archetype. |
modulesFor | (caps: string[]) => RegisteredModule[] | Modules whose capability requirements the caps satisfy. |
affinityOf | (key: string) => string[] | null | Which archetypes a module is scoped to (null = universal). |
Authoring DSL
Section titled “Authoring DSL”| Export | Description |
|---|---|
matchModule, branchMatchModule, beatModule, complicationModule, bondRevealModule | Builders that return a BeatDescriptor from a spec. |
matchBeat, branchMatchBeat | Lower-level rule builders the module builders wrap. |
BeatDescriptor, MatchSpec, BeatStep, MotivationSpec, StageKey, CoreDescriptor, QuestArchetype | The DSL types. |
Schema & utilities
Section titled “Schema & utilities”The package also re-exports the augmented-quest schema and validity helpers, and graph utilities (reidGraph, largestComponent, splitByComponents, wlSignature) for validating and normalizing quest graphs.
See also
Section titled “See also”- Integrate quests into your game: usage of these exports.
- The quest generation system: the design reasoning.
Built by Kiberon Labs