Files
systemic-game-design-course/course/02-action-queue/reference/ts
2026-10-29 02:30:26 +01:00
..
2026-10-29 02:30:26 +01:00
2026-10-29 02:30:26 +01:00
2026-10-29 02:30:26 +01:00
2026-10-29 02:30:26 +01:00
2026-10-29 02:30:26 +01:00
2026-10-29 02:30:26 +01:00
2026-10-29 02:30:26 +01:00
2026-10-29 02:30:26 +01:00

Module 2 reference engine (TypeScript)

The course's own engine as of the end of Module 2. It adds heroes, Health, Attack and Armor, triggered abilities, an event log, and the action queue that resolves one player action depth-first. Module 1's reference was the starting point, so a diff between the two shows what this module adds. Module 3's reference starts from this one.

  • src/engine/: generic machinery. Names no cards.
    • queue.ts: actions, the context an effect sees, and the resolver. Area damage creates every Damage Event before any trigger is queued; a Queue is filled once, oldest listener first, then locked; each trigger resolves completely before the next.
    • world.ts: entities, zones, order of play, heroes, stats, Armor and the log. Every state change records its event.
    • card.ts: card definitions (stats, triggers, a spell's effect) and the library.
    • event.ts: the engine's events. src/harness.ts translates them into the course's GameEvent.
  • src/content/index.ts: card definitions. Each effect is a small function that returns actions; Module 5 turns them into data.
  • src/harness.ts: the adapter the course tests call. play is still the Module 1 Expansion Drop stub.

Run it with the module's tests: node tools/verify-references.mjs 02 from the course repository.