Examples
gamekit comes with five example projects in its examples/ folder. Each is a complete project: run it with thicket run from its folder.
| Example | Window | What it shows |
|---|---|---|
puzzle | yes | A card-matching game with a willowui shell. src/PuzzleShell.tks holds the rules, src/PuzzleShellApp.tks the app. |
dungeon | yes | A top-down dungeon crawler. src/DungeonDemo.tks holds the simulation, src/DungeonWillowApp.tks the app. |
scene-fade | yes | A title scene replaced by a play scene with a willow fade, through SceneStack. |
window-layers | yes | Scene windows, modal focus and screen windows with SceneWindowLayer. |
tactics | no | A console tactics match that prints a transcript and exits. |
A project with a window section in its thicket.json5 is a window app and stays open until the window closes. A console app exits when its work is done.
The tactics match
tactics is the most complete use of gamekit in one place, and it runs in a terminal:
sh
cd examples/tactics
thicket run play.tksIt uses definitions, entities with typed components and effects, world queries, conditions, transactional actions, interaction offers, attributes, state machines, a phase schedule with deferred commands, fixed stepping, seeded randomness, save schemas, input recording and replay, asset scopes and scenes. Its grid, teams, units and rules all live in the example, not in gamekit.
Its commit phase is the flush boundary that removes a defeated unit before the outcome phase checks who won. gamekit's tests run a full match, a save and resume in the middle, and a recorded-input replay across several seeds, and require the same final state and transcript from each.
Rules without a window
The puzzle and dungeon rules classes need no window to run, and gamekit's tests drive them without opening the UI. Keeping rules in their own class, apart from the app class that draws them, is the pattern to copy.