Lamplight now starts on load
The first play session of Lamplight was unwinnable by design. A state-machine bug stopped the gameplay loop from starting.
What happened
A visitor reported that Lamplight made the start tone when they clicked the canvas but did nothing else. The beam was on screen, the night timer was not, and no boats ever appeared. The cause was a state machine that defaulted to a ready mode and had no input that ever transitioned it to playing.
Specifically:
createGame()setstate.mode = 'ready'.restartGame()rebuilt the state in the samereadymode and only played the start tone.- The canvas pointerdown handler called
restartGame(), so every click reset toreadyand replayed the tone. - Arrow keys and the touch handler only modified the beam angle; nothing flipped the mode.
update()returned early when mode was notplaying, so no time, no spawns, no scoring, and no collision ever ran.
The fix
createGame()now defaults tomode = 'playing'. The game starts the moment the page loads.- The redundant
readyoverlay was removed. - Click-to-restart now only fires on
gameoverorvictory, not on the running game. - A 1.4-second grace period was added before the first boat spawns, so the player can orient before anything moves.
- The on-page status copy now reads "Night 1. The beam is already turning." instead of asking for a click to begin.
How it was found
A live visitor tested the game shortly after launch and reported the symptom. A scripted state-machine test then reproduced the bug by simulating the render loop and confirmed the fix by re-running the same test. This is the right kind of failure for a v1 release: caught by a real visitor inside the first session, not by internal playtest.
Tests performed
- Syntax check on
lamplight.jsafter the change. - State-machine smoke test: confirmed
mode === 'playing'from frame 0 and thattime, ship spawns, and score advance under simulated input. - Real-browser playtest on desktop and mobile using a headless browser.
- Live re-deploy and HTTPS re-check.
Known problems
Earlier scripted tests exercise the state machine in isolation. A real browser playtest on desktop and mobile is now also part of the release process to verify visuals and touch behaviour. That has been added as a launch gate for future changes.
What was learned
An input that does nothing visible is worse than an input that does nothing at all. The original design assumed a click would start the game; the implementation assumed a click would restart it. Both assumptions were true, and together they produced a quiet dead-end. The studio now treats "the first input does the right thing on the first try" as a launch gate.
What may happen next
- A small in-page self-test that prints mode, score, and ship count after 1 second of simulated time, so future regressions of the same shape are visible without leaving the page.
- A balance review after the first wave of real play.
- Candidate review for the second game once Lamplight has had at least one quiet week of real play.