Phaser 4TypeScript2D lightingWeb AudioVitest
Керування
- Drag anywhere on the chart to turn the lamp; with a mouse just move it. The bright pool where the beam lands is where boats steer, so lead them with it round the reefs to the green quay light
- Sweep is a wide, short beam; Focus is narrow and reaches far but burns oil three times faster
- Fog bell: every boat in the dark stops and waits a few seconds. Tap a lantern post to light it (it burns oil). Flare: tap the button, then the chart, to light a wide area for a few seconds. Tap a boat aground (or the Lifeboat button) to send the lifeboat
- Keyboard: arrow keys or WASD turn the lamp and move the pool nearer or further, Q switches Sweep and Focus, Space rings the bell, F fires a flare at the pool, B sends the lifeboat, 1 to 4 light the posts, P or Escape pauses
- Stars: one when every boat is home or towed, two and three for higher scores (three with no boat aground). Shillings buy upgrades in the workshop; every night can be won without them
- Add ?night=12 to the address to open a night, or ?demo=12 to watch the reference keeper play it
Needs WebGL. Without it the poster is shown. Respects the reduced-motion setting: no rain or squall streaks, slower fog and water, no flicker, and pages fade instead of sliding. Sound is off until you turn it on. Progress, upgrades and settings are saved in this browser.
Питання
How do I play Lantern Keeper?
Drag on the chart, or move the mouse, to turn the lamp. Boats steer toward the bright pool where the beam lands, so lead them round the reefs to the green quay light.
How many levels are there?
Thirty nights in five weeks, each proved winnable by a reference keeper in tests. Every night can be won without upgrades.
What tools does the keeper have?
A wide Sweep or far-reaching Focus beam, a fog bell that stops boats in the dark, lantern posts, flares and a lifeboat for boats aground.
Can I play with the keyboard?
Yes. Arrow keys or WASD turn the lamp, Q switches beams, Space rings the bell, F fires a flare and B sends the lifeboat.
Does it save progress?
Progress, upgrades and settings are saved in this browser.
Як це зроблено
Lantern Keeper is a lighthouse game: you turn the lamp of a small island light at night, and boats steer for the bright pool where the beam lands. Reefs under the water show only where light falls on them. Phaser 4 draws the chart and the light; the simulation, the thirty nights, the economy and the save are plain TypeScript with unit tests, and React owns the logbook interface and the input.
The light
- Every rock is a polygon. Each frame a visibility polygon is cast from the lamp: rays go to every rock corner inside the beam (and a hair either side of it, so light wraps past the corner) plus a fan along the far edge, and each ray stops at the nearest rock edge. The result is the exact lit area, with real shadows behind every rock.
- That polygon is drawn as a fan of bands into a half-resolution light map, each band coloured by how much light reaches it: a soft cone that fades with distance and toward its edges, a bright pool where the beam lands, and less reach inside fog. Lantern posts, flares, boat lanterns and the lamp's own glow are stamped into the same map as soft additive lights.
- The light map goes through a blur filter into a second texture (soft shadow edges), which is laid over the whole chart with a multiply blend. So the night is not a black overlay: the world itself is dimmed to moonlight blue and warmed to lamplight where the beam falls. A faint additive haze in the beam stands in for lamplight in spray, mist and rain.
- The rules use the same light: a boat counts as lit when the lamp reaches it without a rock in the way, and a reef is marked on the chart once the light has touched it. Reefs are drawn close to the colour of the sea, so in the dark they really are invisible.
Boats and nights
- The simulation runs at a fixed 30 steps a second with a seeded random generator, so a night always plays out the same for the same input. Boats steer toward the light pool when they are in the beam, hold their course in the dark for a few seconds (less for rowboats), then lose their bearing; the current, squalls and other boats push them. Rocks, live reefs and shoals (only at low tide) ground them.
- The nights come from a generator: a lighthouse isle with one or two quays, entry points round the chart edge, a lane for each boat with a dogleg, rocks placed so they never shade a lane, and reefs lining both sides of each lane and lying across the straight short cut. Each week turns a few knobs (fog banks, lantern posts, tide, current, squalls, snow, boat types, spacing).
- A reference keeper (the autopilot) plays a night by the book: it leads one boat at a time along its lane, rings the bell for boats waiting in the dark and sends the lifeboat to anyone aground. A hand-run test searches seeds until the autopilot brings every boat home without a grounding, freezes that seed per night and takes the star scores from its run. Unit tests replay all thirty nights on every run, and the same autopilot drives
?demo= and the card capture.
Economy
- Flotsam drifts on every night (crates, casks, now and then a bottle); holding the lamp on a piece for a moment hauls it in for shillings. Clean passages in a row build a harbour chain that pays a bonus. Both pay on replays too, so a night can be replayed for salvage, while stars only pay once.
- Eighteen honours (achievements) are stamped into the back of the logbook, each with a one-off purse, and the keeper's rank on the cover rises with stars.
- Shillings come from boats brought home and from stars; replaying a night only pays for stars above your best, so there is nothing to farm. A test checks that a keeper who earns two stars a night can afford most of the workshop and a three-star keeper all of it.
- Upgrades (lens, oil tank, clockwork, bell rope, wicks, lifeboat crew, flare box, chart notes) only make a night more comfortable: every night is proved winnable without them.
Performance and accessibility
- The canvas renders at the device pixel ratio (capped at 2, or 1.5 on low-end devices); the light map is half resolution and its blur is skipped on low-end devices. The loop sleeps when the canvas is off screen or the tab is hidden, and the game pauses itself when you leave the tab.
- Under reduced motion there are no rain or squall streaks, the water and fog drift slowly, nothing flickers and the logbook pages fade instead of sliding. Sound is generated with Web Audio (sea wash, a struck fog bell, horns, chimes) and stays off until you turn it on.
- Everything works from the keyboard, a live region reads arrivals, berths, groundings and warnings aloud, and the pause page lists every boat and what it is doing.