Appearance
Getting started
This page walks through a minimal B.A.G.E.L. game: a 3×3 grid, one move (place a marker), and two end conditions (win by line or draw when full).
Minimal game: three in a row
See the full example in the repo at server/tic-tac-toe2.json. Summary:
- entities: one Grid named
mainGrid, width 3, height 3 - numPlayers: 2
- moves.placePlayerMarker: type
PlaceNew, entity thatMatchesisCurrentPlayer, destination thatMatches a Space and isEmpty, playerChoice true - endConditions: (1) HasLine on mainGrid, sequence of 3 with ContainsSame player → winner ownerOfFirstResultEntity; (2) IsFull on mainGrid → draw
What each part does
- entities — One grid named
mainGrid, 3×3. The engine also adds a shared board and per-player “playerMarker” entities. - numPlayers — 2 (equivalent to
minPlayersandmaxPlayersboth 2). - moves.placePlayerMarker — A PlaceNew move: take an entity that matches “current player’s marker” and place it at a destination that is a Space and isEmpty. The player picks the destination (
playerChoice: true). - endConditions — Two outcomes:
- If the grid HasLine of 3 spaces that ContainsSame
player→ winner is the owner of the first such entity (shorthand:ownerOfFirstResultEntity). - If the grid IsFull → draw.
- If the grid HasLine of 3 spaces that ContainsSame
Shorthand used here: thatMatches (→ conditions), isCurrentPlayer, isEmpty, endConditions (→ endIf). See Shorthand for the full list.
Try it in the editor
- Open the app’s game editor (where you define games).
- Choose the “Three in a Row” example or paste the JSON above into a blank game.
- Run a test game and confirm win/draw behavior.
From here, explore Reference for the full structure, Moves and Conditions, or the Examples for more complex games.