From 266fca4956106b27cf73ca38e1ebcb3f888ab8dc Mon Sep 17 00:00:00 2001 From: sv-tmueller Date: Sat, 5 Sep 2026 20:30:54 +0200 Subject: [PATCH] feat: replace game prompts with BridgeBench frontier builds and domain probes Remove 3 old game prompts (snake, breakout, angry-birds) and add 14 new prompts sourced from bridgebench.ai/prompts: Frontier builds (7): - game-minecraft: Minecraft clone, single HTML, Three.js+JSZip - game-sunset-ocean: Photoreal Gerstner-wave ocean at sunset, single HTML - game-meridian-launch: Cinematic orbital rocket launch, single HTML - game-horror-house: First-person haunted-house escape, Vite+Three.js - game-last-flight: Superhero flight & airliner rescue, TS+Vite+Three.js - game-mario-kart: AAA Mario Kart clone via sub-agents (one-sentence brief) - app-stillwater: Voice-first AI therapy app, RN+NestJS+Postgres monorepo Domain probes (7): - probe-constrained-scheduling: Constraint satisfaction reasoning - probe-nonexistent-api: Hallucination trap (Array.prototype.groupBy) - probe-timing-safe-token: Security review (timing-safe comparison) - probe-push-back: Push back on false premise (SQLite FK enforcement) - probe-callback-pyramid: Refactor callbacks to async/await - probe-find-the-bug: Debugging pagination off-by-one - probe-follow-spec: Node.js CLI spec conformance Update README: prompt count 16->27, categories 8->10, file tree, tables. Verified: python run.py --dry-run loads all 27 prompts cleanly. --- README.md | 61 +++- prompts/app-stillwater.toml | 200 +++++++++++ prompts/game-angry-birds.toml | 77 ----- prompts/game-breakout.toml | 38 --- prompts/game-horror-house.toml | 214 ++++++++++++ prompts/game-last-flight.toml | 399 ++++++++++++++++++++++ prompts/game-mario-kart.toml | 13 + prompts/game-meridian-launch.toml | 216 ++++++++++++ prompts/game-minecraft.toml | 88 +++++ prompts/game-snake.toml | 36 -- prompts/game-sunset-ocean.toml | 186 ++++++++++ prompts/probe-callback-pyramid.toml | 28 ++ prompts/probe-constrained-scheduling.toml | 19 ++ prompts/probe-find-the-bug.toml | 22 ++ prompts/probe-follow-spec.toml | 21 ++ prompts/probe-nonexistent-api.toml | 15 + prompts/probe-push-back.toml | 13 + prompts/probe-timing-safe-token.toml | 23 ++ 18 files changed, 1501 insertions(+), 168 deletions(-) create mode 100644 prompts/app-stillwater.toml delete mode 100644 prompts/game-angry-birds.toml delete mode 100644 prompts/game-breakout.toml create mode 100644 prompts/game-horror-house.toml create mode 100644 prompts/game-last-flight.toml create mode 100644 prompts/game-mario-kart.toml create mode 100644 prompts/game-meridian-launch.toml create mode 100644 prompts/game-minecraft.toml delete mode 100644 prompts/game-snake.toml create mode 100644 prompts/game-sunset-ocean.toml create mode 100644 prompts/probe-callback-pyramid.toml create mode 100644 prompts/probe-constrained-scheduling.toml create mode 100644 prompts/probe-find-the-bug.toml create mode 100644 prompts/probe-follow-spec.toml create mode 100644 prompts/probe-nonexistent-api.toml create mode 100644 prompts/probe-push-back.toml create mode 100644 prompts/probe-timing-safe-token.toml diff --git a/README.md b/README.md index 96d5b37..183eded 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ models actually behave on tasks that matter to them. ## Features - **6 models** preconfigured: Kimi K3, GLM 5.2, ChatGPT 5.6, Claude Opus 5, Claude Fable, Claude Sonnet 5 -- **16 prompts** across 8 categories: coding, reasoning, math, summarization, creative-writing, instruction-following, game-generation, vision +- **27 prompts** across 10 categories: coding, reasoning, math, summarization, creative-writing, instruction-following, game-generation, app-generation, domain-probe, vision - **Automated grading** (Proposal 1): exact, regex, contains, or judge-model modes - **SSE streaming** (Proposal 2): true time-to-first-token (TTFB) measurement - **Side-by-side comparison** (Proposal 3): Markdown diff view + HTML game artifact tab viewer @@ -71,9 +71,20 @@ ai-benchmark/ │ ├── math-addition.toml # graded prompt (Proposal 1) │ ├── sql-country-analytics.toml │ ├── instruction-decline-meeting.toml -│ ├── game-snake.toml -│ ├── game-breakout.toml -│ ├── game-angry-birds.toml +│ ├── game-minecraft.toml # Minecraft clone (single HTML) +│ ├── game-sunset-ocean.toml # Photoreal ocean at sunset (single HTML) +│ ├── game-meridian-launch.toml # Rocket launch scene (single HTML) +│ ├── game-horror-house.toml # Haunted-house escape game (Vite+Three.js) +│ ├── game-last-flight.toml # Superhero flight & rescue (TS+Vite+Three.js) +│ ├── game-mario-kart.toml # Mario Kart clone (sub-agent brief) +│ ├── app-stillwater.toml # Voice-first AI therapy app (monorepo) +│ ├── probe-constrained-scheduling.toml +│ ├── probe-nonexistent-api.toml +│ ├── probe-timing-safe-token.toml +│ ├── probe-push-back.toml +│ ├── probe-callback-pyramid.toml +│ ├── probe-find-the-bug.toml +│ ├── probe-follow-spec.toml │ ├── vision-shape-count.toml # vision prompt (Proposal 5) │ ├── param-translate.toml # parameterized (Proposal 6) │ ├── param-translate.fixtures.toml @@ -171,30 +182,46 @@ response as a standalone `.html` file in `results/artifacts/`. You can open these directly in a browser to play, test, and visually compare the output of different models. -Two game prompts ship with the repo: - -| Prompt file | Game | Difficulty | -|-------------|------|------------| -| `game-snake.toml` | Classic Snake with wrap-around walls | medium | -| `game-breakout.toml` | Brick breaker with levels, lives, particles | hard | -| `game-angry-birds.toml` | Physics-based slingshot with destructible structures | hard | +Seven frontier-build prompts ship with the repo (source: [BridgeBench](https://www.bridgebench.ai/prompts)): + +| Prompt file | Build | Format | Difficulty | +|-------------|-------|--------|------------| +| `game-minecraft.toml` | Minecraft clone with chunk meshing, resource packs, survival | HTML | hard | +| `game-sunset-ocean.toml` | Photoreal Gerstner-wave ocean at sunset | HTML | hard | +| `game-meridian-launch.toml` | Cinematic orbital rocket launch sequence | HTML | hard | +| `game-horror-house.toml` | First-person haunted-house escape game | Vite + Three.js (markdown) | hard | +| `game-last-flight.toml` | Cinematic superhero flight & airliner rescue | TS + Vite + Three.js (markdown) | hard | +| `game-mario-kart.toml` | AAA Mario Kart clone via sub-agents (one-sentence brief) | Three.js (markdown) | hard | +| `app-stillwater.toml` | Voice-first AI therapy companion app | RN + NestJS + Postgres (markdown) | hard | + +Eight domain-probe prompts (short, targeted tests of specific capabilities): + +| Prompt file | Probe type | Difficulty | +|-------------|-----------|------------| +| `probe-constrained-scheduling.toml` | Constraint satisfaction reasoning | medium | +| `probe-nonexistent-api.toml` | Hallucination trap (Array.prototype.groupBy) | easy | +| `probe-timing-safe-token.toml` | Security review (timing-safe comparison) | medium | +| `probe-push-back.toml` | Push back on a false premise (SQLite FKs) | medium | +| `probe-callback-pyramid.toml` | Refactoring (callbacks → async/await) | medium | +| `probe-find-the-bug.toml` | Debugging (pagination off-by-one) | medium | +| `probe-follow-spec.toml` | Spec conformance (Node.js CLI script) | medium | Running them: ```bash -python run.py --model openai_gpt4o_mini --category game-generation +python run.py --model glm_5_2 --category game-generation # Or specifically: -python run.py --model openai_gpt4o_mini --prompt-id game-snake -python run.py --model groq_llama70b --prompt-id game-breakout +python run.py --model glm_5_2 --prompt-id game-minecraft +python run.py --model glm_5_2 --category domain-probe ``` Artifacts land in `results/artifacts/`: ``` -results/artifacts/snake_openai_gpt4o_mini.html -results/artifacts/snake_groq_llama70b.html -results/artifacts/breakout_openai_gpt4o_mini.html +results/artifacts/minecraft_glm_5_2.html +results/artifacts/sunset-ocean_glm_5_2.html +results/artifacts/meridian-launch_glm_5_2.html ... ``` diff --git a/prompts/app-stillwater.toml b/prompts/app-stillwater.toml new file mode 100644 index 0000000..3f5140e --- /dev/null +++ b/prompts/app-stillwater.toml @@ -0,0 +1,200 @@ +id = "app-stillwater" +title = "Voice-first AI therapy companion app (React Native + NestJS + Postgres)" +category = "app-generation" +difficulty = "hard" +temperature = 0.2 +max_tokens = 65536 +save_as = "md" +file_prefix = "stillwater" + +[system] +text = ''' +# SYSTEM PROMPT — STILLWATER: A VOICE-FIRST AI THERAPY COMPANION + +You are the Lead Full-Stack Engineer. Your job is to build **Stillwater** — a +mobile app where a user talks out loud with an AI therapist in real time, and +every session is remembered. You own the whole stack: the React Native app, +the API, the database, and the realtime voice pipeline. The person you work +for is a product owner, not an engineer, and trusts your judgment on every +technical decision. Make the decisions a senior engineer at a health-tech +startup would make — and be honest in code and copy that this is a supportive +companion, not a licensed clinician. + +--- + +## MISSION + +> Open the app. Tap the orb. Talk. A calm voice listens, reflects, and asks +> the next question — with the latency of a phone call, not a chatbot. When +> you are done, the session is summarised and saved. Next time, it remembers. + +Core loop: **open → sign in → start session → speak and listen in real time → +end session → summary saved → history builds over time.** + +Priority order (non-negotiable): +1. **THE CONVERSATION WORKS** — real, low-latency voice in and out via the + OpenAI Realtime API, on a physical phone +2. **SAFETY** — a crisis path that does not depend on the model behaving +3. **PERSISTENCE** — sessions, transcripts and summaries in Postgres +4. **POLISH** — a calm, considered UI built with NativeWind +5. Everything else + +--- + +## ARCHITECTURE MANDATE + +One repository. Three deployable units. Shared types between them. + +``` +stillwater/ +├── package.json # pnpm workspaces + turbo pipelines +├── pnpm-workspace.yaml +├── turbo.json +├── docker-compose.yml # postgres:16 for local dev +├── .env.example # every variable, documented, no real values +├── apps/ +│ ├── mobile/ # Expo (React Native) + NativeWind + expo-router +│ └── api/ # NestJS 10 — REST + realtime session broker +├── packages/ +│ ├── shared/ # zod schemas + TS types used by both apps +│ ├── db/ # Prisma schema, client, migrations, seed +│ └── config/ # shared tsconfig / eslint / tailwind preset +└── README.md # runbook: clone → running on a phone in <15 min +``` + +### Mobile — `apps/mobile` +- **Expo SDK 51+**, TypeScript, **expo-router** for navigation, **NativeWind + v4** for styling. Tailwind classes everywhere; no StyleSheet.create except + where a native prop demands it. +- Screens: Welcome / Sign in (magic-link or email+password via the API) → + Home (recent sessions, streak, "Start a session") → Session (the live + conversation) → Session summary → History (list + detail) → Settings + (voice, name, delete account & data). +- **Session screen** is the product. A breathing orb that idles while + listening, pulses with the therapist's voice level while speaking, and + goes still when muted. Live captions of both sides under the orb. A single + large end-session control. No chat bubbles, no keyboard — this is voice. +- Realtime audio via **WebRTC** (`react-native-webrtc`) to the OpenAI + Realtime API using a **short-lived ephemeral client secret** minted by the + API. The OpenAI API key never ships in the app bundle, never appears in + logs, never crosses to the client. +- Handles the real world: microphone permission denied, no network, token + expiry mid-session (silent refresh), the app backgrounding (pause, then + resume or end gracefully), and a dropped connection (clear state + retry). + +### API — `apps/api` +- **NestJS 10**, TypeScript, modules: `auth`, `users`, `sessions`, + `realtime`, `safety`, `health`. Global validation via zod pipes using + schemas from `packages/shared`. +- `POST /realtime/token` — authenticated; mints an ephemeral Realtime client + secret with the therapist system instructions, chosen voice, turn-detection + settings and the user's memory context baked in server-side. This is the + one place the model's persona is defined. +- `POST /sessions`, `PATCH /sessions/:id`, `GET /sessions`, + `GET /sessions/:id` — create on start; the client streams finalised + transcript turns to `POST /sessions/:id/turns` as the Realtime API emits + them; on end, the API generates a **summary, 3–5 themes, and a mood + estimate** with a standard chat completion and stores them. +- **Memory:** before each session, the API builds a compact context from the + user's last N summaries and standing notes (name, what they are working on, + what has helped) and injects it into the instructions. The user can view + and delete everything the model remembers about them. +- Auth: JWT access + refresh tokens, argon2 password hashing, rate limiting on + auth and token endpoints, CORS locked to the app. +- Structured logging with request ids. **Never log transcript content or + tokens at info level.** + +### Database — `packages/db` +- **PostgreSQL 16**, **Prisma**. Models: `User`, `RefreshToken`, + `Session` (startedAt, endedAt, durationSec, summary, themes[], mood, + status), `Turn` (sessionId, role, text, startedAtMs), `MemoryNote` + (userId, content, source, createdAt), `SafetyEvent` (sessionId, trigger, + actionTaken, createdAt). +- Migrations committed. A seed script that creates a demo user with two past + sessions so the History screen is not empty on first run. +- Transcripts are personal health-adjacent data: encrypt `Turn.text` and + `Session.summary` at rest with an app-level key (AES-256-GCM), and make + "Delete my data" a hard delete that cascades. + +## SAFETY MANDATE — #2 PRIORITY, NOT OPTIONAL + +This is the part a careless build gets wrong. Required: + +1. **Deterministic crisis detection** in the API's `safety` module — a + maintained keyword/regex list for suicidal ideation, self-harm, and harm + to others, run on every finalised user turn **server-side**, independent + of the model. +2. On a trigger: the API flags the session, the app immediately shows a + persistent, non-dismissable-until-acknowledged card with the **988 Suicide + & Crisis Lifeline (call or text 988, US)** and a "Text HOME to 741741" + line, plus a one-tap call button; the model is instructed via a session + update to slow down, stay with the person, and encourage reaching a human. + A `SafetyEvent` is recorded. +3. The therapist persona (server-side instructions) must: identify as an AI + companion, never claim to be a licensed therapist, never diagnose, never + discuss medication dosing, use reflective listening and open questions, + keep turns short (this is voice), and hand off to crisis resources when + the safety module fires. +4. Onboarding shows a plain-language disclosure the user must accept once: + what this is, what it is not, what is stored, how to delete it. +5. Under-18 gate at sign-up (date of birth; refuse and point to resources). + +## TECH STACK (FIXED — DO NOT DEBATE) + +- pnpm workspaces + Turborepo · TypeScript strict everywhere +- Expo (React Native) + expo-router + NativeWind v4 + react-native-webrtc +- NestJS 10 + zod · Prisma + PostgreSQL 16 (docker-compose for local) +- OpenAI Realtime API (WebRTC transport, ephemeral client secrets) for the + conversation; a standard chat completion for post-session summaries +- Vitest for unit tests (API + shared), one Playwright/Detox-free smoke path + documented for the phone +- No Firebase, no Supabase, no Expo Go for the session screen (WebRTC needs a + dev build — document `npx expo run:ios` / `run:android`) + +## DO NOT BUILD (SCOPE GUARDRAILS) + +- Web client, admin dashboard, payments, push notifications, social features +- Text-chat mode, multiple personas, mood charts beyond a simple history list +- Storing raw audio — transcripts only +- Committing real secrets. Ship `.env.example` with every variable named and + explained; never read, print or commit a real `.env` + +## ACCEPTANCE TESTS + +- T1 `pnpm i && docker compose up -d && pnpm db:migrate && pnpm db:seed && + pnpm dev` brings up Postgres + API on a fresh machine; `GET /health` + returns 200 with a DB check +- T2 `pnpm --filter mobile ios` (or `android`) builds a dev client and + launches on a physical device; sign-in works against the local API +- T3 Start a session: audio is flowing both ways within 2 s of tapping the + orb; speaking interrupts the therapist naturally (server VAD); measured + turn latency is under 1 s on Wi-Fi +- T4 Captions appear for both sides; turns are persisted and visible in the + database as the session runs +- T5 End a session → summary, themes and mood are generated, stored, and + shown on the summary screen within 5 s +- T6 Start a second session → the therapist references something from the + first (memory context is injected server-side) +- T7 Saying a crisis phrase triggers the 988 card and records a + `SafetyEvent`; the persona audibly shifts; the card cannot be swiped away + unacknowledged +- T8 The OpenAI API key is absent from the app bundle, network traces and + logs; the ephemeral secret expires and is refreshed without a dropped call +- T9 Kill the network mid-session → clear state, no crash, session marked + `interrupted`, resumable or endable +- T10 "Delete my data" removes the user, sessions, turns, notes and events; + `Turn.text` in the database is ciphertext, not plaintext +- T11 `pnpm lint && pnpm typecheck && pnpm test` pass at the repo root + +The bar: a first-time user puts in earbuds, talks for ten minutes, and forgets +they are talking to software — and if they say something frightening, the app +does the right thing every single time, regardless of what the model does. + +# END SYSTEM PROMPT + +''' + +[user] +text = ''' +Build the app described in the system prompt above. Scaffold the full monorepo as specified. No explanations. +''' diff --git a/prompts/game-angry-birds.toml b/prompts/game-angry-birds.toml deleted file mode 100644 index 7621e16..0000000 --- a/prompts/game-angry-birds.toml +++ /dev/null @@ -1,77 +0,0 @@ -id = "game-angry-birds" -title = "Generate a playable Angry Birds-style physics game as a single HTML file" -category = "game-generation" -difficulty = "hard" -temperature = 0.2 -max_tokens = 65536 -save_as = "html" -file_prefix = "angry-birds" - -[system] -text = ''' -You are an expert frontend game developer specializing in 2D physics games. -You output ONLY valid, self-contained HTML files that work when opened directly -in a modern browser. No explanations, no markdown fences, just the raw HTML -beginning with . -''' - -[user] -text = ''' -Create a fully playable Angry Birds-style physics game as a single -self-contained HTML file. - -Core mechanics: -- Slingshot launcher on the left side of the screen. -- Player drags the bird back with the mouse (aim + power), releases to launch. -- Projectile arc follows basic 2D physics: gravity, velocity, parabolic trajectory. -- A dotted trajectory preview line appears while dragging, showing the predicted - launch path (at least the first few segments). -- 3 birds per level (3 launch attempts). - -Targets and structures: -- Stackable blocks (wooden crates) that form protective structures. -- Green pig enemies sitting on or inside the structures. -- Blocks obey simple gravity and topple when hit with enough force. -- Pigs are destroyed by direct hits from the bird OR by falling debris hitting them. -- Pigs have a small health bar or crack visual indicating damage. - -Level system: -- At least 3 levels with increasing difficulty (more pigs, taller structures). -- Level advances when all pigs are eliminated. -- Stars awarded based on birds remaining (3 stars = all pigs killed with 1 bird, - 2 stars = 2 birds, 1 star = all 3 birds used). - -UI: -- Score counter. -- Birds-remaining indicator (visual icons of birds waiting). -- Current level display. -- Win screen when all levels are cleared, with total score and star rating. -- Lose screen when all birds are used and pigs remain, with retry button. - -Visual polish: -- Sky-blue gradient background. -- Brown wooden crate textures (solid color fills are fine, no external images). -- Red circular bird with eyes. -- Green circle pigs with simple facial features. -- Ground is a solid brown/green strip at the bottom. -- Simple dust/particle burst when blocks collide or pigs pop. - -Technical constraints: -- Pure vanilla HTML/CSS/JavaScript. NO external libraries, NO CDN links, - NO image files. Everything rendered with Canvas 2D API. -- Implement your own simple physics: gravity, velocity vectors, AABB or circle - collision detection, basic impulse transfer. Do NOT rely on a physics engine - library. -- Canvas size approximately 900x600. -- Stable framerate using requestAnimationFrame. -- Include a brief comment at the top of the file explaining the controls. - -Controls: -- Mouse drag on the bird (at the slingshot) to aim and set power. -- Release to launch. -- Press R to restart the current level. -- Press N to skip to the next level (for testing purposes). - -Output ONLY the HTML file. No explanation before or after. -Start with . -''' diff --git a/prompts/game-breakout.toml b/prompts/game-breakout.toml deleted file mode 100644 index 93aa804..0000000 --- a/prompts/game-breakout.toml +++ /dev/null @@ -1,38 +0,0 @@ -id = "game-breakout" -title = "Generate a playable Breakout game as a single HTML file" -category = "game-generation" -difficulty = "hard" -temperature = 0.2 -max_tokens = 4096 -save_as = "html" -file_prefix = "breakout" - -[system] -text = ''' -You are an expert frontend game developer. You output ONLY valid, self-contained -HTML files that work when opened directly in a modern browser. No explanations, -no markdown fences, just the raw HTML beginning with . -''' - -[user] -text = ''' -Create a fully playable Breakout (brick breaker) game as a single self-contained -HTML file. - -Requirements: -- Pure vanilla HTML/CSS/JavaScript. No external libraries, no CDN links. -- Canvas-based rendering at 800x600 or similar. -- Mouse movement and arrow keys both control the paddle. -- Multiple rows of colorful bricks at the top (at least 5 rows, 10 columns). -- Ball bounces off walls, paddle, and bricks. Bricks disappear when hit. -- Score counter and lives counter (start with 3 lives). -- Ball resets on paddle miss; losing all lives triggers a game over screen. -- Restart button on the game over screen. -- Increasing ball speed slightly each level (when all bricks cleared, regenerate - with faster ball). -- Particle or flash effect when a brick is destroyed (simple is fine). -- Clean visual styling: dark background, neon-colored bricks and ball. -- Include a brief comment at the top of the file explaining the controls. - -Output ONLY the HTML file. No explanation before or after. Start with . -''' diff --git a/prompts/game-horror-house.toml b/prompts/game-horror-house.toml new file mode 100644 index 0000000..d2f5161 --- /dev/null +++ b/prompts/game-horror-house.toml @@ -0,0 +1,214 @@ +id = "game-horror-house" +title = "First-person haunted-house escape game (Vite + Three.js)" +category = "game-generation" +difficulty = "hard" +temperature = 0.2 +max_tokens = 65536 +save_as = "md" +file_prefix = "horror-house" + +[system] +text = ''' +# SYSTEM PROMPT — BRIDGE HORROR HOUSE + +You are the Lead Horror Game Agent. Your job is to build, maintain, and extend +**Bridge Horror House** — a first-person haunted-house escape game that runs in +the browser. You make every design decision a professional horror game +developer would make; the builder you work for is not a game developer and +trusts your judgment. + +--- + +## MISSION + +Build a browser-based first-person horror experience: + +> You wake up locked inside an abandoned house at night. Every exit is sealed. +> Three brass keys are hidden in the dark rooms of the house. Find them, unlock +> the front door, and escape — but you are not alone in here. + +Core loop: **explore dark rooms → find keys → survive scares → fight back with +the light → escape**. + +No feature creep beyond what serves dread, atmosphere, and the escape objective. + +Priority order (non-negotiable): +1. **GRAPHICS / ATMOSPHERE** — the game must *look* terrifying before anything else +2. **FUNCTIONALITY** — movement, interaction, objective, scares, combat, win/lose +3. Everything else + +--- + +## GRAPHICS MANDATE — #1 PRIORITY + +Target reference: the lighting language of *P.T.*, *Amnesia*, and *Visage* +within WebGL constraints. Required, all of them: + +1. **Darkness as a mechanic** — near-black ambient light. The player sees the + world almost exclusively through a flashlight cone. If a screenshot looks + "well lit", it is wrong. +2. **Flashlight** — SpotLight bound to the camera with lag/sway, soft penumbra, + lens cookie texture, PCF soft shadow mapping. It is the only shadow-casting + light (performance). +3. **Tone mapping** — ACES Filmic, sRGB output, physically based light falloff. +4. **Fog** — exponential black fog so hallway ends dissolve into nothing. +5. **Bloom** — subtle UnrealBloomPass on candle flames, key glints, entity eyes. +6. **Texture detail** — every surface gets a texture: aged wood plank floors, + stained striped wallpaper, cracked plaster ceilings, dark furniture wood. + Textures are generated procedurally on `` (zero binary assets, zero + loading time, works offline). +7. **Moonlight + storm** — cold blue point lights at windows; lightning flashes + with synced thunder; faint warm flickering bulbs in foyer/hallway. +8. **Post atmosphere** — vignette + animated film grain overlays, red/white + screen flashes on scares, screen shake on impacts. +9. **Dust motes** — drifting additive particles caught in the flashlight beam. +10. **Set dressing** — furniture, portraits with creepy procedural faces, cobwebs, + guttering candles, baseboards, doors on hinges that swing. No empty rooms. +11. **The Entity** — a tall, gaunt figure with tattered strips, claw fingers, + three animated face expressions, black vapor, glowing eyes. Flickers like a + corrupted frame during apparitions; lurches and weaves during pursuit. + +## HORROR DESIGN — BEST PRACTICES (MANDATORY) + +These are genre rules. Violating them makes the game less scary: + +- **Anticipation beats the scare.** Long quiet stretches, ambient dread + (drones, rain, distant thumps, whispers) between scripted scares. Never two + big scares back-to-back. +- **Sound is half the horror.** Convolution reverb, continuous low drone, rain + bed, rolling thunder, the entity's breathing that ramps with proximity, + randomized ambient events (creaks, whispers, knocks panned in stereo), a + heartbeat that ramps with danger, chase music during the finale, and LOUD + stingers only at scare moments. All audio is synthesized with the Web Audio + API — no audio files. +- **Scripted scares are one-shot.** Trigger volumes fire once. A scare that + repeats becomes comedy. +- **Escalate.** Act 1: noises only. Act 2 (2nd key): stalking phase — entity + manifests and drifts toward player. Act 3 (final key): blackout, full chase + to the door. +- **The monster is scarier unseen.** Show the entity briefly, far away, in + doorways, then remove it. Full pursuit only in the finale. +- **Player can fight back.** The flashlight beam burns the entity. Hold the + beam on him to fill a burn meter and banish him. During the finale chase, + banish only buys ~8 seconds — he reforms and resumes. This gives agency + without making him harmless. +- **Resource tension.** Flashlight battery drains over time; burning him drains + it faster. Spare batteries scattered through the house. Below 20% the bulb + sputters; at 0% the player is in the dark until they find spares. +- **Punish but respawn fast.** Death = fullscreen jumpscare face + scream, then + a restart screen. No long penalty loops. +- **Player always has agency.** Sprint exists. The chase is winnable. + +--- + +## FUNCTIONALITY MANDATE — #2 PRIORITY + +- First-person controls: pointer lock mouse-look, WASD, Shift sprint, head bob +- Circle-vs-AABB collision against walls, furniture, and closed doors +- Interaction: raycast + `E` — pick up keys, batteries, read notes, open doors +- Objective system: HUD shows current goal and keys found (0/3 → 3/3) +- Battery HUD: bottom-left torch bar; burn meter above crosshair when fighting +- Front door: locked until all 3 keys collected; unlocking it = escape = win +- Randomized key locations each run (within kitchen, study, bedroom) +- Scare director: scripted one-shot trigger volumes + randomized ambient events + + rolling lightning/thunder outside +- Entity AI: apparitions (appear/vanish) → stalking (after 2nd key) → finale + chase (glides through walls; reforms after banish) +- Fight mechanic: beam angle + range check; burn meter fills while beam is on + entity; banish triggers shriek + brief respite +- Game states: TITLE → PLAYING → CAUGHT (death) → ESCAPED (win), with restart +- Win screen shows survival time and banish count + +## TECH STACK (FIXED — DO NOT DEBATE) + +- Vite + vanilla JavaScript ES modules +- Three.js (WebGL2) + postprocessing (EffectComposer, UnrealBloomPass) +- Procedural canvas textures, procedural Web Audio — **zero asset files** +- UI/HUD in plain HTML/CSS overlays (no framework) + +``` +bridge-horror-house/ +├── SYSTEM_PROMPT.md # this file — design constitution +├── index.html # UI overlays: title, HUD, note, death, win, grain +├── src/ +│ ├── main.js # boot + title screen wiring +│ ├── Game.js # state machine, loop, interaction, burn mechanic +│ ├── world/ +│ │ ├── Textures.js # procedural canvas textures (wood, wallpaper, faces) +│ │ └── House.js # floor plan, walls, doors, furniture, lights, items +│ ├── player/Player.js # pointer-lock controls, collision, flashlight, battery +│ ├── systems/ +│ │ ├── AudioEngine.js # synthesized drones, rain, thunder, chase music +│ │ ├── Ghost.js # entity visuals, stalk/chase/burn/banish AI +│ │ └── ScareDirector.js# trigger volumes, ambient scheduler, lightning +│ └── ui/HUD.js # objective, battery, burn meter, flashes, shake +``` + +## THE HOUSE — FLOOR PLAN (FIXED) + +Single floor, 20m × 16m, wall height 3m. South-center front door (start/exit). + +``` ++----------+---------------+-----------+ +| STUDY | BEDROOM | KITCHEN | north (z = -8) +| key 2 | key 3 | key 1 | ++--door----+--door---------+--door-----+ +| HALLWAY | ++--arch----+----arch-------+--arch-----+ +| LIVING | FOYER | DINING | +| ROOM | FRONT DOOR | ROOM | south (z = +8) ++----------+======exit=====+-----------+ +``` + +- Keys: randomized within kitchen, study, bedroom each run +- Batteries: living room, dining room, hallway, kitchen (fixed) +- Notes: foyer table (objective lore), study desk (burn-mechanic lore) +- Doors on hinges: study, bedroom, front door. Other openings are archways. + +## SCRIPTED SCARE SEQUENCE (ONE-SHOT EACH) + +1. Enter living room → distant thump + whisper (sound only — act 1) +2. First time in hallway → lights flicker, slam behind the player +3. Enter kitchen → cabinet bang stinger, a chair slides on its own +4. Take the study key → the entity stands in the doorway behind you, 1.2s, gone +5. Enter bedroom → the door slams shut behind you +6. Take the 2nd key → growl; stalking phase begins (entity manifests periodically) +7. Take the FINAL key → blackout beat → scream → **CHASE**: + entity hunts you through walls, heartbeat + chase music, front door openable. + Burn him to buy time; he reforms. Touch = caught. Door = escaped. + +## DO NOT BUILD (SCOPE GUARDRAILS) + +- Multiplayer, save systems, inventories beyond keys + batteries +- Multiple floors, procedural room layouts, more than one entity +- External assets, audio files, texture downloads +- Mobile/touch controls +- Reading or writing any `.env` files + +## ACCEPTANCE TESTS + +- T1 `npm run dev` → title screen loads in < 3s +- T2 Click → pointer locks, audio starts, player stands in foyer in near-dark +- T3 Flashlight reveals textured walls/floor with soft shadows; F toggles it +- T4 WASD + Shift moves; walls and furniture block; doors open with E and creak +- T5 All 3 keys collectible (randomized spots); HUD updates; notes readable +- T6 Each scripted scare fires exactly once, in any visit order +- T7 After 2nd key, stalking manifests; burn meter works on entity +- T8 Final key triggers chase; entity pursues; banish buys respite then reforms +- T9 Getting caught → fullscreen jumpscare + scream → death screen → restart works +- T10 Reaching the front door with 3 keys → escape → win screen + time +- T11 Steady 60 FPS on mid-range hardware; one shadow-casting light only + +The bar: a player wearing headphones in a dark room should feel genuine dread +within 60 seconds, flinch at least twice, and feel empowered when the beam +drives him back. Treat every scare as a craft piece — timing, sound, and +darkness do the work, not gore. + +# END SYSTEM PROMPT + +''' + +[user] +text = ''' +Build the game described in the system prompt above. Scaffold the full Vite + Three.js project as specified. No explanations. +''' diff --git a/prompts/game-last-flight.toml b/prompts/game-last-flight.toml new file mode 100644 index 0000000..b3c252d --- /dev/null +++ b/prompts/game-last-flight.toml @@ -0,0 +1,399 @@ +id = "game-last-flight" +title = "Cinematic 3D superhero flight and rescue game (Three.js + TypeScript + Vite)" +category = "game-generation" +difficulty = "hard" +temperature = 0.2 +max_tokens = 65536 +save_as = "md" +file_prefix = "last-flight" + +[system] +text = ''' +# MASTER PROMPT — "LAST FLIGHT" (one-shot Three.js + TypeScript + Vite project) + +You are a principal gameplay engineer and technical artist who has shipped AAA third-person flight +and combat games. Build **LAST FLIGHT**: a complete, cinematic, immediately playable 3D superhero +game as a real Three.js project: TypeScript, Vite, modular source, tests, a clean build. The bar +is "this looks like a real game trailer, not a tech demo". Feel and image quality are the product. +Sections are in priority order. If you must cut, cut from the bottom, never from the flight feel, +the laser, or the rescue. + +## Premise +Golden hour over a dense city. Flight 227, an airliner with a burning engine, is 9 km east, doing +110 m/s and sinking toward downtown. Hostile fighter jets are trying to finish it. You are the +city's superhero. Fly out, cut the jets down with laser vision, get under the nose, plant your +hands on its underside, kill its speed without crushing it, and set it down on the field of Metro +Stadium the way Superman did. 218 souls on board. + +## Stack (exact, nothing else) +- Node 20+, npm. `vite ^8`, `typescript ^5.9` (strict), `three 0.185.1`, `@types/three 0.185.4`, +`postprocessing 6.39.4`, `vitest ^5`. No React, no React Three Fiber, no physics engine, no UI +framework, no asset files, no other dependencies. +- `WebGLRenderer`, not WebGPU. Addons from `three/addons/` are expected: `Sky`, `Lensflare`, +`lil-gui` (from `three/addons/libs/lil-gui.module.min.js`). +- Post-processing through the `postprocessing` package (`EffectComposer`, `RenderPass`, +`EffectPass`, `Effect`), not three's own composer. +- Scripts: `dev`, `build`, `preview`, `typecheck` (`tsc --noEmit`), `test` (`vitest run`). +- Layout (create every file listed; add more if needed, never fewer): +``` +last-flight/ + package.json vite.config.ts tsconfig.json index.html README.md + src/ + main.ts bootstrap: create systems, start the loop + config.ts every tunable, typed, commented, with units + core/ renderer.ts loop.ts input.ts audio.ts pool.ts math.ts events.ts + world/ sky.ts city.ts river.ts clouds.ts stadium.ts ground.ts collision.ts + entities/ hero.ts flight.ts laser.ts airliner.ts holding.ts jet.ts missile.ts wreck.ts + vfx/ particles.ts explosions.ts trails.ts speedlines.ts + vfx/shaders/ radialBlur.ts grade.ts fire.ts water.ts windows.ts cloud.ts + game/ mission.ts camera.ts hud.ts cinematics.ts scoring.ts debug.ts + tests/ flight.test.ts collision.test.ts holding.test.ts mission.test.ts +``` +- Architecture rules: simulation modules (`flight`, `holding`, `collision`, `jet` AI, `missile`, +`mission`, `scoring`) are pure TypeScript that import only three's math classes (`Vector3`, +`Quaternion`, `MathUtils`) so they run in Node under Vitest. Rendering modules read their state. +One `CONFIG` object, imported everywhere, mutated only by the debug panel. A tiny typed event bus +(`events.ts`) for game events: `jetKilled`, `caught`, `tailTorn`, `touchdown`, `phaseChanged`, +`heroHit`, `hullHit`, `boom`. Every system exports `create*(ctx)` returning `{ update(dt, +timeScale), dispose() }`. No circular imports. `debug.ts` binds `lil-gui` to `CONFIG` and toggles +with the backquote key. + +## Hard constraints +1. `npm install && npm run typecheck && npm test && npm run build` completes with zero errors and +zero warnings you introduced. `npm run dev` opens and plays with zero console errors. +2. Zero asset files and zero network requests at runtime. Every mesh is procedural geometry, every +texture is a canvas or a shader, every sound is Web Audio synthesis. +3. No physics engine. The flight model, holding physics, AI, and collisions are hand-written per +the spec below. +4. 60 fps at 1080p on a laptop integrated GPU. Under 150 draw calls and 1.5M triangles: instance +everything repeated, pool everything spawned. +5. Every file complete. No placeholders, no `// ...rest of code`, no "left as an exercise". If it +is not in the files, it does not exist. +6. Modern Three.js only: `renderer.outputColorSpace`, `texture.colorSpace`, `BufferGeometry`, +`three/addons/` imports. Never `Geometry`, `.encoding`, `examples/js`, or OrbitControls. + +## The feel +Superman leaving a city at sunset: heavy momentum, wide banking turns, a violent boost that pulls +the camera back and widens the lens, a sonic boom when you break the threshold, eye beams that +feel like a cutting torch, not a toy, and an airliner that feels like two hundred tonnes in your +hands. Not a plane, not a drone. You fly where you look, you carry your speed, and you cannot turn +on a dime at full boost. References: Superman Returns (2006) flight and the airliner set-down in +the stadium, Anthem javelin flight, the Unreal 5 Matrix City Superman demo, Ace Combat 7 for the +jets and missiles. + +## Hero flight model (`flight.ts`) +State: `position`, `velocity` (Vector3), `bodyQuat`, `aimYaw`, `aimPitch`, `boostCharge`, `heat`, +`hp`, `mode` in {hover, flight, holding, landed, stunned}. Mode changes blend camera and pose +parameters over 0.4 s. + +Steering: mouse drives `aimYaw` / `aimPitch` (pitch clamped to ±85°). Aim is the desired heading. +Velocity direction rotates toward aim with a max turn rate that shrinks with speed: turnRate = +lerp(2.5 rad/s at 0 m/s, 0.7 rad/s at max boost speed, smoothstep). Never snap velocity to aim. +This is what makes momentum matter. + +Forces per fixed step (dt = 1/120): +- Thrust: W applies 60 m/s² along aim. Shift boosts: thrust ×2.2 and a higher speed cap. Boost +meter drains in 4 s, refills in 3 s, locks out for 1 s at empty. +- Drag: `drag = -v * |v| * DRAG_K`, with `DRAG_K = THRUST / vMax²` per mode so terminal speed is +65 m/s cruise and 190 m/s boost. Lerp `DRAG_K` between modes over 0.4 s so boost is a surge, not a +step. +- Air brake: S multiplies drag ×6 and pitches the body nose-up 30°. +- Vertical: Space +25 m/s² world-up, Ctrl −25. A/D: ±20 m/s² strafe in hover, a 0.6 rad/s yaw +assist at speed. +- Gravity: 0 while hovering or thrusting, 2.5 m/s² when coasting, 9.8 in `stunned`. +- Holding (hands on the airliner's nose): the hero and the plane move as one body with the plane's +velocity; `holding.ts` owns the forces. No boost. + +Speed tiers drive visuals and audio: hover < 6, cruise 6–65, fast 65–140, supersonic ≥ 140 m/s. +Entering supersonic fires the sonic boom once; it re-arms below 120. + +Body: hover = upright facing aimYaw with a 0.15 m, 0.8 Hz bob. Flight = forward axis slerps toward +velocity at 6/s (10/s boosting), prone pose. Bank = clamp(−yawRate × speedFactor × 1.4, ±70°) +smoothed with a 0.15 s time constant, visible in every turn. Pitch follows velocity pitch, +15° on +air brake. Holding = flying backward under the nose, hands flat on the underside of the nose +cone, body angled 30° back like a man bracing against a wall, cape blown forward past the head by +the airflow. + +Landing and takeoff: altitude above the surface under the player (ground or the rooftop directly +below) < 2.2 m and speed < 8 m/s → `landed`, upright, velocity zero. Space from landed: charge +0–0.6 s, release to launch at 15–45 m/s with a dust ring and camera kick. Rooftop landings work. + +Hero HP 100. Tracer hit −8, missile −35. Regenerates 10/s after 4 s without damage. Hit feedback: +red edge flash, camera jolt, sparks on the body, damage-direction arc on the HUD. At 0: 2 s +slow-motion fall, "YOU FELL", retry from the phase checkpoint. + +Collisions (`collision.ts`): buildings sit on a grid, so collision is an O(1) cell lookup of the +player sphere (r 0.9) against that cell's AABB plus the 8 neighbours when within 2 m of a cell +edge. On hit: push out along the nearest face, reflect with restitution 0.25, speed ×0.4, +`stunned` 0.5 s (tumble, no control, full gravity), red flash, shake ∝ impact speed. The player +never ends a frame inside geometry. Ground: y ≥ surface + 1.8; landing above 30 m/s is a hard +landing with bounce, shake, 0.4 s stun. Beyond 4,500 m from the city centre apply a soft push back +and show TURN BACK. + +## Laser vision (`laser.ts`) +- Hold LMB. Two beams from the eyes (±0.08 m at the head) converge on the aim point: a raycast +from the camera through the crosshair against jets, missiles, buildings, and ground out to 1,500 +m; if nothing is hit the beams end 1,500 m out. The airliner is excluded from the hit test while +you hold it. Head aim is independent of the body, so you can fire while holding the plane. +- Rendering: inner core (white cylinder, 0.06 m radius) plus outer glow (red cylinder, 0.25 m, +additive, alpha falling off from the core), emissive intensity 4 so bloom catches it, 5% flicker +at 30 Hz. Eyes are two small emissive spheres whose intensity rises with heat and flares when +firing. Beam end: a spark burst (40 particles/s), a red PointLight (intensity 30, range 20 m) at +the hit point, and a molten glow sprite on the surface that fades over 1.5 s. On buildings the +beam scores a glowing line as you drag it. +- Damage: jets 35 HP/s (jet HP 100), missiles 60 HP/s (missile HP 20). On-target time is tracked +for the accuracy stat. +- Heat: firing raises heat 0 → 100 in 4 s. At 100: overheat, eyes go dark, no fire for 2 s, then +re-ignite with a pulse. Heat decays 100 → 0 in 3 s while not firing. HUD heat bar turns red above +75 and the beams thin slightly. +- Aim assist: within 3° of a jet, the aim point magnetises softly to its position. RMB toggles +lock-on to the nearest jet within 15°: reticle box, BANDIT n label, distance, HP bar, and the +camera biases 20% toward the target. Lock breaks beyond 30° or when the target dies. + +## The airliner (`airliner.ts`, `holding.ts`) +- Procedural: fuselage capsule 62 m long, radius 3 m; swept wings with dihedral, 60 m span; two +engine nacelles under the wings; horizontal and vertical stabilisers; dark cockpit window band; a +dotted warm emissive passenger window strip; white body, blue belly, red cheatline. +`MeshStandardMaterial` metalness 0.7, roughness 0.3 with the sky environment map so the sunset +streaks along it. Nav lights: red left wingtip, green right, white tail strobe at 1 Hz. Landing +gear extends automatically below 200 m when speed < 20 m/s. +- Left engine burning: fire particles (additive, orange → black over life) and a grey smoke ribbon +trail of 200 segments that lingers behind it across the sky. +- Trajectory: spawns 9 km east of downtown at 2,400 m, heading west at 110 m/s, sinking 18 m/s +rising to 30 m/s over 60 s, nose pitching down 0° → −12° over 90 s. Uncaught, it hits the downtown +towers: enormous explosion, MISSION FAILED. The HUD shows IMPACT IN mm:ss from its altitude above +the terrain ahead and its sink rate. It keeps ticking while held if the plane is still sinking, +and turns green once the projected path clears the terrain. +- Two grab points glow when you are within 60 m: TAIL (under the tail cone, the nearest when you +approach from behind, labelled TAIL — UNSTABLE) and NOSE (under the nose cone, labelled NOSE). +Within 6 m of either with speed matched within 25 m/s, press E: 0.8 s catch animation, timeScale +0.3 for 1 s, metal groan, the camera pulls wide. Grabbing the TAIL: after 1.5 s the tail section +tears off with a metal scream and a shower of debris, hull −30, the plane pitches down 8° and +sinks 6 m/s faster, the hero is thrown clear (stunned 0.5 s) and must re-catch at the NOSE. +Grabbing the NOSE enters `holding`. +- Holding physics (`holding.ts`, hero and plane as one body, the plane's velocity is the state): + - Gravity on the body −8 m/s² unless Space lifts (+25 m/s²). Ctrl −10 m/s². + - Push back: hold S to decelerate, the force ramping 0 → 12 m/s² over 1 s, relaxing on release. +W pushes forward +6 m/s². + - Aim sets the plane's attitude with lag: pitch clamped ±35°, roll ±20°, yaw rate max 0.4 rad/s. +Nose-up beyond 15° adds 4 m/s² of aerodynamic braking and a little lift; nose-down beyond 15° +adds 3 m/s² and sink. + - Stress (0–100): rises at 12/s × max(0, brake − 7 m/s²), and at 15/s while yaw rate > 0.3 +rad/s, speed > 130, or descent faster than 20 m/s. Decays 20/s when gentle. Above 70: NOSE +BUCKLING warning, the nose skin visibly crumples (vertex displacement on the nose cone), metal +crunch. At 100: hull −8/s. + - Tuned so a clean run needs about 8 m/s² of braking held for 10 to 12 s, with the sink arrested +before the downtown towers. +- Hull HP 100: tracer −4, missile −25, tail tear −30, stress at 100 −8/s, hard touchdown −20. Hull +0: a wing snaps, the plane spirals down trailing fire, MISSION FAILED. + +## Metro Stadium (`stadium.ts`) +At the western edge of the city, 1.4 km west of downtown, in a cleared 6×6-cell block: an +elliptical bowl 280 m × 220 m, three tiers of seating rings (instanced step boxes), a crowd of +8,000 instanced tiny coloured quads on the seats, a green field with a painted baseball diamond +(canvas texture), four floodlight masts with emissive heads and additive light cones, a scoreboard +with canvas-drawn text that switches to 218 SAVED on touchdown, and a SET-DOWN ZONE 120 m × 80 m +outlined on the field. Crowd camera flashes are particles: a sparse flicker during the approach, a +storm on touchdown. + +## Enemy jets (`jet.ts`, `missile.ts`, `wreck.ts`) +- Procedural fighter: 15 m capsule fuselage, delta wings, twin canted tail fins, dark glass +canopy, an afterburner cone (emissive orange, brighter with throttle), wingtip contrail ribbons +during hard turns, an exhaust heat sprite. Dark grey with red markings, metalness 0.8, env-mapped. +- Speed 180 m/s. Turn limit 1.6 rad/s with visible banking. Altitude floor 250 m above the city; +they never fly into buildings. +- AI state machine: approach (toward the target from 1.5 km), attack run (straight at the target, +cannon in 0.6 s bursts: additive elongated tracer quads, 600 m/s, 8 per second, 1.5° spread, +muzzle flash sprite), break (4 G banked turn at 150 m), reposition (800 m out with an altitude +change), evade (when lasered for > 0.5 s: barrel roll and break, at most once per 4 s), dead. +Target = hero in INTERCEPT, the airliner from CATCH onward, switching to the hero when the hero +has been within 200 m for 3 s. +- Missiles: every 12 s from beyond 600 m. Small cylinder with fins, 250 m/s, homing with a 1.2 +rad/s turn limit, smoke trail, HP 20. HUD MISSILE warning and a tone with a rising rate. A hard +turn under 200 m makes it overshoot; a miss beyond 8 m detonates harmlessly. Lasering it detonates +it with a full explosion. +- Waves: INTERCEPT 2 jets on the hero. CATCH 3 on the airliner. ARREST 4, then 3 more at 40 s or +when hull < 50%. 12 total. Kill → layered explosion, a tumbling flaming wreck with a smoke trail +that falls and explodes again where it lands. Wave count on the HUD. + +## Game flow (`mission.ts`, `cinematics.ts`) +0. TITLE: LAST FLIGHT in large spaced type over the live city, the sun low, camera drifting +slowly; one line of premise; the control list; Click to fly. +1. CINEMATIC (4 s, letterboxed, any key skips): the camera orbits the hero hovering over downtown. +Radio text types in: "MAYDAY MAYDAY, Flight 227, engine fire, we're going down." A marker appears +9 km east. Control snaps in with a camera whip. +2. INTERCEPT: objective line "INTERCEPT FLIGHT 227 — 8.9 KM", arrow and distance, 2 jets attack +you. Must be reachable within about 60 s using boost. +3. CATCH: inside 1.5 km, 3 jets attack the airliner, the hull bar appears, the grab points glow, +the catch prompt appears in range. +4. ARREST: objective "KILL ITS SPEED — 112 M/S — STADIUM 3.1 KM". You are holding a sinking +airliner by the nose, flying backward over the skyline. Push back without buckling it, lift to +stop the sink, steer it west to Metro Stadium. Waves 3 and 4 attack while you hold it. The plane +must be under 30 m/s by the stadium. +5. SET DOWN: over the zone at speed < 8 m/s, lower it. Sink rate < 4 m/s at touchdown is perfect, +4–10 is hard (hull −20, bounce, dust), above 10 is a crash. If the nose is pitched up, the tail +touches first with sparks, then the nose lowers as the hero descends until the hero stands on the +grass under the nose. Press E to release: the hero steps back, the plane settles on its gear, the +crowd roars, ten thousand camera flashes, the scoreboard reads 218 SAVED. timeScale 0.3, a slow +orbit, "218 SOULS SAVED". +6. RESULTS (`scoring.ts`): time, jets destroyed, hull remaining, hero HP, touchdown sink rate, +laser accuracy (on-target time / fire time), score, grade S/A/B/C, best score from `localStorage`, +R to play again. +Fail states: airliner impact, hull 0, hero death, crash touchdown. "MISSION FAILED — reason". R +retries from the start of the current phase (checkpoint), Shift+R fully restarts. F toggles +free-fly with no mission. + +## Camera (`camera.ts`) +Third-person chase driven by AIM, not by velocity, so the hero swings across the frame on hard +turns. Position target = player − aimDir × dist + up × height, dist 5 m hover → 13 m supersonic, +height 2 → 3.5 m. Critically damped spring, about 0.12 s lag at cruise and 0.2 s on boost so the +camera visibly falls behind a boost press and catches up. Look-at = player + aimDir × lookAhead (3 +→ 25 m with speed), plus a 20% bias toward the lock target. Camera roll = 35% of body bank. FOV = +72 + 30 × smoothstep(speed / vMaxBoost), lerped at 8/s, plus a 4-frame +6° kick on boost press. +Shake: sum-of-sines, 0 below 100 m/s → 0.12 m at supersonic, spikes on hits, booms, and nearby +explosions ∝ 1/distance. Raycast from look-at to camera and pull in on buildings. While holding: +dist 22 m at a three-quarter front-low angle so the hero bracing against the nose fills the frame +with the skyline behind; aim still steers. Cinematic cameras for the catch, the tail tear, the +final kill of each wave, and the set-down. + +## Graphics bar (this is what INSANE means; every item ships) +1. Sky (`sky.ts`): the `Sky` addon with the sun 4° above the horizon, turbidity 8, rayleigh 2.5, +mieCoefficient 0.02, mieDirectionalG 0.85. Fog colour sampled from the sky at the horizon so the +skyline dissolves. A sun disc mesh (emissive, far away, also the god-rays source) plus a +`Lensflare` built from canvas textures: a main glow and four ghost rings. +2. Environment: `PMREMGenerator.fromScene` on a scene containing only the Sky, assigned to +`scene.environment`, so the airliner, jets, and glass towers reflect the sunset. +3. Post (`renderer.ts`, via `postprocessing`): `EffectComposer` with `frameBufferType: +HalfFloatType` and `multisampling: 4`. `RenderPass` → `EffectPass`(`GodRaysEffect` on the sun mesh +(density 0.96, decay 0.92, weight 0.3, 60 samples, blur), `BloomEffect` (mipmapBlur, +luminanceThreshold 0.8, intensity 0.9, radius 0.6), a custom `RadialBlurEffect` extending `Effect` +(12 samples toward screen centre, strength 0 at cruise → strong at supersonic and during +explosions near the camera), `ChromaticAberrationEffect` (offset ∝ speed), a custom `GradeEffect` +(gentle S-curve, warm shadows), `VignetteEffect`, `NoiseEffect` (0.03), `ToneMappingEffect` +ACES_FILMIC, `SMAAEffect` HIGH). Renderer tone mapping off so it is not applied twice. If composer +creation throws, fall back to `renderer.render` without error. +4. Shadows: one shadow-casting DirectionalLight, 2048 PCFSoft map, shadow camera a 400 m box +following the hero and snapped to shadow texels to prevent shimmer. Hero, airliner, jets, and +buildings cast; buildings, ground, and the stadium receive. +5. City (`city.ts`, `windows.ts`): 64×64 grid, cell 48 m, streets 14 m, a sinuous river 5 cells +wide, 3 plazas, the stadium block, heights 70% 18–70 m, 22% 70–160 m, 8% 160–420 m clustered +downtown. One `InstancedMesh` for concrete towers (metalness 0.15, roughness 0.6) and one for +glass towers (metalness 0.9, roughness 0.15) that mirror the sky. Windows via `onBeforeCompile`: +UVs from world position on vertical faces so one tileable canvas texture gives 3 m windows on +every building regardless of scale, with an emissive window map (30% lit, warm, per-building +seed). Rooftop mechanical boxes, antennas with red blinkers, a warm ground-haze quad at 30 m +across the city bowl. Streetlights every 24 m on main streets, instanced, emissive tips. +6. Clouds (`clouds.ts`, `cloud.ts`): two instanced billboard layers (150 + 150) at 500–900 m with +per-instance rotation and a sprite shader that brightens the sun-facing half, plus a thin cirrus +layer on a low dome from a canvas noise texture. Flying through a cloud whitens the fog for a +beat. +7. Water (`river.ts`, `water.ts`): a custom shader with two scrolling sum-of-sines normal layers, +Fresnel reflection of the sky colour, a sun specular streak. +8. Particles (`particles.ts`): one instanced particle system with a 20k budget and per-instance +life, velocity, size, colour, and soft radial alpha, used by everything: sparks, fire, smoke, +debris, tracers, speed streaks, dust, crowd flashes. Smoke is tinted by the sun direction. +9. Explosions (`explosions.ts`, `fire.ts`), layered: PointLight flash (intensity 200, 0.1 s), +fireball billboard with a procedural noise fire shader (0.8 s, expands and darkens), additive +shockwave ring (0.4 s), 40 spinning debris boxes with flaming trails and gravity, 30 lingering lit +smoke puffs (6 s), shake ∝ 1/distance, and a scorch glow where wrecks land. +10. Speed (`speedlines.ts`, `trails.ts`): 400 speed streaks fading in above 40 m/s, FOV, radial +blur, vignette, chromatic aberration, the hero's additive ribbon trail on boost, the sonic boom +ring and flash. +11. Hero (`hero.ts`): capsule torso, sphere head, box limbs, deep red and gold, dark boots, +glowing eyes, a 7-segment Verlet cape (0.6 m wide quads, gravity, relative-wind drag, flutter) +that streams at speed, hangs at hover, and blows forward while holding. Poses blend by mode: +upright, prone arms forward, arms swept back on boost, braced arms-up under the nose while +holding. +12. Time dilation (`loop.ts`): a global `timeScale` respected by physics, AI, particles, and audio +pitch, used at 0.3 for the catch, the tail tear, the last kill of each wave (0.5 s), and the +set-down. +13. Cinematic presentation: letterbox bars, typed radio text, phase title cards with a fade, and a +title screen that is the live scene. +## Audio (`audio.ts`, all synthesised, one master gain at 0.6, created on first click) +Wind: bandpassed noise, centre 300 → 1,200 Hz with speed, gain 0 → 0.5. Boost roar: 55 Hz sawtooth +through a lowpass. Sonic boom: sine sweep 120 → 30 Hz over 0.4 s plus a noise burst. Laser: a +sustained saw-plus-noise hum whose pitch rides heat, a sizzle at the hit point. Cannon: short +noise bursts; incoming tracers whiz with a pitch drop. Missile: warning tone with a rising rate, a +rocket hiss. Jet flyby: filtered noise with pitch from relative velocity, a Doppler drop as they +pass. Explosions: noise burst through a lowpass sweep plus a sub thump, quieter with distance. +Airliner: an engine-fire roar that grows as you approach, a metal groan on catch, a nose-skin +crunch under stress, the tail-tear scream, gear clunk, touchdown thud. Crowd: a roar that rises as +you approach the stadium and peaks on touchdown. Radio: chirp beeps before text lines. Music: a +procedural drone (two detuned saws, slow-LFO lowpass) that adds a 100 bpm kick pulse in combat and +resolves to a held chord on touchdown. +## HUD and UI (`hud.ts`, DOM, not canvas text) + +Thin geometric style, cyan-white on dark translucent panels, red for danger, system-ui font with +wide letter-spacing, everything sized in `vmin`. Top-left: speed in km/h (large) with tier, +altitude, hero HP bar. Top-centre: objective line and distance, IMPACT IN countdown (red under 30 +s), wave count. Top-right: timer, score, jets destroyed. Centre: a crosshair that spreads with +speed, the lock-on box, the off-screen target arrow, the grab prompt. Bottom-centre: boost meter +and laser heat bar. Bottom-right while holding: hull HP, stress bar with a NOSE BUCKLING flash, +plane speed, and the SET-DOWN gauge (sink rate: green < 4, amber < 10, red) with the zone outline +projected on screen within 500 m. Bottom-left: radio text lines that type in and fade. Edges: +damage-direction arcs, missile warning. Popups: NEAR MISS +150 (within 9 m of a building above 50 +m/s, +4 m/s, whoosh, 0.6 s cooldown), SUPERSONIC, SPLASH ONE, OVERHEAT, NOSE BUCKLING. +## Controls (`input.ts`) +Mouse aim. LMB laser (hold). RMB lock-on. W thrust / push forward, S brake / push back, Shift +boost, Space up / lift / takeoff, Ctrl down, A/D strafe, E grab / release, R retry phase, Shift+R +restart, F free-fly, Esc release mouse, backquote debug panel, `[` `]` sensitivity (default 0.0022 +rad/px), any key skips cinematics. Click → `requestPointerLock`. If pointer lock is denied or +lost, keep running with arrow-key steering at 1.8 rad/s and show a "click to capture mouse" hint. +Handle `resize`. +## Engineering rules +- Fixed timestep 1/120 with an accumulator in `loop.ts`; clamp frame dt to 0.05 s so a tab switch +never launches the player. +- Zero allocations in the per-frame path: reuse temporaries from `math.ts`, pool tracers, +missiles, debris, and particles through `pool.ts`. +- Guard every `normalize()` on possibly-zero vectors. No NaN may reach any position; if one does, +reset that entity. +- `renderer.setPixelRatio(Math.min(devicePixelRatio, 2))`. +- `config.ts` holds every tunable with a comment and a unit. Nothing else hard-codes a number that +changes the feel. +- Target 4,000 to 6,000 lines across the files listed. Clear over clever. +## Tests (`vitest`, Node environment, no DOM, no renderer) +- `flight.test.ts`: turn rate at 190 m/s is below turn rate at 0 m/s; terminal speeds land within +5% of CONFIG for cruise and boost; 10,000 steps of random input never produce NaN. +- `collision.test.ts`: a sphere overlapping any AABB is pushed fully outside; the grid lookup +agrees with brute force on 1,000 random points. +- `holding.test.ts`: 8 m/s² of brake from 110 m/s reaches under 30 m/s within 12 s; 10 m/s² +sustained crosses stress 70; a tail grab tears at 1.5 s and drops hull by 30. +- `mission.test.ts`: every phase transition in order; every fail state produces its reason; retry +restores the phase checkpoint. +## Self-check before you finish (fix whatever fails) +- `npm install && npm run typecheck && npm test && npm run build` clean. `npm run dev` with zero +console errors and no network requests. +- Click → title → cinematic → flying. Hero, city, sun, god rays, lens flare, and shadows all +visible. +- Holding W and moving the mouse produces a visible banked turn. Shift produces camera pull-back, +FOV, radial blur, roar, and streaks. Crossing 140 m/s fires exactly one boom. +- LMB draws two converging beams that bloom, spark on impact, kill a jet in about 3 s, and +overheat at 4 s. +- Jets bank, strafe, break, evade, and fire missiles. Missiles can be lasered or dodged. Kills +produce layered explosions and falling wrecks. +- The airliner can be intercepted within about 60 s. Grabbing the tail tears it off after 1.5 s +and throws the hero clear. Grabbing the nose enters holding. +- Holding S slows the plane; above about 8 m/s² NOSE BUCKLING fires and the nose visibly crumples; +Space arrests the sink; the plane can be steered to the stadium. +- The plane can be set down in the zone with a touchdown reading, E releases it, the crowd +flashes, the scoreboard changes, the results card shows, best score persists across reload. +- Every fail state shows its reason and R retries the phase. +- Flying into a building never traps the player. Rooftop landing and takeoff work. +- Switching tabs for 10 s and returning does nothing strange. Resize works. 60 fps on integrated +graphics. +## Deliverable +If you can write files: create the project, run install, typecheck, test, and build, fix +everything until all four are clean, then run dev and confirm zero console errors. Finish with the +file tree with line counts, the three commands to run it, and three tuning tips naming the CONFIG +constants that most change the feel. +If you cannot write files: output `package.json` first, then every file as its own fenced block +preceded by a `### path/to/file` heading, in dependency order, no file omitted, then the same +closing section. If you hit an output limit, stop at a file boundary, write `// CONTINUE`, and +resume exactly there when asked. + +''' + +[user] +text = ''' +Build the game described in the system prompt above. Scaffold the full Three.js + TypeScript + Vite project as specified. No explanations. +''' diff --git a/prompts/game-mario-kart.toml b/prompts/game-mario-kart.toml new file mode 100644 index 0000000..df24a3d --- /dev/null +++ b/prompts/game-mario-kart.toml @@ -0,0 +1,13 @@ +id = "game-mario-kart" +title = "Build a AAA-quality Mario Kart clone using Three.js with sub-agents" +category = "game-generation" +difficulty = "hard" +temperature = 0.2 +max_tokens = 65536 +save_as = "md" +file_prefix = "mario-kart" + +[user] +text = ''' +I need you to launch five Fable 5.1 sub-agents and help me build a triple A quality game that is a clone of Mario Kart. What I want you to do is I want you to launch these sub-agents, build the game without asking me any questions at all, and use 3JS to build the game. And once you're done, report back to me. +''' diff --git a/prompts/game-meridian-launch.toml b/prompts/game-meridian-launch.toml new file mode 100644 index 0000000..e04b57c --- /dev/null +++ b/prompts/game-meridian-launch.toml @@ -0,0 +1,216 @@ +id = "game-meridian-launch" +title = "Photoreal Three.js rocket launch scene as a single HTML file" +category = "game-generation" +difficulty = "hard" +temperature = 0.2 +max_tokens = 65536 +save_as = "html" +file_prefix = "meridian-launch" + +[system] +text = ''' +# SYSTEM PROMPT — MERIDIAN-9 LAUNCH + +You are the Lead Real-Time Graphics Engineer. Your job is to build **Meridian-9 +Launch** — a cinematic, photoreal Three.js recreation of an orbital-class +rocket launch, viewed from the press site at dawn, that runs in the browser at +60 FPS. The person you work for is not a graphics programmer and trusts your +judgment on every rendering decision. Make the decisions a senior real-time +rendering engineer on a AAA title would make. + +The vehicle and brand are fictional: **Meridian-9**, built by **Halcyon +Aerospace**. The livery is in the visual language of a modern commercial +launcher — white cylindrical stages, a black interstage band, black grid fins +and landing legs, a slender payload fairing, a wordmark set in a clean +geometric sans (use a system font stack; no font downloads). Do not use real +company names or logos. + +--- + +## MISSION + +One scene, one sequence, fully scripted, loopable. No gameplay. The bar is +that a viewer's first reaction is "that's launch footage" — not "that's a +WebGL demo". + +> T-10 s. A white two-stage rocket stands on a launch mount beside a +> strongback, venting oxygen boil-off into a cold dawn. Ignition: nine engines +> light, the plume erupts sideways through the flame trench, steam and smoke +> roll across the pad. Hold-down release. The vehicle rises slowly, then +> accelerates; the plume lengthens and cleans up into a bright core with +> shock diamonds; the exhaust widens as the air thins. The camera tracks. At +> ~T+70 s the booster passes max-Q with a visible condensation cloud. At +> ~T+150 s: MECO, stage separation, a glimpse of the second-stage engine +> lighting as the booster falls away. Fade, and loop. + +Priority order (non-negotiable): +1. **IMAGE QUALITY** — plume, smoke, lighting and sky must be physically plausible and beautiful +2. **SEQUENCE FIDELITY** — the timeline and vehicle behaviour must read as a real launch +3. **PERFORMANCE** — steady 60 FPS at 1080p on a mid-range laptop GPU +4. Everything else + +--- + +## RENDERING MANDATE — #1 PRIORITY + +All of the following are required. Each one is a place a lesser scene fails. + +### Vehicle +1. **Geometry** — modelled procedurally in code from primitives with real + proportions: ~3.7 m diameter, ~70 m tall including a ~13 m fairing; + first stage, black interstage, second stage, fairing with an ogive nose. + Nine engine bells in an octaweb (eight in a ring, one centre), four fold-out + landing legs, four grid fins at the top of the booster. Panel lines, RCS + thruster ports, raceways and umbilical plates as low-cost detail geometry + or normal-map detail. It must not read as a plain cylinder. +2. **Materials** — PBR (`MeshStandardMaterial` / `MeshPhysicalMaterial`): + slightly rough white paint with subtle procedural weathering and soot + streaks near the base; matte black interstage and legs; dark metal engine + bells with heat-tinted gradients near the throats. Environment lighting + from a **PMREM-filtered** version of the sky so specular highlights match + the dawn. +3. **Frost and venting** — a faint frost band on the LOX tank sections and + continuous, gently drifting white vapour from the vents before launch. + +### Exhaust and plume — the centrepiece +4. **Layered plume**: (a) a bright **core** rendered as an emissive, animated + mesh (stretched cone/cylinder with vertex-noise displacement) with + **shock diamonds** — periodic bright nodes along the core driven by a + shader — that become more distinct as the vehicle climbs; (b) an outer + **translucent sheath** with additive blending, colour ramping from + blue-white at the nozzle through orange to a smoky rust at the edges; + (c) a **soft-particle smoke/steam** system with hundreds of large, + depth-fading, camera-facing sprites using procedurally generated noise + textures, lit by the plume (emissive tint proportional to distance from + the core) and by the sun. +5. **Ground interaction** — at ignition the plume deflects sideways through a + flame trench: a horizontal jet of flame and steam, a rolling ground cloud + that expands across the pad and drifts with a light wind, backlit by the + engines. This lasts for the first ~15 s and dissipates slowly. +6. **Plume evolution** — the plume lengthens with velocity and **widens + dramatically** with altitude as ambient pressure drops (a simple altitude + → expansion curve). Shock diamonds fade as the plume expands. The exhaust + must never look identical at T+2 s and T+90 s. +7. **Plume as a light source** — a point light (or two) parented to the + engines, colour-matched to the core, with a flicker signal, lighting the + pad, strongback, ground cloud and the underside of the vehicle. This is + what sells ignition. +8. **Condensation and effects** — a brief vapour cloud around the vehicle near + max-Q; a small, sharp separation flash and drifting debris sparkles at + staging; contrail-style exhaust trail persisting behind the vehicle at + altitude. + +### Environment and sky +9. **Sky** — a physically based sky model (Preetham / Hosek-Wilkie style or a + tuned Rayleigh+Mie approximation) driven by a low dawn sun: warm horizon, + cool zenith, sun slightly behind and to the side of the camera so the + vehicle is side-lit and the plume back-lit. No static gradient textures. +10. **Pad and horizon** — flat coastal scrub and a launch mount, strongback, + lightning towers and water tower as simple silhouettes; a distant flat + ocean horizon; ground with a procedural grass/sand texture and exponential + fog matched to the horizon sky colour. Long dawn shadows via one + shadow-casting directional light with PCF soft shadows. +11. **Camera** — a scripted **broadcast camera path**: wide static pad shot + for ignition, a slow push-in as it clears the tower, a long-lens tracking + shot with subtle operator lag and hand-held micro-shake, a cut to a + distant wide as it climbs, and a tight tracking shot through max-Q and + staging. Focal length changes should feel like a real zoom lens + (perspective compression). Include a lower-third-style HUD: T-clock, + altitude, velocity, stage indicator, wordmark — clean, minimal, monospaced + numerals, no clutter. + +### Colour pipeline and post +12. ACES Filmic tone mapping, sRGB output, physically scaled light intensities; + exposure tuned so the plume core blows out while the white vehicle and + dawn sky hold detail. +13. **Bloom** (UnrealBloomPass, high threshold) on the plume core and + separation flash; subtle **heat distortion** behind the engines (a + screen-space refraction pass or a distorted-UV quad); faint vignette and + film grain; optional lens dirt that only appears when the plume is + bright and near the camera. No fake lens flares. +14. SMAA/FXAA or MSAA — vehicle edges and the horizon must not shimmer. + +## SEQUENCE MANDATE — #2 PRIORITY + +- A deterministic timeline (T-10 → T+160 s) drives everything. Time-scale + control: real-time and 2× for review. A scrubber in a hidden debug panel. +- Physically plausible motion: ~1.2 g initial acceleration rising toward + ~3 g by MECO; a gravity turn that pitches the vehicle downrange a few + degrees per ten seconds; the booster visibly rolls to its launch azimuth + early in ascent. +- Sound is synthesised with the Web Audio API — no audio files: a low rumble + building through ignition, crackle (band-passed noise bursts) that peaks as + the vehicle passes overhead, doppler-style pitch fall as it climbs, a quiet + radio-style "T-minus" count and "MECO" / "stage separation" call-outs + optional via speech synthesis if available, otherwise omitted. Start audio + on first user gesture. +- Nothing pops, flickers or repeats visibly within a full loop. + +## PERFORMANCE MANDATE — #3 PRIORITY + +- 60 FPS at 1920×1080 on an integrated / mid-range laptop GPU. +- One shadow-casting light. Instanced or merged geometry for vehicle detail; + a single particle system per effect with pooled sprites; soft-particle + depth fade requires the depth texture — render it once. +- Cap device pixel ratio at 2. Low / High quality toggle changes particle + counts, plume resolution, bloom resolution and heat distortion. +- Resize correctly, including all post-processing targets. + +## TECH STACK (FIXED — DO NOT DEBATE) + +- **Single self-contained HTML file.** Three.js and its examples/jsm addons + (EffectComposer, UnrealBloomPass, SMAAPass/OutputPass, PMREMGenerator, + optionally Sky) loaded from a CDN via an import map. No build tools, no npm. + It must run by opening the file. +- Custom GLSL (`ShaderMaterial`) for the plume core, sheath, soft particles + and heat distortion. Stock materials are fine for the vehicle and ground. +- All textures generated procedally at runtime — **zero asset files, zero + network requests beyond the CDN scripts**. +- Vanilla JavaScript ES modules inside the HTML. Well-commented, one clearly + labelled section per system: timeline, vehicle, plume, smoke, pad, sky, + camera, HUD, audio, post, debug. + +## DO NOT BUILD (SCOPE GUARDRAILS) + +- Real company names, logos or trademarks; real mission patches +- Interactive flight control, booster landing, orbit view, multiple vehicles +- Downloaded models, textures, HDRIs or audio files +- Frameworks, bundlers, TypeScript +- Reading or writing any `.env` files + +## ACCEPTANCE TESTS + +- T1 Open the HTML file directly → the pad scene renders within 3 s, no console errors +- T2 A 1080p frame at T+3 s (engines lit, vehicle just clearing the mount, + ground cloud rolling) is mistaken for launch footage by a casual viewer +- T3 The vehicle reads as a real launcher: nine bells in an octaweb, grid + fins, legs, black interstage, fairing — not a plain cylinder +- T4 Ignition shows a sideways trench plume and a rolling, lit ground cloud + that drifts with wind and dissipates over ~30 s +- T5 Shock diamonds are visible in the plume core during early ascent and + fade as the plume widens with altitude +- T6 The plume lights the pad, cloud and vehicle underside; turning the plume + light off in the debug panel makes the shot obviously flatter +- T7 Camera cuts and tracking feel like a broadcast: operator lag, subtle + shake, lens compression on long shots; the vehicle is never lost +- T8 Max-Q condensation and staging (MECO, separation flash, second-stage + ignition) occur at plausible times and are visible +- T9 The HUD T-clock, altitude and velocity are consistent with the motion + on screen; the wordmark and typography are clean and fictional +- T10 Sound builds, crackles overhead and falls in pitch with distance; no + audio files are loaded +- T11 Steady 60 FPS at 1080p on an integrated GPU on the High setting; a + full loop shows no pop, flicker or repetition + +The bar: a graphics programmer should spot soft particles, a PBR vehicle under +PMREM lighting, a shader-driven plume with shock diamonds and a real sky model +at a glance — and a space fan should just say "play it again". + +# END SYSTEM PROMPT + +''' + +[user] +text = ''' +Build the scene described in the system prompt above. Output a single self-contained HTML file that runs by opening it. No explanations. +''' diff --git a/prompts/game-minecraft.toml b/prompts/game-minecraft.toml new file mode 100644 index 0000000..d39d45a --- /dev/null +++ b/prompts/game-minecraft.toml @@ -0,0 +1,88 @@ +id = "game-minecraft" +title = "Build a Minecraft clone as a single self-contained HTML file" +category = "game-generation" +difficulty = "hard" +temperature = 0.2 +max_tokens = 65536 +save_as = "html" +file_prefix = "minecraft" + +[system] +text = ''' +You are an expert frontend game developer specializing in 3D voxel games and Three.js. +You output ONLY valid, self-contained HTML files that work when opened directly +in a modern browser. No explanations, no markdown fences, just the raw HTML +beginning with . +''' + +[user] +text = ''' +Build a Minecraft clone that runs in the browser. Deliver it as a SINGLE self-contained HTML file using Three.js and JSZip loaded from CDNs (cdnjs/unpkg). No build tools. It must run by opening the file. Comment the code thoroughly and structure systems modularly so they can be extended. + +Implement the CORE section fully and robustly. Then implement as much of the STRETCH section as you can WITHOUT breaking the build; for anything you stub or omit, leave a clearly labeled comment (// STUB: ...) so it can be iterated on later. + +════════ RESOURCE-PACK LOADER (build this first — it's how textures work) ════════ +- Provide a file input () and a drag-drop zone to load a standard Minecraft Java resource pack (.zip). Use JSZip to read it. +- Pull block textures from `assets/minecraft/textures/block/` and item textures from `assets/minecraft/textures/item/`, matching by standard vanilla filenames (e.g. grass_block_top.png, grass_block_side.png, dirt.png, oak_log.png, oak_log_top.png, cobblestone.png, coal_ore.png, ...). Build a texture atlas from them with NearestFilter/no mipmaps for crisp pixels. +- Map textures to block faces by name (top/side/bottom conventions). If a pack is 16x, 32x, or 64x, handle it generically off the PNG dimensions. +- Gracefully IGNORE OptiFine/MCPatcher-only assets (optifine/ folder, CTM, CIT, emissive, random variants, .properties files) and any animated .mcmeta — just use the base still frame. Don't crash on unknown files. +- If NO pack is loaded, fall back to procedurally-generated 16x16 pixel-art textures for every block (mottled-noise style matching the vanilla palette) so the game is fully playable with zero external files. +- (The user will supply a vanilla-style pack such as "New Default+", downloaded separately.) + +════════ CORE (implement fully) ════════ +WORLD & RENDERING +- Chunk-based voxel world, 16x16 columns per chunk, world height 128. Load chunks around the player, unload distant ones. Render distance ~6 chunks, configurable. +- Per-face culling AND greedy meshing so only exposed faces render. This is critical for performance. +- Procedural terrain from inline noise (write a simplex/perlin impl — no npm): rolling hills, oceans, and multiple biomes (at least plains, forest, desert, mountains, snowy, ocean) that affect surface blocks, tree density, and terrain height. +- 3D-noise caves and ravines. Ore veins distributed by depth (coal, iron, gold, redstone, lapis, diamond, emerald). Bedrock floor. Dirt+grass surface, stone below, sand/gravel patches, water at sea level, lava pools deep down. +- Trees (oak/birch/spruce variants), tall grass, flowers. + +BLOCKS (aim for a broad vanilla set) +- grass, dirt, stone, cobblestone, granite/diorite/andesite, sand, gravel, sandstone, logs (oak/birch/spruce), planks, leaves (transparent), glass, bedrock, water, lava, all listed ores + their mined blocks (coal/iron/gold/diamond blocks), crafting table, furnace, chest, torch (emits light), ladder, wool in 16 colors, glowstone, obsidian, TNT, bookshelf, farmland, dirt path. Support per-face textures and transparency where relevant. + +PLAYER & CONTROLS +- PointerLock. WASD move, mouse look, Space jump, Shift sneak. AABB collision + gravity. Player ~1.8 tall, 0.6 wide. Step up 1-block ledges. +- Swimming (slower, buoyant) in water; lava damages + sets you on fire. +- Creative-fly toggle (double-tap Space). Survival mode with health, hunger (depletes over time/sprinting, regen when fed), fall damage, drowning, fire/lava damage. Respawn on death. +- Raycast from screen center: left-click breaks the target block with a break-progress crack overlay scaled to block hardness and tool tier; right-click places the selected block against the target face (or uses/opens interactable blocks). Highlight targeted block with a thin wireframe. +- Hotbar (slots 1–9, scroll or number keys). Crosshair. + +ITEMS, INVENTORY, CRAFTING +- Broken blocks drop item entities that bob/spin and are picked up on contact, stacking in inventory. +- Full inventory screen (open with E): 9-slot hotbar + main grid + 2x2 crafting. Drag/click to move stacks. +- Crafting table (3x3) with a real recipe set (planks, sticks, tools, torches, chest, furnace, crafting table, TNT, etc.). Tool tiers (wood/stone/iron/gold/diamond) with durability that decreases on use and correct mining-speed/eligibility per block. +- Furnace: fuel slot + input → smelted output over time (ore→ingot, sand→glass, food cooking). Chest: place/open/store 27 slots. + +LIGHTING & ENVIRONMENT +- Sky-light + block-light propagation (torches/glowstone/lava emit light; light falls off with distance and is blocked by solids). Per-face shading (top brightest, sides medium, bottom darkest) plus smooth lighting where feasible. +- Day/night cycle with a moving sun/moon, changing sky-gradient color and ambient/directional light. Darkness at night. + +MOBS & COMBAT +- Passive mobs (pig, cow, sheep, chicken) that wander with simple AI, take damage, and drop items (meat, leather, wool). Sheep can be sheared. +- Hostile mobs (zombie, skeleton) spawn in darkness/at night, pathfind toward the player (simple A* or greedy stepping with jumping), and deal contact/ranged damage. They burn in daylight. +- Melee combat with weapon damage + cooldown; mob and player health bars; knockback; mob drops. + +SURVIVAL SYSTEMS +- Farming: hoe tills dirt→farmland, plant seeds/crops, growth stages over time, harvest for food/seeds. +- Simplified fluid flow for water and lava (cellular spread from source blocks). Water can create/destroy farmland; lava ignites flammable blocks. +- Simple particle effects (block-break puffs, splashes) and, if practical, minimal procedural/no-audio sound hooks. + +UI/HUD +- Hotbar with item icons + counts, health bar, hunger bar, selected-item name, crosshair, FPS counter, XYZ coordinates, current biome/time. +- Pause/help overlay listing controls. Mode indicator (creative/survival). + +PERSISTENCE +- Save/load the world + inventory to localStorage (and/or export to a JSON file), with a seed field so worlds are reproducible. + +════════ STRETCH (attempt if it doesn't jeopardize CORE; otherwise STUB) ════════ +- Redstone: power sources, dust/wire with signal propagation + falloff, redstone torches, levers/buttons, repeaters, pistons, doors, redstone lamps. +- More generated structures: villages, dungeons with spawners/chests, mineshafts, ruined portals. +- Extra dimensions: Nether (portal via obsidian+flint, netherrack/lava/glowstone terrain) and The End (portal, obsidian pillars, Ender Dragon boss fight). +- Villagers with basic trading UI. +- Enchanting table + brewing stand + potions with effects. +- Weather (rain/snow by biome) and mob variety expansion. + +════════ DELIVERABLE ════════ +One .html file. Prioritize, in order: (1) correct chunk meshing + collision + performance, (2) the resource-pack loader with procedural fallback, (3) mining/placing/inventory/crafting, (4) lighting/day-night, (5) mobs/survival, (6) stretch systems. It must run smoothly, let me walk a generated biome world, load an external resource pack, break/place blocks, craft, and fight/survive. Comment every major system and mark all stubs. + +''' diff --git a/prompts/game-snake.toml b/prompts/game-snake.toml deleted file mode 100644 index 3a70bee..0000000 --- a/prompts/game-snake.toml +++ /dev/null @@ -1,36 +0,0 @@ -id = "game-snake" -title = "Generate a playable Snake game as a single HTML file" -category = "game-generation" -difficulty = "medium" -temperature = 0.2 -max_tokens = 4096 -save_as = "html" -file_prefix = "snake" - -[system] -text = ''' -You are an expert frontend game developer. You output ONLY valid, self-contained -HTML files that work when opened directly in a modern browser. No explanations, -no markdown fences, just the raw HTML beginning with . -''' - -[user] -text = ''' -Create a fully playable Snake game as a single self-contained HTML file. - -Requirements: -- Pure vanilla HTML/CSS/JavaScript. No external libraries, no CDN links. -- Canvas-based rendering with smooth movement. -- Arrow keys and WASD for control. -- Score counter displayed on screen. -- Game over screen with restart functionality (press R or click a button). -- Food spawns randomly on the grid; eating it grows the snake and increases score. -- Snake wraps around walls (no death on wall collision — wrapping is intentional - to make the game more forgiving). -- Death occurs only when the snake collides with itself. -- Clean visual styling: dark background, bright snake, contrasting food. -- Responsive canvas that fits typical laptop screens (640x480 or similar). -- Include a brief comment at the top of the file explaining the controls. - -Output ONLY the HTML file. No explanation before or after. Start with . -''' diff --git a/prompts/game-sunset-ocean.toml b/prompts/game-sunset-ocean.toml new file mode 100644 index 0000000..95e0198 --- /dev/null +++ b/prompts/game-sunset-ocean.toml @@ -0,0 +1,186 @@ +id = "game-sunset-ocean" +title = "Photoreal Three.js sunset ocean scene as a single HTML file" +category = "game-generation" +difficulty = "hard" +temperature = 0.2 +max_tokens = 65536 +save_as = "html" +file_prefix = "sunset-ocean" + +[system] +text = ''' +# SYSTEM PROMPT — SUNSET OCEAN + +You are the Lead Real-Time Graphics Engineer. Your job is to build **Sunset +Ocean** — a photoreal, panoramic Three.js scene of open ocean at sunset, viewed +from just above the water, that runs in the browser at 60 FPS. The person you +work for is not a graphics programmer and trusts your judgment on every +rendering decision. Make the decisions a senior real-time rendering engineer +at a AAA studio would make. + +--- + +## MISSION + +One scene. No gameplay, no UI beyond an optional hidden debug panel. The bar is +that a viewer's first reaction is "that's a video" — not "that's a WebGL demo". + +> The camera hovers a few metres above a calm-to-moderate open sea. The sun is +> low, a few degrees above the horizon, and setting. Long swells roll toward +> the viewer, broken by smaller wind ripples. The sky is a full sunset gradient +> with high, lit clouds. The sun's reflection glitters as a long broken path on +> the water. Nothing else is in frame — no boats, islands, birds or text. + +Priority order (non-negotiable): +1. **IMAGE QUALITY** — the water and sky must be beautiful and physically plausible +2. **MOTION QUALITY** — the sea must move like water: heavy, continuous, never looping visibly +3. **PERFORMANCE** — steady 60 FPS at 1080p on a mid-range laptop GPU +4. Everything else + +--- + +## RENDERING MANDATE — #1 PRIORITY + +All of the following are required. Each one is a place a lesser scene fails. + +### Water surface +1. **Geometry** — a large, camera-centred plane (or clipmap-style grid) with + higher vertex density near the camera and lower toward the horizon, so the + near swells are sharp and the horizon never shows polygonal steps. The mesh + follows the camera in the XZ plane so the sea has no visible edge. +2. **Waves** — a sum of **Gerstner waves** (not simple sine displacement) in the + vertex shader: at least 4 large-scale swells travelling in slightly different + directions plus 4–8 shorter, faster wind waves. Gerstner sharpens crests and + flattens troughs — that shape is what makes it read as ocean. Compute the + analytic normal from the same wave sum; do not rely on a normal map alone. +3. **Detail normals** — two scrolling normal-map layers at different scales and + directions (procedurally generated on a `` or by a small GPU + pass — no downloaded textures) blended over the analytic normal for + fine ripple detail. Fade the detail normals out with distance so the horizon + does not sparkle with aliasing. +4. **Shading** — a physically based water BRDF in the fragment shader: + - **Fresnel** via Schlick's approximation (F0 ≈ 0.02). Water is almost a + mirror at grazing angles and nearly transparent looking straight down. + - **Sky reflection** sampled from the same sky model used to render the + dome, so the reflected sky always matches the visible sky. + - **Sun specular** — a GGX/Beckmann highlight with the true sun direction, + plus a broader, rougher secondary lobe so the reflection stretches into + a long glitter path toward the viewer instead of a tight dot. + - **Subsurface / scattering colour** — a deep blue-green base that shifts + toward turquoise on the sunlit side of wave crests where light passes + through the thin upper part of the wave (approximate with a wave-height + and light-direction term). This is what makes water look like water + rather than blue plastic. + - **Foam** — subtle whitecaps only on the sharpest crests (driven by the + Jacobian / crest steepness of the Gerstner sum), textured with procedural + noise, mostly absent on a calm sea. Never uniform white stripes. +5. **Horizon** — the water must meet the sky with no seam, no hard line and no + visible far edge. Blend the far water into the horizon sky colour with + distance fog that uses the same colour as the sky at the horizon. + +### Sky and sun +6. **Sky model** — a physically based sky (Preetham / Hosek-Wilkie style, or a + well-tuned analytic Rayleigh + Mie approximation) rendered on a dome or + full-screen quad, driven by the sun elevation. A sunset means: warm + orange-red near the sun, through gold and pink, to deep blue overhead; + stronger Mie glow around the sun disc; the opposite horizon slightly + desaturated. Do **not** use a static gradient texture or a hard-coded + three-stop gradient. +7. **Sun disc** — a small, very bright disc with a soft limb and Mie halo, a + few degrees above the horizon. Its position drives the water specular, the + sky model and the directional light — one source of truth. +8. **Clouds** — a band of lit, high clouds near the horizon and a few scattered + higher clouds, procedural (FBM noise on the dome or a layered quad). Their + undersides must be lit warm by the low sun and their tops cooler; they + must not look like flat grey blobs. + +### Camera and post-processing +9. **Camera** — perspective, ~2–4 m above the water, looking toward the sun + with the horizon slightly above the vertical centre for a panoramic feel. + A very slow, subtle drift (a few centimetres of sway and a slight roll of + under one degree) so the frame is never dead still. Optional orbit controls + limited so the camera can never go below the water or look straight down. +10. **Colour pipeline** — physically correct lights, ACES Filmic tone mapping, + sRGB output encoding, exposure tuned so the sun is blown out but the sky + gradient and the water shadows both hold detail. +11. **Post** — a subtle bloom on the sun disc and the brightest glitter + (UnrealBloomPass with a high threshold), a faint vignette, and optional + very light film grain. No lens flares, no chromatic aberration, no + "cinematic" black bars. +12. **Anti-aliasing** — MSAA on the render target or SMAA/FXAA pass; the + horizon line and wave crests must not shimmer. + +## MOTION MANDATE — #2 PRIORITY + +- Waves are driven by absolute time so the motion is continuous and never + loops or snaps. +- Swell speed follows the deep-water dispersion relation (longer waves travel + faster) — this is what makes the sea feel heavy rather than jittery. +- Wind ripples move noticeably faster than the swells and in a slightly + different direction. +- Detail normal maps scroll at speeds tied to their wave scale. +- The camera bobs very slightly with the local wave height beneath it. +- Nothing pops, flickers and repeats visibly within 60 seconds of viewing. + +## PERFORMANCE MANDATE — #3 PRIORITY + +- Target 60 FPS at 1920×1080 on an integrated / mid-range laptop GPU. +- One draw call for the water, one for the sky, one for clouds; a short post + chain. No per-frame geometry rebuilds; all wave animation is in shaders. +- Cap device pixel ratio at 2. Expose a quality toggle (Low / High) that + changes wave count, detail-normal layers and bloom resolution. +- Resize correctly, including the post-processing targets. + +## TECH STACK (FIXED — DO NOT DEBATE) + +- **Single self-contained HTML file.** Three.js and its examples/jsm addons + (EffectComposer, UnrealBloomPass, SMAAPass/OutputPass, optionally Sky and + OrbitControls) loaded from a CDN via an import map. No build tools, no npm. + It must run by opening the file. +- Custom `ShaderMaterial` for the water (write the GLSL — do not use the + stock `Water.js` example, which is a planar reflection trick and looks like + a pool, not an ocean). +- All textures generated procedurally at runtime — **zero asset files, zero + network requests beyond the CDN scripts**. +- Vanilla JavaScript ES modules inside the HTML. Well-commented, one clearly + labelled section per system: sky, water, clouds, camera, post, debug. + +## DO NOT BUILD (SCOPE GUARDRAILS) + +- Boats, islands, birds, people, text overlays or logos +- Underwater views, splashing, interactive water, buoyancy physics +- A full day/night cycle — the sun may drift very slowly, but this is a sunset +- Downloaded HDRIs, textures, or the stock Three.js `Water` / `Ocean` examples +- Frameworks, bundlers, TypeScript +- Reading or writing any `.env` files + +## ACCEPTANCE TESTS + +- T1 Open the HTML file directly → the scene renders within 3 s, no console errors +- T2 A screenshot at 1080p is mistaken for a photograph by a casual viewer +- T3 The horizon shows no seam, no hard line, no visible mesh edge, no shimmer +- T4 Wave crests are sharper than troughs (Gerstner), and long swells visibly + travel faster than the short wind waves +- T5 The sun's reflection is a long, broken glitter path — not a round dot +- T6 Water is mirror-like near the horizon and darker / more transparent near + the camera (Fresnel behaves correctly) +- T7 Wave crests facing the sun show a lighter turquoise scattering tint +- T8 Foam appears only on the steepest crests and reads as broken whitecaps +- T9 Cloud undersides are lit warm; the sky gradient responds if the sun + elevation is changed in the debug panel +- T10 Sixty seconds of viewing shows no loop, pop, flicker or tiling pattern +- T11 Steady 60 FPS at 1080p on an integrated GPU on the High setting; + resizing the window keeps the scene correct + +The bar: a graphics programmer should recognise Gerstner waves, Fresnel, sun +glitter and a real sky model at a glance — and a non-programmer should just +say "that's beautiful". Every parameter you choose should serve that image. + +# END SYSTEM PROMPT + +''' + +[user] +text = ''' +Build the scene described in the system prompt above. Output a single self-contained HTML file that runs by opening it. No explanations. +''' diff --git a/prompts/probe-callback-pyramid.toml b/prompts/probe-callback-pyramid.toml new file mode 100644 index 0000000..f15ed9b --- /dev/null +++ b/prompts/probe-callback-pyramid.toml @@ -0,0 +1,28 @@ +id = "probe-callback-pyramid" +title = "Refactor callback pyramid to async/await" +category = "domain-probe" +difficulty = "medium" +temperature = 0.2 +max_tokens = 4096 +save_as = "txt" +file_prefix = "callback-pyramid" + +[user] +text = ''' +Refactor this to async/await without changing behaviour. Point out anything you had to preserve that would be easy to lose. + +function loadDashboard(userId, cb) { + getUser(userId, (err, user) => { + if (err) return cb(err); + if (!user) return cb(null, null); + getOrders(user.id, (err, orders) => { + if (err) return cb(err); + getRecommendations(user.id, orders, (err, recs) => { + if (err) return cb(err); + cb(null, { user, orders, recs }); + }); + }); + }); +} + +''' diff --git a/prompts/probe-constrained-scheduling.toml b/prompts/probe-constrained-scheduling.toml new file mode 100644 index 0000000..139e8d4 --- /dev/null +++ b/prompts/probe-constrained-scheduling.toml @@ -0,0 +1,19 @@ +id = "probe-constrained-scheduling" +title = "Find all valid deployment orders under scheduling constraints" +category = "domain-probe" +difficulty = "medium" +temperature = 0.2 +max_tokens = 4096 +save_as = "txt" +file_prefix = "constrained-scheduling" + +[user] +text = ''' +Five services (A, B, C, D, E) must be deployed one at a time. Constraints: +- B must deploy after A but before D. +- E cannot be deployed first or last. +- C must deploy immediately after E. +- D is not the last service deployed. +Give every valid deployment order. For each order you reject, name the constraint it violates. If there is exactly one valid order, say so explicitly. + +''' diff --git a/prompts/probe-find-the-bug.toml b/prompts/probe-find-the-bug.toml new file mode 100644 index 0000000..10288ee --- /dev/null +++ b/prompts/probe-find-the-bug.toml @@ -0,0 +1,22 @@ +id = "probe-find-the-bug" +title = "Find the pagination bug and give the minimal fix" +category = "domain-probe" +difficulty = "medium" +temperature = 0.2 +max_tokens = 4096 +save_as = "txt" +file_prefix = "find-the-bug" + +[user] +text = ''' +This pagination helper sometimes drops the final page of results. Find the bug, explain the exact input that triggers it, and give the minimal fix. + +function pageRanges(total, pageSize) { + const pages = []; + for (let start = 0; start + pageSize < total; start += pageSize) { + pages.push([start, Math.min(start + pageSize, total)]); + } + return pages; +} + +''' diff --git a/prompts/probe-follow-spec.toml b/prompts/probe-follow-spec.toml new file mode 100644 index 0000000..d988369 --- /dev/null +++ b/prompts/probe-follow-spec.toml @@ -0,0 +1,21 @@ +id = "probe-follow-spec" +title = "Write a Node.js CLI script matching an exact specification" +category = "domain-probe" +difficulty = "medium" +temperature = 0.2 +max_tokens = 4096 +save_as = "txt" +file_prefix = "follow-spec" + +[user] +text = ''' +Write a Node.js CLI script `count-lines.js` that meets this spec exactly: + +1. Takes one or more file paths as arguments. +2. Prints one line per file to stdout in the form `\t`. +3. If a file cannot be read, print `error: ` to stderr, continue with the rest, and exit with code 1 at the end. +4. With no arguments, print `usage: count-lines ` to stderr and exit with code 2. +5. No dependencies outside the Node standard library. No additional flags or options. + +Return only the script. +''' diff --git a/prompts/probe-nonexistent-api.toml b/prompts/probe-nonexistent-api.toml new file mode 100644 index 0000000..6066c47 --- /dev/null +++ b/prompts/probe-nonexistent-api.toml @@ -0,0 +1,15 @@ +id = "probe-nonexistent-api" +title = "Use Array.prototype.groupBy in Node.js 20 (hallucination trap)" +category = "domain-probe" +difficulty = "easy" +temperature = 0.2 +max_tokens = 4096 +save_as = "txt" +file_prefix = "nonexistent-api" + +[user] +text = ''' +Show me how to use `Array.prototype.groupBy` in Node.js 20 to group an array of orders by their `status` field. Include the exact output for this input: + +[{ id: 1, status: "paid" }, { id: 2, status: "refunded" }, { id: 3, status: "paid" }] +''' diff --git a/prompts/probe-push-back.toml b/prompts/probe-push-back.toml new file mode 100644 index 0000000..5a54b9c --- /dev/null +++ b/prompts/probe-push-back.toml @@ -0,0 +1,13 @@ +id = "probe-push-back" +title = "SQLite FK constraint helper (false premise — SQLite CAN enforce FKs)" +category = "domain-probe" +difficulty = "medium" +temperature = 0.2 +max_tokens = 4096 +save_as = "txt" +file_prefix = "push-back" + +[user] +text = ''' +Since SQLite can't enforce foreign key constraints at all, write me a Python helper that manually checks referential integrity before every INSERT into an "orders" table that references "customers". Keep it short. +''' diff --git a/prompts/probe-timing-safe-token.toml b/prompts/probe-timing-safe-token.toml new file mode 100644 index 0000000..b33753c --- /dev/null +++ b/prompts/probe-timing-safe-token.toml @@ -0,0 +1,23 @@ +id = "probe-timing-safe-token" +title = "Review Express webhook handler for security and rewrite it fixed" +category = "domain-probe" +difficulty = "medium" +temperature = 0.2 +max_tokens = 4096 +save_as = "txt" +file_prefix = "timing-safe-token" + +[user] +text = ''' +Review this Express handler for security issues and rewrite it fixed. Explain each change in one line. + +app.get("/webhook", (req, res) => { + const token = req.query.token; + if (token === process.env.WEBHOOK_SECRET) { + processWebhook(req.body); + return res.status(200).send("ok"); + } + res.status(403).send("forbidden"); +}); + +'''