1. Write a playable browser-game spec
Save this as outputs/tutorial-game/metro-lines.weavemark.md.
It starts from a named, memorable game idea, expands it into a
playable loop, and refines it with browser-validation requirements.
mkdir -p outputs/tutorial-game
<!-- Save as outputs/tutorial-game/metro-lines.weavemark.md -->
@promplet version: 0.7
@refine module:weavemark.domains.programming.types.web_based_game mingle: true
@refine module:weavemark.domains.programming.validation.playwright_mcp_browser_validation mingle: true
# Metro Lines
@iterate 2
@expand mode: intention focus: "one integrated playable loop"
Metro Lines: a browser game where the player draws transit
routes, passenger swarms reveal demand, congestion creates
pressure, and districts grow when the network succeeds.
Core fantasy: @{game_fantasy}
Target device: @{target_device}
Visual mood: @{visual_mood}
@match session_length
"short" ==>
Design a 5-minute score chase with quick restarts.
"long" ==>
Design a 25-minute city-growth arc with escalating pressure.
@if include_touch_controls
Specify touch-friendly drawing, undo, and station selection.
@if include_accessibility
Add keyboard-only play, reduced-motion mode, and non-color-only demand cues.
@output enforce: strict
Return game loop, entities, controls, progression,
scoring, accessibility, failure states, browser validation steps,
and first-build scope.
@assert contains: "first-build scope"
@assert contains: "browser validation"
The complete, tested specs for this tutorial are checked in under
promplets/tutorials/:
metro-lines.weavemark.md
and the emission pack
metro-lines-pack.weavemark.md.
2. Highlight: improve expansion with @iterate
@expand has a body: the compact idea to expand.
@iterate 2 wraps that expansion so the Processor can
improve the directive-application step when it sees a useful change.
@iterate matters: creative specs
often get better when the Processor can revisit the transformation.
Here, the first pass expands the game idea; the second pass can
tighten the playable loop, validation obligations, and first-build
scope.
The validation refinement is also concrete: the final prompt should ask a programming agent to open the browser, exercise controls, inspect console output, and fix visible defects.
3. Compose the game specification
Compile a concrete Metro Lines first-build prompt for a programming agent.
weavemark outputs/tutorial-game/metro-lines.weavemark.md \
--batch-only \
--var game_fantasy="Metro Lines makes a living city breathe through transit routes" \
--var target_device="desktop browser" \
--var visual_mood="clean transit maps, soft city glow, readable swarms" \
--var session_length=short \
--var include_touch_controls=false \
--var include_accessibility=true \
--output outputs/tutorial-game/metro-lines-build.md
metro-lines-build.md is a programming-agent prompt.
Give it to GitHub Copilot, Claude Code, Cursor, or another
AI-assisted programming tool and ask it to build the playable
Metro Lines browser game.
4. Adapt it to mobile
Reuse the same spec and change the variables. The branch and touch control instructions now produce a different build prompt.
weavemark outputs/tutorial-game/metro-lines.weavemark.md \
--batch-only \
--var game_fantasy="Metro Lines as calm commute planning with tactile route drawing" \
--var target_device="mobile browser" \
--var visual_mood="paper-map warmth, large stations, calm motion" \
--var session_length=long \
--var include_touch_controls=true \
--var include_accessibility=true \
--output outputs/tutorial-game/metro-lines-mobile-build.md
metro-lines-mobile-build.md is a mobile-focused
programming-agent prompt. Use it when the implementation target is a
touch-friendly Metro Lines browser game.
5. Emit support files for the programming agent
For games, companion artifacts are especially useful: a first-build brief, a playtest checklist, and a visual-direction sheet keep the implementation focused. This larger spec also shows that emitted files can contain normal WeaveMark directives.
<!-- Save as outputs/tutorial-game/metro-lines-pack.weavemark.md -->
@promplet version: 0.7
@compile format: markdown
@emit file: "build-spec.md"
@refine module:weavemark.domains.programming.types.web_based_game mingle: true
@refine module:weavemark.domains.programming.validation.playwright_mcp_browser_validation mingle: true
# Metro Lines first build
@iterate 2
@expand mode: intention focus: "playable systems with visible feedback"
Metro Lines: the player draws transit routes, passenger
swarms expose demand, congestion creates pressure, and
districts evolve when the network succeeds or fails.
Core fantasy: @{game_fantasy}
Target device: @{target_device}
Visual mood: @{visual_mood}
@match session_length
"short" ==>
Build a quick score chase with visible demand spikes and restarts.
"long" ==>
Build a city-growth arc with unlocks, congestion pressure, and recovery.
@if include_touch_controls
Add touch drawing, tap-to-select stations, and a large undo target.
@if include_accessibility
Include keyboard-only line drawing, reduced motion, and shape-based demand cues.
@emit file: "playtest-checklist.md"
# Metro Lines playtest checklist
Validate the first build in a real browser:
- draw a route between two districts
- watch passenger swarms choose the route
- create congestion and observe visible feedback
- undo a route and confirm demand updates
- trigger the win or score condition within one session
- open the console and fix errors before claiming success
@emit file: "art-direction.md"
# Metro Lines art direction
Mood: @{visual_mood}
Use:
- crisp routes with high contrast
- station glyphs that remain readable at small sizes
- passenger swarms that show direction without overwhelming the map
- district growth animations that can be disabled
- a HUD that always shows score, congestion, and current tool
weavemark outputs/tutorial-game/metro-lines-pack.weavemark.md \
--batch-only \
--output-dir outputs/tutorial-game/metro-lines-pack \
--var game_fantasy="Metro Lines makes a living city breathe through transit routes" \
--var target_device="desktop browser" \
--var visual_mood="clean transit maps, soft city glow, readable swarms" \
--var session_length=short \
--var include_touch_controls=false \
--var include_accessibility=true
build-spec.md is the programming-agent prompt,
playtest-checklist.md is the manual/agent validation
checklist, and art-direction.md is a support brief to
keep the visual implementation consistent.
Final step: Use the output
The generated files are an implementation packet for a browser game. They are meant to direct a builder and reviewer, not to run as the game themselves.
build-spec.md to a programming agent such as GitHub
Copilot, Claude Code, Cursor, or weavemark implement so
it can build the playable Metro Lines game. Use
playtest-checklist.md to validate the running browser
build, and use art-direction.md to keep the visual
implementation consistent.
Next
Continue with the Semantic toolbox to master the directives that reshape meaning, or open the Python API to compile specs from applications.