Documentation

Everything you need to add new games, configure board rendering, and extend the engine with new topologies or plugins.

What is Moddable Engine

A universal game engine where games are configuration files, not code. Any game expressible as a combination of topology, rules, pieces, and setup can be defined entirely in YAML frontmatter. The engine handles rendering, move validation, state management, and AI.

How games are defined

Every game variant lives as a Markdown file in moddable-rules with an engine: block in its YAML frontmatter. This block tells the engine everything it needs: what topology to use, how to render the board, where pieces start, and what rules apply.

---
title: Standard Chess
engine:
  topology:
    type: grid
    rows: 8
    cols: 8
  surface: parchment
  render:
    cellColor: checkered
    labels: true
    ops:
      - op: cells
        pattern: checkered
  setup: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR
  pieces:
    set: mce-chess
---

The engine reads this frontmatter, resolves it through a cascade (surface defaults, family defaults, variant overrides), and produces a complete game definition or rendered board diagram.

Architecture at a glance

The engine is organised into layers. Each layer depends only on the layers below it.

┌─────────────────────────────────────────────┐
│  Frontmatter (YAML in moddable-rules)       │  ← game definitions
├─────────────────────────────────────────────┤
│  Schema (parse, validate, produce, cascade) │  ← turns YAML into objects
├─────────────────────────────────────────────┤
│  Plugins (chess, go, mancala, ...)          │  ← game-specific logic
│  Topologies (grid, hex, track, pit, graph)  │  ← spatial structure
│  Rules (castling, capture, turn-flow, ...)  │  ← composable behaviours
├─────────────────────────────────────────────┤
│  Core (state, events, pipeline, registry)   │  ← micro-kernel
└─────────────────────────────────────────────┘

Key concepts

Guides

PageSectionCovers
Authoring a VariantGuidesWriting a variant from scratch, step by step
FrontmatterGuidesThe engine block: topology, render, pieces, setup notation
TopologiesGuidesGrid, hex, track, pit, graph, tableau and more: fields and coordinates
SurfacesGuidesNamed surfaces and colour customisation
Piece SetsGuidesGallery index format, virtual sets, extends, surfaces
SDKGuidesEvery family through one headless SDK, and what each supports
PluginsGuidesPlugin structure, hooks, registry, adding a family
Families on Shared PluginsGuidesNaming the plugin that plays a family, and the keys each shared plugin reads
Render PipelineGuidesHow frontmatter becomes an SVG board
ChessFamiliesChess SDK, embed, variant parameters, AI and puzzles
GoFamiliesGo SDK, embed and variants
DraughtsFamiliesDraughts SDK, embed and variant keys
HexFamiliesHex connection games: embed, variants, AI
MancalaFamiliesMancala sowing games: embed and variant keys
MorrisFamiliesMorris mill games: embed and variant keys
XiangqiFamiliesXiangqi SDK, embed and variants
ShogiFamiliesShogi SDK, embed, drops and variants
ReversiFamiliesReversi: embed and variants
Landlord's GameFamiliesThe Landlord's Game: embed and editions
BackgammonFamiliesThe tables games: dice, variant keys, AI
Race GamesShared PluginsRoutes, declared randomisers and landing rules: Ur, Senet, Nyout, Pachisi, Chaupar
Hopping GamesShared PluginsSteps, chained hops, goal camps and asymmetric seats: Halma, Stern-Halma, Asalto
Cards, Tiles and DiceShared PluginsEvery card, tile and dice game, and hidden hands
Hex MapsToolsHex map generators and tile styles

Current coverage

The engine renders boards for 335 game variants across 34 families and 8 topology types, plus 3 RPG systems (D&D 5e, Ironsworn, Starforged) via manifest-driven oracle/entity providers. 30 families (agon, asalto, backgammon, bavarian-32, chaupar, chess, dou-shou-qi, double-six-dominoes, draughts, fanorona, flower-48, go, halma, hex, the Landlord's Game, mahjong, mancala, morris, nyout, pachisi, reversi, royal-ur, senet, shogi, standard-52, standard-dice, stern-halma, surakarta, tafl, xiangqi) are fully playable with move execution, AI, embed protocol, and SDK.

ComponentStatusTests
Schema (parse, validate, produce)Complete113
Core (state, pipeline, events)Complete157
Topologies (6 types)Complete165
Plugins (13 families)Complete375
Rules (composable, parametric)Complete118
Render (SVG generation)Complete34
Board diagrams (293 variants)Complete293 snapshots
RPG providers (3 systems)CompleteManifest-driven
Play (frontend integration)In progress—