Skip to content

Chapter 6 — Modules

Part II — Engine Architecture

How mechanics plug into the engine.

  • Module lifecycleregister(), init(), teardown()
  • Event listeners — subscribing to simulation events
  • Formula registration — contributing calculations to the engine
  • Namespaced state — per-module data attached to world state
ModulePurpose
traversal-coreMovement between zones
combat-coreAttack resolution, damage, defeat
inventory-coreItem management and usage
dialogue-coreConversation trees and state
status-coreBuffs, debuffs, and timed effects
cognition-coreAI beliefs, memory, and intent
perception-filterEntity-level truth layers
progression-coreCurrency, trees, and advancement
environment-coreDynamic zone properties and hazards
narrative-authorityTruth concealment and distortion

Modules extend the engine without modifying core. Each module is self-contained, registering its verbs, event handlers, and formulas during initialization.

These packages provide types and logic that work independently or alongside the built-in modules. Install them separately from npm.

PackagePurpose
@ai-rpg-engine/presentationNarration plan schema, render contracts, voice profiles
@ai-rpg-engine/audio-directorCue scheduling, priority, ducking, cooldown logic
@ai-rpg-engine/soundpack-coreSound pack manifests, content-addressable registry
@ai-rpg-engine/campaign-memoryPersistent NPC memory, relationship axes, campaign journal
@ai-rpg-engine/rumor-systemRumor lifecycle, mutation mechanics, spread tracking
@ai-rpg-engine/character-creationArchetypes, backgrounds, traits, multiclassing, build validation
@ai-rpg-engine/asset-registryContent-addressed storage for portraits, icons, and media
@ai-rpg-engine/image-genHeadless portrait generation pipeline with provider abstraction
@ai-rpg-engine/equipmentEquipment slots, item catalogs, and loadout management
@ai-rpg-engine/character-profilePersistent character profiles with progression, injuries, and save/load

Standalone packages have no engine dependency — they define types and logic that game runtimes consume. The built-in modules handle engine integration (event listeners, world state mutation), while standalone packages handle domain logic (how memories decay, how rumors mutate).

Pre-built worlds that wire all 15 modules with genre-specific rulesets, content, and progression. Each is a single createGame() call.

PackageGenreStatsUnique Verbs
@ai-rpg-engine/starter-fantasyDark fantasyvigor, instinct, willpray, rest
@ai-rpg-engine/starter-cyberpunkCyberpunkchrome, reflex, netrunningjack-in
@ai-rpg-engine/starter-detectiveVictorian mysteryperception, eloquence, gritinterrogate, deduce
@ai-rpg-engine/starter-pirateHigh-seas piratebrawn, cunning, sea-legsplunder, navigate
@ai-rpg-engine/starter-zombieZombie survivalfitness, wits, nervebarricade, scavenge
@ai-rpg-engine/starter-weird-westWeird westgrit, draw-speed, loredraw, commune
@ai-rpg-engine/starter-colonySci-fi colonyengineering, command, awarenessscan, allocate