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.
The engine has three layers of extension points, and no single variant uses them all:
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.
Build three custom pieces with divergent movement (move one way, capture another). Covers:
MCE.registerPiece() — define new piece types with movement and attack logicgenMoves(g, from, side) — generate pseudo-legal moves (slides, jumps, divergent patterns)attacks(g, from, target) — check detection for custom piecespieceRoles — map piece characters to handlersBuild 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 movesafterMove — respond to moves (place drops, capture to hand)MCE.mutateBoard() — board changes with automatic undorestoreState — restore custom state for AI searchevaluate — teach the AI to value hand piecesstatusText — display custom information to the playerBuild a variant with timed square effects. Capture squares become toxic, destroying pieces that land on them. Covers:
MCE.addEffect() — create timed effects on squaresMCE.hasEffect() — query effects during move filteringMCE.tickEffects() — automatic duration countdownMCE.mutateBoard() — destroy pieces with undo supportmoveFilter — restrict movement based on effectsevaluate — score positions considering effect proximityBuild 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 systemownershipMode: 'pieceData' — unlimited unit types via a single piece characterterrainSkip — global terrain predicates for move generationbeforeMove — capture interception (cancel/redirect captures)afterMove + MCE.mutateBoard() — board mutations with undoturnLogic + pendingAction — multi-step turnspositionKey — custom hash for pieceData-based gamesMCE.createGameController() — full interaction loop with AI, undo, animationtilePainter / pieceProvider / afterRender / surroundRenderer — custom rendering pipelineonSquareClick / onAnimateMove — controller interaction callbacks| If you want to... | Read |
|---|---|
| Add new piece types with custom movement | Orda Chess |
| Add abilities, drops, or non-movement actions | Crazyhouse |
| Add timed effects, auras, or square states | Poison Chess |
| Override how captures work | Crazyhouse + API: Capture Interception |
| Control turn advancement (multi-move, phases) | Crazyhouse (turnLogic concept) + API Reference |
| Add fog of war or visibility restrictions | API Reference (visibility hook) |
| Use MCE as an embedded engine in a larger game | Dungeon Chess |
| Custom rendering (terrain, sprites, effects) | Dungeon Chess |
| Terrain and board geometry | Dungeon Chess |
| Embed a board in another page | API: Embedding |
| Control a board programmatically (SDK) | API: Game Controller + SDK Demo |
| Use chess from an AI assistant | API: MCP Server |
| Build an opening book for a variant | API: Opening Books |