From b4d45175ad482ebd15de19e389117f4a81ad147c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 16:31:02 +0000 Subject: [PATCH 1/2] Flood Crew: new water physics and a better-looking flood - core.js: the water is now a shallow-water solver with momentum (semi-Lagrangian advection, Manning friction, thin-film drag, linear drag), still exactly volume-conserving with block sleeping; push() lets wading make a bow wave and wake. Tanners Field and Mill Lane targets go to 540 s and 600 s. - game.js: GPU ripple field (wading, splashes), whirlpools at running drains, frame-rate blending between water steps, sim-slope lighting, screen-sized mirror without the sun disc, sharp sun glint, thin shoreline foam, caustics under shallow water (High), lighter shader path on Low. - README Flood Crew section updated; What's new entry added. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Cw2rM7oof2mCeBWM93T7t4 --- README.md | 2 +- e63334287a3deaa3/ebbwork/core.js | 129 ++++++++----- e63334287a3deaa3/ebbwork/game.js | 174 +++++++++++++----- .../news/ngcoding10-flood-water.json | 19 ++ 4 files changed, 237 insertions(+), 87 deletions(-) create mode 100644 e63334287a3deaa3/news/ngcoding10-flood-water.json diff --git a/README.md b/README.md index 0d722ede..702b6a72 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Personal site hosted with GitHub Pages at **https://ascoding11.github.io**, the - `e63334287a3deaa3/flickerwood/`: Flickerwood (Back Room), an 8-bit maze chase for one player (one file, one canvas, Web Audio, no libraries, no Firebase except stats.js). Glim, a firefly, gathers every speck of pollen in a moonlit hedge maze (a glade) while four night critters come out of the hollow stump in the middle and chase its light. It is our own take on the maze-chase genre: the name, theme, characters, mazes, art, sounds, words and numbers are all ours, and only the genre's ideas are used. **The four critters** never find a path: at the middle of every tile each one picks the open way (never straight back) whose next tile is nearest, in a straight line, to the tile it wants (`target()`), and all of its character is in that tile. Swoop the bat wants Glim's tile; Gulp the frog wants the tile 3 ahead of the way Glim faces (`AHEAD`); Tangle the spider wants the point on the far side of Glim from Swoop (twice Glim's tile minus Swoop's); Dither the moth wants Glim while more than 5 tiles away (`NEAR`) and its own corner once closer. They take turns at two moods on a clock: **roost** (each heads for its own corner: Swoop top right, Gulp top left, Tangle bottom right, Dither bottom left) and **hunt**; every time the mood changes they all turn straight round, which is the tell. Glim is faster than they are in an empty corridor and a little slower while eating, turns can be pressed early and are remembered until the next gap, a turn started up to 4 pixels before the middle of a tile cuts the corner and gains those pixels (`CUT`; up to 3 pixels late it is still taken, `LATE`), and a reverse is taken anywhere. A **moonbloom** (four a glade) dazzles the critters: they turn round, go pale, slow to 60% and mostly run away, and touching one sends it home as a puff of dust for 100, 250, 500 then 1000 (`CATCH`); they flicker for the last 2 seconds, and a caught one rests 1.2 s in the stump and comes back out as itself. **Tunnels** at the edges (`~` tiles) wrap round and slow critters to 55%. A **find** (dewdrop, acorn, clover, toadstool, bluebell, feather, snail shell, moonstone, one kind a glade) shows under the stump for 9 s when 35% and again when 70% of the glade is eaten, worth 200 plus 100 a glade up to 1000. Our own twists: **Dash** (0.32 s at 2.1 times speed, then 6 s to recharge, shown as a meter) and the **chain** (each speck eaten within 1 s of the last carries it on; every 12 raises the multiplier on specks, up to 5 times). Specks are 5, moonblooms 30, clearing a glade 100 times its number up to 1000 plus 300 if no life was lost in it; 3 lives, one more at 6,000 and every 15,000 after, 5 at most. **Rules** live between `// ==RULES==` and `// ==END RULES==`: no page, clock, sound or `Math.random` in there, so the same seed and presses always give the same game (`create(seed)`, `startGame(g)`, `step(g, 1/120)`, `turn(g, d)` with d 0 right, 1 down, 2 left, 3 up, and `dash(g)`; what should be heard or shown goes into `g.ev` as words, and eaten tiles into `g.gone`). Positions in the rules are maze pixels; the page adds the score bar above. Glim and the critters are a tile, a direction and how far along it they are (`c, r, dir, off`), so they can never leave a path; they touch when both gaps are under 7 pixels (`HIT`, smaller than the sprites). **Glades** are the five `MAZES` at the top of the rules, drawn by hand as 23 rows of 21 letters (12-pixel tiles): `#` hedge, `.` pollen, `o` moonbloom, `-` path, `~` tunnel, `HHH` the stump with `G` its gate above the middle, `P` Glim's start, `B` the find, space outside the glade. Hedge Court is a full rectangle with a tunnel across the middle, Lily Pond has its corners cut off and tunnels top to bottom, Bramble Wheel is not mirrored (its bottom half is its top half turned half round) and has two tunnels, Mossy Ruin has tunnels both ways through the middle of each edge, and Moth Hollow is an hourglass with none; glade 6 is Hedge Court again, quicker. A new or changed glade must stay: every path one tile wide (no open 2 × 2), no dead ends, all joined up, a border tile that is a path matched on the opposite border, the start at least 8 steps from the gate with a way left and right (Glim sets off left), one moonbloom in each quarter, nothing but hedge next to the outside. A script checked all of that for the five glades when they were made (it is not in the repo), so check again by hand if you change one. **Tuning** is `tune(level)` and the constants at the top of the rules: Glim 66 pixels a second plus 1.3 a glade; critters 70% of that plus 3 points a glade (97% at glade 10); the dazzle 8 s less 0.67 s a glade, never under 2; roosts of 7, 7, 5 and 4 s (less 0.55 s a glade, never under 1.5) between hunts of 13, 15 and 18 s (plus 1.2 s a glade), then hunting for good; Gulp leaves the stump after 3 s, Tangle after 12 s or 30 specks, Dither after 28 s or 90 specks, all sooner glade by glade; from glade 3 Swoop speeds up 6% when 20% of the pollen is left and 12% under 8%, and keeps hunting through roosts; nothing tightens after glade 10 (`TOP_LEVEL`). Glade 1 is meant to be cleared by a first-time player: a test bot that only heads for the nearest pollen and runs when something is three tiles away clears it nearly every time. **Drawing**: the game is a 252 × 300 picture (a 14-pixel score bar, the 252 × 276 maze, a 10-pixel strip for spare lives, the dash meter and finds). `layout()` shows it at a whole number of device pixels per game pixel, so pixels stay square and sharp, and tries three places for it, biggest picture first: under the top bar with the key hint, under the bar without the hint, and between the bar's title and buttons (so a 1366 × 768 laptop with a short browser window still gets 2 ×); only when a whole number would be 1 is it drawn at 2 and shrunk smoothly to fit. Never size the canvas with CSS percentages or `vh`. Sprites are rows of letters turned into small canvases once (`bake`; Glim is drawn facing right and turned for the other three ways; two frames each; the dazzled look is the same shapes in two pale tones); the hedges, stump and tunnel marks are drawn once per glade (`mazeL`, and a lit copy `flashL` for the blink when a glade is cleared), the pollen sits on its own layer and each speck is wiped from it as it is eaten, the score bar is redrawn only when something on it changes, and words use a 5 × 5 pixel alphabet drawn in code (capitals, digits and `+ - : ! .` only). The loop runs the rules in fixed steps of 1/120 s and draws between steps. It pauses when the tab is hidden or the window loses focus. **Sound** is made in the page: square, triangle and noise blips in `SFX`, and a 16-bar tune of our own in A minor in `TUNE` (notes as numbers), booked a tenth of a second ahead on the audio clock; while a moonbloom is on, a quicker bright figure plays instead. Nobody has listened to it yet, so the loudness and the tune want a check by ear. **Saved in the browser only**: `flickerwood-best` (score), `flickerwood-glade` (furthest glade), `flickerwood-mute` (in try/catch), keys under `keybinds:flickerwood`. Stats hook: `max('score', score)` and `max('glade', glade reached)` when a glade is cleared and at game over (the Leaderboards show best score). Controls: arrows or WASD turn, Space or Shift dashes, P, Enter or Esc pause, M sound, all rebindable under KEYS. On touch screens (`body.touch`): swipe anywhere to turn (keep sliding to turn again without lifting), tap the screen to dash, or use the d-pad with a DASH button either side of it under the screen (pad on the left and DASH on the right when the phone is sideways). How to play, with a picture of each character, sits beside the screen when there is room, otherwise behind the ? button. A test hook (`window.__fw`) exists only when `navigator.webdriver` is set. It has Spanish: its words are in `flickerwood/es.js` (lang.js), with a Language switch in How to play; the canvas words are chosen to need no accents (the 5×5 pixel font has none), and glade and critter names stay English. **The Wardrobe** (captains only for now, like the other games' hidden cosmetics): 28 looks for Glim in `flickerwood/wardrobe.js`, listed in `cosmetics.js` under `GAMES.flickerwood` (14 kits, 7 hats, 2 face pieces and 5 trails: sports kits, a tin firefly, pirates, suits and more, all seen from above). The page fetches `wardrobe.js` and `../cosmetics.js` only when `wardrobeOn()` is true (`FLICKERWOOD_PUBLIC`, the one line that opens it to everyone; a site captain through `captains.js`; or `?wardrobe=1` on localhost or in an automated browser), and then a hanger button appears in the top bar; for everyone else `WR` stays null and Glim is drawn exactly as before. Looks only: a look swaps `SP.glim` for pictures of the same 16 × 16 size (so the spare Glims on the score bar wear it too), no kit recolours the glowing yellow tail or the halo (what tells Glim from the critters), and trails are drawn under the critters and Glim, fade in 0.4 s and are never small yellow dots that could pass for pollen. Opening it pauses a game in progress. What is worn is saved in this browser as `flickerwood-look` (`{k, h, f, t}`, item numbers, 0 for none); nothing is sent anywhere. The words are in `es.js`. - `e63334287a3deaa3/lanternhold/`: Lanternhold (Back Room), a co-op tower defense game for 1 to 4 players (one file, three.js r128 with `../autores.js`, `../netsmooth.js` for teammates' pointers, Web Audio, Firebase Realtime Database rooms under `rooms/lh-`, same project and rules as Rumble Karts; invite links go through the home page as `#lh-`; no Quick match, rooms hold up to 4). The name, the Gloom, the towers, the maps, the art and the sounds are all our own. The Gloom walks a road across a floating island (a 20 × 12 grid of 2 m tiles, `GW`/`GH`/`T`) to the lantern; each one that gets there costs lives (`lv` in `EN`: 1, 2 for Shellbacks and Splitblobs, 15 for the boss). Towers go on grass tiles only (not road, scenery or the lantern). **Rules** are plain data and pure functions near the top of the script, the same in every browser, so a client can work out wave previews and enemy health without asking: `MAPS` (Meadow Bend, one long road; Twin Fords, two roads that meet; Whorl Garden, a spiral, whose flyers come from their own pink gate, `fly`, so they don't skip almost the whole map), `DIFFS` (Easy, Normal, Hard: health factor, lives 30/20/12, starting gold 720/620/540, bounty factor and seconds between waves), `EN` (Gloomling; Skitter, fast; Shellback, armour 7 taken off every hit, at least a quarter always goes through; Duskmoth, flies straight at the lantern; Splitblob, splits into three Bloblets; Mender, heals the Gloom near it 5% a second; Gloomwarden, the boss on every 10th wave, armoured, slow, and calls two Skitters every 5 s), `TW` (Bolt Spire, quick single shots, two at once at level 3; Thumper, lobbed blasts that hurt groups, ground only; Frost Bell, rings out to slow and chip everything near it, bosses half as much; Spark Coil, lightning that jumps between enemies; Sky Lance, flyers only, splash on nearby flyers; Sun Lens, a long beam that ignores armour), each with three levels (`lv`: range, damage, seconds between shots and the upgrade's cost) and a target mode (First, Last, Strong, Close). Selling gives back 70% of what went into the tower (`SELL`). `waveDef(w, map)` builds wave w from a seeded random pool (new kinds join at waves 2, 4, 5, 6 and 8, and the wave a kind first appears always has a group of it), `hpScale` makes them tougher each wave and faster still after wave 30. Survive 30 waves (`CAMPAIGN`) to win; then Keep going is endless mode. Gold: every kill's bounty and every wave's bonus (25 + 5 a wave) is split evenly between the players (`income`), each player spends their own share, and the team list has +50 to give gold to a teammate. Sending a wave before its countdown ends pays 2 gold per second left. Speed 1×, 2× or 3× (`sp`, anyone can change it). Only whoever built a tower can sell it (anyone can once they've left); anyone can upgrade or retarget it. `simStep(S, dt)` runs the game at a fixed 30 steps a second in solo, behind the menu (a demo game, `attract`) and on the online host; `act(S, uid, a)` applies one action (`b` build, `u` upgrade, `s` sell, `m` target mode, `w` send the wave, `f` speed, `g` give gold, `c` continue into endless) and returns '' or what went wrong. **Online:** each player writes only their own node `rooms/lh-/players/`: `n` name, `c` colour, `x`/`z` where their pointer is on the board (drawn on the others' screens as a ring and a name tag from a short history, NetSmooth), `h` (always 0), `ts` (server time), `j` (when they joined), and `ac`, their last 10 actions as JSON, each with a rising number `i` and the game number `g`. The host is whoever has the highest `he` with a published state, else whoever joined first (`Net.elect`); it runs the game, takes each player's new actions (`takeActs`, at most once each, by `i`, and only for the current game), and publishes the whole state as JSON in its own node's `rs` about 5 times a second (`encodeRS`: phase, wave, lives, gold per player, towers, enemies, Thumper shells in the air and the last shots, so clients can draw them). Clients rebuild the game from it (`decodeRS`, which checks every value) and move the Gloom on between snapshots from its speed, easing towards the host's numbers. If the host leaves, the next player picks up the last snapshot and carries on (`he` goes up by one), and a tab in the background keeps the host's game running once a second. The host picks the map and difficulty in the room's lobby and presses Start; anyone joining later gets a share of gold (the average, at most 250). Nodes are removed on leave and onDisconnect. **Saved in this browser** (localStorage, all `lanternhold:`): `name`, `color`, `map`, `diff`, `gfx` (Pretty, with shadows, or Fast; Fast is the default on touch screens), `sound`, `room` (the last room code) and `best::`, the best wave held. **stats.js:** `max('wave', waves held)` and `add('bosses', n)`; the Leaderboards show Most waves held and Gloomwardens beaten. **Touch:** shown only on touch screens (`body.touch`): tap a tower button, tap a tile to see the tower there, tap it again to build; drag to move the board, pinch to zoom. The camera fits the board into the space the HUD leaves (`fitCam`, `measureHud`), and on an upright phone the wave box becomes a row under the top bar and the dock gets compact. **Drawing:** the island, scenery and lantern are merged meshes with vertex colours; enemies, health bars, shots and rings are instanced meshes (their colour buffers are made at full size in `whiteColors`, because three r128's `setColorAt` sizes the buffer from the mesh's current count); particles are one Points draw. Automated browsers get a test hook, `window.__lh`. It has Spanish: its words, tower names and descriptions are in `lanternhold/es.js` (lang.js), with a Language switch on the menu and the pause screen; map names and the Gloom's names stay English, and nothing translated is sent to the room. **Wardrobe (hidden: captains only for now).** `LH_PUBLIC = false` and `wardOn()` (captains.js's `may(false, 'wardrobe', 'lh-wardrobe')`; `?wardrobe=1` for tests on localhost or in an automated browser) decide whether the menu shows a Wardrobe button under the colour swatches; for everyone else `lanternhold/wardrobe.js` is never fetched and the game is exactly as before, unless a teammate wears something, in which case it is fetched to draw them. It has 30 items in four slots, numbered as in `../cosmetics.js` (`lh-…`): 12 tower banners (a small flag on a pole at the back-left of every tower that player builds, seen by the whole team: sports pennants, a gear, a pirate flag with an eye-patched skull, a ship's wheel, pinstripes, a crown; baked into the tower's base mesh through `towerParts`' new `ban` argument, so a tower is still the same draw calls and its shape, owner band and level gems are untouched), 9 lanterns (the lantern's stand and cage on the captain's own screen only: `lanternGeo()` is the usual one, and `world.core.body`'s geometry is swapped; the flame, halo and light stay where they are and the same size), 5 flame colours (the flame's and halo's colour on the captain's own screen only; the point light is not recoloured, the low-lives flicker and the red flash are kept) and 4 build bursts (in place of the usual puff in `fxBuild` when that player builds or upgrades, seen by everyone, from the same particle pool). Saved in this browser as `lanternhold:wardrobe` (`'banner.lantern.flame.burst'`); online, a player's own node carries `cz: 'banner.burst'` (written with `Net.upd`) only while one of those is worn. Older pages ignore `cz`, `rs` and the actions are unchanged, and a page draws the usual look for numbers it doesn't know. The test hook `window.__lh` adds `WD` (with `wear(slot, n)`), `wardOn`, `wdLoad`, `wearOf`, `towerViews`, `towerMesh`, `wx`, `wz` and `world`. Its words and item names are in `lanternhold/es.js`. - `e63334287a3deaa3/windrow/`: Leaf Sweep (Back Room; first called Windrow, and the folder, the `WR` name in the code, the save key `windrow:v1`, `keybinds:windrow` and the stats name keep that), a calm single-player first-person game about clearing autumn leaves out of five walled gardens (three.js: the site's own r187 build, `/lib/three/r187/three.min.js` with its r128 layer, then `../autores.js`; no Firebase and no rooms, except `stats.js` for play time; no ads). The page is `index.html` (markup, styles, HUD and menus) plus five plain scripts in `js/`, loaded in this order: `world.js` (the areas, the collision grid and everything that stands still), `leaves.js` (the leaf simulation and its drawing), `audio.js` (every sound, made in code), `models.js` (gloves, sack, rake, blower, finder beams) and `game.js` (player, tools, money, HUD, menus, saving, the frame loop); `es.js` is its Spanish. Everything is drawn and textured in code; nothing is downloaded. **The start.** A new player stands on the doorstep of a garden house in the Front Yard (8 x 7 m of buried lawn with a stone path, one bin, low walls and a closed gate) with only their hands. It is a sixth area, `WR.AREAS[5]` (`WR.YARD`), added after the first five so the numbers in older saves keep their meaning; `WR.ORDER` is the order areas are listed in. Its leaves lie 1.5 times thicker (`dense`), and clearing it to 100% opens the gate to Gatehouse Court by itself, free. The screen shows a crosshair, the sack and the acorns, and one line of instruction at the bottom middle (`hintText` in `game.js`: hold to gather; sack full, empty it in the bin, with a bouncing marker over the bin; spend acorns in the shed; bought the rake; the gate is open), one at a time, each gone when done. Everything else appears when it first matters (`hudStatic`): percent cleared and the shed after the first sack is emptied, the tool bar with a second tool and only with tools owned, garden names, the Gardens tab and map, gate signs and the finder button once the court is open. The shed lists the sack, hands and rake at first and the rest as they become useful (`shedShows`). `state.seen` remembers which lines have been shown; a save that already has the court open skips them all. A scripted player that walks and aims perfectly fills its first sack in about 9 game-seconds, buys Quick hands (25) after its second sack, the rake (60) at about 45 s and clears the yard in about 150 s; a person takes longer. The "hold to gather" line stays until the sack is half full. **The garden** is flat, about 61 x 53 m, on one grid of 0.25 m cells (`WR.CELL`, 248 x 216; the plan in `world.js` is written at full size and every position is then multiplied by `WR.S` = 0.8, so the gardens are small and the leaves lie thick): `solid` blocks the player and the leaves, `gtype` is the surface (lawn, paving, decking, gravel: how far a leaf slides), `inlet` marks mulch-chute cells, `areaOf` says which garden a cell belongs to. The five big gardens are the first entries of `WR.AREAS` in `world.js` (Gatehouse Court, Orchard Walk, Lily Terrace, Glasshouse Row, Maze Lawn) with their gate cost, the garden that must be half cleared first, the bonus and the reward for finishing (sprint, kneel, higher jump, chutes that draw leaves in, a gold rake); bins, chutes, gates, trees, hedges and benches are lists just under it, and `WR.buildGrid` turns them into the grid, so moving a prop means editing its list only. Its last step, `seal()`, proves every leaf can be cleared: with all gates open it finds the cells a player can stand in, and any free cell with no standing spot within 2 m in a clear line (a slot behind a bench, say) is made solid, so neither leaves nor feet can get into it (5 cells with the present props; about 18 ms at load). **Leaves** are real objects, never removed by pointing: each has a place, a speed and a tumble, and leaves the garden only by being carried to a compost bin in the sack or by reaching a mulch chute. To stay cheap, resting leaves are asleep and cost nothing; each leaf sits in one grid cell (a linked list per cell), so a tool only visits the cells it reaches; and leaves do not collide one with another: a cell is a stack (each extra leaf rests 1.4 cm higher), a cell with 26 leaves turns sliding leaves away (40 for falling ones, about 56 cm) and a leaf near the top of a stack 5 taller than a neighbour slides off onto it. A leaf never moves more than 0.22 m in a step and its new place is rounded to what the arrays hold before the wall test, so nothing gets through or into a wall. That is what makes heaps against walls and rows in front of the rake. `Leaves.blow` is the blower (a cone; force falls with distance and with angle off the middle, 13 rays stop it at walls, leaves low in a heap are sheltered), `rake` carries the leaves under the head along with it, `scoop` sends the nearest leaves in a ring to the sack (they need a clear line from the player, except a garden's last 6 leaves, so none can be stranded behind a bench), `kick` is walking through them and `pull` the Draught grates reward. A leaf is two triangles: a flat card with one of four leaf shapes cut out of it (alpha test) by a 256 px atlas drawn in the page, tinted per leaf. They are drawn as instanced meshes, one per garden and leaf shape (20 draw calls); each mesh keeps its leaves in the order of the 4 m tile they started in and only the tiles where something moved are sent to the graphics card each frame. On top is one see-through 'litter' sheet whose opacity comes from a texture with one pixel per cell, so cleared ground looks clean about a second after its leaves go. **How many leaves** is the quality setting, in leaves per square metre of open ground (`WR.QUALITY`): Low 14 (27,600 leaves in the whole garden), Medium 24 (47,300), High 40 (78,800); Medium and High have a real shadow map from the low sun, drawn once (nothing that casts a shadow moves, except a gate opening), and Low has soft dark patches under the trees instead. Colours are written as screen colours and lit in linear light (`WR.lin`, sRGB output, ACES tone mapping), so any new colour or canvas texture must go through `WR.lin` or be marked sRGB. Phones start on Low, computers on Medium. Measured: with a fully upgraded blower sweeping through leaves the simulation costs 0.4 / 0.5 / 0.8 ms a step (1.4 / 3.0 / 2.8 ms at 4x CPU slowdown), with up to 2,800 leaves awake at once; looking across the first garden draws about 78k / 117k / 180k triangles in about 70 draw calls. Not measured: the cost of the cut-out leaves overlapping on a real phone's graphics chip (the test machines have none). `autores.js` lowers the resolution first; if frames stay slow for 8 s after that and the player never chose a setting, the game drops one leaf tier itself and says so. An area's leaves are worth the same in total at every tier (`units`; fewer leaves are each worth more), and the sack and the hands are measured in quality-free units too (an area's `leaves` number is its size in sack units; `Leaves.fill` is what one leaf takes), so progress and prices do not depend on the setting. Changing the setting scatters the leaves that are left again and keeps each garden's percent. **Looks and feedback.** `world.js` builds the house (door, lit windows, shutters, roof, chimney), trees with a crown of rounded masses shaded light above and dark below, walls with piers and caps, slatted benches, the fountain and a painted sky with cloud and a sun glow. `models.js` has rounded gloves on sleeves: open hands and the sack, a fist on the blower's handle, and two fists and forearms that follow the rake's handle in the garden itself. The blower shows wind streaks and lifts and tumbles leaves; landing from a jump throws leaves up and out, with a burst of loose leaves and a sound when it is a real heap; a rake stroke ends with a thump and a puff of crumbs; emptying the sack pours leaves into the bin; buying something pulses the HUD; 100% is a warm flash, falling leaves and a fanfare. **Tools and money.** Hands and sack, a rake (a stroke reaches out lifted, then drags back along the ground, so it pulls) and a blower (it pushes). Acorns come from leaves: at a bin when the sack is emptied (20% more for a full sack) or at once at a chute. `UP` in `game.js` is the shed (nine upgrades and their prices) and the arrays under it are what each level does; the models in `models.js` change with them. The leaf finder (F, or by itself when under 3% of a garden is left) lights the 8 nearest leaves of the garden you are standing in, and the journal map draws a dot for every leaf on the ground. **Saved data:** one localStorage key, `windrow:v1` (JSON): `acorns`, `earned`, `up` (upgrade levels), `unlocked` and `done` (per garden; six entries now, and a save with five is given the yard, open, as the sixth), `rewards`, `bagUnits` (what is in the sack, per garden) and `bagFill`, `gone` (share of each garden cleared), `tool`, `tut` (no longer used), `seen` (which instructions have been shown), `pos`, `secs`, `binFill`, `set` (look speed, volume, quality, flipped look, whether the player chose the quality), and `leaves` with `leafMul`: for each garden that has been touched, a base64 string of two 16-bit numbers a leaf (centimetres from the corner of the garden; 65535 = gone), about 250 KB at Medium and 420 KB at High once every garden has been disturbed; a leaf saved against a wall is stepped back out of it on loading. An untouched garden saves nothing and is scattered again from its seed. It saves 8 s after a change, on pause, and when the tab is hidden or closed. Keys are rebindable (`keybinds:windrow`); `autores.js` keeps its own scale. It is not in `account-nudge.js`'s KEYS, so it does not follow a Google account to another device, and it has no row in `leaderboard.js` or `miles.js`. **Touch:** `body.touch` is set on the first touch and shows `#touch` (left stick, Use, Jump, Run and Kneel once earned, a context button for bins and gates, and finder, journal and pause top right); the three tool slots at the bottom are tappable on any device. Portrait and landscape have their own positions in the style block; a drag on the view or on the Use button looks around. `WR.test` at the bottom of `game.js` is only for test scripts (start without a click, step the simulation, hold the tool, a simulation benchmark); nothing in the game calls it. -- `e63334287a3deaa3/ebbwork/`: Flood Crew (Back Room; first built as Ebbwork, and the folder, the `ebbwork:v1` save key and the names in the code keep that name), a single-player first-person flood-drainage game: each job is a flooded place, and you work out why it flooded and get it dry (three.js r187 from the site's own build with its r128 layer, then `../autores.js`; no Firebase, no rooms, no stats.js, no ads). It is our own design: the name, the six places, the tools, the prices and the text are ours. **Files:** `index.html` (the page and its styles), `game.js` (shaders, effects, controls, sound, HUD and menus), `models.js` (everything modelled: houses, fences, garden things, the van, drains, pipes, the things you put down, and the first-person hands and tools, all built from simple shapes and pictures drawn on a canvas, as `EWLook`), `core.js` (everything that is not drawing, with no DOM and no three.js in it, so `node` can load it: `require('./core.js')` gives `{EWSim, EW, EWMaps}`), `es.js` (its Spanish for `../lang.js`) and `preview.jpg`. **The water (`EWSim` in `core.js`):** a grid of 0.5 m cells, each with a ground height `g`, a barrier height `bar` laid on top, a depth `d` (kept in 64-bit numbers: with 32-bit ones a slow seep into a deep cell rounded away and volume drifted) and a flow through its right and bottom edge (`fx`, `fy`). Every step (1/30 s, fixed) each edge's flow speeds up by the difference in water surface across it and slows by friction (`fric`, `damp`), no cell may give more than it holds (flows out of a cell are scaled down together), and depths change by what flowed, so volume is conserved exactly: water only appears through `add()` and leaves through `take()`. Walls are `solid` cells. A 3 mm film (`FILM`) never flows, so floors keep real puddles in their dips. Blocks of 8 × 8 cells sleep when nothing in or next to them is changing; an edge into a sleeping block carries nothing and wakes it (leaving that out loses water across the edge). A big pool takes minutes to fall fully asleep because the film keeps creeping, so sleeping saves little while a map is draining; one step with every block awake costs about 1 ms for 128 × 128 cells on a desktop, and the biggest job is 68 × 48. **A job site (`EW.World`):** built from a map's `build(b)` with metres as the unit (x east, z south): `ground`, `shape` and `noise` set heights; `surf` sets the surface type and whether it can be dug; `wall` makes solid blocks (its `kind` is only for drawing); `drain` (a `rate` in m³/s and a `cap`: how much debris blocks it fully), `sinkArea` (water there leaves the map: a ditch or storm channel), `river` (cells held at a level: a stream that both feeds and takes water), `leak` (fed by a `valve` id, or `wrench: true` for a dripping joint), `valve`, `socket`, `litter`, `flood`, `spot` (a note the player gets when they walk near, kept in the journal), `sign`, `station` (the depot's board, bench and van) and `noJob` (cells that don't count). `step(dt)` runs leaks, the river, pumps, drains, sinks, the water and the debris, in that order. Debris floats in more than 5 cm of water, drifts with the current and towards a running drain, strands when the water drops, and blocks a drain by lying within 0.85 m of it (`clog`): a drain's rate is `rate × (0.03 + 0.97 × clear^1.25)`. Debris that has just been raked lies in a sodden heap for 45 seconds (`heavy`) before it can float off again, so a cleared drain stays clear long enough for the level to fall away from the heap. The job is done (`isDone`) when the water left in the job's cells is at most 3% of the most there has been (`World.DONE`) and nothing is still coming in; a skin of water under 8 mm (`World.SKIN`) is wet ground, not flood, and is not counted, which is what stops a job ending in minutes of waiting for a thin sheet to creep away. **Tools (each one a function on the world, so a test can call it):** `rake` (push or pull debris), `scoop` and `pour` (the 30-litre bucket), `squeegee` (moves water under 7 cm one cell along), `dig` and `pile` (soft ground only, down to `DIGMAX` 0.64 m; one stroke takes the cell down 0.24 m and pulls its four neighbours down with it, so a trench is a few strokes and is wide enough to run; piling uses the spoil you dug), `placeBarrier` (three cells in a row, four directions, `BARH` 0.36 m; refused on drains, ditches and the river), `placePump` / `setHose` / `placeGen` (a pump runs when it is on, has a socket or a live generator within cable reach and has a hose end; water it takes goes to the hose end's cell, so emptying into the same pool does nothing, and it only leaves the map if the hose end is on a sink or the river; a generator standing in more than 14 cm of water stops), `takeDebris` (the sack: removes debris for good), `setValve` and `fixLeak`. **The jobs (`EWMaps`, in order; a job opens when the one before has a star):** Marlow Row (a back yard: a drain buried in leaves and a split pipe whose copper supply pipe, drawn along the house wall with `pipe`, leads round the corner to its tap; a new player starts here, standing in it: the yard starts shin to knee deep, half a metre at the drain, so that it plainly is a flood and the before and after are obvious; see **The start** below), Pell Street (three hidden drains, a dripping joint, a paving dip that keeps a puddle), Tanners Field (allotments in a hollow with no drain: a trench through the bank to the ditch; a choked pipe that sits too high to finish the job), Fenny Underpass (a dead sump: pump from a wall socket with the hose over the crest to the storm channel, and a water main valve at the far end), Wharf Cellar (the river seeps in through a doorway: sandbags, then pump up the steps; it is dark, so `sky: 'cellar'` gives a head torch) and Mill Lane (a stream through its bank, a culvert under a raft of debris, a walled garden that needs the pump and the generator, a hollow to trench). `EWMaps.depot` is the depot: not a job, a yard with the job board, the gear bench and the van, and a puddle. **The start (rebuilt 26 Nov 2026 after the owner found the first version confusing):** Play puts a new player straight into Marlow Row holding the rake and nothing else. `TUT` gives one short line at a time at the bottom of the screen (move, find the drain, rake it, follow the pipe to the tap, hold to shut it, keep the drain clear) and each goes when it has been done. What a new player has not met yet is not on screen: `firstJob()` hides the scan and journal buttons, the other tools and the job's notes; the depot appears only after that job, with just the job board working (taking a job from it sets off at once); the gear bench appears after the second job (`shopOpen()`), and the van and its loadout only once the player owns more tools than it holds (`vanNeeded()`). The HUD in a job is a crosshair, one water bar, the tool, and one line of words (`#say`, which carries the instruction or else the latest message); there is no clock or coin count in a job. Each map has `pay`, `par` (the target time in seconds) and `needs` (what the job board suggests bringing, shown only after the player has been there once, so the first visit is for finding out). Stars: one for finishing, a second inside 1.6 × `par`, a third inside `par` with 1.5% or less left; pay is `pay × (0.6 + 0.2 × stars)`, halved when the job has been done before. **Gear** (`GEAR` in the page): tools with `slot: 1` take one of the van's five places (seven with Van racking); the rest are upgrades (more sandbags, long hose, cable reel, second pump, waders, racking). Prices are set so that one-star pay alone affords each next job's tool. **Storage:** localStorage `ebbwork:v1` only: `{v, coins, gear, load, jobs: {: {stars, best, n, seen}}, set: {sens, vol, q, inv}, tut}`; keep `v: 1` and these names working if you change it. Nothing is sent anywhere. **Drawing:** the ground and the water are each one mesh with a vertex at every cell centre. The ground (`terrainMat`) is three's own lit material with our patterns added in `onBeforeCompile` (grain, paving joints, and wet ground that is darker and shiny until it dries over about half a minute, so the band the water has just left is plain to see), which lets it take the sun's shadows and the cellar torch. The water (`waterMat`) is our own shader: its vertices carry depth and speed, a dry cell beside water takes its neighbours' surface height with a negative depth, and the shader throws away everything shallower than 3 mm, so the shoreline is a smooth line where the surface meets the ground and no squares show; it is brown where deep and clear where thin, with a pale lapping line at the edge and a dip pulled into the surface over a working drain. The light is a low warm sun with a cool sky fill; shadows come from one shadow map that is drawn once per site and again only when something is put down (`shadowMap.autoUpdate` is off), 2048 on High and 1024 on Low. Splashes, rings, drops and the pale flecks that ride the current are small pools in `fx` (`ring`, `splash`, `drop`, `fleckSpawn`). Ripples follow the flow, and the scene is drawn once more upside down into a small picture (`renderReflection`) so the water mirrors the buildings and sky: 512 × 320 every frame on High, 256 × 160 every other frame on Low. Low gets it too because without it the water did not read as water on a phone. The walls' materials carry one clipping plane all the time (it only bites during the mirror pass), because switching the renderer's planes on and off each frame made three re-check every material. Graphics: Phones ask for a pixel ratio of up to 2 on any setting, so that `../autores.js`, which can halve it, never takes them under 1. Auto starts High on computers and Low on touch screens and Chromebooks, and steps down to Low for the rest of the visit if frames stay under about 34 a second for nine seconds, after `../autores.js` has had its chance to lower the resolution (`quality`, `autoLow`); it never steps back up by itself. On Low there is one more step for slow phones: if frames stay under about 27 a second for nine seconds, the mirror pass is switched off for the visit (`mirrorOff`) and the water shows the sky only. Walls and props are merged into five meshes by surface (`Batch` in `models.js`: brick, wood, roof, plain and glass), each kind of block a map declares being drawn by `thing()`; debris is three instanced meshes; the first-person hands and tools are each baked into one mesh (`bake`); and things the player puts down are rebuilt together when they change (`EWLook.dyn`). **Sound** is all made in the page with the Web Audio API (`sfx`, `audioTick`): steps and wading, splashes, raking, digging, a gulp when a drain runs shallow, the pump's hum, and a lapping that fades as the place dries. **Touch:** a walk stick on the left (push it right out to run), drag anywhere else to look, and Use and Jump buttons in `#touch`, with Alt (only for tools that have a second use), Do (when you face something to work) and Turn (sandbags) appearing when they apply, all shown only on touch screens; the tool bar moves to the top there. A slow frame is caught up rather than played in slow motion: up to a quarter of a second, as up to eight water steps and the walking split into 40 ms pieces. **Tests:** `window.__ew` (the world, the player, `start(id)`, `ff(seconds)` to run the water ahead, `use()`, `select()`) is for tests and tuning from the console. To check a changed map can still be finished, load `core.js` in node, build `new EW.World(map)` and call the tool functions and `step(1/30)` until `isDone()`; every job was checked that way when it was made. **To add a job:** push a map onto `MAPS` in `core.js` after the last one (ids are saved, so never rename or reorder them), give it `needs`, `pay` and `par`, put its Spanish in `es.js`, and finish it with a node script before trying it by hand. +- `e63334287a3deaa3/ebbwork/`: Flood Crew (Back Room; first built as Ebbwork, and the folder, the `ebbwork:v1` save key and the names in the code keep that name), a single-player first-person flood-drainage game: each job is a flooded place, and you work out why it flooded and get it dry (three.js r187 from the site's own build with its r128 layer, then `../autores.js`; no Firebase, no rooms, no stats.js, no ads). It is our own design: the name, the six places, the tools, the prices and the text are ours. **Files:** `index.html` (the page and its styles), `game.js` (shaders, effects, controls, sound, HUD and menus), `models.js` (everything modelled: houses, fences, garden things, the van, drains, pipes, the things you put down, and the first-person hands and tools, all built from simple shapes and pictures drawn on a canvas, as `EWLook`), `core.js` (everything that is not drawing, with no DOM and no three.js in it, so `node` can load it: `require('./core.js')` gives `{EWSim, EW, EWMaps}`), `es.js` (its Spanish for `../lang.js`) and `preview.jpg`. **The water (`EWSim` in `core.js`, rewritten 26 Nov 2026 because the first version looked wrong: a checkerboard shimmer and a slow slosh):** the shallow-water equations on a grid of 0.5 m cells. Each cell has a ground height `g`, a barrier height `bar` laid on top and a depth `d` (kept in 64-bit numbers: with 32-bit ones a slow seep into a deep cell rounded away and volume drifted); each edge between two cells has a water speed (`u` across a cell's east edge, `v` across its south edge, m/s), so the water carries momentum: a current keeps going round a corner, piles up against a wall and swirls behind it. Every step (1/30 s, fixed): the speeds are carried along by the flow itself (semi-Lagrangian advection), speed up downhill on the water surface (`GRAV`), and are slowed by Manning friction (`mann`, 0.018), a drag on thin films (`film`) so a wet floor creeps rather than races, and a gentle linear drag (`drag`, 0.35 per second) so a pool settles in about 20 seconds instead of sloshing for minutes; then each edge carries speed × the depth on its upstream side (`fx`, `fy`), no cell may give more than it holds (flows out of a cell are scaled down together, and so are their speeds), and depths change by what flowed, so volume is conserved exactly: water only appears through `add()` and leaves through `take()`. Walls are `solid` cells. A 3 mm film (`FILM`) never flows, so floors keep real puddles in their dips. `push(x, z, vx, vz, r, f, dt)` shoves the water near a point along a velocity without adding or removing any (the player wading: a bow wave ahead and a wake behind). `vel(i, out)` gives a cell's current for drawing and for debris. Blocks of 8 × 8 cells sleep when nothing in or next to them is changing; an edge into a sleeping block carries nothing and wakes it (leaving that out loses water across the edge). One step with every block awake costs a few ms for the biggest job (68 × 48) on a desktop. With this water Tanners Field and Mill Lane run slower (the water now has to build up speed), so their `par` went up (420 to 540 s and 540 to 600 s; pay is unchanged); every job was finished again by a node bot after the change. **A job site (`EW.World`):** built from a map's `build(b)` with metres as the unit (x east, z south): `ground`, `shape` and `noise` set heights; `surf` sets the surface type and whether it can be dug; `wall` makes solid blocks (its `kind` is only for drawing); `drain` (a `rate` in m³/s and a `cap`: how much debris blocks it fully), `sinkArea` (water there leaves the map: a ditch or storm channel), `river` (cells held at a level: a stream that both feeds and takes water), `leak` (fed by a `valve` id, or `wrench: true` for a dripping joint), `valve`, `socket`, `litter`, `flood`, `spot` (a note the player gets when they walk near, kept in the journal), `sign`, `station` (the depot's board, bench and van) and `noJob` (cells that don't count). `step(dt)` runs leaks, the river, pumps, drains, sinks, the water and the debris, in that order. Debris floats in more than 5 cm of water, drifts with the current and towards a running drain, strands when the water drops, and blocks a drain by lying within 0.85 m of it (`clog`): a drain's rate is `rate × (0.03 + 0.97 × clear^1.25)`. Debris that has just been raked lies in a sodden heap for 45 seconds (`heavy`) before it can float off again, so a cleared drain stays clear long enough for the level to fall away from the heap. The job is done (`isDone`) when the water left in the job's cells is at most 3% of the most there has been (`World.DONE`) and nothing is still coming in; a skin of water under 8 mm (`World.SKIN`) is wet ground, not flood, and is not counted, which is what stops a job ending in minutes of waiting for a thin sheet to creep away. **Tools (each one a function on the world, so a test can call it):** `rake` (push or pull debris), `scoop` and `pour` (the 30-litre bucket), `squeegee` (moves water under 7 cm one cell along), `dig` and `pile` (soft ground only, down to `DIGMAX` 0.64 m; one stroke takes the cell down 0.24 m and pulls its four neighbours down with it, so a trench is a few strokes and is wide enough to run; piling uses the spoil you dug), `placeBarrier` (three cells in a row, four directions, `BARH` 0.36 m; refused on drains, ditches and the river), `placePump` / `setHose` / `placeGen` (a pump runs when it is on, has a socket or a live generator within cable reach and has a hose end; water it takes goes to the hose end's cell, so emptying into the same pool does nothing, and it only leaves the map if the hose end is on a sink or the river; a generator standing in more than 14 cm of water stops), `takeDebris` (the sack: removes debris for good), `setValve` and `fixLeak`. **The jobs (`EWMaps`, in order; a job opens when the one before has a star):** Marlow Row (a back yard: a drain buried in leaves and a split pipe whose copper supply pipe, drawn along the house wall with `pipe`, leads round the corner to its tap; a new player starts here, standing in it: the yard starts shin to knee deep, half a metre at the drain, so that it plainly is a flood and the before and after are obvious; see **The start** below), Pell Street (three hidden drains, a dripping joint, a paving dip that keeps a puddle), Tanners Field (allotments in a hollow with no drain: a trench through the bank to the ditch; a choked pipe that sits too high to finish the job), Fenny Underpass (a dead sump: pump from a wall socket with the hose over the crest to the storm channel, and a water main valve at the far end), Wharf Cellar (the river seeps in through a doorway: sandbags, then pump up the steps; it is dark, so `sky: 'cellar'` gives a head torch) and Mill Lane (a stream through its bank, a culvert under a raft of debris, a walled garden that needs the pump and the generator, a hollow to trench). `EWMaps.depot` is the depot: not a job, a yard with the job board, the gear bench and the van, and a puddle. **The start (rebuilt 26 Nov 2026 after the owner found the first version confusing):** Play puts a new player straight into Marlow Row holding the rake and nothing else. `TUT` gives one short line at a time at the bottom of the screen (move, find the drain, rake it, follow the pipe to the tap, hold to shut it, keep the drain clear) and each goes when it has been done. What a new player has not met yet is not on screen: `firstJob()` hides the scan and journal buttons, the other tools and the job's notes; the depot appears only after that job, with just the job board working (taking a job from it sets off at once); the gear bench appears after the second job (`shopOpen()`), and the van and its loadout only once the player owns more tools than it holds (`vanNeeded()`). The HUD in a job is a crosshair, one water bar, the tool, and one line of words (`#say`, which carries the instruction or else the latest message); there is no clock or coin count in a job. Each map has `pay`, `par` (the target time in seconds) and `needs` (what the job board suggests bringing, shown only after the player has been there once, so the first visit is for finding out). Stars: one for finishing, a second inside 1.6 × `par`, a third inside `par` with 1.5% or less left; pay is `pay × (0.6 + 0.2 × stars)`, halved when the job has been done before. **Gear** (`GEAR` in the page): tools with `slot: 1` take one of the van's five places (seven with Van racking); the rest are upgrades (more sandbags, long hose, cable reel, second pump, waders, racking). Prices are set so that one-star pay alone affords each next job's tool. **Storage:** localStorage `ebbwork:v1` only: `{v, coins, gear, load, jobs: {: {stars, best, n, seen}}, set: {sens, vol, q, inv}, tut}`; keep `v: 1` and these names working if you change it. Nothing is sent anywhere. **Drawing:** the ground and the water are each one mesh with a vertex at every cell centre. The ground (`terrainMat`) is three's own lit material with our patterns added in `onBeforeCompile` (grain, paving joints, and wet ground that is darker and shiny until it dries over about half a minute, so the band the water has just left is plain to see), which lets it take the sun's shadows and the cellar torch. The water (`waterMat`) is our own shader: its vertices carry depth and speed, a dry cell beside water takes its neighbours' surface height with a negative depth, and the shader throws away everything shallower than 3 mm, so the shoreline is a smooth line where the surface meets the ground and no squares show; it is brown where deep and clear where thin, with a pale lapping line a few centimetres wide at the edge (measured with screen-space derivatives of the depth, so it stays thin on a gentle slope and only shows where the water is under about 9 cm). Between two water steps the vertices are blended from the last step to this one (`aPrev`, `uLerp`), so the surface moves at the screen's frame rate, not 30 times a second. The surface slope of the simulation (`aSlope`) tilts the lighting, so a wake or a bow wave shows as a darker or brighter band. Up to four running drains (`uDr`) each get a whirlpool: a dip in the surface, the pattern twisted round the drain, a dark eye and thin spiral streaks. The ground under shallow water is tinted and gets moving caustics (High only). **Ripples** are a separate wave-equation height field on the graphics card (`RIP`: two half-float pictures swapped each step, 0.07 m texels on High at 60 steps a second, 0.12 m at 30 on Low, damped, and faded out where the flood is under about 2 cm, from a small picture of the depths, `tSim`, updated each water step). `rip(x, z, r, a)` drops a ring-shaped bump in (up to 16 a frame): the legs when wading, and everything that calls `ring()` (splashes and the like), which uses it in place of flat ring sprites. The water shader reads the ripple slope to bend the reflection and the light, with pale crests where it is steep. Without WebGL2 and half-float render targets ripples are off (`RIP.ok`) and `ring()` falls back to sprites. `__ew.U.uRipDbg.value = 1` shows the ripple heights in false colour, for tuning. The light is a low warm sun with a cool sky fill; shadows come from one shadow map that is drawn once per site and again only when something is put down (`shadowMap.autoUpdate` is off), 2048 on High and 1024 on Low. Splashes, rings, drops and the pale flecks that ride the current are small pools in `fx` (`ring`, `splash`, `drop`, `fleckSpawn`). The scene is drawn once more upside down into a picture (`renderReflection`) so the water mirrors the buildings and sky: half the screen's resolution every frame on High, a third of it (at least 256 × 160) every other frame on Low; the sun's disc is left out of that pass (`uNoSun`) because a mirrored sun clipped to white blotches, and the water adds its own sharp sun glint instead. On Low the water also skips its two finest pattern layers, the silt layer and two of the four ripple reads (`uHi`). Low gets it too because without it the water did not read as water on a phone. The walls' materials carry one clipping plane all the time (it only bites during the mirror pass), because switching the renderer's planes on and off each frame made three re-check every material. Graphics: Phones ask for a pixel ratio of up to 2 on any setting, so that `../autores.js`, which can halve it, never takes them under 1. Auto starts High on computers and Low on touch screens and Chromebooks, and steps down to Low for the rest of the visit if frames stay under about 34 a second for nine seconds, after `../autores.js` has had its chance to lower the resolution (`quality`, `autoLow`); it never steps back up by itself. On Low there is one more step for slow phones: if frames stay under about 27 a second for nine seconds, the mirror pass is switched off for the visit (`mirrorOff`) and the water shows the sky only. Walls and props are merged into five meshes by surface (`Batch` in `models.js`: brick, wood, roof, plain and glass), each kind of block a map declares being drawn by `thing()`; debris is three instanced meshes; the first-person hands and tools are each baked into one mesh (`bake`); and things the player puts down are rebuilt together when they change (`EWLook.dyn`). **Sound** is all made in the page with the Web Audio API (`sfx`, `audioTick`): steps and wading, splashes, raking, digging, a gulp when a drain runs shallow, the pump's hum, and a lapping that fades as the place dries. **Touch:** a walk stick on the left (push it right out to run), drag anywhere else to look, and Use and Jump buttons in `#touch`, with Alt (only for tools that have a second use), Do (when you face something to work) and Turn (sandbags) appearing when they apply, all shown only on touch screens; the tool bar moves to the top there. A slow frame is caught up rather than played in slow motion: up to a quarter of a second, as up to eight water steps and the walking split into 40 ms pieces. **Tests:** `window.__ew` (the world, the player, `start(id)`, `ff(seconds)` to run the water ahead, `use()`, `select()`) is for tests and tuning from the console. To check a changed map can still be finished, load `core.js` in node, build `new EW.World(map)` and call the tool functions and `step(1/30)` until `isDone()`; every job was checked that way when it was made. **To add a job:** push a map onto `MAPS` in `core.js` after the last one (ids are saved, so never rename or reorder them), give it `needs`, `pay` and `par`, put its Spanish in `es.js`, and finish it with a node script before trying it by hand. - `e63334287a3deaa3/daily/`: Daily Puzzles (Back Room), the dashboard for every daily puzzle. No libraries, no network except stats.js. `DAILY_GAMES` at the top of the script lists every daily game (`slug` = folder = storage key `daily:`, name, icon, `cat`: word, geo, logic, est (Estimation) or soccer, a one-line blurb, `ready`), plus `EXTRA` link cards under Play together (Puffer Party, `chip` in place of a daily status). Tiles only show for `ready:true` games, and "Coming soon" ones are listed under each category; flip `ready` when a game's folder lands. For each game it reads the shared record `daily:` (written by the game when a daily ends: `{ v:1, days:{YYYYMMDD:{done,win,score,tries,time}}, played, wins, streak, maxStreak, last, dist }`) and shows today's status (Not played, Solved in N / in m:ss, Done, or Missed) and the game's 🔥 streak (only while its last win was today or yesterday). Deepword is read from its own `deepword:` keys. The summary counts today's finished puzzles, the overall streak (days in a row, ending today or yesterday, with at least one daily done, worked out from every game's `days`), and counts down to local midnight; when every ready game is done it shows an "All done today" banner. stats.js (`data-game="daily"`): `max('streak', overall)` and `add('done', 1)` once per game per day (remembered in `daily-hub:counted`). It re-reads storage when the tab comes back into view or another tab writes, so finishing a puzzle in another tab updates it. Test hook: `window.__dh` under webdriver (`setToday`, `render`, `streakOverall`). A game whose win shouldn't read "Solved in " gives a `show` template (`{tries}`, `{score}`, `{time}`; `{score|hint}` adds the word, plural unless the number is 1, and `zero` is the text used when the number is 0): Crosslet shows its time, Ninefold puzzles solved of 3, Crossbar squares, Stat Duel calls right, Top Bins entries found, Quartets mistakes (Perfect for none), Sleight hints, Poopdle moves, Mainstream its points, Yardstick its total out of 500 and Thereabouts its average miss (`{score|x100}`: a score saved as a hundred times a decimal, so 137 reads "1.37×"). A missed puzzle's tile has the finished look but no ✓. Poopdle and Thereabouts are under Logic. `RETIRED`, under `DAILY_GAMES`, holds the daily puzzles taken off the list on 18 Nov 2026 (the least played; see the Back Room page above): they have no tile and aren't in today's total, but their records still count toward the overall streak, so taking a puzzle off never shortens anyone's streak, and a category with nothing listed (Soccer, for now) isn't shown. To bring one back, move its line back into `DAILY_GAMES`. The daily games don't have Back Room or phone-page cards of their own: the Daily Puzzles card and tile are the way in (the phone thumbnails in `m/thumbs/` are kept for if they ever do). - `e63334287a3deaa3/hunch/`: Hunch (Back Room, a daily puzzle on the Daily Puzzles page), a five-letter word guess in six tries, like Wordle. No libraries, no network: `words.js` holds `window.WORDS5 = { ANSWERS, GUESSES }` as space-separated strings, 2,019 answers (common, school-safe, no plurals) and 6,334 more allowed guesses (8,353 in all), written for the site and checked by a script (five letters a–z, no repeats, every answer also a guess, a blocklist for rude words). `ANSWERS` is already in daily order (a fixed seeded shuffle): day n after 1 November 2026 (puzzle #n+1, from the player's local date) uses `ANSWERS[n % length]`, so new answers must be **appended** to keep past days unchanged. Scoring marks greens first, then yellows only for as many copies as the answer has left. Hard mode (Settings, only before a game's first guess) makes every green stay put and every found letter be reused; High contrast swaps green/yellow for orange/blue. Unlimited mode picks random answers and never touches daily stats. Storage: the shared daily record `daily:hunch` (`{ v:1, days:{YYYYMMDD:{done,win,score,tries,time,hard?}}, played, wins, streak, maxStreak, last, dist }`, 60 days kept; the Daily Puzzles page reads it), the day in progress `hunch:day` (`{ d, g:[guesses], hard, t0 }`), Unlimited `hunch:free`, settings `hunch:settings`, `hunch:seen` (how-to shown) and `hunch:mode`. stats.js (`data-game="hunch"`): `add('wins')`, `max('streak')`, `min('fewest')`. The page is generated from the same engine as Fourcast (`CFG` at the top of the script: boards, rows, offset); keep the two in step when fixing the engine. Tile size is worked out in `fit()` (bigger of the layouts that fit); on a sideways phone the keyboard sits right of the board. Test hooks: `window.__wg` under webdriver (`setToday('YYYYMMDD')`, `type(word)`, `score`, …). Thanksgiving Day 2026 (`TG_DAY`) has its own answer, FEAST, set in `answersFor` for Hunch only; every other day and Fourcast are unchanged. **Spanish:** `es.js` has its words (lang.js), with a language switch in Settings; the words are English by design and tagged "En inglés". - `e63334287a3deaa3/fourcast/`: Fourcast (Back Room, a daily puzzle), four five-letter words at once in nine guesses, like Quordle. The same engine as Hunch with `boards: 4, rows: 9, offset: 777`, and the same word lists (it loads `/e63334287a3deaa3/hunch/words.js`, so don't move that file). Each guess goes on every unsolved board; a solved board stops. Day n uses `ANSWERS[(777 + 4n + k) % length]` for boards k = 0–3, so appending answers keeps past days. Each keyboard key shows four corner colours, one per board in reading order (top left = board 1). Tiles may be up to 1.45× wider than tall, and `fit()` picks a 1 × 4 or 2 × 2 layout, whichever gives bigger tiles; on a sideways phone the keyboard stays underneath in short rows. Win = all four within nine; the share card shows the guess each board fell on (🟥 for missed). Storage: `daily:fourcast` (same contract; each day also has `boards`, how many were solved), `fourcast:day`, `fourcast:free`, `fourcast:settings`, `fourcast:seen`, `fourcast:mode`. stats.js: `add('wins')`, `max('streak')`, `min('fewest')`. **Spanish:** `es.js` has its words (lang.js), with a language switch in Settings; the words are English by design and tagged "En inglés". diff --git a/e63334287a3deaa3/ebbwork/core.js b/e63334287a3deaa3/ebbwork/core.js index 08ef07b5..12ab00d2 100644 --- a/e63334287a3deaa3/ebbwork/core.js +++ b/e63334287a3deaa3/ebbwork/core.js @@ -1,21 +1,33 @@ /* Flood Crew (first built as Ebbwork; the folder and the save key keep that name): everything that is not drawing. Three parts, in order: EWSim (the water), EW.World (a job site and what each tool does to it) and EWMaps (the jobs). No DOM and no three.js, so `node` can load this file and play a job by calling the same functions the page does (see the README section). index.html loads it with one script tag. */ -// The water. A grid of square cells. Each has a ground height g (+ bar, a barrier laid on top), a water depth d, and a -// flow through its right and bottom edge (fx, fy, m3/s, signed). Each step: every edge's flow speeds up by the -// difference in surface height across it (and slows by friction), no cell may give more than it holds, then -// depths change by what flowed. Nothing is added or removed here except through add() and take(), so volume is -// conserved. Blocks of 8 x 8 cells go to sleep when nothing in or next to them is changing. +// The water: the shallow-water equations on a grid of square cells (0.5 m). Each cell has a ground height g (+ bar, a +// barrier laid on top) and a water depth d. Each edge between two cells has a water speed (u across a cell's east +// edge, v across its south edge, m/s), so the water carries momentum: a current keeps going round a corner, piles up +// against a wall and swirls behind it. Each step: +// 1. the speeds are carried along by the flow itself (semi-Lagrangian advection: look back along the current to +// where this water came from, and take the speed it had there), +// 2. they speed up downhill on the water surface (gravity), +// 3. friction slows them: Manning's law for the ground, plus a strong drag on thin films so a wet floor creeps +// rather than racing, +// 4. each edge passes speed x upwind depth x width of water (fx, fy, m3/s); no cell may give more than it holds, +// 5. depths change by what flowed in and out. +// Nothing is added or removed here except through add() and take(), so volume is conserved exactly. Blocks of 8 x 8 +// cells go to sleep when nothing in or next to them is changing. var EWSim=(function(){ - var BS=8,FILM=0.003,GRAV=9.0,AWAKE=45; + var BS=8,FILM=0.003,GRAV=9.81,AWAKE=45; function Sim(W,H,cs){ this.W=W;this.H=H;this.cs=cs;var n=W*H;this.n=n; this.g=new Float32Array(n);this.bar=new Float32Array(n);this.solid=new Uint8Array(n); this.d=new Float64Array(n);this.fx=new Float32Array(n);this.fy=new Float32Array(n); + this.u=new Float32Array(n);this.v=new Float32Array(n);this.u2=new Float32Array(n);this.v2=new Float32Array(n); this.k=new Float32Array(n); this.BW=Math.ceil(W/BS);this.BH=Math.ceil(H/BS);var nb=this.BW*this.BH; this.act=new Uint8Array(nb);this.proc=new Uint8Array(nb);this.was=new Uint8Array(nb); - this.nProc=0;this.fric=0.004;this.damp=0.4; + this.nProc=0; + this.mann=0.018; // Manning's n: about right for paving and short grass + this.film=0.00012; // drag on thin water (m^2/s): a 1 cm film barely moves, 10 cm flows freely + this.drag=0.35; // a little drag on everything (1/s): rubbish, grass and rough ground in the water. Waves die down in seconds, not minutes } var P=Sim.prototype; P.idx=function(x,z){return z*this.W+x}; @@ -25,53 +37,73 @@ var EWSim=(function(){ P.take=function(i,vol){var a=this.cs*this.cs,have=this.d[i]*a,t=volW-2){x0=W-2;fx=1}if(z0<0){z0=0;fz=0}else if(z0>H-2){z0=H-2;fz=1} + var i=z0*W+x0;return (F[i]*(1-fx)+F[i+1]*fx)*(1-fz)+(F[i+W]*(1-fx)+F[i+W+1]*fx)*fz} P.step=function(dt){ var W=this.W,H=this.H,BW=this.BW,BH=this.BH,g=this.g,bar=this.bar,solid=this.solid,d=this.d,fx=this.fx,fy=this.fy,k=this.k; - var act=this.act,proc=this.proc,was=this.was,bx,bz,b,x,z,i,x0,x1,z0,z1,np=0; - var cs=this.cs,area=cs*cs,cdt=dt*GRAV,fr=this.fric*dt,lim=area/dt,dm=1+this.damp*dt; + var u=this.u,v=this.v,u2=this.u2,v2=this.v2; + var act=this.act,proc=this.proc,was=this.was,bx,bz,b,x,z,i,j,x0,x1,z0,z1,np=0; + var cs=this.cs,area=cs*cs,lim=area/dt,gdc=GRAV*dt/cs,s=dt/cs,vmax=0.45*cs/dt,mf=GRAV*this.mann*this.mann*dt,ff=this.film*dt,dr=1+this.drag*dt; // which blocks to work on: awake ones and their neighbours for(bz=0;bz0&&act[b-1])||(bx0&&act[b-BW])||(bz0?v[i-W]+(x0?u[i-1]+(zzj?zi:zj;up=(hi>hj?hi:hj)-sill-FILM; - if(up>0){if(x===xe){fx[i]=0;act[b]=AWAKE}else{f=(fx[i]+cdt*up*(hi-hj))/(dm+fr/(up+0.01));fx[i]=f}}else fx[i]=0; - }else fx[i]=0; - if(zzj?zi:zj;up=(hi>hj?hi:hj)-sill-FILM; - if(up>0){if(z===ze){fy[i]=0;act[b]=AWAKE}else{f=(fy[i]+cdt*up*(hi-hj))/(dm+fr/(up+0.01));fy[i]=f}}else fy[i]=0; - }else fy[i]=0; - } + for(z=z0;zzj?zi:zj; + if((hi>hj?hi:hj)-sill>FILM){if(x===xe){u[i]=0;fx[i]=0;act[b]=AWAKE}else{ + sp=u2[i]-gdc*(hj-hi);dw=sp>0?hi-sill:hj-sill; + if(dw<=FILM){sp=0;fx[i]=0}else{var h43=Math.pow(dw,1.3333);sp=sp/(dr+mf*(sp<0?-sp:sp)/h43+ff/(dw*dw));if(sp>vmax)sp=vmax;else if(sp<-vmax)sp=-vmax;fx[i]=sp*dw*cs} + u[i]=sp}}else{u[i]=0;fx[i]=0} + }else{u[i]=0;fx[i]=0} + // south edge + if(zzj?zi:zj; + if((hi>hj?hi:hj)-sill>FILM){if(z===ze){v[i]=0;fy[i]=0;act[b]=AWAKE}else{ + sp=v2[i]-gdc*(hj-hi);dw=sp>0?hi-sill:hj-sill; + if(dw<=FILM){sp=0;fy[i]=0}else{var h43b=Math.pow(dw,1.3333);sp=sp/(dr+mf*(sp<0?-sp:sp)/h43b+ff/(dw*dw));if(sp>vmax)sp=vmax;else if(sp<-vmax)sp=-vmax;fy[i]=sp*dw*cs} + v[i]=sp}}else{v[i]=0;fy[i]=0} + }else{v[i]=0;fy[i]=0} } } - // 2. no cell gives more than it holds + // no cell gives more than it holds (outflows are scaled down together, and so are their speeds) for(bz=0;bz0)out+=v;v=fy[i];if(v>0)out+=v; - if(x>0){v=fx[i-1];if(v<0)out-=v} - if(z>0){v=fy[i-W];if(v<0)out-=v} + i=z*W+x;var out=0,q; + q=fx[i];if(q>0)out+=q;q=fy[i];if(q>0)out+=q; + if(x>0){q=fx[i-1];if(q<0)out-=q} + if(z>0){q=fy[i-W];if(q<0)out-=q} var can=d[i]*lim;k[i]=out>can?(out>0?can/out:0):1; } } @@ -79,14 +111,14 @@ var EWSim=(function(){ if(!proc[bz*BW+bx])continue; x0=bx*BS;x1=Math.min(W,x0+BS);z0=bz*BS;z1=Math.min(H,z0+BS); for(z=z0;z0)fx[i]=a*k[i];else if(a<0)fx[i]=a*(proc[(((z/BS)|0))*BW+(((x+1)/BS)|0)]?k[i+1]:0); - a=fy[i]; - if(a>0)fy[i]=a*k[i];else if(a<0)fy[i]=a*(proc[(((z+1)/BS)|0)*BW+((x/BS)|0)]?k[i+W]:0); + i=z*W+x;var a2=fx[i],kk; + if(a2>0){kk=k[i];fx[i]=a2*kk;u[i]*=kk}else if(a2<0){kk=proc[(((z/BS)|0))*BW+(((x+1)/BS)|0)]?k[i+1]:0;fx[i]=a2*kk;u[i]*=kk} + a2=fy[i]; + if(a2>0){kk=k[i];fy[i]=a2*kk;v[i]*=kk}else if(a2<0){kk=proc[(((z+1)/BS)|0)*BW+((x/BS)|0)]?k[i+W]:0;fy[i]=a2*kk;v[i]*=kk} } } - // 3. depths - var q=dt/area; + // 5. depths + var q2=dt/area; for(bz=0;bz0)net+=fx[i-1];if(z>0)net+=fy[i-W]; - net*=q;var nd=d[i]+net;if(nd<0)nd=0;d[i]=nd; + net*=q2;var nd=d[i]+net;if(nd<0)nd=0;d[i]=nd; if(net<0)net=-net;if(net>mx)mx=net; } if(mx>4e-5)act[b]=AWAKE;else if(act[b]>0)act[b]--; @@ -104,11 +136,22 @@ var EWSim=(function(){ }; // speed of the water in a cell (m/s), written into out[0], out[1] P.vel=function(i,out){ - var W=this.W,x=i%W,dd=this.d[i];if(dd<0.004){out[0]=0;out[1]=0;return} - var a=this.fx[i]+(x>0?this.fx[i-1]:0),b=this.fy[i]+(i>=W?this.fy[i-W]:0),s=0.5/(this.cs*(dd+0.02)); - out[0]=a*s;out[1]=b*s; + var W=this.W,x=i%W;if(this.d[i]<0.004){out[0]=0;out[1]=0;return} + out[0]=0.5*(this.u[i]+(x>0?this.u[i-1]:0));out[1]=0.5*(this.v[i]+(i>=W?this.v[i-W]:0)); + }; + // Something moving through the water (a person wading) shoves it: the water in front is pushed along and out to + // the sides, which makes a bow wave and a wake. Only speeds change, so no water is made or lost. + // (x, z) in cells, (vx, vz) in m/s, r in cells, f = how much of the mover's speed the water takes on per second. + P.push=function(x,z,vx,vz,r,f,dt){ + var W=this.W,H=this.H,u=this.u,v=this.v,d=this.d,solid=this.solid,sp=Math.sqrt(vx*vx+vz*vz);if(sp<0.05)return; + var nx=vx/sp,nz=vz/sp,ax=Math.max(0,Math.floor(x-r)),bx=Math.min(W-2,Math.ceil(x+r)),az=Math.max(0,Math.floor(z-r)),bz=Math.min(H-2,Math.ceil(z+r)),cx,cz,i,q,w,ex,ez,ahead,k=f*dt; + for(cz=az;cz<=bz;cz++)for(cx=ax;cx<=bx;cx++){i=cz*W+cx;if(solid[i]||d[i]<0.02)continue; + ex=cx+0.5-x;ez=cz+0.5-z;q=Math.sqrt(ex*ex+ez*ez);if(q>r)continue;w=1-q/r;w*=w; + ahead=(ex*nx+ez*nz)/(q+0.3); // in front of the mover: pushed along; beside: pushed out + var px=vx*Math.max(0,ahead)+ex/(q+0.3)*sp*0.6,pz=vz*Math.max(0,ahead)+ez/(q+0.3)*sp*0.6; + u[i]+=(px-u[i])*k*w;v[i]+=(pz-v[i])*k*w;this.wake(i)} }; - Sim.FILM=FILM;Sim.BS=BS; + Sim.FILM=FILM;Sim.BS=BS;Sim.GRAV=GRAV; return Sim; })(); // The job site: ground, walls, drains, leaks, valves, debris, pumps, barriers, and what each tool does to them. @@ -345,7 +388,7 @@ var EWMaps=(function(){ b.spawnAt(2,9,-Math.PI/2); }}); // 3. Tanners Field: allotments in a hollow. No drain at all: the only way out is over, or through, the bank. - MAPS.push({id:'field',name:'Tanners Field',sub:'Allotments',w:34,h:24,seed:31,pay:160,par:420,sky:'day',needs:['shovel','rake'], + MAPS.push({id:'field',name:'Tanners Field',sub:'Allotments',w:34,h:24,seed:31,pay:160,par:540,sky:'day',needs:['shovel','rake'], brief:'The allotments sit in a hollow. The water came in and has nowhere to go.', build:function(b){ b.ground(function(x,z){if(x>=30.5)return -0.6;var g=0.30+0.015*dist(x,z,22,12)+0.36*bump((x-28.75)/1.25);if(x>30)g=g+(x-30)*2*(-0.6-g);return g}); @@ -406,7 +449,7 @@ var EWMaps=(function(){ b.spawnAt(10.5,1.6,Math.PI); }}); // 6. Mill Lane: the stream has broken its bank and is still coming. - MAPS.push({id:'mill',name:'Mill Lane',sub:'Lane by the stream',w:30,h:24,seed:67,pay:400,par:540,sky:'day',needs:['sandbags','rake','pump','generator','shovel'], + MAPS.push({id:'mill',name:'Mill Lane',sub:'Lane by the stream',w:30,h:24,seed:67,pay:400,par:600,sky:'day',needs:['sandbags','rake','pump','generator','shovel'], brief:'The mill stream is through its bank and the whole lane is under. Start with whatever is still feeding it.', build:function(b){ b.ground(function(x,z){ diff --git a/e63334287a3deaa3/ebbwork/game.js b/e63334287a3deaa3/ebbwork/game.js index 61599b50..473f70f1 100644 --- a/e63334287a3deaa3/ebbwork/game.js +++ b/e63334287a3deaa3/ebbwork/game.js @@ -78,54 +78,128 @@ var noiseTex=(function(){var N=128,c=document.createElement('canvas');c.width=c. var t=new THREE.CanvasTexture(c);t.wrapS=t.wrapT=THREE.RepeatWrapping;return t})(); var U={uT:{value:0},uCam:{value:new THREE.Vector3()},uSun:{value:SKY.sun},uSunC:{value:SKY.sunC},uSky:{value:SKY.zen},uHor:{value:SKY.hor}, - uFog:{value:SKY.fog},uFogN:{value:45},uFogF:{value:210},tN:{value:noiseTex},uScan:{value:0},uTorch:{value:0},uDay:{value:1},tR:{value:null},uRefl:{value:0},uReflVP:{value:new THREE.Matrix4()}}; + uFog:{value:SKY.fog},uFogN:{value:45},uFogF:{value:210},tN:{value:noiseTex},uScan:{value:0},uTorch:{value:0},uDay:{value:1},tR:{value:null},uRefl:{value:0},uReflVP:{value:new THREE.Matrix4()}, + tRip:{value:null},uRipOn:{value:0},uMap:{value:new THREE.Vector2(1,1)},uRipPx:{value:new THREE.Vector2(0.1,0.1)},uLerp:{value:1}, + uNoSun:{value:0},uRipDbg:{value:0},uHi:{value:1},uDr:{value:[new THREE.Vector4(),new THREE.Vector4(),new THREE.Vector4(),new THREE.Vector4()]}}; var skyDome=new THREE.Mesh(new THREE.SphereGeometry(260,24,12),new THREE.ShaderMaterial({uniforms:U,side:THREE.BackSide,depthWrite:false,fog:false, vertexShader:'varying vec3 vDir;void main(){vDir=normalize(position);gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}', - fragmentShader:'precision highp float;uniform sampler2D tN;uniform float uT;uniform vec3 uSun,uSunC,uSky,uHor;varying vec3 vDir;'+ + fragmentShader:'precision highp float;uniform sampler2D tN;uniform float uT,uNoSun;uniform vec3 uSun,uSunC,uSky,uHor;varying vec3 vDir;'+ 'void main(){vec3 d=normalize(vDir);float h=max(d.y,0.0);float sd=max(dot(d,uSun),0.0);vec3 c=mix(uHor,uSky,pow(h,0.55));c=mix(c,vec3(1.0,0.86,0.62),pow(sd,5.0)*0.55*(1.0-h*0.6));'+ 'vec2 uv=d.xz/(d.y+0.3);float n=texture2D(tN,uv*0.10+vec2(uT*0.0016,0.0)).b*0.62+texture2D(tN,uv*0.29-vec2(0.0,uT*0.0022)).r*0.38;'+ 'float cl=smoothstep(0.50,0.72,n)*smoothstep(0.0,0.2,h);vec3 cc=mix(vec3(1.0,0.95,0.86),vec3(0.62,0.66,0.74),smoothstep(0.58,0.9,n));cc=mix(cc,vec3(1.0,0.82,0.6),pow(sd,3.0)*0.5);c=mix(c,cc,cl*0.85);'+ - 'c+=uSunC*pow(sd,260.0)*1.4+uSunC*pow(sd,22.0)*0.22;gl_FragColor=vec4(c,1.0);}'})); + 'c+=(uSunC*pow(sd,260.0)*1.4+uSunC*pow(sd,22.0)*0.22)*(1.0-uNoSun);gl_FragColor=vec4(c,1.0);}'})); skyDome.renderOrder=-10;skyDome.frustumCulled=false;scene.add(skyDome); var FOGF='float fd=length(uCam-vW);gl_FragColor.rgb=mix(gl_FragColor.rgb,uFog,smoothstep(uFogN,uFogF,fd));'; // The ground is three's own lit material (so it takes the sun's shadows and the torch), with our patterns added: // grain, paving joints, and wet ground that is darker and shines until it dries. var terrainMat=new THREE.MeshLambertMaterial({vertexColors:true}); -terrainMat.onBeforeCompile=function(sh){sh.uniforms.tN=U.tN;sh.uniforms.uHorC=U.uHor; - sh.vertexShader=sh.vertexShader.replace('#include ','attribute float aPat;attribute float aWet;varying float vPat;varying float vWet;varying vec3 vWp;\n#include ').replace('#include ','#include \nvPat=aPat;vWet=aWet;vWp=position;'); - sh.fragmentShader=sh.fragmentShader.replace('#include ','uniform sampler2D tN;uniform vec3 uHorC;varying float vPat;varying float vWet;varying vec3 vWp;\n#include ') +terrainMat.onBeforeCompile=function(sh){sh.uniforms.tN=U.tN;sh.uniforms.uHorC=U.uHor;sh.uniforms.uT=U.uT;sh.uniforms.uSunC=U.uSunC;sh.uniforms.uDay=U.uDay;sh.uniforms.uHi=U.uHi; + sh.vertexShader=sh.vertexShader.replace('#include ','attribute float aPat;attribute float aWet;attribute float aWd;varying float vPat;varying float vWet;varying float vWd;varying vec3 vWp;\n#include ').replace('#include ','#include \nvPat=aPat;vWet=aWet;vWd=aWd;vWp=position;'); + sh.fragmentShader=sh.fragmentShader.replace('#include ','uniform sampler2D tN;uniform vec3 uHorC,uSunC;uniform float uT,uDay,uHi;varying float vPat;varying float vWet;varying float vWd;varying vec3 vWp;\n#include ') .replace('#include ','#include \nvec3 g_=texture2D(tN,vWp.xz*0.43).rgb;float big_=texture2D(tN,vWp.xz*0.071+0.3).b;diffuseColor.rgb*=(0.80+0.34*g_.b)*(0.84+0.32*big_);'+ 'if(vPat>0.02){vec2 q_=vWp.xz/vPat;vec2 f_=abs(fract(q_)-0.5);float j_=smoothstep(0.455,0.492,max(f_.x,f_.y));vec2 id_=floor(q_);float h_=fract(sin(dot(id_,vec2(12.9898,78.233)))*43758.5453);diffuseColor.rgb*=(0.90+0.18*h_)*(1.0-0.45*j_);}'+ 'else{diffuseColor.rgb*=0.86+0.34*texture2D(tN,vWp.xz*1.9).r;}'+ - 'float wet_=clamp(vWet,0.0,1.0);diffuseColor.rgb*=mix(1.0,0.52,wet_);') - .replace('#include ','#include \nfloat fr_=pow(1.0-abs(dot(normalize(vNormal),normalize(vViewPosition))),3.0);totalEmissiveRadiance+=uHorC*fr_*wet_*0.38;')}; + 'float wet_=clamp(vWet,0.0,1.0);diffuseColor.rgb*=mix(1.0,0.52,wet_);'+ + // under water the ground takes on the colour of the silt in it + 'float uw_=smoothstep(0.0,0.18,vWd);diffuseColor.rgb=mix(diffuseColor.rgb,vec3(0.32,0.25,0.15),uw_*0.55);') + .replace('#include ','#include \n'+ + // wet paving shines a little at a low angle; grass does not + 'float fr_=pow(1.0-abs(dot(normalize(vNormal),normalize(vViewPosition))),4.0);totalEmissiveRadiance+=uHorC*fr_*wet_*0.14*step(0.02,vPat)*(1.0-uw_);'+ + // caustics: sunlight focused by the ripples into a moving net of bright lines on the bottom of shallow water + 'if(uHi>0.5&&vWd>0.004&&vWd<0.3){vec2 cp_=vWp.xz*1.25;float c1_=texture2D(tN,cp_*0.61+vec2(uT*0.031,uT*0.019)).b;float c2_=texture2D(tN,cp_*0.73-vec2(uT*0.023,-uT*0.029)+0.5).b;'+ + 'float ca_=pow(max(0.0,1.0-abs(c1_-c2_)*3.2),6.0);totalEmissiveRadiance+=uSunC*uDay*ca_*0.55*smoothstep(0.004,0.03,vWd)*exp(-vWd*11.0);}')}; -// The water. Brown where it is deep, clear where it is thin, a pale moving line where it meets the ground, ripples that -// run with the current, and the sky (or on High, a mirror picture of the site) on its surface. +// The water. Its vertices sit at the cell centres; they glide between two simulation steps (uLerp) so the surface +// never jumps. Brown and opaque where deep, clearer where thin; a crisp foam line at the shore; patches of silt that +// drift with the current; ripples from a second, finer simulation on the graphics card (tRip: footsteps, drips, +// rake strokes, pours); a whirlpool over every running drain (uDr); and the sky, or a mirror picture of the site, on top. var waterMat=new THREE.ShaderMaterial({uniforms:U,transparent:true,depthWrite:false,polygonOffset:true,polygonOffsetFactor:-1,polygonOffsetUnits:-3, - vertexShader:'attribute float aDepth;attribute vec2 aFlow;uniform mat4 uReflVP;varying float vD;varying vec2 vF;varying vec3 vW;varying vec4 vR;'+ - 'void main(){vD=aDepth;vF=aFlow;vW=position;vR=uReflVP*vec4(position,1.0);gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}', - fragmentShader:'precision highp float;uniform sampler2D tN,tR;uniform float uT,uScan,uFogN,uFogF,uTorch,uDay,uRefl;uniform vec3 uCam,uSun,uSunC,uSky,uHor,uFog;varying float vD;varying vec2 vF;varying vec3 vW;varying vec4 vR;'+ + vertexShader:'attribute float aDepth;attribute vec2 aFlow;attribute vec2 aPrev;attribute vec2 aSlope;uniform mat4 uReflVP;uniform float uLerp,uT;uniform vec4 uDr[4];varying float vD;varying vec2 vF;varying vec2 vS;varying vec3 vW;varying vec4 vR;'+ + 'void main(){vec3 p=position;p.y=mix(aPrev.x,p.y,uLerp);vD=mix(aPrev.y,aDepth,uLerp);vF=aFlow;vS=aSlope;'+ + 'for(int i=0;i<4;i++){vec4 d=uDr[i];if(d.z<=0.0)continue;vec2 e=p.xz-d.xy;p.y-=d.z*0.11*exp(-dot(e,e)/0.30)*smoothstep(0.02,0.12,vD);}'+ + 'vW=p;vR=uReflVP*vec4(p,1.0);gl_Position=projectionMatrix*modelViewMatrix*vec4(p,1.0);}', + fragmentShader:'precision highp float;uniform sampler2D tN,tR,tRip;uniform float uT,uScan,uFogN,uFogF,uTorch,uDay,uRefl,uRipOn,uRipDbg,uHi;uniform vec2 uMap,uRipPx;uniform vec4 uDr[4];uniform vec3 uCam,uSun,uSunC,uSky,uHor,uFog;varying float vD;varying vec2 vF;varying vec2 vS;varying vec3 vW;varying vec4 vR;'+ 'void main(){if(vD<0.003)discard;'+ - 'vec2 uv=vW.xz*0.30;vec2 fl=clamp(vF,-1.6,1.6)*0.6;float sp=length(vF);'+ + 'vec2 xz=vW.xz;float swirl=0.0,eye=0.0,spiral=0.0;'+ + // whirlpools: twist the surface pattern round each running drain, darken its eye, and draw spiral streaks + 'for(int i=0;i<4;i++){vec4 d=uDr[i];if(d.z<=0.0)continue;vec2 e=vW.xz-d.xy;float r=length(e);if(r>1.2)continue;float st=d.z*smoothstep(1.2,0.15,r);'+ + 'float an=st*2.2/(r+0.22)+uT*d.z*3.0;float cs=cos(an),sn=sin(an);xz=d.xy+vec2(cs*e.x-sn*e.y,sn*e.x+cs*e.y);swirl=max(swirl,st);eye=max(eye,d.z*exp(-r*r/0.06));'+ + 'float ang=atan(e.y,e.x);spiral=max(spiral,st*st*smoothstep(0.82,0.99,sin(ang*3.0+log(r+0.04)*7.0+uT*d.z*9.0))*smoothstep(0.04,0.2,r)*smoothstep(0.9,0.3,r));}'+ + 'vec2 uv=xz*0.30;vec2 fl=clamp(vF,-1.6,1.6)*0.6;float sp=length(vF);'+ 'float p0=fract(uT*0.35),p1=fract(uT*0.35+0.5);'+ 'vec3 a=texture2D(tN,uv-fl*p0+vec2(uT*0.021,uT*0.013)).rgb;vec3 b=texture2D(tN,uv*1.07+0.37-fl*p1-vec2(uT*0.017,-uT*0.019)).rgb;'+ - 'vec3 m=mix(a,b,abs(1.0-2.0*p0));vec3 fine=texture2D(tN,vW.xz*1.3+vec2(-uT*0.05,uT*0.04)).rgb;vec2 nn=(m.xy*2.0-1.0)+(fine.xy*2.0-1.0)*0.35;'+ - 'float calm=smoothstep(0.0,0.04,vD);float amp=(0.20+min(sp,1.2)*0.6)*calm;'+ - 'vec3 N=normalize(vec3(nn.x*amp,1.0,nn.y*amp));vec3 V=normalize(uCam-vW);'+ - 'float fres=0.08+0.92*pow(1.0-max(dot(N,V),0.0),3.2);'+ - 'float murk=1.0-exp(-max(vD,0.0)*7.5);vec3 tv=uCam-vW;float tl=uTorch*1.5/(1.0+dot(tv,tv)*0.10);float lit=uDay+tl;'+ - 'vec3 body=mix(vec3(0.55,0.44,0.27),vec3(0.38,0.27,0.13),murk)*lit;float al=mix(0.22,0.98,murk);'+ + 'vec3 m=mix(a,b,abs(1.0-2.0*p0));vec3 fine=vec3(0.5,0.5,0.75),chop=vec3(0.5);if(uHi>0.5){fine=texture2D(tN,xz*1.3+vec2(-uT*0.05,uT*0.04)).rgb;chop=texture2D(tN,xz*3.7+vec2(uT*0.09,-uT*0.07)).rgb;}'+ + 'float near=1.0-smoothstep(4.0,18.0,length(uCam.xz-vW.xz));vec2 nn=(m.xy*2.0-1.0)+(fine.xy*2.0-1.0)*0.45+(chop.xy*2.0-1.0)*0.3*near;'+ + 'float calm=smoothstep(0.0,0.04,vD);float amp=(0.2+min(sp,1.2)*0.55+swirl*0.5)*calm;'+ + 'vec3 N=normalize(vec3(nn.x*amp-vS.x*3.0*calm,1.0,nn.y*amp-vS.y*3.0*calm));float crest=0.0;vec2 rg=vec2(0.0);'+ + // ripples: slope of the ripple height field, sampled one texel either side + 'if(uRipOn>0.5){vec2 ru=vW.xz/uMap;vec2 o=uRipPx/uMap;float hr=texture2D(tRip,ru+vec2(o.x,0.0)).r,hu=texture2D(tRip,ru+vec2(0.0,o.y)).r,hl,hd;'+ + 'if(uHi>0.5){hl=texture2D(tRip,ru-vec2(o.x,0.0)).r;hd=texture2D(tRip,ru-vec2(0.0,o.y)).r;}else{hl=texture2D(tRip,ru).r;hd=hl;hr+=hr-hl;hu+=hu-hd;}'+ + 'vec2 gr=vec2(hr-hl,hu-hd)/(2.0*uRipPx);rg=gr;N=normalize(N+vec3(-gr.x,0.0,-gr.y)*5.0);crest=smoothstep(0.12,0.3,length(gr));}'+ + 'vec3 V=normalize(uCam-vW);'+ + 'float fres=0.06+0.94*pow(1.0-max(dot(N,V),0.0),4.0);'+ + 'float murk=1.0-exp(-max(vD,0.0)*8.0);vec3 tv=uCam-vW;float tl=uTorch*1.5/(1.0+dot(tv,tv)*0.10);float lit=uDay+tl;'+ + // silt: lighter and darker clouds in the water that drift with the flow + 'float silt=m.r;if(uHi>0.5)silt=texture2D(tN,uv*0.45-fl*p0*0.5+0.11).b*0.6+m.r*0.4;'+ + 'vec3 body=mix(vec3(0.50,0.45,0.31),vec3(0.27,0.22,0.13),murk)*(0.86+0.28*silt)*lit;body*=1.0-eye*0.55;vec2 sl=-rg-vS*1.5;body*=1.0+clamp(dot(sl,normalize(uSun.xz+vec2(1e-4)))*4.0,-0.4,0.4)*calm;float al=mix(0.18,0.97,murk);'+ 'vec3 R=reflect(-V,N);vec3 skyc=mix(uHor,uSky,clamp(R.y*1.25,0.0,1.0));skyc=mix(vec3(0.20,0.21,0.17)*lit,skyc,smoothstep(0.04,0.30,R.y+nn.x*0.05))+vec3(0.05,0.07,0.08)*uTorch;'+ - 'if(uRefl>0.5){vec2 ruv=vR.xy/vR.w*0.5+0.5+nn*0.03*calm;skyc=texture2D(tR,clamp(ruv,0.003,0.997)).rgb;}'+ - 'vec3 col=mix(body,skyc,fres);al=mix(al,1.0,fres*0.85);'+ - 'float sd=max(dot(R,uSun),0.0);col+=uSunC*(pow(sd,90.0)*1.3+pow(sd,14.0)*0.10*step(0.62,fine.b));col+=vec3(1.0,0.93,0.8)*tl*pow(max(dot(R,V),0.0),10.0)*0.5;'+ - 'float foam=smoothstep(0.18,0.8,sp)*smoothstep(0.50,0.74,m.b)*calm;col=mix(col,vec3(0.95,0.93,0.86)*lit,foam*0.75);al=max(al,foam*0.75);'+ - 'float lap=0.5+0.5*sin(uT*1.7+m.r*9.0);float edge=(1.0-smoothstep(0.006+0.014*lap,0.045+0.025*lap,vD));col=mix(col,vec3(1.0,0.97,0.88)*lit,edge*0.8);al=max(al,edge*0.85);'+ - 'al*=smoothstep(0.003,0.009,vD);'+ + 'if(uRefl>0.5){vec2 ruv=vR.xy/vR.w*0.5+0.5+N.xz*0.12*calm;skyc=mix(skyc,texture2D(tR,clamp(ruv,0.003,0.997)).rgb,0.88);}'+ + 'vec3 col=mix(body,skyc,fres*calm);al=mix(al,1.0,fres*0.8*calm);'+ + 'float sd=max(dot(R,uSun),0.0);col+=uSunC*(pow(sd,900.0)*(1.0+2.0*uHi)+pow(sd,60.0)*0.18+pow(sd,40.0)*0.22*smoothstep(0.8,0.92,chop.b)*near)*calm;col+=vec3(1.0,0.93,0.8)*tl*pow(max(dot(R,V),0.0),10.0)*0.5;'+ + // foam: streaks where the current is quick, on ripple crests, and in the whirlpool's arms + 'float foam=smoothstep(0.12,0.6,sp)*smoothstep(0.52,0.76,m.b)*calm;foam=max(foam,crest*0.35*calm);foam=max(foam,spiral*0.5);'+ + // the shore: a foam line a few centimetres wide whatever the slope, broken up and lapping + 'vec2 gD=vec2(dFdx(vD),dFdy(vD));vec2 gx=vec2(length(dFdx(vW.xz)),length(dFdy(vW.xz)));float dslope=length(gD)/max(length(gx),1e-4);'+ + 'float shoreDist=vD/max(dslope,0.015);float lap=0.5+0.5*sin(uT*1.6+m.r*8.0);float edge=(1.0-smoothstep(0.03+0.05*lap,0.16+0.06*lap,shoreDist))*smoothstep(0.35,0.62,fine.b+0.25)*(1.0-smoothstep(0.03,0.09,vD));'+ + 'foam=max(foam,edge*0.9);col=mix(col,vec3(0.96,0.94,0.87)*lit,foam);al=max(al,foam*0.92);'+ + 'al*=smoothstep(0.003,0.008,vD);'+ 'float sc=uScan*step(0.009,vD)*(0.6+0.4*sin(uT*9.0-length(vW.xz-uCam.xz)*1.6));col=mix(col,vec3(0.25,1.0,0.92),sc*0.8);al=max(al,sc*0.85);'+ - 'gl_FragColor=vec4(col,al);'+FOGF+'}'}); + 'gl_FragColor=vec4(col,al);'+FOGF+'if(uRipDbg>0.5){float h=texture2D(tRip,vW.xz/uMap).r;gl_FragColor=vec4(0.5+h*60.0,0.5,0.5-h*60.0,1.0);}}'}); + +// ---------------------------------------------------------------- ripples: a wave simulation on the graphics card +// A height field a few centimetres a texel over the whole site (R = height now, G = height a step ago). Each 1/60 s: +// the wave equation, damped, held at zero where there is no water (the flood simulation's depths come in through +// tSim) so ripples bounce off walls and die on the shore. Each bump has a dip round it, so it makes rings rather than +// a swell. (Carrying the ripples along with the current was tried: the resampling blurred them away within a second.) Anything that touches the water +// adds a bump (rip()). Needs half-float render targets; without them the flat rings in fx do the job instead. +var RIP={ok:false,a:null,b:null,sim:null,simData:null,scene:null,cam:null,mat:null,acc:0,imp:[],n:0,W:0,H:0,px:0.1,dt:1/60}; +(function(){var gl=renderer.getContext();RIP.ok=!!(renderer.capabilities.isWebGL2&&(renderer.extensions.has('EXT_color_buffer_float')||renderer.extensions.has('EXT_color_buffer_half_float'))); + if(!RIP.ok)return;void gl; + var imp=[];for(var k=0;k<16;k++)imp.push(new THREE.Vector4());RIP.imp=imp; + RIP.mat=new THREE.ShaderMaterial({uniforms:{tPrev:{value:null},tSim:{value:null},uTex:{value:new THREE.Vector2()},uMap:U.uMap,uK:{value:0.04},uDamp:{value:0.992},uDt:{value:1/60},uImp:{value:imp},uImpN:{value:0}}, + vertexShader:'varying vec2 vUv;void main(){vUv=uv;gl_Position=vec4(position.xy,0.0,1.0);}', + fragmentShader:'precision highp float;uniform sampler2D tPrev,tSim;uniform vec2 uTex,uMap;uniform float uK,uDamp,uDt;uniform vec4 uImp[16];uniform int uImpN;varying vec2 vUv;'+ + 'void main(){vec4 s=texture2D(tSim,vUv);vec2 a=vUv;vec4 c=texture2D(tPrev,a);'+ + 'float sum=texture2D(tPrev,a+vec2(uTex.x,0.0)).r+texture2D(tPrev,a-vec2(uTex.x,0.0)).r+texture2D(tPrev,a+vec2(0.0,uTex.y)).r+texture2D(tPrev,a-vec2(0.0,uTex.y)).r;'+ + 'float h=(2.0*c.r-c.g+uK*(sum-4.0*c.r))*uDamp;vec2 w=vUv*uMap;'+ + 'for(int i=0;i<16;i++){if(i>=uImpN)break;vec4 p=uImp[i];vec2 e=w-p.xy;float q=dot(e,e)/(p.z*p.z);h+=p.w*(exp(-q)-0.25*exp(-q*0.25));}'+ + 'h*=smoothstep(0.008,0.03,s.r);h=clamp(h,-0.08,0.08);gl_FragColor=vec4(h,c.r,0.0,1.0);}',depthTest:false,depthWrite:false}); + RIP.scene=new THREE.Scene();RIP.cam=new THREE.OrthographicCamera(-1,1,1,-1,0,1);RIP.scene.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),RIP.mat)); +})(); +function ripSetup(){ + if(!RIP.ok){U.uRipOn.value=0;return} + var hi=quality()==='high',px=hi?0.07:0.12,W=Math.min(400,Math.ceil(world.def.w/px)),H=Math.min(400,Math.ceil(world.def.h/px));px=Math.max(world.def.w/W,world.def.h/H); + if(RIP.a){RIP.a.dispose();RIP.b.dispose()}if(RIP.sim)RIP.sim.dispose(); + var o={type:THREE.HalfFloatType,format:THREE.RGBAFormat,minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,depthBuffer:false,stencilBuffer:false,wrapS:THREE.ClampToEdgeWrapping,wrapT:THREE.ClampToEdgeWrapping}; + RIP.a=new THREE.WebGLRenderTarget(W,H,o);RIP.b=new THREE.WebGLRenderTarget(W,H,o);RIP.W=W;RIP.H=H;RIP.px=px; + var cl=new THREE.Color(0,0,0);renderer.setClearColor(cl,0);[RIP.a,RIP.b].forEach(function(t){renderer.setRenderTarget(t);renderer.clear()});renderer.setRenderTarget(null);renderer.setClearColor(SKY.fog,1); + RIP.simData=new Uint16Array(world.W*world.H*4);RIP.sim=new THREE.DataTexture(RIP.simData,world.W,world.H,THREE.RGBAFormat,THREE.HalfFloatType);RIP.sim.minFilter=RIP.sim.magFilter=THREE.LinearFilter;RIP.sim.needsUpdate=true; + U.uMap.value.set(world.def.w,world.def.h);U.uRipPx.value.set(px,px);RIP.mat.uniforms.uTex.value.set(1/W,1/H);RIP.mat.uniforms.tSim.value=RIP.sim; + var c=2.1,dt=hi?1/60:1/30;RIP.dt=dt;RIP.mat.uniforms.uDamp.value=hi?0.99:0.98;RIP.mat.uniforms.uK.value=Math.min(0.45,(c*dt/px)*(c*dt/px));RIP.n=0;RIP.acc=0;U.uRipOn.value=1;U.tRip.value=RIP.a.texture; +} +// a bump on the water at (x, z) metres, r metres across, a metres high (negative: a dip) +function rip(x,z,r,a){if(!RIP.ok||RIP.n>=16)return;RIP.imp[RIP.n++].set(x,z,Math.max(r,RIP.px*0.8),a)} +function ripSim(){ // copy the flood's depths into tSim (ripples only live where there is water) + if(!RIP.ok)return;var S=world.S,n=S.n,D=RIP.simData,h=THREE.DataUtils.toHalfFloat,i; + for(i=0;i=st){RIP.acc-=st;RIP.mat.uniforms.tPrev.value=RIP.a.texture;RIP.mat.uniforms.uImpN.value=did?0:RIP.n; + renderer.setRenderTarget(RIP.b);renderer.render(RIP.scene,RIP.cam);var t=RIP.a;RIP.a=RIP.b;RIP.b=t;did=1} + renderer.setRenderTarget(null);if(did)RIP.n=0;U.tRip.value=RIP.a.texture; +} function setEnv(kind){var c=kind==='cellar'; SKY.fog.setHex(c?0x0d1113:0xe9dcc4);SKY.zen.setHex(c?0x1a2023:0x4f86c0);SKY.hor.setHex(c?0x20272a:0xf3dfbd);SKY.sunC.setHex(c?0x000000:0xffd7a0); scene.fog.color.copy(SKY.fog);scene.fog.near=U.uFogN.value=c?5:45;scene.fog.far=U.uFogF.value=c?30:210;hemi.intensity=c?0.2:0.6;sun.intensity=c?0:0.95;sun.castShadow=!c;torch.intensity=c?1.3:0;U.uTorch.value=c?1:0;U.uDay.value=c?0.1:1;skyDome.visible=!c} @@ -134,22 +208,24 @@ function setEnv(kind){var c=kind==='cellar'; var world=null,def=null,lv=null,dynDirty=false,dynEnds=[]; function rebuildDyn(){dynDirty=false;if(lv.dyn){lv.grp.remove(lv.dyn);EWLook.dispose(lv.dyn,[lv.mats.plain])}var d=EWLook.dyn(world,lv);lv.dyn=d.grp;dynEnds=d.ends;lv.grp.add(d.grp);renderer.shadowMap.needsUpdate=true} // A mirror picture of the site for the water to reflect: the scene drawn once more from under the water level. It is what -// makes the water read as water, so every tier gets it: 512 x 320 every frame on High, 256 x 160 every other frame on Low. +// makes the water read as water, so every tier gets it: half the screen's resolution with smoothed edges every frame on +// High, a third of it every other frame on Low. var reflN=0,reflSize=0,reflRT=null,reflCam=new THREE.PerspectiveCamera(),reflPlane=new THREE.Plane(new THREE.Vector3(0,1,0),1e4),waterH=0,waterHT=0; // the plane sits on the walls' materials all the time; it only bites during the mirror pass function renderReflection(){ - if(!lv||(mirrorOff&&save.set.q==='auto')){U.uRefl.value=0;return}var hi=quality()==='high',sz=hi?512:256; + if(!lv||(mirrorOff&&save.set.q==='auto')){U.uRefl.value=0;return}var hi=quality()==='high',db=renderer.getDrawingBufferSize(new THREE.Vector2()),f=hi?0.5:0.34,rw=Math.max(256,Math.round(db.x*f)),rh=Math.max(160,Math.round(db.y*f)),sz=rw*10000+rh; if(!hi&&(reflN++&1)&&reflRT)return; - if(!reflRT||reflSize!==sz){if(reflRT)reflRT.dispose();reflRT=new THREE.WebGLRenderTarget(sz,sz*0.625);reflSize=sz;U.tR.value=reflRT.texture} + if(!reflRT||reflSize!==sz){if(reflRT)reflRT.dispose();reflRT=new THREE.WebGLRenderTarget(rw,rh);reflSize=sz;U.tR.value=reflRT.texture} reflCam.fov=camera.fov;reflCam.aspect=camera.aspect;reflCam.near=0.1;reflCam.far=320;reflCam.updateProjectionMatrix(); reflCam.position.set(camera.position.x,2*waterH-camera.position.y,camera.position.z);reflCam.rotation.order='YXZ';reflCam.rotation.set(-camera.rotation.x,camera.rotation.y,0);reflCam.updateMatrixWorld(true); reflCam.matrixWorldInverse.copy(reflCam.matrixWorld).invert();U.uReflVP.value.multiplyMatrices(reflCam.projectionMatrix,reflCam.matrixWorldInverse); reflPlane.constant=-(waterH+0.02);lv.wm.visible=false;var hv=hands.root.visible;hands.root.visible=false;ghost.visible=false;fx.visible=false;U.uRefl.value=0; - renderer.setRenderTarget(reflRT);renderer.render(scene,reflCam);renderer.setRenderTarget(null); + U.uNoSun.value=1;renderer.setRenderTarget(reflRT);renderer.render(scene,reflCam);renderer.setRenderTarget(null);U.uNoSun.value=0; reflPlane.constant=1e4;lv.wm.visible=true;hands.root.visible=hv;ghost.visible=true;fx.visible=true;U.uRefl.value=1; } var vv=[0,0],dummy=new THREE.Object3D(); function updateWaterMesh(){ var S=world.S,W=lv.W,H=lv.H,g=S.g,bar=S.bar,d=S.d,solid=S.solid,wp=lv.wp,wd=lv.wd,wf=lv.wf,wet=lv.wet,x,z,i,j,hs=0,hw=0,k; + var pv=lv.prev;for(i=0;i0.03&&world.mask[i]){var wq=dd/(1+((x*CS-pl.x)*(x*CS-pl.x)+(z*CS-pl.z)*(z*CS-pl.z))*0.02);hs+=(zb+dd)*wq;hw+=wq} if(!solid[i]&&dd>0.0015){wp[i*3+1]=zb+dd;wd[i]=dd;S.vel(i,vv);wf[i*2]=vv[0];wf[i*2+1]=vv[1];wet[i]=1} @@ -157,11 +233,15 @@ function updateWaterMesh(){ if(c){var y=s/c;wp[i*3+1]=y;wd[i]=solid[i]?sd/c:Math.min(y-zb,0.012)}else{wp[i*3+1]=zb-0.03;wd[i]=-0.03} wf[i*2]=0;wf[i*2+1]=0;if(wet[i]>0)wet[i]=Math.max(0,wet[i]-0.0011)} // ground the water has left stays dark for about half a minute } - // a working drain pulls a dip into the surface above it - for(k=0;k=W||z>=H)continue;i=z*W+x;if(wd[i]<=0.01)continue;var ex=(x+0.5)*CS-dr.x,ez=(z+0.5)*CS-dr.z;wp[i*3+1]-=Math.min(wd[i]*0.7,dr.flow*0.42/(0.22+ex*ex+ez*ez))}} + // running drains: where the whirlpools go (the four strongest) + var dl=world.drains.slice().sort(function(p,q){return q.flow-p.flow});for(k=0;k<4;k++){var dr=dl[k],ud=U.uDr.value[k];if(dr&&dr.flow>0.006&&S.d[dr.i]>0.02)ud.set(dr.x,dr.z,clamp(dr.flow*5,0.15,1),0);else ud.set(0,0,0,0)} + ripSim(); + // surface slope at each vertex, from the neighbours either side (water only) + var sl=lv.slope;for(z=0;z0&&wd[i-1]>0.003?i-1:i,r=x0.003?i+1:i,u=z>0&&wd[i-W]>0.003?i-W:i,dn=z0.003?i+W:i; + sl[i*2]=r!==l?(wp[r*3+1]-wp[l*3+1])/((r-l)*CS):0;sl[i*2+1]=dn!==u?(wp[dn*3+1]-wp[u*3+1])/(((dn-u)/W)*CS):0} if(hw>0)waterHT=hs/hw;waterH+=(waterHT-waterH)*0.15; - lv.wg.attributes.position.needsUpdate=true;lv.wg.attributes.aDepth.needsUpdate=true;lv.wg.attributes.aFlow.needsUpdate=true;lv.tg.attributes.aWet.needsUpdate=true; + lv.wg.attributes.position.needsUpdate=true;lv.wg.attributes.aDepth.needsUpdate=true;lv.wg.attributes.aFlow.needsUpdate=true;lv.wg.attributes.aPrev.needsUpdate=true;lv.wg.attributes.aSlope.needsUpdate=true;lv.tg.attributes.aWet.needsUpdate=true; if(world.dirty.length){var seenV={};world.dirty.forEach(function(i){[i,i-1,i+1,i-W,i+W].forEach(function(k){if(k>=0&&k=1){best=rings[k];break}else if(rings[k].t>best.t)best=rings[k];best.t=0;best.s=size||1;best.d=dur||0.9;best.m.position.set(x,y+0.012,z);best.m.visible=true} +function ring(x,y,z,size,dur){if(RIP.ok){rip(x,z,Math.max(0.05,size*0.06),Math.min(0.008,0.0015+size*0.0022));return}var best=rings[0];for(var k=0;k=1){best=rings[k];break}else if(rings[k].t>best.t)best=rings[k];best.t=0;best.s=size||1;best.d=dur||0.9;best.m.position.set(x,y+0.012,z);best.m.visible=true} var ND=160,dropP=new Float32Array(ND*3),dropV=new Float32Array(ND*3),dropL=new Float32Array(ND),dropC=new Float32Array(ND*3),dropK=0,dropGeo=new THREE.BufferGeometry(); dropGeo.setAttribute('position',new THREE.BufferAttribute(dropP,3));dropGeo.setAttribute('color',new THREE.BufferAttribute(dropC,3)); -var drops=new THREE.Points(dropGeo,new THREE.PointsMaterial({size:0.075,vertexColors:true,transparent:true,opacity:0.95,depthWrite:false}));drops.frustumCulled=false;fx.add(drops); +var dotTex=(function(){var c=document.createElement('canvas');c.width=c.height=32;var x=c.getContext('2d'),g=x.createRadialGradient(16,16,0,16,16,15);g.addColorStop(0,'rgba(255,255,255,1)');g.addColorStop(0.55,'rgba(255,255,255,.85)');g.addColorStop(1,'rgba(255,255,255,0)');x.fillStyle=g;x.fillRect(0,0,32,32);return new THREE.CanvasTexture(c)})(); +var drops=new THREE.Points(dropGeo,new THREE.PointsMaterial({size:0.07,map:dotTex,vertexColors:true,transparent:true,opacity:0.95,depthWrite:false}));drops.frustumCulled=false;fx.add(drops); for(var dk=0;dk=0&&!S.solid[i]&&S.d[i]>0.03){S.vel(i,vv);var near=false;for(var q=0;q0.01&&Math.hypot(dr.x-x,dr.z-z)<3.5)near=true}if(!near&&vv[0]*vv[0]+vv[1]*vv[1]<0.0036)continue;fleckP[k*3]=x;fleckP[k*3+2]=z;fleckA[k]=1.5+Math.random()*3;return}}fleckP[k*3+1]=-99;fleckA[k]=0.4+Math.random()} function updateFx(dt,time){ @@ -237,6 +318,11 @@ function movePlayer(dt){ if(moving){pl.bob+=dt*sp*l*1.9;pl.step+=dt*sp*l;if(pl.step>1.5){pl.step=0;var w2=dep>0.03;sfx(w2?'wade':'step',w2?0.35+Math.min(0.5,dep):0.35);if(w2){ring(pl.x-sy*0.3,pl.y+dep,pl.z-cy*0.3,0.9+dep*2,0.9);splash(pl.x-sy*0.3,pl.y+dep,pl.z-cy*0.3,3+Math.round(dep*14),0.55+dep)}}} pl.dep=dep;if(pl.kick>0)pl.kick=Math.max(0,pl.kick-dt*5); } +// Wading: the legs shove the flood (a bow wave and a wake in the simulation itself), and stir ripples round the shins. +var wadeT=0; +function wade(dt,vx,vz){if(!world||pl.dep<0.04||!pl.ground)return;var sp=Math.hypot(vx,vz),S=world.S; + if(sp>0.2){S.push(pl.x/CS,pl.z/CS,vx,vz,1.7,4.5,dt);wadeT-=dt;if(wadeT<=0){wadeT=0.04;var nx=vx/sp,nz=vz/sp,a=Math.min(0.012,0.006+pl.dep*0.012)*Math.min(1,sp/2.2); + rip(pl.x+nx*0.12-nz*0.14,pl.z+nz*0.12+nx*0.14,0.06,a);rip(pl.x+nx*0.12+nz*0.14,pl.z+nz*0.12-nx*0.14,0.06,a)}}} function placeCamera(){camera.position.set(pl.x,pl.y+EYE-pl.crouch*0.55+(pl.speed>0?Math.sin(pl.bob)*0.035:0),pl.z);camera.rotation.set(pl.pitch+pl.kick*0.02,pl.yaw,0)} // where the player is pointing on the ground or the water, within reach var aim={x:0,y:0,z:0,i:-1,ok:false,dx:0,dz:0}; @@ -471,6 +557,7 @@ function enter(d){ def=d;setEnv(def.sky); world=new EW.World(def,{hoseLen:save.gear.hose2?16:9,cableLen:save.gear.reel?18:8});lv=EWLook.level(world,{terrainMat:terrainMat,waterMat:waterMat,T:T,clip:reflPlane});scene.add(lv.grp); lv.stations.forEach(function(s){s.g.visible=stationOn(s.s.kind)}); + lv.prev=new Float32Array(world.S.n*2);lv.wg.setAttribute('aPrev',new THREE.BufferAttribute(lv.prev,2));lv.slope=new Float32Array(world.S.n*2);lv.wg.setAttribute('aSlope',new THREE.BufferAttribute(lv.slope,2));lv.tg.setAttribute('aWd',lv.wg.attributes.aDepth);ripSetup(); pl.x=world.spawn.x;pl.z=world.spawn.z;pl.y=world.groundAt(pl.x,pl.z);pl.yaw=world.spawn.yaw;pl.pitch=def.depot?0:-0.16;pl.vy=0;pl.ground=true;pl.walked=0;sway.lx=pl.yaw;sway.ly=pl.pitch; var first=firstJob(),own=owned(); bar=def.depot?[]:first?['rake']:vanNeeded()?save.load.filter(function(t){return save.gear[t]}):own; @@ -483,7 +570,7 @@ function enter(d){ if(!def.depot){var r=save.jobs[def.id]||(save.jobs[def.id]={stars:0,best:0,n:0});r.seen=1;persist()} depotSay=def.depot?(shopOpen()&&!save.seen.shopSaid?T('You have pay to spend. The gear bench is on the right'):T('Pick your next job from the board')):''; if(def.depot&&shopOpen()&&!save.seen.shopSaid){save.seen.shopSaid=1;persist()} - fitShadow();updateWaterMesh();for(var k=0;k=STEP&&n<8){world.step(STEP);acc-=STEP;n++}if(n){updateWaterMesh();simMs+=(performance.now()-t0-simMs)*0.1}if(acc>STEP)acc=0; + acc+=dt;var n=0,t0=performance.now();while(acc>=STEP&&n<8){world.step(STEP);acc-=STEP;n++}if(n){updateWaterMesh();simMs+=(performance.now()-t0-simMs)*0.1}if(acc>STEP)acc=0;U.uLerp.value=clamp(acc/STEP,0,1);U.uHi.value=quality()==='high'?1:0; var hid=tool();if(useHeld&&(hid==='rake'||hid==='shovel'||hid==='squeegee'))useTool(false); updateThings(dt,now/1000);updateFx(dt,now/1000);updateGhost();animView(dt);updateHud(dt); if(!def.depot&&state==='play'&&world.isDone()){endT+=dt;if(endT>2.2)finishJob()}else endT=0; @@ -603,12 +691,12 @@ function frame(now){ if(state==='menu')return; // On Auto, when frames stay poor for nine seconds: first High drops to Low, then Low drops the mirror pass. It never steps back up. if(state==='play'&&save.set.q==='auto'&&!mirrorOff){fpsT+=dt;fpsN++;if(fpsT>=3){var fps=fpsN/fpsT;fpsT=0;fpsN=0;slowN=fps<(quality()==='high'?34:27)?slowN+1:0;if(slowN>=3){slowN=0;if(quality()==='high'){autoLow=true;resize();fitShadow()}else mirrorOff=true}}} - U.uT.value=now/1000;U.uCam.value.copy(camera.position);skyDome.position.copy(camera.position);renderReflection(); + U.uT.value=now/1000;U.uCam.value.copy(camera.position);skyDome.position.copy(camera.position);if(state==='play')ripStep(dt);renderReflection(); renderer.render(scene,camera); } show('menu');requestAnimationFrame(frame); // for tests and tuning from the console window.__ew={ff:function(sec){for(var k=0;k Date: Thu, 26 Nov 2026 19:17:04 +0000 Subject: [PATCH 2/2] Flood Crew water: lower drag so long jobs are no slower than before drag 0.35 -> 0.2 and thin-film drag halved. Node bot times now (old water -> new): yard 152->157, street 182->181, field 343->304, under 246->255, cellar 221->213, mill 411->346 s. Tanners Field and Mill Lane go back to par 420 and 540 s; the What's new line about longer targets is gone. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Cw2rM7oof2mCeBWM93T7t4 --- README.md | 2 +- e63334287a3deaa3/ebbwork/core.js | 8 ++++---- e63334287a3deaa3/news/ngcoding10-flood-water.json | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 702b6a72..aa8aa3e5 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Personal site hosted with GitHub Pages at **https://ascoding11.github.io**, the - `e63334287a3deaa3/flickerwood/`: Flickerwood (Back Room), an 8-bit maze chase for one player (one file, one canvas, Web Audio, no libraries, no Firebase except stats.js). Glim, a firefly, gathers every speck of pollen in a moonlit hedge maze (a glade) while four night critters come out of the hollow stump in the middle and chase its light. It is our own take on the maze-chase genre: the name, theme, characters, mazes, art, sounds, words and numbers are all ours, and only the genre's ideas are used. **The four critters** never find a path: at the middle of every tile each one picks the open way (never straight back) whose next tile is nearest, in a straight line, to the tile it wants (`target()`), and all of its character is in that tile. Swoop the bat wants Glim's tile; Gulp the frog wants the tile 3 ahead of the way Glim faces (`AHEAD`); Tangle the spider wants the point on the far side of Glim from Swoop (twice Glim's tile minus Swoop's); Dither the moth wants Glim while more than 5 tiles away (`NEAR`) and its own corner once closer. They take turns at two moods on a clock: **roost** (each heads for its own corner: Swoop top right, Gulp top left, Tangle bottom right, Dither bottom left) and **hunt**; every time the mood changes they all turn straight round, which is the tell. Glim is faster than they are in an empty corridor and a little slower while eating, turns can be pressed early and are remembered until the next gap, a turn started up to 4 pixels before the middle of a tile cuts the corner and gains those pixels (`CUT`; up to 3 pixels late it is still taken, `LATE`), and a reverse is taken anywhere. A **moonbloom** (four a glade) dazzles the critters: they turn round, go pale, slow to 60% and mostly run away, and touching one sends it home as a puff of dust for 100, 250, 500 then 1000 (`CATCH`); they flicker for the last 2 seconds, and a caught one rests 1.2 s in the stump and comes back out as itself. **Tunnels** at the edges (`~` tiles) wrap round and slow critters to 55%. A **find** (dewdrop, acorn, clover, toadstool, bluebell, feather, snail shell, moonstone, one kind a glade) shows under the stump for 9 s when 35% and again when 70% of the glade is eaten, worth 200 plus 100 a glade up to 1000. Our own twists: **Dash** (0.32 s at 2.1 times speed, then 6 s to recharge, shown as a meter) and the **chain** (each speck eaten within 1 s of the last carries it on; every 12 raises the multiplier on specks, up to 5 times). Specks are 5, moonblooms 30, clearing a glade 100 times its number up to 1000 plus 300 if no life was lost in it; 3 lives, one more at 6,000 and every 15,000 after, 5 at most. **Rules** live between `// ==RULES==` and `// ==END RULES==`: no page, clock, sound or `Math.random` in there, so the same seed and presses always give the same game (`create(seed)`, `startGame(g)`, `step(g, 1/120)`, `turn(g, d)` with d 0 right, 1 down, 2 left, 3 up, and `dash(g)`; what should be heard or shown goes into `g.ev` as words, and eaten tiles into `g.gone`). Positions in the rules are maze pixels; the page adds the score bar above. Glim and the critters are a tile, a direction and how far along it they are (`c, r, dir, off`), so they can never leave a path; they touch when both gaps are under 7 pixels (`HIT`, smaller than the sprites). **Glades** are the five `MAZES` at the top of the rules, drawn by hand as 23 rows of 21 letters (12-pixel tiles): `#` hedge, `.` pollen, `o` moonbloom, `-` path, `~` tunnel, `HHH` the stump with `G` its gate above the middle, `P` Glim's start, `B` the find, space outside the glade. Hedge Court is a full rectangle with a tunnel across the middle, Lily Pond has its corners cut off and tunnels top to bottom, Bramble Wheel is not mirrored (its bottom half is its top half turned half round) and has two tunnels, Mossy Ruin has tunnels both ways through the middle of each edge, and Moth Hollow is an hourglass with none; glade 6 is Hedge Court again, quicker. A new or changed glade must stay: every path one tile wide (no open 2 × 2), no dead ends, all joined up, a border tile that is a path matched on the opposite border, the start at least 8 steps from the gate with a way left and right (Glim sets off left), one moonbloom in each quarter, nothing but hedge next to the outside. A script checked all of that for the five glades when they were made (it is not in the repo), so check again by hand if you change one. **Tuning** is `tune(level)` and the constants at the top of the rules: Glim 66 pixels a second plus 1.3 a glade; critters 70% of that plus 3 points a glade (97% at glade 10); the dazzle 8 s less 0.67 s a glade, never under 2; roosts of 7, 7, 5 and 4 s (less 0.55 s a glade, never under 1.5) between hunts of 13, 15 and 18 s (plus 1.2 s a glade), then hunting for good; Gulp leaves the stump after 3 s, Tangle after 12 s or 30 specks, Dither after 28 s or 90 specks, all sooner glade by glade; from glade 3 Swoop speeds up 6% when 20% of the pollen is left and 12% under 8%, and keeps hunting through roosts; nothing tightens after glade 10 (`TOP_LEVEL`). Glade 1 is meant to be cleared by a first-time player: a test bot that only heads for the nearest pollen and runs when something is three tiles away clears it nearly every time. **Drawing**: the game is a 252 × 300 picture (a 14-pixel score bar, the 252 × 276 maze, a 10-pixel strip for spare lives, the dash meter and finds). `layout()` shows it at a whole number of device pixels per game pixel, so pixels stay square and sharp, and tries three places for it, biggest picture first: under the top bar with the key hint, under the bar without the hint, and between the bar's title and buttons (so a 1366 × 768 laptop with a short browser window still gets 2 ×); only when a whole number would be 1 is it drawn at 2 and shrunk smoothly to fit. Never size the canvas with CSS percentages or `vh`. Sprites are rows of letters turned into small canvases once (`bake`; Glim is drawn facing right and turned for the other three ways; two frames each; the dazzled look is the same shapes in two pale tones); the hedges, stump and tunnel marks are drawn once per glade (`mazeL`, and a lit copy `flashL` for the blink when a glade is cleared), the pollen sits on its own layer and each speck is wiped from it as it is eaten, the score bar is redrawn only when something on it changes, and words use a 5 × 5 pixel alphabet drawn in code (capitals, digits and `+ - : ! .` only). The loop runs the rules in fixed steps of 1/120 s and draws between steps. It pauses when the tab is hidden or the window loses focus. **Sound** is made in the page: square, triangle and noise blips in `SFX`, and a 16-bar tune of our own in A minor in `TUNE` (notes as numbers), booked a tenth of a second ahead on the audio clock; while a moonbloom is on, a quicker bright figure plays instead. Nobody has listened to it yet, so the loudness and the tune want a check by ear. **Saved in the browser only**: `flickerwood-best` (score), `flickerwood-glade` (furthest glade), `flickerwood-mute` (in try/catch), keys under `keybinds:flickerwood`. Stats hook: `max('score', score)` and `max('glade', glade reached)` when a glade is cleared and at game over (the Leaderboards show best score). Controls: arrows or WASD turn, Space or Shift dashes, P, Enter or Esc pause, M sound, all rebindable under KEYS. On touch screens (`body.touch`): swipe anywhere to turn (keep sliding to turn again without lifting), tap the screen to dash, or use the d-pad with a DASH button either side of it under the screen (pad on the left and DASH on the right when the phone is sideways). How to play, with a picture of each character, sits beside the screen when there is room, otherwise behind the ? button. A test hook (`window.__fw`) exists only when `navigator.webdriver` is set. It has Spanish: its words are in `flickerwood/es.js` (lang.js), with a Language switch in How to play; the canvas words are chosen to need no accents (the 5×5 pixel font has none), and glade and critter names stay English. **The Wardrobe** (captains only for now, like the other games' hidden cosmetics): 28 looks for Glim in `flickerwood/wardrobe.js`, listed in `cosmetics.js` under `GAMES.flickerwood` (14 kits, 7 hats, 2 face pieces and 5 trails: sports kits, a tin firefly, pirates, suits and more, all seen from above). The page fetches `wardrobe.js` and `../cosmetics.js` only when `wardrobeOn()` is true (`FLICKERWOOD_PUBLIC`, the one line that opens it to everyone; a site captain through `captains.js`; or `?wardrobe=1` on localhost or in an automated browser), and then a hanger button appears in the top bar; for everyone else `WR` stays null and Glim is drawn exactly as before. Looks only: a look swaps `SP.glim` for pictures of the same 16 × 16 size (so the spare Glims on the score bar wear it too), no kit recolours the glowing yellow tail or the halo (what tells Glim from the critters), and trails are drawn under the critters and Glim, fade in 0.4 s and are never small yellow dots that could pass for pollen. Opening it pauses a game in progress. What is worn is saved in this browser as `flickerwood-look` (`{k, h, f, t}`, item numbers, 0 for none); nothing is sent anywhere. The words are in `es.js`. - `e63334287a3deaa3/lanternhold/`: Lanternhold (Back Room), a co-op tower defense game for 1 to 4 players (one file, three.js r128 with `../autores.js`, `../netsmooth.js` for teammates' pointers, Web Audio, Firebase Realtime Database rooms under `rooms/lh-`, same project and rules as Rumble Karts; invite links go through the home page as `#lh-`; no Quick match, rooms hold up to 4). The name, the Gloom, the towers, the maps, the art and the sounds are all our own. The Gloom walks a road across a floating island (a 20 × 12 grid of 2 m tiles, `GW`/`GH`/`T`) to the lantern; each one that gets there costs lives (`lv` in `EN`: 1, 2 for Shellbacks and Splitblobs, 15 for the boss). Towers go on grass tiles only (not road, scenery or the lantern). **Rules** are plain data and pure functions near the top of the script, the same in every browser, so a client can work out wave previews and enemy health without asking: `MAPS` (Meadow Bend, one long road; Twin Fords, two roads that meet; Whorl Garden, a spiral, whose flyers come from their own pink gate, `fly`, so they don't skip almost the whole map), `DIFFS` (Easy, Normal, Hard: health factor, lives 30/20/12, starting gold 720/620/540, bounty factor and seconds between waves), `EN` (Gloomling; Skitter, fast; Shellback, armour 7 taken off every hit, at least a quarter always goes through; Duskmoth, flies straight at the lantern; Splitblob, splits into three Bloblets; Mender, heals the Gloom near it 5% a second; Gloomwarden, the boss on every 10th wave, armoured, slow, and calls two Skitters every 5 s), `TW` (Bolt Spire, quick single shots, two at once at level 3; Thumper, lobbed blasts that hurt groups, ground only; Frost Bell, rings out to slow and chip everything near it, bosses half as much; Spark Coil, lightning that jumps between enemies; Sky Lance, flyers only, splash on nearby flyers; Sun Lens, a long beam that ignores armour), each with three levels (`lv`: range, damage, seconds between shots and the upgrade's cost) and a target mode (First, Last, Strong, Close). Selling gives back 70% of what went into the tower (`SELL`). `waveDef(w, map)` builds wave w from a seeded random pool (new kinds join at waves 2, 4, 5, 6 and 8, and the wave a kind first appears always has a group of it), `hpScale` makes them tougher each wave and faster still after wave 30. Survive 30 waves (`CAMPAIGN`) to win; then Keep going is endless mode. Gold: every kill's bounty and every wave's bonus (25 + 5 a wave) is split evenly between the players (`income`), each player spends their own share, and the team list has +50 to give gold to a teammate. Sending a wave before its countdown ends pays 2 gold per second left. Speed 1×, 2× or 3× (`sp`, anyone can change it). Only whoever built a tower can sell it (anyone can once they've left); anyone can upgrade or retarget it. `simStep(S, dt)` runs the game at a fixed 30 steps a second in solo, behind the menu (a demo game, `attract`) and on the online host; `act(S, uid, a)` applies one action (`b` build, `u` upgrade, `s` sell, `m` target mode, `w` send the wave, `f` speed, `g` give gold, `c` continue into endless) and returns '' or what went wrong. **Online:** each player writes only their own node `rooms/lh-/players/`: `n` name, `c` colour, `x`/`z` where their pointer is on the board (drawn on the others' screens as a ring and a name tag from a short history, NetSmooth), `h` (always 0), `ts` (server time), `j` (when they joined), and `ac`, their last 10 actions as JSON, each with a rising number `i` and the game number `g`. The host is whoever has the highest `he` with a published state, else whoever joined first (`Net.elect`); it runs the game, takes each player's new actions (`takeActs`, at most once each, by `i`, and only for the current game), and publishes the whole state as JSON in its own node's `rs` about 5 times a second (`encodeRS`: phase, wave, lives, gold per player, towers, enemies, Thumper shells in the air and the last shots, so clients can draw them). Clients rebuild the game from it (`decodeRS`, which checks every value) and move the Gloom on between snapshots from its speed, easing towards the host's numbers. If the host leaves, the next player picks up the last snapshot and carries on (`he` goes up by one), and a tab in the background keeps the host's game running once a second. The host picks the map and difficulty in the room's lobby and presses Start; anyone joining later gets a share of gold (the average, at most 250). Nodes are removed on leave and onDisconnect. **Saved in this browser** (localStorage, all `lanternhold:`): `name`, `color`, `map`, `diff`, `gfx` (Pretty, with shadows, or Fast; Fast is the default on touch screens), `sound`, `room` (the last room code) and `best::`, the best wave held. **stats.js:** `max('wave', waves held)` and `add('bosses', n)`; the Leaderboards show Most waves held and Gloomwardens beaten. **Touch:** shown only on touch screens (`body.touch`): tap a tower button, tap a tile to see the tower there, tap it again to build; drag to move the board, pinch to zoom. The camera fits the board into the space the HUD leaves (`fitCam`, `measureHud`), and on an upright phone the wave box becomes a row under the top bar and the dock gets compact. **Drawing:** the island, scenery and lantern are merged meshes with vertex colours; enemies, health bars, shots and rings are instanced meshes (their colour buffers are made at full size in `whiteColors`, because three r128's `setColorAt` sizes the buffer from the mesh's current count); particles are one Points draw. Automated browsers get a test hook, `window.__lh`. It has Spanish: its words, tower names and descriptions are in `lanternhold/es.js` (lang.js), with a Language switch on the menu and the pause screen; map names and the Gloom's names stay English, and nothing translated is sent to the room. **Wardrobe (hidden: captains only for now).** `LH_PUBLIC = false` and `wardOn()` (captains.js's `may(false, 'wardrobe', 'lh-wardrobe')`; `?wardrobe=1` for tests on localhost or in an automated browser) decide whether the menu shows a Wardrobe button under the colour swatches; for everyone else `lanternhold/wardrobe.js` is never fetched and the game is exactly as before, unless a teammate wears something, in which case it is fetched to draw them. It has 30 items in four slots, numbered as in `../cosmetics.js` (`lh-…`): 12 tower banners (a small flag on a pole at the back-left of every tower that player builds, seen by the whole team: sports pennants, a gear, a pirate flag with an eye-patched skull, a ship's wheel, pinstripes, a crown; baked into the tower's base mesh through `towerParts`' new `ban` argument, so a tower is still the same draw calls and its shape, owner band and level gems are untouched), 9 lanterns (the lantern's stand and cage on the captain's own screen only: `lanternGeo()` is the usual one, and `world.core.body`'s geometry is swapped; the flame, halo and light stay where they are and the same size), 5 flame colours (the flame's and halo's colour on the captain's own screen only; the point light is not recoloured, the low-lives flicker and the red flash are kept) and 4 build bursts (in place of the usual puff in `fxBuild` when that player builds or upgrades, seen by everyone, from the same particle pool). Saved in this browser as `lanternhold:wardrobe` (`'banner.lantern.flame.burst'`); online, a player's own node carries `cz: 'banner.burst'` (written with `Net.upd`) only while one of those is worn. Older pages ignore `cz`, `rs` and the actions are unchanged, and a page draws the usual look for numbers it doesn't know. The test hook `window.__lh` adds `WD` (with `wear(slot, n)`), `wardOn`, `wdLoad`, `wearOf`, `towerViews`, `towerMesh`, `wx`, `wz` and `world`. Its words and item names are in `lanternhold/es.js`. - `e63334287a3deaa3/windrow/`: Leaf Sweep (Back Room; first called Windrow, and the folder, the `WR` name in the code, the save key `windrow:v1`, `keybinds:windrow` and the stats name keep that), a calm single-player first-person game about clearing autumn leaves out of five walled gardens (three.js: the site's own r187 build, `/lib/three/r187/three.min.js` with its r128 layer, then `../autores.js`; no Firebase and no rooms, except `stats.js` for play time; no ads). The page is `index.html` (markup, styles, HUD and menus) plus five plain scripts in `js/`, loaded in this order: `world.js` (the areas, the collision grid and everything that stands still), `leaves.js` (the leaf simulation and its drawing), `audio.js` (every sound, made in code), `models.js` (gloves, sack, rake, blower, finder beams) and `game.js` (player, tools, money, HUD, menus, saving, the frame loop); `es.js` is its Spanish. Everything is drawn and textured in code; nothing is downloaded. **The start.** A new player stands on the doorstep of a garden house in the Front Yard (8 x 7 m of buried lawn with a stone path, one bin, low walls and a closed gate) with only their hands. It is a sixth area, `WR.AREAS[5]` (`WR.YARD`), added after the first five so the numbers in older saves keep their meaning; `WR.ORDER` is the order areas are listed in. Its leaves lie 1.5 times thicker (`dense`), and clearing it to 100% opens the gate to Gatehouse Court by itself, free. The screen shows a crosshair, the sack and the acorns, and one line of instruction at the bottom middle (`hintText` in `game.js`: hold to gather; sack full, empty it in the bin, with a bouncing marker over the bin; spend acorns in the shed; bought the rake; the gate is open), one at a time, each gone when done. Everything else appears when it first matters (`hudStatic`): percent cleared and the shed after the first sack is emptied, the tool bar with a second tool and only with tools owned, garden names, the Gardens tab and map, gate signs and the finder button once the court is open. The shed lists the sack, hands and rake at first and the rest as they become useful (`shedShows`). `state.seen` remembers which lines have been shown; a save that already has the court open skips them all. A scripted player that walks and aims perfectly fills its first sack in about 9 game-seconds, buys Quick hands (25) after its second sack, the rake (60) at about 45 s and clears the yard in about 150 s; a person takes longer. The "hold to gather" line stays until the sack is half full. **The garden** is flat, about 61 x 53 m, on one grid of 0.25 m cells (`WR.CELL`, 248 x 216; the plan in `world.js` is written at full size and every position is then multiplied by `WR.S` = 0.8, so the gardens are small and the leaves lie thick): `solid` blocks the player and the leaves, `gtype` is the surface (lawn, paving, decking, gravel: how far a leaf slides), `inlet` marks mulch-chute cells, `areaOf` says which garden a cell belongs to. The five big gardens are the first entries of `WR.AREAS` in `world.js` (Gatehouse Court, Orchard Walk, Lily Terrace, Glasshouse Row, Maze Lawn) with their gate cost, the garden that must be half cleared first, the bonus and the reward for finishing (sprint, kneel, higher jump, chutes that draw leaves in, a gold rake); bins, chutes, gates, trees, hedges and benches are lists just under it, and `WR.buildGrid` turns them into the grid, so moving a prop means editing its list only. Its last step, `seal()`, proves every leaf can be cleared: with all gates open it finds the cells a player can stand in, and any free cell with no standing spot within 2 m in a clear line (a slot behind a bench, say) is made solid, so neither leaves nor feet can get into it (5 cells with the present props; about 18 ms at load). **Leaves** are real objects, never removed by pointing: each has a place, a speed and a tumble, and leaves the garden only by being carried to a compost bin in the sack or by reaching a mulch chute. To stay cheap, resting leaves are asleep and cost nothing; each leaf sits in one grid cell (a linked list per cell), so a tool only visits the cells it reaches; and leaves do not collide one with another: a cell is a stack (each extra leaf rests 1.4 cm higher), a cell with 26 leaves turns sliding leaves away (40 for falling ones, about 56 cm) and a leaf near the top of a stack 5 taller than a neighbour slides off onto it. A leaf never moves more than 0.22 m in a step and its new place is rounded to what the arrays hold before the wall test, so nothing gets through or into a wall. That is what makes heaps against walls and rows in front of the rake. `Leaves.blow` is the blower (a cone; force falls with distance and with angle off the middle, 13 rays stop it at walls, leaves low in a heap are sheltered), `rake` carries the leaves under the head along with it, `scoop` sends the nearest leaves in a ring to the sack (they need a clear line from the player, except a garden's last 6 leaves, so none can be stranded behind a bench), `kick` is walking through them and `pull` the Draught grates reward. A leaf is two triangles: a flat card with one of four leaf shapes cut out of it (alpha test) by a 256 px atlas drawn in the page, tinted per leaf. They are drawn as instanced meshes, one per garden and leaf shape (20 draw calls); each mesh keeps its leaves in the order of the 4 m tile they started in and only the tiles where something moved are sent to the graphics card each frame. On top is one see-through 'litter' sheet whose opacity comes from a texture with one pixel per cell, so cleared ground looks clean about a second after its leaves go. **How many leaves** is the quality setting, in leaves per square metre of open ground (`WR.QUALITY`): Low 14 (27,600 leaves in the whole garden), Medium 24 (47,300), High 40 (78,800); Medium and High have a real shadow map from the low sun, drawn once (nothing that casts a shadow moves, except a gate opening), and Low has soft dark patches under the trees instead. Colours are written as screen colours and lit in linear light (`WR.lin`, sRGB output, ACES tone mapping), so any new colour or canvas texture must go through `WR.lin` or be marked sRGB. Phones start on Low, computers on Medium. Measured: with a fully upgraded blower sweeping through leaves the simulation costs 0.4 / 0.5 / 0.8 ms a step (1.4 / 3.0 / 2.8 ms at 4x CPU slowdown), with up to 2,800 leaves awake at once; looking across the first garden draws about 78k / 117k / 180k triangles in about 70 draw calls. Not measured: the cost of the cut-out leaves overlapping on a real phone's graphics chip (the test machines have none). `autores.js` lowers the resolution first; if frames stay slow for 8 s after that and the player never chose a setting, the game drops one leaf tier itself and says so. An area's leaves are worth the same in total at every tier (`units`; fewer leaves are each worth more), and the sack and the hands are measured in quality-free units too (an area's `leaves` number is its size in sack units; `Leaves.fill` is what one leaf takes), so progress and prices do not depend on the setting. Changing the setting scatters the leaves that are left again and keeps each garden's percent. **Looks and feedback.** `world.js` builds the house (door, lit windows, shutters, roof, chimney), trees with a crown of rounded masses shaded light above and dark below, walls with piers and caps, slatted benches, the fountain and a painted sky with cloud and a sun glow. `models.js` has rounded gloves on sleeves: open hands and the sack, a fist on the blower's handle, and two fists and forearms that follow the rake's handle in the garden itself. The blower shows wind streaks and lifts and tumbles leaves; landing from a jump throws leaves up and out, with a burst of loose leaves and a sound when it is a real heap; a rake stroke ends with a thump and a puff of crumbs; emptying the sack pours leaves into the bin; buying something pulses the HUD; 100% is a warm flash, falling leaves and a fanfare. **Tools and money.** Hands and sack, a rake (a stroke reaches out lifted, then drags back along the ground, so it pulls) and a blower (it pushes). Acorns come from leaves: at a bin when the sack is emptied (20% more for a full sack) or at once at a chute. `UP` in `game.js` is the shed (nine upgrades and their prices) and the arrays under it are what each level does; the models in `models.js` change with them. The leaf finder (F, or by itself when under 3% of a garden is left) lights the 8 nearest leaves of the garden you are standing in, and the journal map draws a dot for every leaf on the ground. **Saved data:** one localStorage key, `windrow:v1` (JSON): `acorns`, `earned`, `up` (upgrade levels), `unlocked` and `done` (per garden; six entries now, and a save with five is given the yard, open, as the sixth), `rewards`, `bagUnits` (what is in the sack, per garden) and `bagFill`, `gone` (share of each garden cleared), `tool`, `tut` (no longer used), `seen` (which instructions have been shown), `pos`, `secs`, `binFill`, `set` (look speed, volume, quality, flipped look, whether the player chose the quality), and `leaves` with `leafMul`: for each garden that has been touched, a base64 string of two 16-bit numbers a leaf (centimetres from the corner of the garden; 65535 = gone), about 250 KB at Medium and 420 KB at High once every garden has been disturbed; a leaf saved against a wall is stepped back out of it on loading. An untouched garden saves nothing and is scattered again from its seed. It saves 8 s after a change, on pause, and when the tab is hidden or closed. Keys are rebindable (`keybinds:windrow`); `autores.js` keeps its own scale. It is not in `account-nudge.js`'s KEYS, so it does not follow a Google account to another device, and it has no row in `leaderboard.js` or `miles.js`. **Touch:** `body.touch` is set on the first touch and shows `#touch` (left stick, Use, Jump, Run and Kneel once earned, a context button for bins and gates, and finder, journal and pause top right); the three tool slots at the bottom are tappable on any device. Portrait and landscape have their own positions in the style block; a drag on the view or on the Use button looks around. `WR.test` at the bottom of `game.js` is only for test scripts (start without a click, step the simulation, hold the tool, a simulation benchmark); nothing in the game calls it. -- `e63334287a3deaa3/ebbwork/`: Flood Crew (Back Room; first built as Ebbwork, and the folder, the `ebbwork:v1` save key and the names in the code keep that name), a single-player first-person flood-drainage game: each job is a flooded place, and you work out why it flooded and get it dry (three.js r187 from the site's own build with its r128 layer, then `../autores.js`; no Firebase, no rooms, no stats.js, no ads). It is our own design: the name, the six places, the tools, the prices and the text are ours. **Files:** `index.html` (the page and its styles), `game.js` (shaders, effects, controls, sound, HUD and menus), `models.js` (everything modelled: houses, fences, garden things, the van, drains, pipes, the things you put down, and the first-person hands and tools, all built from simple shapes and pictures drawn on a canvas, as `EWLook`), `core.js` (everything that is not drawing, with no DOM and no three.js in it, so `node` can load it: `require('./core.js')` gives `{EWSim, EW, EWMaps}`), `es.js` (its Spanish for `../lang.js`) and `preview.jpg`. **The water (`EWSim` in `core.js`, rewritten 26 Nov 2026 because the first version looked wrong: a checkerboard shimmer and a slow slosh):** the shallow-water equations on a grid of 0.5 m cells. Each cell has a ground height `g`, a barrier height `bar` laid on top and a depth `d` (kept in 64-bit numbers: with 32-bit ones a slow seep into a deep cell rounded away and volume drifted); each edge between two cells has a water speed (`u` across a cell's east edge, `v` across its south edge, m/s), so the water carries momentum: a current keeps going round a corner, piles up against a wall and swirls behind it. Every step (1/30 s, fixed): the speeds are carried along by the flow itself (semi-Lagrangian advection), speed up downhill on the water surface (`GRAV`), and are slowed by Manning friction (`mann`, 0.018), a drag on thin films (`film`) so a wet floor creeps rather than races, and a gentle linear drag (`drag`, 0.35 per second) so a pool settles in about 20 seconds instead of sloshing for minutes; then each edge carries speed × the depth on its upstream side (`fx`, `fy`), no cell may give more than it holds (flows out of a cell are scaled down together, and so are their speeds), and depths change by what flowed, so volume is conserved exactly: water only appears through `add()` and leaves through `take()`. Walls are `solid` cells. A 3 mm film (`FILM`) never flows, so floors keep real puddles in their dips. `push(x, z, vx, vz, r, f, dt)` shoves the water near a point along a velocity without adding or removing any (the player wading: a bow wave ahead and a wake behind). `vel(i, out)` gives a cell's current for drawing and for debris. Blocks of 8 × 8 cells sleep when nothing in or next to them is changing; an edge into a sleeping block carries nothing and wakes it (leaving that out loses water across the edge). One step with every block awake costs a few ms for the biggest job (68 × 48) on a desktop. With this water Tanners Field and Mill Lane run slower (the water now has to build up speed), so their `par` went up (420 to 540 s and 540 to 600 s; pay is unchanged); every job was finished again by a node bot after the change. **A job site (`EW.World`):** built from a map's `build(b)` with metres as the unit (x east, z south): `ground`, `shape` and `noise` set heights; `surf` sets the surface type and whether it can be dug; `wall` makes solid blocks (its `kind` is only for drawing); `drain` (a `rate` in m³/s and a `cap`: how much debris blocks it fully), `sinkArea` (water there leaves the map: a ditch or storm channel), `river` (cells held at a level: a stream that both feeds and takes water), `leak` (fed by a `valve` id, or `wrench: true` for a dripping joint), `valve`, `socket`, `litter`, `flood`, `spot` (a note the player gets when they walk near, kept in the journal), `sign`, `station` (the depot's board, bench and van) and `noJob` (cells that don't count). `step(dt)` runs leaks, the river, pumps, drains, sinks, the water and the debris, in that order. Debris floats in more than 5 cm of water, drifts with the current and towards a running drain, strands when the water drops, and blocks a drain by lying within 0.85 m of it (`clog`): a drain's rate is `rate × (0.03 + 0.97 × clear^1.25)`. Debris that has just been raked lies in a sodden heap for 45 seconds (`heavy`) before it can float off again, so a cleared drain stays clear long enough for the level to fall away from the heap. The job is done (`isDone`) when the water left in the job's cells is at most 3% of the most there has been (`World.DONE`) and nothing is still coming in; a skin of water under 8 mm (`World.SKIN`) is wet ground, not flood, and is not counted, which is what stops a job ending in minutes of waiting for a thin sheet to creep away. **Tools (each one a function on the world, so a test can call it):** `rake` (push or pull debris), `scoop` and `pour` (the 30-litre bucket), `squeegee` (moves water under 7 cm one cell along), `dig` and `pile` (soft ground only, down to `DIGMAX` 0.64 m; one stroke takes the cell down 0.24 m and pulls its four neighbours down with it, so a trench is a few strokes and is wide enough to run; piling uses the spoil you dug), `placeBarrier` (three cells in a row, four directions, `BARH` 0.36 m; refused on drains, ditches and the river), `placePump` / `setHose` / `placeGen` (a pump runs when it is on, has a socket or a live generator within cable reach and has a hose end; water it takes goes to the hose end's cell, so emptying into the same pool does nothing, and it only leaves the map if the hose end is on a sink or the river; a generator standing in more than 14 cm of water stops), `takeDebris` (the sack: removes debris for good), `setValve` and `fixLeak`. **The jobs (`EWMaps`, in order; a job opens when the one before has a star):** Marlow Row (a back yard: a drain buried in leaves and a split pipe whose copper supply pipe, drawn along the house wall with `pipe`, leads round the corner to its tap; a new player starts here, standing in it: the yard starts shin to knee deep, half a metre at the drain, so that it plainly is a flood and the before and after are obvious; see **The start** below), Pell Street (three hidden drains, a dripping joint, a paving dip that keeps a puddle), Tanners Field (allotments in a hollow with no drain: a trench through the bank to the ditch; a choked pipe that sits too high to finish the job), Fenny Underpass (a dead sump: pump from a wall socket with the hose over the crest to the storm channel, and a water main valve at the far end), Wharf Cellar (the river seeps in through a doorway: sandbags, then pump up the steps; it is dark, so `sky: 'cellar'` gives a head torch) and Mill Lane (a stream through its bank, a culvert under a raft of debris, a walled garden that needs the pump and the generator, a hollow to trench). `EWMaps.depot` is the depot: not a job, a yard with the job board, the gear bench and the van, and a puddle. **The start (rebuilt 26 Nov 2026 after the owner found the first version confusing):** Play puts a new player straight into Marlow Row holding the rake and nothing else. `TUT` gives one short line at a time at the bottom of the screen (move, find the drain, rake it, follow the pipe to the tap, hold to shut it, keep the drain clear) and each goes when it has been done. What a new player has not met yet is not on screen: `firstJob()` hides the scan and journal buttons, the other tools and the job's notes; the depot appears only after that job, with just the job board working (taking a job from it sets off at once); the gear bench appears after the second job (`shopOpen()`), and the van and its loadout only once the player owns more tools than it holds (`vanNeeded()`). The HUD in a job is a crosshair, one water bar, the tool, and one line of words (`#say`, which carries the instruction or else the latest message); there is no clock or coin count in a job. Each map has `pay`, `par` (the target time in seconds) and `needs` (what the job board suggests bringing, shown only after the player has been there once, so the first visit is for finding out). Stars: one for finishing, a second inside 1.6 × `par`, a third inside `par` with 1.5% or less left; pay is `pay × (0.6 + 0.2 × stars)`, halved when the job has been done before. **Gear** (`GEAR` in the page): tools with `slot: 1` take one of the van's five places (seven with Van racking); the rest are upgrades (more sandbags, long hose, cable reel, second pump, waders, racking). Prices are set so that one-star pay alone affords each next job's tool. **Storage:** localStorage `ebbwork:v1` only: `{v, coins, gear, load, jobs: {: {stars, best, n, seen}}, set: {sens, vol, q, inv}, tut}`; keep `v: 1` and these names working if you change it. Nothing is sent anywhere. **Drawing:** the ground and the water are each one mesh with a vertex at every cell centre. The ground (`terrainMat`) is three's own lit material with our patterns added in `onBeforeCompile` (grain, paving joints, and wet ground that is darker and shiny until it dries over about half a minute, so the band the water has just left is plain to see), which lets it take the sun's shadows and the cellar torch. The water (`waterMat`) is our own shader: its vertices carry depth and speed, a dry cell beside water takes its neighbours' surface height with a negative depth, and the shader throws away everything shallower than 3 mm, so the shoreline is a smooth line where the surface meets the ground and no squares show; it is brown where deep and clear where thin, with a pale lapping line a few centimetres wide at the edge (measured with screen-space derivatives of the depth, so it stays thin on a gentle slope and only shows where the water is under about 9 cm). Between two water steps the vertices are blended from the last step to this one (`aPrev`, `uLerp`), so the surface moves at the screen's frame rate, not 30 times a second. The surface slope of the simulation (`aSlope`) tilts the lighting, so a wake or a bow wave shows as a darker or brighter band. Up to four running drains (`uDr`) each get a whirlpool: a dip in the surface, the pattern twisted round the drain, a dark eye and thin spiral streaks. The ground under shallow water is tinted and gets moving caustics (High only). **Ripples** are a separate wave-equation height field on the graphics card (`RIP`: two half-float pictures swapped each step, 0.07 m texels on High at 60 steps a second, 0.12 m at 30 on Low, damped, and faded out where the flood is under about 2 cm, from a small picture of the depths, `tSim`, updated each water step). `rip(x, z, r, a)` drops a ring-shaped bump in (up to 16 a frame): the legs when wading, and everything that calls `ring()` (splashes and the like), which uses it in place of flat ring sprites. The water shader reads the ripple slope to bend the reflection and the light, with pale crests where it is steep. Without WebGL2 and half-float render targets ripples are off (`RIP.ok`) and `ring()` falls back to sprites. `__ew.U.uRipDbg.value = 1` shows the ripple heights in false colour, for tuning. The light is a low warm sun with a cool sky fill; shadows come from one shadow map that is drawn once per site and again only when something is put down (`shadowMap.autoUpdate` is off), 2048 on High and 1024 on Low. Splashes, rings, drops and the pale flecks that ride the current are small pools in `fx` (`ring`, `splash`, `drop`, `fleckSpawn`). The scene is drawn once more upside down into a picture (`renderReflection`) so the water mirrors the buildings and sky: half the screen's resolution every frame on High, a third of it (at least 256 × 160) every other frame on Low; the sun's disc is left out of that pass (`uNoSun`) because a mirrored sun clipped to white blotches, and the water adds its own sharp sun glint instead. On Low the water also skips its two finest pattern layers, the silt layer and two of the four ripple reads (`uHi`). Low gets it too because without it the water did not read as water on a phone. The walls' materials carry one clipping plane all the time (it only bites during the mirror pass), because switching the renderer's planes on and off each frame made three re-check every material. Graphics: Phones ask for a pixel ratio of up to 2 on any setting, so that `../autores.js`, which can halve it, never takes them under 1. Auto starts High on computers and Low on touch screens and Chromebooks, and steps down to Low for the rest of the visit if frames stay under about 34 a second for nine seconds, after `../autores.js` has had its chance to lower the resolution (`quality`, `autoLow`); it never steps back up by itself. On Low there is one more step for slow phones: if frames stay under about 27 a second for nine seconds, the mirror pass is switched off for the visit (`mirrorOff`) and the water shows the sky only. Walls and props are merged into five meshes by surface (`Batch` in `models.js`: brick, wood, roof, plain and glass), each kind of block a map declares being drawn by `thing()`; debris is three instanced meshes; the first-person hands and tools are each baked into one mesh (`bake`); and things the player puts down are rebuilt together when they change (`EWLook.dyn`). **Sound** is all made in the page with the Web Audio API (`sfx`, `audioTick`): steps and wading, splashes, raking, digging, a gulp when a drain runs shallow, the pump's hum, and a lapping that fades as the place dries. **Touch:** a walk stick on the left (push it right out to run), drag anywhere else to look, and Use and Jump buttons in `#touch`, with Alt (only for tools that have a second use), Do (when you face something to work) and Turn (sandbags) appearing when they apply, all shown only on touch screens; the tool bar moves to the top there. A slow frame is caught up rather than played in slow motion: up to a quarter of a second, as up to eight water steps and the walking split into 40 ms pieces. **Tests:** `window.__ew` (the world, the player, `start(id)`, `ff(seconds)` to run the water ahead, `use()`, `select()`) is for tests and tuning from the console. To check a changed map can still be finished, load `core.js` in node, build `new EW.World(map)` and call the tool functions and `step(1/30)` until `isDone()`; every job was checked that way when it was made. **To add a job:** push a map onto `MAPS` in `core.js` after the last one (ids are saved, so never rename or reorder them), give it `needs`, `pay` and `par`, put its Spanish in `es.js`, and finish it with a node script before trying it by hand. +- `e63334287a3deaa3/ebbwork/`: Flood Crew (Back Room; first built as Ebbwork, and the folder, the `ebbwork:v1` save key and the names in the code keep that name), a single-player first-person flood-drainage game: each job is a flooded place, and you work out why it flooded and get it dry (three.js r187 from the site's own build with its r128 layer, then `../autores.js`; no Firebase, no rooms, no stats.js, no ads). It is our own design: the name, the six places, the tools, the prices and the text are ours. **Files:** `index.html` (the page and its styles), `game.js` (shaders, effects, controls, sound, HUD and menus), `models.js` (everything modelled: houses, fences, garden things, the van, drains, pipes, the things you put down, and the first-person hands and tools, all built from simple shapes and pictures drawn on a canvas, as `EWLook`), `core.js` (everything that is not drawing, with no DOM and no three.js in it, so `node` can load it: `require('./core.js')` gives `{EWSim, EW, EWMaps}`), `es.js` (its Spanish for `../lang.js`) and `preview.jpg`. **The water (`EWSim` in `core.js`, rewritten 26 Nov 2026 because the first version looked wrong: a checkerboard shimmer and a slow slosh):** the shallow-water equations on a grid of 0.5 m cells. Each cell has a ground height `g`, a barrier height `bar` laid on top and a depth `d` (kept in 64-bit numbers: with 32-bit ones a slow seep into a deep cell rounded away and volume drifted); each edge between two cells has a water speed (`u` across a cell's east edge, `v` across its south edge, m/s), so the water carries momentum: a current keeps going round a corner, piles up against a wall and swirls behind it. Every step (1/30 s, fixed): the speeds are carried along by the flow itself (semi-Lagrangian advection), speed up downhill on the water surface (`GRAV`), and are slowed by Manning friction (`mann`, 0.018), a drag on thin films (`film`) so a wet floor creeps rather than races, and a gentle linear drag (`drag`, 0.2 per second) so a pool settles instead of sloshing for minutes; then each edge carries speed × the depth on its upstream side (`fx`, `fy`), no cell may give more than it holds (flows out of a cell are scaled down together, and so are their speeds), and depths change by what flowed, so volume is conserved exactly: water only appears through `add()` and leaves through `take()`. Walls are `solid` cells. A 3 mm film (`FILM`) never flows, so floors keep real puddles in their dips. `push(x, z, vx, vz, r, f, dt)` shoves the water near a point along a velocity without adding or removing any (the player wading: a bow wave ahead and a wake behind). `vel(i, out)` gives a cell's current for drawing and for debris. Blocks of 8 × 8 cells sleep when nothing in or next to them is changing; an edge into a sleeping block carries nothing and wakes it (leaving that out loses water across the edge). One step with every block awake costs a few ms for the biggest job (68 × 48) on a desktop. `drag` and `film` were tuned so every job drains at least as fast as with the old water (node bot times, old to new: Marlow Row 152 to 157 s, Pell Street 182 to 181, Tanners Field 343 to 304, Fenny Underpass 246 to 255, Wharf Cellar 221 to 213, Mill Lane 411 to 346); raising them makes the long jobs drag on. **A job site (`EW.World`):** built from a map's `build(b)` with metres as the unit (x east, z south): `ground`, `shape` and `noise` set heights; `surf` sets the surface type and whether it can be dug; `wall` makes solid blocks (its `kind` is only for drawing); `drain` (a `rate` in m³/s and a `cap`: how much debris blocks it fully), `sinkArea` (water there leaves the map: a ditch or storm channel), `river` (cells held at a level: a stream that both feeds and takes water), `leak` (fed by a `valve` id, or `wrench: true` for a dripping joint), `valve`, `socket`, `litter`, `flood`, `spot` (a note the player gets when they walk near, kept in the journal), `sign`, `station` (the depot's board, bench and van) and `noJob` (cells that don't count). `step(dt)` runs leaks, the river, pumps, drains, sinks, the water and the debris, in that order. Debris floats in more than 5 cm of water, drifts with the current and towards a running drain, strands when the water drops, and blocks a drain by lying within 0.85 m of it (`clog`): a drain's rate is `rate × (0.03 + 0.97 × clear^1.25)`. Debris that has just been raked lies in a sodden heap for 45 seconds (`heavy`) before it can float off again, so a cleared drain stays clear long enough for the level to fall away from the heap. The job is done (`isDone`) when the water left in the job's cells is at most 3% of the most there has been (`World.DONE`) and nothing is still coming in; a skin of water under 8 mm (`World.SKIN`) is wet ground, not flood, and is not counted, which is what stops a job ending in minutes of waiting for a thin sheet to creep away. **Tools (each one a function on the world, so a test can call it):** `rake` (push or pull debris), `scoop` and `pour` (the 30-litre bucket), `squeegee` (moves water under 7 cm one cell along), `dig` and `pile` (soft ground only, down to `DIGMAX` 0.64 m; one stroke takes the cell down 0.24 m and pulls its four neighbours down with it, so a trench is a few strokes and is wide enough to run; piling uses the spoil you dug), `placeBarrier` (three cells in a row, four directions, `BARH` 0.36 m; refused on drains, ditches and the river), `placePump` / `setHose` / `placeGen` (a pump runs when it is on, has a socket or a live generator within cable reach and has a hose end; water it takes goes to the hose end's cell, so emptying into the same pool does nothing, and it only leaves the map if the hose end is on a sink or the river; a generator standing in more than 14 cm of water stops), `takeDebris` (the sack: removes debris for good), `setValve` and `fixLeak`. **The jobs (`EWMaps`, in order; a job opens when the one before has a star):** Marlow Row (a back yard: a drain buried in leaves and a split pipe whose copper supply pipe, drawn along the house wall with `pipe`, leads round the corner to its tap; a new player starts here, standing in it: the yard starts shin to knee deep, half a metre at the drain, so that it plainly is a flood and the before and after are obvious; see **The start** below), Pell Street (three hidden drains, a dripping joint, a paving dip that keeps a puddle), Tanners Field (allotments in a hollow with no drain: a trench through the bank to the ditch; a choked pipe that sits too high to finish the job), Fenny Underpass (a dead sump: pump from a wall socket with the hose over the crest to the storm channel, and a water main valve at the far end), Wharf Cellar (the river seeps in through a doorway: sandbags, then pump up the steps; it is dark, so `sky: 'cellar'` gives a head torch) and Mill Lane (a stream through its bank, a culvert under a raft of debris, a walled garden that needs the pump and the generator, a hollow to trench). `EWMaps.depot` is the depot: not a job, a yard with the job board, the gear bench and the van, and a puddle. **The start (rebuilt 26 Nov 2026 after the owner found the first version confusing):** Play puts a new player straight into Marlow Row holding the rake and nothing else. `TUT` gives one short line at a time at the bottom of the screen (move, find the drain, rake it, follow the pipe to the tap, hold to shut it, keep the drain clear) and each goes when it has been done. What a new player has not met yet is not on screen: `firstJob()` hides the scan and journal buttons, the other tools and the job's notes; the depot appears only after that job, with just the job board working (taking a job from it sets off at once); the gear bench appears after the second job (`shopOpen()`), and the van and its loadout only once the player owns more tools than it holds (`vanNeeded()`). The HUD in a job is a crosshair, one water bar, the tool, and one line of words (`#say`, which carries the instruction or else the latest message); there is no clock or coin count in a job. Each map has `pay`, `par` (the target time in seconds) and `needs` (what the job board suggests bringing, shown only after the player has been there once, so the first visit is for finding out). Stars: one for finishing, a second inside 1.6 × `par`, a third inside `par` with 1.5% or less left; pay is `pay × (0.6 + 0.2 × stars)`, halved when the job has been done before. **Gear** (`GEAR` in the page): tools with `slot: 1` take one of the van's five places (seven with Van racking); the rest are upgrades (more sandbags, long hose, cable reel, second pump, waders, racking). Prices are set so that one-star pay alone affords each next job's tool. **Storage:** localStorage `ebbwork:v1` only: `{v, coins, gear, load, jobs: {: {stars, best, n, seen}}, set: {sens, vol, q, inv}, tut}`; keep `v: 1` and these names working if you change it. Nothing is sent anywhere. **Drawing:** the ground and the water are each one mesh with a vertex at every cell centre. The ground (`terrainMat`) is three's own lit material with our patterns added in `onBeforeCompile` (grain, paving joints, and wet ground that is darker and shiny until it dries over about half a minute, so the band the water has just left is plain to see), which lets it take the sun's shadows and the cellar torch. The water (`waterMat`) is our own shader: its vertices carry depth and speed, a dry cell beside water takes its neighbours' surface height with a negative depth, and the shader throws away everything shallower than 3 mm, so the shoreline is a smooth line where the surface meets the ground and no squares show; it is brown where deep and clear where thin, with a pale lapping line a few centimetres wide at the edge (measured with screen-space derivatives of the depth, so it stays thin on a gentle slope and only shows where the water is under about 9 cm). Between two water steps the vertices are blended from the last step to this one (`aPrev`, `uLerp`), so the surface moves at the screen's frame rate, not 30 times a second. The surface slope of the simulation (`aSlope`) tilts the lighting, so a wake or a bow wave shows as a darker or brighter band. Up to four running drains (`uDr`) each get a whirlpool: a dip in the surface, the pattern twisted round the drain, a dark eye and thin spiral streaks. The ground under shallow water is tinted and gets moving caustics (High only). **Ripples** are a separate wave-equation height field on the graphics card (`RIP`: two half-float pictures swapped each step, 0.07 m texels on High at 60 steps a second, 0.12 m at 30 on Low, damped, and faded out where the flood is under about 2 cm, from a small picture of the depths, `tSim`, updated each water step). `rip(x, z, r, a)` drops a ring-shaped bump in (up to 16 a frame): the legs when wading, and everything that calls `ring()` (splashes and the like), which uses it in place of flat ring sprites. The water shader reads the ripple slope to bend the reflection and the light, with pale crests where it is steep. Without WebGL2 and half-float render targets ripples are off (`RIP.ok`) and `ring()` falls back to sprites. `__ew.U.uRipDbg.value = 1` shows the ripple heights in false colour, for tuning. The light is a low warm sun with a cool sky fill; shadows come from one shadow map that is drawn once per site and again only when something is put down (`shadowMap.autoUpdate` is off), 2048 on High and 1024 on Low. Splashes, rings, drops and the pale flecks that ride the current are small pools in `fx` (`ring`, `splash`, `drop`, `fleckSpawn`). The scene is drawn once more upside down into a picture (`renderReflection`) so the water mirrors the buildings and sky: half the screen's resolution every frame on High, a third of it (at least 256 × 160) every other frame on Low; the sun's disc is left out of that pass (`uNoSun`) because a mirrored sun clipped to white blotches, and the water adds its own sharp sun glint instead. On Low the water also skips its two finest pattern layers, the silt layer and two of the four ripple reads (`uHi`). Low gets it too because without it the water did not read as water on a phone. The walls' materials carry one clipping plane all the time (it only bites during the mirror pass), because switching the renderer's planes on and off each frame made three re-check every material. Graphics: Phones ask for a pixel ratio of up to 2 on any setting, so that `../autores.js`, which can halve it, never takes them under 1. Auto starts High on computers and Low on touch screens and Chromebooks, and steps down to Low for the rest of the visit if frames stay under about 34 a second for nine seconds, after `../autores.js` has had its chance to lower the resolution (`quality`, `autoLow`); it never steps back up by itself. On Low there is one more step for slow phones: if frames stay under about 27 a second for nine seconds, the mirror pass is switched off for the visit (`mirrorOff`) and the water shows the sky only. Walls and props are merged into five meshes by surface (`Batch` in `models.js`: brick, wood, roof, plain and glass), each kind of block a map declares being drawn by `thing()`; debris is three instanced meshes; the first-person hands and tools are each baked into one mesh (`bake`); and things the player puts down are rebuilt together when they change (`EWLook.dyn`). **Sound** is all made in the page with the Web Audio API (`sfx`, `audioTick`): steps and wading, splashes, raking, digging, a gulp when a drain runs shallow, the pump's hum, and a lapping that fades as the place dries. **Touch:** a walk stick on the left (push it right out to run), drag anywhere else to look, and Use and Jump buttons in `#touch`, with Alt (only for tools that have a second use), Do (when you face something to work) and Turn (sandbags) appearing when they apply, all shown only on touch screens; the tool bar moves to the top there. A slow frame is caught up rather than played in slow motion: up to a quarter of a second, as up to eight water steps and the walking split into 40 ms pieces. **Tests:** `window.__ew` (the world, the player, `start(id)`, `ff(seconds)` to run the water ahead, `use()`, `select()`) is for tests and tuning from the console. To check a changed map can still be finished, load `core.js` in node, build `new EW.World(map)` and call the tool functions and `step(1/30)` until `isDone()`; every job was checked that way when it was made. **To add a job:** push a map onto `MAPS` in `core.js` after the last one (ids are saved, so never rename or reorder them), give it `needs`, `pay` and `par`, put its Spanish in `es.js`, and finish it with a node script before trying it by hand. - `e63334287a3deaa3/daily/`: Daily Puzzles (Back Room), the dashboard for every daily puzzle. No libraries, no network except stats.js. `DAILY_GAMES` at the top of the script lists every daily game (`slug` = folder = storage key `daily:`, name, icon, `cat`: word, geo, logic, est (Estimation) or soccer, a one-line blurb, `ready`), plus `EXTRA` link cards under Play together (Puffer Party, `chip` in place of a daily status). Tiles only show for `ready:true` games, and "Coming soon" ones are listed under each category; flip `ready` when a game's folder lands. For each game it reads the shared record `daily:` (written by the game when a daily ends: `{ v:1, days:{YYYYMMDD:{done,win,score,tries,time}}, played, wins, streak, maxStreak, last, dist }`) and shows today's status (Not played, Solved in N / in m:ss, Done, or Missed) and the game's 🔥 streak (only while its last win was today or yesterday). Deepword is read from its own `deepword:` keys. The summary counts today's finished puzzles, the overall streak (days in a row, ending today or yesterday, with at least one daily done, worked out from every game's `days`), and counts down to local midnight; when every ready game is done it shows an "All done today" banner. stats.js (`data-game="daily"`): `max('streak', overall)` and `add('done', 1)` once per game per day (remembered in `daily-hub:counted`). It re-reads storage when the tab comes back into view or another tab writes, so finishing a puzzle in another tab updates it. Test hook: `window.__dh` under webdriver (`setToday`, `render`, `streakOverall`). A game whose win shouldn't read "Solved in " gives a `show` template (`{tries}`, `{score}`, `{time}`; `{score|hint}` adds the word, plural unless the number is 1, and `zero` is the text used when the number is 0): Crosslet shows its time, Ninefold puzzles solved of 3, Crossbar squares, Stat Duel calls right, Top Bins entries found, Quartets mistakes (Perfect for none), Sleight hints, Poopdle moves, Mainstream its points, Yardstick its total out of 500 and Thereabouts its average miss (`{score|x100}`: a score saved as a hundred times a decimal, so 137 reads "1.37×"). A missed puzzle's tile has the finished look but no ✓. Poopdle and Thereabouts are under Logic. `RETIRED`, under `DAILY_GAMES`, holds the daily puzzles taken off the list on 18 Nov 2026 (the least played; see the Back Room page above): they have no tile and aren't in today's total, but their records still count toward the overall streak, so taking a puzzle off never shortens anyone's streak, and a category with nothing listed (Soccer, for now) isn't shown. To bring one back, move its line back into `DAILY_GAMES`. The daily games don't have Back Room or phone-page cards of their own: the Daily Puzzles card and tile are the way in (the phone thumbnails in `m/thumbs/` are kept for if they ever do). - `e63334287a3deaa3/hunch/`: Hunch (Back Room, a daily puzzle on the Daily Puzzles page), a five-letter word guess in six tries, like Wordle. No libraries, no network: `words.js` holds `window.WORDS5 = { ANSWERS, GUESSES }` as space-separated strings, 2,019 answers (common, school-safe, no plurals) and 6,334 more allowed guesses (8,353 in all), written for the site and checked by a script (five letters a–z, no repeats, every answer also a guess, a blocklist for rude words). `ANSWERS` is already in daily order (a fixed seeded shuffle): day n after 1 November 2026 (puzzle #n+1, from the player's local date) uses `ANSWERS[n % length]`, so new answers must be **appended** to keep past days unchanged. Scoring marks greens first, then yellows only for as many copies as the answer has left. Hard mode (Settings, only before a game's first guess) makes every green stay put and every found letter be reused; High contrast swaps green/yellow for orange/blue. Unlimited mode picks random answers and never touches daily stats. Storage: the shared daily record `daily:hunch` (`{ v:1, days:{YYYYMMDD:{done,win,score,tries,time,hard?}}, played, wins, streak, maxStreak, last, dist }`, 60 days kept; the Daily Puzzles page reads it), the day in progress `hunch:day` (`{ d, g:[guesses], hard, t0 }`), Unlimited `hunch:free`, settings `hunch:settings`, `hunch:seen` (how-to shown) and `hunch:mode`. stats.js (`data-game="hunch"`): `add('wins')`, `max('streak')`, `min('fewest')`. The page is generated from the same engine as Fourcast (`CFG` at the top of the script: boards, rows, offset); keep the two in step when fixing the engine. Tile size is worked out in `fit()` (bigger of the layouts that fit); on a sideways phone the keyboard sits right of the board. Test hooks: `window.__wg` under webdriver (`setToday('YYYYMMDD')`, `type(word)`, `score`, …). Thanksgiving Day 2026 (`TG_DAY`) has its own answer, FEAST, set in `answersFor` for Hunch only; every other day and Fourcast are unchanged. **Spanish:** `es.js` has its words (lang.js), with a language switch in Settings; the words are English by design and tagged "En inglés". - `e63334287a3deaa3/fourcast/`: Fourcast (Back Room, a daily puzzle), four five-letter words at once in nine guesses, like Quordle. The same engine as Hunch with `boards: 4, rows: 9, offset: 777`, and the same word lists (it loads `/e63334287a3deaa3/hunch/words.js`, so don't move that file). Each guess goes on every unsolved board; a solved board stops. Day n uses `ANSWERS[(777 + 4n + k) % length]` for boards k = 0–3, so appending answers keeps past days. Each keyboard key shows four corner colours, one per board in reading order (top left = board 1). Tiles may be up to 1.45× wider than tall, and `fit()` picks a 1 × 4 or 2 × 2 layout, whichever gives bigger tiles; on a sideways phone the keyboard stays underneath in short rows. Win = all four within nine; the share card shows the guess each board fell on (🟥 for missed). Storage: `daily:fourcast` (same contract; each day also has `boards`, how many were solved), `fourcast:day`, `fourcast:free`, `fourcast:settings`, `fourcast:seen`, `fourcast:mode`. stats.js: `add('wins')`, `max('streak')`, `min('fewest')`. **Spanish:** `es.js` has its words (lang.js), with a language switch in Settings; the words are English by design and tagged "En inglés". diff --git a/e63334287a3deaa3/ebbwork/core.js b/e63334287a3deaa3/ebbwork/core.js index 12ab00d2..57fb040f 100644 --- a/e63334287a3deaa3/ebbwork/core.js +++ b/e63334287a3deaa3/ebbwork/core.js @@ -26,8 +26,8 @@ var EWSim=(function(){ this.act=new Uint8Array(nb);this.proc=new Uint8Array(nb);this.was=new Uint8Array(nb); this.nProc=0; this.mann=0.018; // Manning's n: about right for paving and short grass - this.film=0.00012; // drag on thin water (m^2/s): a 1 cm film barely moves, 10 cm flows freely - this.drag=0.35; // a little drag on everything (1/s): rubbish, grass and rough ground in the water. Waves die down in seconds, not minutes + this.film=0.00006; // drag on thin water (m^2/s): a 1 cm film barely moves, 10 cm flows freely + this.drag=0.2; // a little drag on everything (1/s): rubbish, grass and rough ground in the water. Waves die down in seconds, not minutes } var P=Sim.prototype; P.idx=function(x,z){return z*this.W+x}; @@ -388,7 +388,7 @@ var EWMaps=(function(){ b.spawnAt(2,9,-Math.PI/2); }}); // 3. Tanners Field: allotments in a hollow. No drain at all: the only way out is over, or through, the bank. - MAPS.push({id:'field',name:'Tanners Field',sub:'Allotments',w:34,h:24,seed:31,pay:160,par:540,sky:'day',needs:['shovel','rake'], + MAPS.push({id:'field',name:'Tanners Field',sub:'Allotments',w:34,h:24,seed:31,pay:160,par:420,sky:'day',needs:['shovel','rake'], brief:'The allotments sit in a hollow. The water came in and has nowhere to go.', build:function(b){ b.ground(function(x,z){if(x>=30.5)return -0.6;var g=0.30+0.015*dist(x,z,22,12)+0.36*bump((x-28.75)/1.25);if(x>30)g=g+(x-30)*2*(-0.6-g);return g}); @@ -449,7 +449,7 @@ var EWMaps=(function(){ b.spawnAt(10.5,1.6,Math.PI); }}); // 6. Mill Lane: the stream has broken its bank and is still coming. - MAPS.push({id:'mill',name:'Mill Lane',sub:'Lane by the stream',w:30,h:24,seed:67,pay:400,par:600,sky:'day',needs:['sandbags','rake','pump','generator','shovel'], + MAPS.push({id:'mill',name:'Mill Lane',sub:'Lane by the stream',w:30,h:24,seed:67,pay:400,par:540,sky:'day',needs:['sandbags','rake','pump','generator','shovel'], brief:'The mill stream is through its bank and the whole lane is under. Start with whatever is still feeding it.', build:function(b){ b.ground(function(x,z){ diff --git a/e63334287a3deaa3/news/ngcoding10-flood-water.json b/e63334287a3deaa3/news/ngcoding10-flood-water.json index ba61da0b..36364e2c 100644 --- a/e63334287a3deaa3/news/ngcoding10-flood-water.json +++ b/e63334287a3deaa3/news/ngcoding10-flood-water.json @@ -1,19 +1,19 @@ { "kind": "feature", "title": "Flood Crew: new water", - "tags": ["Flood Crew"], + "tags": [ + "Flood Crew" + ], "items": [ "The flood moves like real water now: currents carry on round corners, swirl behind walls and settle down instead of shimmering.", "Wading pushes a bow wave ahead of you and leaves a wake, and splashes send out rings of ripples.", - "Working drains pull a proper whirlpool, the reflections are sharper, and sunlight sparkles on the surface.", - "Tanners Field and Mill Lane have longer target times, because the water takes a little longer to get going." + "Working drains pull a proper whirlpool, the reflections are sharper, and sunlight sparkles on the surface." ], "es": { "Flood Crew: new water": "Flood Crew: agua nueva", "Flood Crew": "Flood Crew", "The flood moves like real water now: currents carry on round corners, swirl behind walls and settle down instead of shimmering.": "La inundación se mueve como agua de verdad: las corrientes siguen al doblar las esquinas, giran detrás de los muros y se calman en vez de temblar.", "Wading pushes a bow wave ahead of you and leaves a wake, and splashes send out rings of ripples.": "Al caminar por el agua empujas una ola por delante y dejas una estela, y las salpicaduras forman anillos de ondas.", - "Working drains pull a proper whirlpool, the reflections are sharper, and sunlight sparkles on the surface.": "Los desagües que funcionan forman un remolino de verdad, los reflejos son más nítidos y el sol destella en la superficie.", - "Tanners Field and Mill Lane have longer target times, because the water takes a little longer to get going.": "Tanners Field y Mill Lane tienen tiempos objetivo más largos, porque el agua tarda un poco más en ponerse en marcha." + "Working drains pull a proper whirlpool, the reflections are sharper, and sunlight sparkles on the surface.": "Los desagües que funcionan forman un remolino de verdad, los reflejos son más nítidos y el sol destella en la superficie." } }