New gem_anim.sx adds a purely-visual per-gem pose set driven by a single animation clock: a calm always-on idle breath (scale-pulse + bob, per-gem phase, ramped in from rest), a selection pop, a landing squash-bounce, and a clear pop. BoardView draws every settled gem through gem_pose_at / gem_pose_frame; the move timeline (P6.1) and FX (P6.2) are untouched and the input-lock semantics are unchanged (idle never locks input). Determinism: the idle is always-on, so main reads M3TE_ANIM_TIME=<seconds> to freeze the clock at a chosen phase (t==0 == the resting board, so the pre-P6.3 goldens reproduce) and M3TE_SELECT=<cellIndex> to force a selection for capture. tests/gem_pose.sx locks the t==0-rest invariant and the reaction envelopes headlessly (fails if the idle ramp is dropped). Goldens (deterministic capture): p6_idle_t0 (resting), p6_idle_mid (pinned mid-breath), p6_select (selection pop on cell 3,3). Purely visual: no change to model/score/moves/hit-testing.
87 lines
3.7 KiB
Markdown
87 lines
3.7 KiB
Markdown
# m3te
|
|
|
|
A match-3 game written entirely in the **sx** language, targeting **iOS** first.
|
|
|
|
- Game logic, rendering, input, and UI are all authored in sx.
|
|
- Art (palettes, sprite sheets) is produced as real assets.
|
|
- Verification gate: sx logic tests pass AND the iOS app builds & launches in the Simulator.
|
|
|
|
Development is driven by the multi-agent `flow` (Product Owner → Worker → Reviewer → Observer).
|
|
|
|
## Verification gate
|
|
|
|
The gate has two halves. Both must pass. The sx compiler used below lives at
|
|
`/Users/agra/projects/sx/zig-out/bin/sx` (override the runner's binary with the
|
|
`SX` env var). Run everything from the repo root.
|
|
|
|
### 1. Logic tests
|
|
|
|
Pure-sx logic tests run under `sx` and have their stdout + exit code diffed
|
|
against committed snapshots in `tests/expected/`. A failed assertion exits the
|
|
process non-zero, so it fails the runner (and the gate).
|
|
|
|
```bash
|
|
bash tools/run_tests.sh
|
|
```
|
|
|
|
- A test is any `tests/<name>.sx` that has a `tests/expected/<name>.exit`
|
|
marker; `tests/test.sx` (the `expect` assert helper) has no marker, so it is
|
|
not itself run.
|
|
- Regenerate snapshots after an intentional change: `bash tools/run_tests.sh --update`.
|
|
|
|
### 2. iOS Simulator build + launch
|
|
|
|
Build the app for the simulator, then install/launch it on an available device
|
|
and screenshot the rendered scene (blue background + a centered orange quad).
|
|
|
|
```bash
|
|
# Build the .app bundle (sx-out/ios/M3te.app):
|
|
/Users/agra/projects/sx/zig-out/bin/sx build --target ios-sim main.sx
|
|
|
|
# Discover an available simulator — do NOT hardcode a udid:
|
|
xcrun simctl list devices available
|
|
# e.g. capture the first available device's UDID into $udid:
|
|
udid=$(xcrun simctl list devices available | grep -Eo '[0-9A-Fa-f-]{36}' | head -1)
|
|
|
|
# Boot it (skip if already "Booted") and bring the Simulator window up:
|
|
xcrun simctl boot "$udid" || true
|
|
open -a Simulator
|
|
|
|
# Install, launch (bundle id co.swipelab.m3te), and screenshot:
|
|
xcrun simctl install booted sx-out/ios/M3te.app
|
|
xcrun simctl launch booted co.swipelab.m3te
|
|
xcrun simctl io booted screenshot /tmp/m3te.png
|
|
```
|
|
|
|
The screenshot should match `goldens/p0_quad.png` (a centered orange quad over a
|
|
blue clear), modulo the status-bar clock — pixel-exact equality is not required.
|
|
A tap on the quad flips its color (orange ↔ green); see
|
|
`goldens/p0_input_before.png` / `goldens/p0_input_after.png`.
|
|
|
|
### Deterministic animation capture (P6.3)
|
|
|
|
The per-gem idle loop (`gem_anim.sx`) is always-on, so a plain screenshot is
|
|
time-dependent. Two environment variables pin the visual state so the board can
|
|
be captured reproducibly. The simulator forwards any `SIMCTL_CHILD_*` variable to
|
|
the launched app, so prefix them on the `simctl launch`:
|
|
|
|
- `M3TE_ANIM_TIME=<seconds>` freezes the animation clock at that phase. **`t=0`
|
|
is the resting board** — every gem sits at its static pose, so the pre-P6.3
|
|
goldens reproduce unchanged. A larger `t` (e.g. `1.0`) shows the mid-breath
|
|
idle deformation. The select/land reactions read this same pinned phase.
|
|
- `M3TE_SELECT=<cellIndex 0..63>` (= `row*8 + col`) force-selects a cell at
|
|
startup, so the selection highlight + pop can be captured without a tap.
|
|
|
|
```bash
|
|
# Resting board (idle at rest): goldens/p6_idle_t0.png
|
|
SIMCTL_CHILD_M3TE_ANIM_TIME=0 xcrun simctl launch booted co.swipelab.m3te
|
|
# Mid-breath idle: goldens/p6_idle_mid.png
|
|
SIMCTL_CHILD_M3TE_ANIM_TIME=1.0 xcrun simctl launch booted co.swipelab.m3te
|
|
# Selection pop on cell (3,3): goldens/p6_select.png
|
|
env SIMCTL_CHILD_M3TE_ANIM_TIME=0.17 SIMCTL_CHILD_M3TE_SELECT=27 \
|
|
xcrun simctl launch booted co.swipelab.m3te
|
|
```
|
|
|
|
With no variable set the game runs fully live (the clock advances by
|
|
`delta_time`). `tests/gem_pose.sx` locks the `t==0`-rest invariant headlessly.
|