Talk
Stream

The first version is one self-contained HTML page with a full-window canvas and a control panel that works with mouse and touch. Scene (all drawn in code): a starry night sky, a house silhouette with a porch and one lamp, and a lawn. The glow color mixes violet (UV), cyan-blue (Blue) and amber (Warm). Glow radius and yard brightness scale with lumens. Controls: UV, Blue and Warm sliders, each 0–100. - Lumens = 0.2*blue + 1.0*warm + 0.05*uv, scaled up for display. - Attraction = 1.0*uv + 0.6*blue + 0.1*warm. Moths: about 80 agents spawn at the screen edges, each with a random sensitivity of ±30%. They wander with noise and steer toward the lamp in proportion to attraction divided by distance. Near the lamp they orbit and flutter. When attraction is low they drift away. Each moth is drawn as small pale flapping wings. HUD: - Lumens - Number of moths inside the lamp radius - Score = bugs/lumen, shown as "—" when lumens are 0 - Rating: "Moth Magnet" or "Bug-Free Glow" Preset buttons: - Old Filament: UV 5, Blue 15, Warm 90 - Streetlamp Vapor: UV 80, Blue 70, Warm 30 - Warm LED: UV 0, Blue 10, Warm 85 - Cool LED: UV 0, Blue 80, Warm 50 Challenge: reach at least 60 lumens (the displayed value) with the lowest score possible. The best qualifying score is saved in localStorage.

Discussion

  1. Hallway Studio

    Build one self-contained HTML page with a full-window canvas and a control panel that works with mouse and touch. Scene: a dark sky with stars, the silhouette of a house with a porch and a lamp, and a lawn. The lamp's glow color mixes from the slider values: UV is violet, blue is cyan-blue and warm is amber. Glow radius and yard brightness scale with lumens. Sliders (0–100): UV, Blue, Warm. Lumens = 0.2*blue + 1.0*warm + 0.05*uv (scaled up for display). Attraction = 1.0*uv + 0.6*blue + 0.1*warm. Moths: about 80 agents spawn at the edges. Each has a random sensitivity (±30%). They wander with noise and steer toward the lamp in proportion to attraction divided by distance. Close to the lamp they orbit and flutter. Low attraction lets them drift away. Draw them as small pale wings that flap. HUD: lumens, the number of moths within the lamp radius, and score = bugs/lumen (shown as "—" when lumens are 0). It also shows a rating: "Moth Magnet" or "Bug-Free Glow". Presets as buttons: Old Filament (uv 5, blue 15, warm 90), Streetlamp Vapor (uv 80, blue 70, warm 30), Warm LED (0, 10, 85), Cool LED (0, 80, 50). Challenge: reach at least 60 lumens with the lowest score you can. Show the best score in localStorage. Acceptance criteria: - The moths visibly react within about 3 seconds of a slider change. - Mercury vapor draws a swarm. - Warm LED draws few moths. - It runs at 60fps on mobile. The original idea, in the owner's words: “Porch Light Lure: Change a porch lamp's color spectrum and watch a swarm of simulated moths gather or ignore it, then try to light the yard with as few bugs as you can. Canvas night scene, one lamp, and sliders for UV, blue and warm output. Each moth's attraction depends on the spectrum. Score is bugs per lumen. Presets: incandescent, mercury vapor, warm LED, cool LED.”

  2. PM

    Your spec is clear enough to build as written. This first version is one self-contained HTML page with the scene, the three sliders, about 80 moths, the HUD, all four presets and a saved best score. One decision I made for you: the 60-lumen goal and the score both use the displayed lumens value, so the numbers on screen match the challenge. Queued for implementation in an isolated workspace. I’ll report the checks and a pull request here.

  3. PM

    Implemented in pull request #1. The project build and tests passed in the isolated workspace. I built Porch Light Lure as one self-contained `dist/index.html` (58.6 KB, no network requests). `npm run build` works and `npm test` passes 16 of 16. **What's in it** - **Scene, all drawn in code:** a starry sky with a crescent moon, a house with a porch and a wall lantern, a fence, a big tree and a lawn with a stone path. The glow color mixes violet, cyan-blue and amber from the three sliders. The glow radius, the light on the house siding and the pool of light on the lawn all grow with lumens. A dashed ring marks the lamp radius that the moth count uses. - **Controls:** custom UV, Blue and Warm sliders (0–100) that work with mouse, touch drag and arrow keys, plus the four presets with their exact values. - **Moths:** 80 moths spawn at the screen edges, each with a random sensitivity of ±30%. They wander, steer toward the lamp in proportion to attraction divided by distance, orbit and flutter near it, and drift away when attraction drops. Each is drawn as small pale flapping wings that brighten near the light. - **HUD:** lumens, the in-radius count, the score ("—" when lumens are 0) and the Moth Magnet / Bug‑Free Glow rating, all updating live. - **Challenge:** a score only counts at 60+ displayed lumens, after you hold one setting for 8 seconds so the swarm settles. The best score is saved in localStorage, and also through Hallway's save when it's available. - **Sound:** small synthesized effects that start after your first tap, plus a mute button. No music. **Choices I made** - **Display scale:** displayed lumens are the raw formula ×1.25. That puts Streetlamp Vapor at exactly 60 lm (it qualifies, but scores badly) and makes the 60 lm goal need about half the Warm slider. - **Challenge not trivial:** I tuned the moths so warm-only light still catches a few passing moths, a score around 0.04. Without that, the best score was always 0. - **Storage caveat:** Hallway's player blocks localStorage. There the best score is kept through Hallway's save instead, as long as Hallway provides it. **Checks I ran** - **Simulation tests**, over 5 seeds and 3 scene sizes, after 10 seconds: - Streetlamp Vapor always has more than 40 of the 80 moths in the radius, about 50–70 in my tuning runs. - Warm LED averages 12 or fewer and less than a quarter of Streetlamp. - Moths turn toward the lamp within 1.5 s of raising attraction. - After lowering it, the count falls within 3 s. - **Other tests:** the formulas, preset values, the "—" score, persistence (including blocked storage), and the build being self-contained. - **Browser:** a touch drag and preset taps work on a phone viewport, and a mouse drag works on desktop. The best score survived a page reload. I checked 12 window sizes from 320×568 to 1920×1080: none scrolls or pushes the panel off-screen. Desktop holds 60 fps. - **Phone speed:** on a phone-sized canvas, headless software rendering held 60 fps. With the CPU throttled 4× it dropped to about 30 fps, so I added automatic resolution step-down. I haven't tested on a real phone. - **Screenshots I reviewed:** start, Streetlamp swarm, Warm LED and a busy mix, at 1440×900, 920×575, 390×844 and several small sizes. They led me to fix: - a black hole behind the moon - truncated challenge text - clipped preset names - the HUD running under the panel at 480×320 - the stretched tablet panel The cover image is saved at `/tmp/projex-shots/cover-1440x900.png`. Verification and merge follow the project’s auto-merge setting. You can follow the pull request in the Code tab.

  4. PM

    Auto-merged pull request #1 after a fresh build and test run against the latest main branch. Automatic publishing will follow when enabled and hosting is connected; the live release status appears here.

  5. PM

    Published: https://projex.fly.dev/play/project_c804d219-702 — fresh build and tests passed, stored content verified, commit 1cf9760. This is the platform-built version.

Log in to add to the discussion.