Pattern-driven Development A
Solar2D with Kwik
TODO Workflow overview
Pattern‑driven workflow (in the spirit of Alexander)
How to use
- Choose a pattern path for this project (Narrative → Interaction → Architecture → Release).
- Instantiate patterns per scene/page; record decisions.
- Link each pattern to concrete tasks in Kwik/Solar2D.
Pattern template
- Name
- Context
- Problem + Forces
- Solution
- Implementation (Kwik/Solar2D)
- Consequences
- Related
Authoring/Narrative patterns
- Beat and Reveal: Pace content into beats; reveal on interaction or time.
- Implementation: One beat per Kwik layer/group; show/hide via timelines; narration audio per beat.
- Scene as Stage: One scene = one compositional unit with entry/exit cues.
- Implementation: Solar2D composer scene per page; preEnter/enter transitions.
- Foreshadowing Hook: Plant a visual hint for later payoff.
- Implementation: Add subtle animated prop; later scene references same asset/tag.
Interaction/UX patterns
- Diegetic Controls: UI elements live inside the world (props/buttons).
- Implementation: Kwik button components on in‑scene sprites; tactile SFX.
- Safe Exploration: Users can’t get stuck; always a way back.
- Implementation: Persistent “Home/Back” layer; composer.gotoScene with crossfade; state checkpoint.
- Feedback Pulse: Every action gets instant visual/audio response.
- Implementation: OnTap → scale tween + click SFX; short haptic (iOS) when applicable.
Architecture/Performance patterns
- Asset Bundles: Group assets per chapter; share common.
- Implementation: shared/ for common; chapter1/, chapter2/ for bundles; Kwik shared assets.
- Lazy Load Above‑the‑Fold: Load only what the next beat/scene needs.
- Implementation: composer.recycleOnSceneChange; preloading next scene’s textures on scene:show(“will”).
- Event Bus (Signals): Decouple gameplay events from UI.
- Implementation: Local Runtime listeners; emit “BEAT_DONE”, “CHOICE_MADE”.
Release/Operations patterns
- Instrumentation as Sensing: Measure critical beats and exits.
- Implementation: Analytics event on scene enter/exit and choice taps.
- Feature Flags/Remote Config: Switch features without rebuild.
- Implementation: Load JSON from server; branch behavior at scene start.
Example (filled)
- Beat and Reveal
- Context: Interactive page with narration.
- Problem: Users skip too fast; pacing must guide attention.
- Forces: Short attention, device performance, readability.
- Solution: Sequence micro‑beats gated by taps or timed delays.
- Implementation: Kwik timelines per beat; disable next tap until SFX ends; narration markers.
- Consequences: Clear pacing; cost = more timeline assets.
- Related: Feedback Pulse, Lazy Load.
Mapping to phases
- Phase I (Assets): Beat and Reveal, Scene as Stage, Foreshadowing Hook.
- Phase II (Simulator): Diegetic Controls, Safe Exploration, Event Bus, Lazy Load.
- Phase III (Deployment): Asset Bundles, Instrumentation as Sensing, Feature Flags.