Docs / Guides

Developer Guides

Four step-by-step guides that together cover every hook, utility, and pattern in the engine. The first three each build a variant from an empty file to a working plugin. The fourth builds a complete standalone game on the engine.

Why Four Guides?

The engine has three layers of extension points, and no single variant uses them all:

  • Custom pieces — new movement patterns, attack functions, piece registration
  • Game hooks — action moves, turn logic, move filtering, board mutations
  • Effects system — timed status effects, square-based state, automatic expiry

Guides 1–3 each target one layer in isolation, building a variant plugin from scratch. Guide 4 uses all three layers together and adds the consumer APIs — game controller, terrain, custom rendering, and unit templates — to build a complete standalone game on the engine.

Guide 1: Orda Chess — Custom Pieces

Build three custom pieces with divergent movement (move one way, capture another). Covers:

  • MCE.registerPiece() — define new piece types with movement and attack logic
  • genMoves(g, from, side) — generate pseudo-legal moves (slides, jumps, divergent patterns)
  • attacks(g, from, target) — check detection for custom pieces
  • pieceRoles — map piece characters to handlers
  • Asymmetric FEN — different armies for each side

Start the Orda Chess guide

Guide 2: Crazyhouse — Action Moves and State

Build the most popular variant online. Captured pieces go into your hand and can be dropped back. Covers:

  • init — initialize custom game state (hand arrays)
  • moveFilter — generate non-standard moves (drops) alongside normal moves
  • afterMove — respond to moves (place drops, capture to hand)
  • MCE.mutateBoard() — board changes with automatic undo
  • restoreState — restore custom state for AI search
  • evaluate — teach the AI to value hand pieces
  • statusText — display custom information to the player

Start the Crazyhouse guide

Guide 3: Poison Chess — Effects System

Build a variant with timed square effects. Capture squares become toxic, destroying pieces that land on them. Covers:

  • MCE.addEffect() — create timed effects on squares
  • MCE.hasEffect() — query effects during move filtering
  • MCE.tickEffects() — automatic duration countdown
  • MCE.mutateBoard() — destroy pieces with undo support
  • moveFilter — restrict movement based on effects
  • evaluate — score positions considering effect proximity

Start the Poison Chess guide

Guide 4: Dungeon Chess — MCE as a Game Subsystem

Build a complete standalone game on MCE — 4-player tactical combat with 22 custom unit types, terrain, effects, capture interception, multi-step turns, and fully custom rendering. Covers:

  • MCE.buildUnitHandler() — declarative move specs with the unit template system
  • ownershipMode: 'pieceData' — unlimited unit types via a single piece character
  • terrainSkip — global terrain predicates for move generation
  • beforeMove — capture interception (cancel/redirect captures)
  • afterMove + MCE.mutateBoard() — board mutations with undo
  • turnLogic + pendingAction — multi-step turns
  • positionKey — custom hash for pieceData-based games
  • MCE.createGameController() — full interaction loop with AI, undo, animation
  • tilePainter / pieceProvider / afterRender / surroundRenderer — custom rendering pipeline
  • onSquareClick / onAnimateMove — controller interaction callbacks

Start the Dungeon Chess guide

Which Guide Do I Need?

If you want to...Read
Add new piece types with custom movementOrda Chess
Add abilities, drops, or non-movement actionsCrazyhouse
Add timed effects, auras, or square statesPoison Chess
Override how captures workCrazyhouse + API: Capture Interception
Control turn advancement (multi-move, phases)Crazyhouse (turnLogic concept) + API Reference
Add fog of war or visibility restrictionsAPI Reference (visibility hook)
Use MCE as an embedded engine in a larger gameDungeon Chess
Custom rendering (terrain, sprites, effects)Dungeon Chess
Terrain and board geometryDungeon Chess
Embed a board in another pageAPI: Embedding
Control a board programmatically (SDK)API: Game Controller + SDK Demo
Use chess from an AI assistantAPI: MCP Server
Build an opening book for a variantAPI: Opening Books

Reference