diff --git a/README.md b/README.md index 03adaa11..e977131a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Personal site hosted with GitHub Pages at **https://ascoding11.github.io**, the - `e63334287a3deaa3/rollaway/`: Overdrop (Back Room; formerly Rollaway, and the folder, saved data, stats names and the Leaderboards' `d: 'rollaway'` keep the old name), an endless single-player downhill runner (Three.js r128, no Firebase except stats.js). A heavy chrome ball drops on its own down a steep skyway of dark lit panels plunging through a city at night; the player only steers, and rolling over an edge or touching a hazard ends the run. **Slope and speed:** the course falls at about 38° to 43° (grade `dy/ds` around -0.75 to -0.95; the old track was about -0.07), with flatter shelves, steeper plunges, drop-offs and kickers. Speed is not scripted: when a module is laid down, its speed is worked out metre by metre from its own grade (`P.GA` of pull per unit of grade, against a drag set so the normal grade (`P.GB`) settles at `vTop(s)`, which rises from 22 m/s toward `P.VT1` 60 m/s over the first kilometres), plus speed pads (`c.pad`, a push) and brake strips (`c.brake`, extra drag). So a steeper stretch really is faster and a shelf really slows you, while the speed at every metre (`Track.V`) and the arrival time (`Track.TT`, `tr.tAt(s)`, inverse `tr.sAt(t)`) are still known in advance, and the ball's clock is set from its distance every step, so every moving hazard is exactly in phase. In practice: 20 m/s (about 80 km/h along the deck) at the gate, about 35 by 10 to 15 s, 50 by 40 s and 55 to 63 from about a minute on (all speeds are along the ground plan; the HUD shows km/h along the deck, a third more). A module that changes the grade must plan it (`c.grade(x0, x1, offset)`) before it asks for a speed or a time (`c.vx`, `c.T`); asking first is flagged as `late` and the tests fail on it. A bend over into something steeper must be long enough not to throw the ball (`c.crest`). Steering is a sideways force (`A_STEER` 28 m/s², 1.5× against the drift) damped by `GRIP` (4.2/s, 6.5 with no input); both grow by up to 40 % between 25 and 60 m/s (`STEER_K`), so the drift feels the same and the answers come quicker at speed. Curves pull outward by v²κ unless banked; walls and banks push back by gravity (`G` 22 m/s²); 35 % steering in the air. **Opening and pacing:** every run starts the same way: a dodge (one pylon) about 3 s in, a three-row weave from about 4.5 s, then the plunge (the deck bends over into a dive of about 50°, bottoms out and kicks the ball over a gap onto a landing off to one side) between about 8 and 12 s. After that modules are seeded; rests are short and most have a pylon in them, so there is never more than about 3 s without something to steer round. Difficulty (`diffAt`) starts at 0.22 and reaches 1 after 2,600 m; a breather (a flatter shelf with a ring of shards) comes every 950 m. 36 modules in four groups: rests (straight, banked turn, flat curve, S-bend, rollers, shelf), layout (narrow beam, tube, curving tube, fork, zigzag, eye, crossing beams, missing panels, stepping pads, tilting slabs, wall ride), air (kicker onto an offset landing, double gap, drop-offs, kicker onto islands, the plunge) and hazards (pylon slalom, pylon gates with one gap, sliders, hammers, hammers over a beam, crusher rhythm, rotors, moving walls, speed pad into a slalom, brake strip into fast crushers, a mixed gauntlet). The run-in before a module's first row, and the spacing between rows, are worked out from how far apart the ways through are (`leadTo`, `moveT`). **Checking it:** `RA.validate(track, metres)` follows every reachable state with 80 % steering, hazards 12 cm bigger and decks 6 cm narrower and reports any module nothing gets through; `RA.sight(track, s0, s1)` checks every hazard is in plain sight from the camera at least `P.SEE` (0.8 s) before the ball reaches it (no crest hides it); `new RA.Bot(track)` looks 1.5 s ahead. After changing a module or a physics number, run validate and sight in Node on a few hundred kilometres of seeds (the RA module between `// ==CORE==` and `// ==/CORE==` still has no DOM or Three.js in it). **Look:** night, neon and chrome (our own design, not modelled on any other game): a violet sky with stars, a magenta and amber horizon band, a slotted sun on the horizon and a skyline of far megastructures, all painted by one sky shader (and once into a panorama for reflections); towers that stand from far below and stream upward as you drop (one instanced box with a window shader, placed in 320 m cells away from the track); a dim lit city far below; specks of light fixed in the world round the camera and a light rain falling plumb; light frames over the deck every 36 m and invented holo glyph boards beside it. Several things are there to make the slope read in a single frame: rungs of light across the deck every 4 m (they bunch up as it dives), plumb masts beside the deck every 44 m ringed with level lights, short plumb beacons along every drop edge, a plumb warning light above each pylon, the rain, a pool of light the ball throws down the deck ahead of it, and a horizon and city that stay level while the deck drops under them. The deck is dark panels (one canvas texture: shade in red, faint circuit traces in green) lit by `neonMat`, a standard material that adds a per-vertex glow colour (`emi`): drop edges always glow cyan (a band and a light strip), safe walls end in a raised magenta rail, kickers have amber chevrons, beams a cyan centre line. Hazards are dark chrome with hot amber bands and white-hot parts, and read by shape and brightness as well as colour: pylons have pointed tips, sliders (rolling drums) and crushers carry bands, hammers are double cones on gantries, rotors have a spiked arm on a hub, moving walls a striped top with white posts at the gap. Shards (the gems) are pink octahedra with halos. The ball is a chrome sphere whose seam glows in its own colour, with a light trail; landings throw sparks and a shockwave ring, crashes a burst and a soft flash. Glow is all emissive colour and additive sprites (no post-processing). The camera sits above the deck behind the ball and pitches down most of the grade ahead, so the horizon stays near the top and the track falls away below it; field of view widens with speed. Reduce effects (on by default when the system asks for reduced motion) turns off speed streaks, motes, rain, the shockwave, the lean and the flash, and narrows the widening of the view. **Score:** distance times a multiplier that rises 0.1 per shard and 0.25 per close call (passing a hazard within 0.6 m) and settles back after 4 s. A milestone gate every 500 m; an amber strip with two BEST flags where your best run ended. **Balls** (cosmetic, by best distance on either track; the ids and distances are Rollaway's, the shown names are new): Ion (`lapis`), Flare (`sunstone`) 500 m, Cryo (`glacier`) 1,000 m, Circuit (`jade`) 1,500 m, Ember 2,000 m, Volt (`tiger`) 3,000 m, Nightfall 4,000 m, Prism (`pearl`) 5,000 m. **Audio** is all Web Audio, synthesised: a rolling hiss and a low turbine hum that climb with speed, rushing air, landing thumps with a zap, a close-call whoosh panned to the side, shard chimes up a C minor pentatonic, boost and brake sounds, and an original 124 BPM loop (pad, saw bass, kick and clap, hats, arpeggio) whose layers come in and whose filter opens as the speed rises; Volume, Music, Effects and Mute (M). **Controls:** A/D or the arrow keys (rebindable, `keybinds:rollaway`), optional mouse steering; touch: drag left and right anywhere (a floating stick, the default), or hold either side, and optional tilt; a sensitivity slider; R or Space restarts at once. **Drawing:** the deck is built in 10 m chunks (one rebuilt per frame at most, so no frame does much work) from a pool of meshes rewritten in place, pylons under it and the light frames are two instanced meshes, each hazard kind one instanced mesh, shards one plus one for their halos; a floating origin keeps numbers small. Graphics Auto / Low / Medium / High (`QP`: resolution, view distance, shadows on High only, how many towers and motes), plus `../autores.js`. **Saved in the browser only**, in Rollaway's keys and format: `rollaway:save` (`{v: 1, best, bestD, runs, gems, ball, daily: {day, best, bestD, g}, how, od: {best, bestD}}`) and `rollaway:set` (quality, sensitivity, reduce effects, volumes, mute, touch mode, tilt, mouse). `od` holds the bests on the new track; `best`/`bestD` are the classic Rollaway bests, kept and shown on the title as "Classic Rollaway best" but no longer raised; a daily best set on the new track has `g: 2`, and an older one from the same day is kept as `dailyC`. The Daily run's seed is now `hashStr('overdrop-daily-' + day)`. Stats hooks at the end of every run: `max('od-distance', metres)`, `max('od-score', score)`, `add('runs', 1)`; the Overdrop row in `../leaderboard.js` shows those, with the old `distance` and `score` kept as the classic Rollaway boards. **Spanish:** `rollaway/es.js` (ball names stay English); text built in code goes through `TX()`. In an automated browser `window.__ra` drives it (`startRun(daily, seed)`, `bot(true)`, `run(seconds, hz, draw)`, `state()`, `info()` for draw calls and triangles). - `e63334287a3deaa3/rampline/`: Rampline (Back Room), a low-poly stunt time-trial racer with a track builder, online boards and community tracks (Three.js; Firebase Realtime Database only for the boards and community tracks, under the prefix `rl`, plus stats.js). One small car, one track, the clock: 30 built-in tracks in four tiers (`TIERS`: Green, Blue, Red, Black), your own tracks from the builder, and tracks other players publish. Everything that isn't drawing is the `RL` module between `// ==CORE==` and `// ==/CORE==`, with no DOM or Three.js in it, so a Node script can run it on its own: the pieces (`PIECES`), building a track (`buildTrack`), the car physics (`newCar`, `step`), share codes, ghost recordings, the checks (`validate`), the track-writing cursor (`Course`), the tracks (`TRACKS`, `trackOf`) and the checking bot (`runBot`). **Pieces** sit on a grid of 10 m tiles and 2 m height steps with a quarter-turn (`{t, x, y, z, r, w}`: type, tile, height, turn, side walls); each has the tiles it covers (`fp`), how many height steps above it it keeps clear (`hh`) and its ports (where road leaves it). Pieces: straight, curves (tight, normal, wide, huge), S-bends left and right, slope, steep slope and long climb (+1, +2, +3 steps), climbing curves left and right (+1 step while turning), bump, two banked curves, boost pad, kicker and big ramp (no exit port: they launch you), loops leaning left and right, wall ride, narrow road, gap, platform, start, checkpoint, checkpoint ring (an arch instead of posts), finish, and scenery (tree, rock, arrow sign). The order of `PIECES` is part of the share-code format: only ever add to the end (the pieces from curveXL on were added with the handling pass). Raised road gets **pillars** down to the ground automatically (`pillars` in `buildTrack`), every 10 m or so, only where no other piece is below that tile and always below the road surface. **One set of triangles:** `buildTrack` turns every piece into triangles that are both the collision geometry (type 0 road, 1 solid; `FX` 1 marks a boost pad, 2 a slab end that meets another piece's (inside the road), 3 the side of a piece that twists) and, merged with one colour each, the single drawn mesh; positions are rounded to 1/1024 m. Pieces that twist (`tw`: the two banked curves and the wall ride) also keep, per road triangle, the surface's real normals, the twist of its quad, how far across the road each corner is and the way across (`X3`, `XD`), used only by the newer contact rules below. **Physics** (`PH`, `PHYS_V` 2, fixed 1/120 s step, only + − × ÷ and √ while stepping, so a recording of inputs replays to exactly the same run on any device): the car is a point riding 0.55 m above the road with two 0.75 m spheres for hitting things. **Contact rules** (`car.pv`; `PHYS_NOW` 3 for every new run, 2 for recordings from before the side-ramp fix, which replay with the old rules bit for bit; same car, same boards): on flat road, curves, slopes and loops the two are the same run for the same inputs, except where rules 2 hit a slab end. Rules 3 differ in four ways. (1) A road that twists climbs or drops along the way you drive anywhere off the line it twists round, by up to 40°, which the frame's up (`n`, what the driving uses, so banks and wall rides handle as before) doesn't know: the body now leans with the real surface (`car.bd`, `bodyPose`: where the car is drawn and where its spheres sit), so the nose no longer digs through the road into the slab's underside (a dead stop anywhere off the middle of a wall ride, and on the outside of a bank above about 200 km/h) and the car no longer sinks into or floats over the road by up to 0.8 m. (2) The ride height there follows the smooth surface through each quad's four corners instead of the ridge or dip its two triangles make (up to 13 cm, at every quad). (3) A car on the road never hits a slab end where two pieces join (it used to when its nose dipped below road level: landing nose-down near a join, or at the bottom of a slope above about 290 km/h: a dead stop, a shove or a bounce), nor the side of the twisting piece it is riding (the wall ride's low edge used to bounce cars back up the wall; now they drop off it). Open ends (a ramp's lip, the two sides of a gap) are as solid as ever, so jumps are unchanged. (4) The wall ride lifts its middle as it rolls up, which slid the road about 2 m sideways under a car that wasn't steering, towards the low edge; now a car on it keeps its place across the road (`laneKeep`). Not changed: too fast into a bank still throws you off at its exit, and the blunt start of a barrier after a piece with none (wall ride, loop, gap) still stops a car that hits it head-on. Acceleration 20 m/s² tapering to nothing at 82 m/s with drag: 0–100 km/h in 1.5 s, 0–200 in 3.8 s, top speed about 252 km/h. Steering lock and rate fall off with speed (full lock turns in 6 m at 30 km/h and about 55 m at 150 km/h), and the turn rate is capped a little above what the tyres hold, so holding full lock at speed slides a little. **Drifting:** let go of go and tap brake while steering at more than 50 km/h: the nose holds an angle set by the steering (`driftAng`), grip is a little higher than normal (`driftK`), so you get round a tight corner at speed (about 75 % of the grip turn's radius, for 3–8 % of your speed); it lasts while you keep steering and the car is sideways. Downforce grows with speed (`stick` plus `stickHi` above 30 m/s), which keeps you on loops, wall rides and most crests; the fastest cars still fly over sharp crests. A share of the road's turn at take-off carries into the air as spin (`carryW`); in the air the **air brake** (input 32, Space or Left Shift, or the brake) damps the spin and levels the car for the landing; landing square keeps your speed, crooked costs up to 70 % (with the air brake the bot's landings cost 2–5 %, without it up to 70 % and falls). Boost pads give 1.4 s of extra push up to 1.3 × the top speed. Walls take the speed into them, turn the nose along them and never push a car on the road upwards (barriers on banks and loops lean); of the speed along the wall a light brush keeps 96% and a square hit 40% (`walls()`; 92% and 35% until November 2026, eased a little because every touch felt costly once tight corners had real inside barriers). Falling off (or 6 s in the air) puts you back at the last checkpoint 0.25 s later with the speed you had there; Backspace does it at once. **A run that went back to a checkpoint doesn't count** (no best, ghost, medal, stats or board), and the HUD shows "Practice". Starting a track and R are both instant and plain (restart under a millisecond): no countdown, no camera move and no fade; the car waits on the line with the camera already in place, and the clock starts with your first drive key. The menu sits over a still view of a track. Splits against your best show at every checkpoint and at the finish. **Gates:** a checkpoint counts when you cross it either way; the finish only counts going forwards, once every checkpoint has been passed. **Tracks** are written with the `Course` cursor (`s`, `L`/`R` curves with `S`, `M`, `L`, `X` sizes, `sL`/`sR`, `bL`/`bR`, `up`/`down`, `climb`/`drop`, `cuL`/`cuR`/`cdL`/`cdR`, `bump`, `boost`, `ring`, `loop`, `wall`, `narrow`, `gap`, `ramp` + `jump(n, dy, speed cap)`, `plat`, `cp`, `fin`), each with its look (`th`). After changing a track or the physics, run the bot: it drives with the real `step` and only a player's keys (it slows for crests that lead into corners and for jumps' speed caps, uses the air brake, and never starts a drift by accident; `pv` picks the contact rules, and with rules 3 it doesn't steer against the wall ride's old sideways slide), in 13 styles; every track must be finished cleanly by at least one, and the same inputs must replay to the same time. `MED` ([builder, gold, silver, bronze] in ms) comes from it: builder is the bot's best clean time rounded up to 10 ms, gold 1.05 ×, silver 1.2 ×, bronze 1.45 ×, rounded up to 0.1 s. Built-in tracks run 24–49 s for the builder time. The 20 tracks from the first version got longer layouts (layout 2) with the handling pass: a best from the first layout is kept in the save as `pb[id].old = {t, m}` (shown on the track card as "Old layout", and its medal `m`, worked out with `OLD_MED`, still counts). **Looks:** three environments of our own, chosen per track (`th`, or Look in the builder): Summer valley, Snowy pass, Desert canyon (`THEME`: sky, fog, ground, hills, the colours of its light (`hs`, `hg`, `sun`, `em`, so hills and trees take the look's colours), its dust colour, and recolouring of trees, rocks and road sides). **Ghosts:** a ghost is a recording of inputs driven through the same physics once (`GTrack`, every step's pose kept, built a little ahead of where it's needed), so up to 10 race at once with almost no cost and never collide: your best (the Ghost setting) plus any you tick on a board. **Online** (signed in anonymously only when first used; the shared rules only let a player write their own node, which needs n, c, x, z, h, ts): `rooms/rl-b2-/players/` is a player's board entry for a track (`t` best ms, `k` car, `p` paint, `pa`, `a`, and `lk` only when a Captain's garage look is worn, see below), `rooms/rl-g2-/players/` the ghost behind it (`t`, `g` the inputs, `f` 2, `v` the contact rules it was driven with: 2 or 3), where `` is a built-in track's id or a custom track's `trackKey` and "2" is PHYS_V (new physics, new boards; the contact rules share one board). A clean new best is uploaded if it beats the account's entry. The top 10 shows only entries whose ghost, fetched and driven again on this device, finishes cleanly in exactly the claimed time with the contact rules it names (`Online.verify`; results cached in `rampline:vc`), so a made-up time or an edited recording never shows. A page from before rules 3 checks every run with rules 2, so until it is reloaded it doesn't list runs driven with rules 3. `rooms/rl-tracks/players/` holds a player's published tracks (`tr: {: {nm, code, at}}`, at most 5, at most 800 pieces each, and only after a clean finish of it), `rooms/rl-plays/players/` who raced which published track (`p: {: [best ms, last played]}`, 150 at most). **Community** lists published tracks (newest, most raced, raced this week), with the featured track of the week on top (the most raced in the last 7 days, else one picked by the week number), each with its own top 10; names and track names go through `/namefilter.js`. Hide and Report hide a track in this browser only (`rampline:hidden`); there is no shared report list, so Report tells the player to use Tell us. **Replay viewer:** watch any of your last 12 runs (`rampline:runs`) or a board run, with play/pause, frame steps, ¼× to 2×, a timeline, and a graph of speed over distance that can lay a second run (your best or a board run) over the first. **Builder:** a free camera (middle-drag to look round, right-drag, Shift-drag or WASD to pan, wheel to zoom, Shift + wheel or Q/E for the build height), a palette (keys 1–0 for the first ten), click or tap to place (R turns it; the preview shows arrows where the road leaves), right-click, X then click, or the bin to delete, the select tool (V: click, Shift-click or drag a box) to move (M, or M over a piece to pick it up), copy (Ctrl+C), cut (Ctrl+X), paste (Ctrl+V, R turns the group, Esc cancels and puts a moved group back) or delete pieces, Ctrl+Z / Ctrl+Y undo and redo (200 steps), Look (theme), a check, Test drive (T), Share, and Publish (in Track builder's list). **Share codes:** `RL1.` + base64url of: version 1, name length + UTF-8 name (≤ 40 bytes), piece count (2 bytes), 5 bytes a piece (type, x + 128, z + 128, y, turn + 4 × walls), then an FNV-1a checksum (4 bytes); version 2 is the same with a theme byte after the version (theme 0 is still written as version 1, so older copies read it). `decodeTrack` checks everything and returns a plain message for anything wrong. **Saved in the browser:** `rampline:save` (`{v: 1, pb: {: {t, sp, n, name, lv, old}}, runs}`), `rampline:ghost:` (`{v: 2 or 3 (the contact rules), f: 2, t, g}`: your best run as inputs, one byte per step (1 go, 2 brake, 4 left, 8 right, 16 back to checkpoint, 32 air brake) in runs of varint(count × 64 + input), base64url; version 1 ghosts used count × 32 and the old physics, and are left alone), `rampline:runs` (each with `v`, the contact rules; none means 2), `rampline:tracks`, `rampline:hidden`, `rampline:vc`, `rampline:set` (`vol, mute, cam, gfx, car, col, ghost`), `rampline:garage` (`{v: 1, car, col, pat, acc, rim, trail, name}`: car, paint, pattern (plain, stripe, twin stripes, two-tone) and its colour, rims, exhaust trail (off, smoke, flame, rainbow) and the name on the boards; account-nudge.js syncs it) and keys under `keybinds:rampline`. Stats hooks: `min('r2-', seconds)` for every clean built-in finish (stats.js's `LOWER`; the old `t-` names stay there for first-layout times), `max('medals', n)` (1 to 4 a track, old-layout medals included) and `max('golds', n)`. Drawing: the track is one merged mesh, each gate banner its own mesh, the car one mesh plus its wheels as one `InstancedMesh`, each ghost the same plus a name tag, dust and the exhaust trail a point cloud each, speed lines one line set; with no ghosts racing is about 17 draw calls, with 10 ghosts about 43 (logic under 1 ms a frame). **Drawn-only extras** (none of them is in the `RL` module, the physics or the track format, so times and share codes don't change): the **ground** is one mesh made in `buildScenery`, a patchwork of flat triangles in slightly different tones round the track (at most 32 × 32 cells, tones fading out at its edge) plus four plain sheets out to the horizon, so every bit of ground is drawn once (drawing a second ground under it cost about a fifth of the frame on slow graphics); the **centre dashes** on the road are their own mesh (`makeRoadLines`), swept from the same frames as the road (`RL.framesWorld`), on every other segment so they line up with the kerb stripes, a hair above the surface, skipped where the road twists (bank and wall-ride entries), on boost pads and at gates; dust and exhaust use one small shader (`fxPointsMat`) that gives each point its own colour, fade and size, so puffs grow and fade instead of popping: landings throw a ring in the look's dust colour, sliding leaves pale tyre smoke from the back wheels, and a boost pad's push shows as a flame from the exhaust when no garage trail is chosen; on the Fast graphics setting (`gfx: 'low'`, where nothing casts shadows) the car gets one soft dark patch under it (`blobStep`: on the road while driving, on whatever is below while flying, one ray a frame only in the air). The camera widens its view and pulls back with speed, and speed lines (short streaks kept to the edges of the view, never across the car) fade in above about 90 km/h; the Speed effects setting (menu and pause, `set.fx` in `rampline:set`, on by default) turns both the widening and the lines off. On touch screens the page adds `touch` to `body` (steer bottom left, GO and BRAKE bottom right, BRAKE in the air is the air brake, checkpoint/restart/camera/sound/pause top right); the builder works by tapping, with one finger to look round, two to pan and pinch, and the select tool's bar (Move, Copy, Delete, Done) above the palette. **Captain's garage (hidden, not public yet):** 42 more cars (normal cars, work vehicles, toy cars and silly cars, from a muscle car to a rubber duck, and from the second wave in November 2026 sports cars, a team bus, ice resurfacer, golf cart racer, football helmet and soccer ball, and pirates, suits and robots, a pirate ship, black sedan, VIP limo, armoured van, robo walker and lowrider: car numbers 32 to 42), 25 paints, 12 wheel designs, 10 tyre smokes and 13 horns, all drawn in code in `garage.js` beside the page and numbered as in `cosmetics.js` (game `rampline`). `RAMPLINE_PUBLIC = false` in `index.html` is the one switch; until it is flipped, `garageOn()` asks `captains.js` (`may(false, 'garage', 'rampline-garage')`), so only the site's captains, or `?garage=1` on localhost or in an automated browser, see the "Captain's garage" button at the end of the Garage card and its screen (front and back pictures rendered from the real models, tabs for cars, paint, wheels, tyre smoke and horn). Everything is free to wear; nothing is bought and the shop stays shut. What a captain wears is saved as `rampline:cos` (`{v: 1, car, paint, wheels, smoke, horn}`, item numbers, 0 for none; not synced to the account) and, for what shows on a ghost, goes on their board entries as `lk` = `"1..."` beside the old `k` and `p` (which stay the garage car and colour, so pages from before it draw the garage car as before). Reading a board, `lkOf` checks the string's shape and `garage.js`'s `parse` every number; unknown numbers are drawn plain. `garage.js` is fetched only for a captain or when a board row has an `lk`; for everyone else nothing changes. A paint repaints the car's own paintwork (with none, a car with a colour of its own, such as the school bus or the taxi, keeps it; the rest take the garage swatch); wheels replace the car's own wheels or the garage rims. Tyre smoke recolours the slide smoke and the horn plays on H (only if no control is bound to H) or a horn button above the steering on touch screens; both are yours only. Looks only: every car is still one mesh plus one `InstancedMesh` of wheels (up to six, each its own size), 120 to 650 triangles, so the draw calls are unchanged; all fit about the same box as the garage cars; a car that would sit in front of the Hood camera hides its body in that camera only. A test hook (`window.__rl`) exists only when `navigator.webdriver` is set; with `GX` it has `sheet()` and `wheelSheet()` (contact sheets of every car and wheel). It has Spanish (`rampline/es.js`, through `../lang.js`; EN | ES switch next to Speed effects in both settings panels): menus, how-to-play, results, boards, community, the track builder and its checks, and the captains' garage; the builder's checks stay English inside the code (the page translates them with `_t()` when it shows them, because `T` is the tile size there), and track names and players' track names are never translated. -- `e63334287a3deaa3/hush-pools/`: Hush Pools (Back Room), an original co-op horror obby for 1 to 4 players in flooded tiled pool halls (one file, three.js r128 with `../autores.js`, `../netsmooth.js` for teammates, Web Audio, Firebase Realtime Database rooms under `rooms/hp-`, same project and rules as Rumble Karts; invite links go through the home page as `#hp-`; Quick match uses `hp-pub-1` to `hp-pub-6`; rooms hold up to 4). The name, the monster, the rooms, the art and the sounds are all our own (everything is drawn and synthesised in code; no image or sound files). Players hop between floating tiles across nine big, misty halls of knee-deep water while one tall, blind, very fast monster hunts them **by sound only**. The water is shallow (you wade, slowly and noisily, and can always jump back out; nobody drowns), and the mist (`FOG_NEAR`/`FOG_FAR` in the renderer, about 15 m in the halls, clear in the lobby) hides the far wall and the monster until they're close. **Rules** are in the `// ==CORE==` … `// ==/CORE==` part of the script: plain data and pure functions with no DOM or three.js, the same in every browser and loaded as they are by the tests (below). `TUNING` holds every number worth tuning (gravity, jump, walk 4 / run 6.2 / creep 2 m/s, how loud each thing is in `TUNING.loud`, hearing radius 20 m × loudness × difficulty, memory 8 s, the monster's speeds and reach, grab 1.6 s, revive 2.6 s, shield 3 s, and so on); `DIFFS` is Easy (bigger tiles; the monster is 0.8× as fast, hears less and waits longer before it rushes; 50% coins), Normal and Hard (smaller tiles; 1.2× as fast, hears more, rushes sooner; 160% coins; opened by two Normal escapes). **Noise** is the core: every event is `{ x, y, z, l (loudness), src }` (`emit`), heard by a monster in the same room when it's within `hearRadius(l, df)`; falling in is loudest (1.0), clipping the water with your feet 0.7, a hard or edge landing 0.42, running on tiles 0.16, wading 0.45 a step (0.62 running, 0.24 creeping), climbing out 0.3, valves 1.05, a bottle 1.25 and its echo; walking and creeping are silent. Each noise shows as rings spreading on the water (the water shader's `uRings`, 14 at a time) and on the HUD's noise meter. **The monster** (`monStep`): there is one, and it follows the party from hall to hall. It drifts (0), goes to look at the loudest thing it remembers (1), freezes and turns towards a fresh noise close by (7, for `TUNING.react` s), then rushes at it at about 14 m/s (2), holds someone (3) or is stunned by a flare (4). When most of the party is in another hall it sinks under the drains (5, `partyRoom`) and rises somewhere in that hall far from everyone (6, `riseSpot`); it hears nothing while it's under. Memory fades over 8 s (`memWeight`), and it paths around tiles and pillars on a 0.5 m grid (`gridPath`). A rush takes anyone within 2 m at the end of it, so the way to survive one is to be far away or to get moving the moment you hear its shriek; otherwise it only takes someone who has just made a noise right next to it (walking into someone makes a bump that counts), so standing still and quiet beside a wandering monster is safe. Being grabbed shows a short face-to-face scare (a hard cut to its face lunging at you, a red strobe and a distorted screech, then black with TAKEN; no blood), with a gentler version in Settings. **Halls** (`ROOMS`, built from a seed by `buildWorld(df, seed)`): each is 56 m wide (`RHW`) and 56 to 70 m long. Its obstacle course is placed somewhere across the hall (`newRoom`), and `furnish` adds stepping-stone trails from the door you came in by to the course and from the course to three doors in the far wall, only one of them open (`W.doors`, `real`; the open one leads into the next hall), plus dead-end trails, lone stones and pillars, all from the seed. The courses: Pillar Hall, Broken Walkway (two routes), Sinking Tiles (light-edged tiles sink a moment after you land), Turning Bridge (planks that line up every 4 s), Moving Tiles, Currents (the water pushes you sideways), Memory Bridge (six rows of three tiles: the safe one in each row lights up in turn, the others sink under you), Crushing Walls (one lane in three is safe, shown by a green light) and the Maintenance Lock: two red valves (hold E, loud) raise the water and a stair, four number pillars give the keypad code, and the door out opens. Everything that moves is worked out from the run's clock and seed (`updateDyn`, `plankAngle`, `moverPos`, `crushOut`, `memLit`), so every browser agrees without sending it. **Items** (1–5): pebbles (6 to start, 3 more from each grey stone pile every 20 s; they skip on the water), bottles (loud, with an echo), wind-up toys (rattle for 8 s), flares (stun the monster for 5 s if it's within 6 m, and free anyone it's holding) and rescue ropes (pull a downed teammate out from 8 m). A thrown item's flight is the same function in the thrower's browser (shown straight away) and on the host (which decides what it does: `stepProj`, `throwVel`). Being held by the monster for its full grab puts you **down**: a teammate holds E next to you (2.6 s) or throws a rope, and you come back with a 3 s shield; while down you watch a teammate. Everyone down sends the party back to the last checkpoint (the start of the furthest room reached). **Online:** each player writes only their own node `rooms/hp-/players/`: `n`, `c`, `x`, `z`, `h`, `ts` (the six the shared rules need), `y`, `j` (when they joined), `my`/`li`/`lv` (their lowest feet since the last update, their landing count and last landing speed: the host decides what those mean), `tp` (how many host moves they've applied), `hd` (what they're holding E on), `a` (pose flags), `up` (upgrade levels, 6 digits), `pk` (items packed for the run), `rd` (ready), `ac` (their last few actions as JSON, each with a rising `i` and the run number `g`), `ch` (proximity chat) and `pg` (a ping). The host is whoever has the highest `he` with a published state, else whoever joined first; it runs the run (`hostSense` turns each player's reported position into noises, falls, downs, checkpoints and coins, and checks speed and floating; `hostAct` checks every throw, pebble pickup, keypad try and rope; `hostStep` runs the monsters, items, valves, revives and the exit) and publishes it as JSON in its own node's `rs` about 10 times a second (`encodeRS`; clients check every value in `decodeRS`). Players move themselves (so jumps feel instant) and the host moves them only by teleport (`tp`), after a fall, a too-fast move, a revive or a checkpoint retry. If the host leaves, the next player rebuilds the run from the last snapshot (`stateFromRS`) and carries on. Someone who drops out keeps their place for 60 s (`TUNING.rejoin`) and the menu offers Rejoin (`hushpools:last`). `?dev=1` adds a fake-lag slider to Settings for testing. **Saved in this browser** (localStorage, all `hushpools:`): `name`, `set` (settings: sensitivity, field of view, volumes, gentler scare, invert, graphics, dev lag), `save` (coins, upgrade levels, items owned (at most 3 of each), Normal and Hard escapes, best time), `last` (the room of a run in progress, for Rejoin). Items you take into a run leave the shelf and whatever you didn't use comes back after it. **Coins** (no real money anywhere): 10 a room cleared and 50 for the escape, times the difficulty's factor; the lobby's Equipment stall sells bottles 15, toys 25, flares 30 and ropes 25, and the Upgrades stall has six upgrades at 40/90/160 coins a level (throw range, pebble skips and rescue speed from the start; toy battery, flare radius and rope reach once you've owned that item). **stats.js:** `add('escapes')`, `min('fastest', seconds)` (Normal or Hard only), `add('revives')`, `add('rooms')` and `add('hard')`; the Leaderboards show Elo, Fastest escape, Escapes and Rescues (see elo.js for how a co-op escape is rated). **Touch:** shown only on touch screens (`body.touch`): a stick on the left, drag anywhere else to look, and Jump, E, Throw (hold to aim), Run, Creep and Ping buttons; the HUD rearranges itself for an upright or sideways phone. **Tests** aren't in this repo (it has no build step or packages): the core is checked from outside with Node (`node:test`: noise and hearing, wading and climbing out, the monster's states, rush, forgetting and following the party, item checks, seeds, the halls' doors and stepping stones, the memory tiles and keypad, coins and upgrades, checkpoints, wipes, revives and valves), headless bots that play whole runs with the real physics (1 to 4 bots escape on Easy, Normal and Hard), and two headless browsers in one online room (joining, ready, falling in and wading, being grabbed and going down, a rescue and the host leaving). Automated browsers get a test hook, `window.__hp`. +- `e63334287a3deaa3/hush-pools/`: Blackwade (Back Room; first released as Hush Pools, and the folder, the room prefix `hp`, the `hushpools:` storage keys and the stats, Elo and leaderboard id `hush-pools` all keep that name on purpose, so invite links, saved progress, coins, upgrades and ratings carry over), an original co-op horror obby for 1 to 4 players in flooded pool halls that were shut and left dark for decades (one file, three.js r128 with `../autores.js`, `../netsmooth.js` for teammates, Web Audio, Firebase Realtime Database rooms under `rooms/hp-`, same project and rules as Rumble Karts; invite links go through the home page as `#hp-`; Quick match uses `hp-pub-1` to `hp-pub-6`; rooms hold up to 4). The name, the monster, the rooms, the art and the sounds are all our own (everything is drawn and synthesised in code; no image or sound files). **Look:** dark on purpose, but the way across must read on a dim laptop: the mist is a dim green-grey (`FOG`), a cold fill (hemisphere and ambient light) keeps tiles, edges and the monster visible, and real light comes only from the few ceiling panels that still work and the lamps over the doors (`LV.lamps`, built in `buildLevel`: working panels are picked over the route stops, one panel in a hall may flicker, the rest are dead and some hang loose). Each frame `lampFrame` hands the nearest eight to every lit material and to the water (`LAMPU`, `GLSL_LAMPS`; `lampPatch` adds them to Lambert and Phong materials, with a rim light so the monster and swimmers separate from the dark). A flickering panel steps between on, dim and off at most about twice a second and changes only its own pool of light; with Reduced motion it stays dim and steady. `tileMat` layers age onto every tiled surface from one small noise texture (`NOISE_TEX`): stained grout, cracked and missing tiles, grime, green-black mould rising from the water, rust runs under the wall pipes and peeling paint on the ceiling; tops you can stand on have a dark rim exactly `TUNING.edgeMargin` wide and a worn, cleaner middle. The water (`WATER`) is murky with a scum film, lamp glints and, now and then, something pale under the surface (off with Reduced motion); light cones fall from working panels (`CONE_MAT`, off on Low graphics, fading when the camera is close so they never wash over the screen). The dressing (pipes, ladders, lifebuoys, broken tile, rubbish on the water) is a few instanced meshes seeded from the difficulty, the same in every browser. Ambience adds far-off clanks and pipe groans, never anything that sounds like a splash. Players hop between floating tiles across nine big, misty halls of knee-deep water while one tall, blind, very fast monster hunts them **by sound only**. The water is shallow (you wade, slowly and noisily, and can always jump back out; nobody drowns), and the mist (`FOG_NEAR`/`FOG_FAR` in the renderer, about 15 m in the halls, clear in the lobby) hides the far wall and the monster until they're close. **Rules** are in the `// ==CORE==` … `// ==/CORE==` part of the script: plain data and pure functions with no DOM or three.js, the same in every browser and loaded as they are by the tests (below). `TUNING` holds every number worth tuning (gravity, jump, walk 4 / run 6.2 / creep 2 m/s, how loud each thing is in `TUNING.loud`, hearing radius 20 m × loudness × difficulty, memory 8 s, the monster's speeds and reach, grab 1.6 s, revive 2.6 s, shield 3 s, and so on); `DIFFS` is Easy (bigger tiles; the monster is 0.8× as fast, hears less and waits longer before it rushes; 50% coins), Normal and Hard (smaller tiles; 1.2× as fast, hears more, rushes sooner; 160% coins; opened by two Normal escapes). **Noise** is the core: every event is `{ x, y, z, l (loudness), src }` (`emit`), heard by a monster in the same room when it's within `hearRadius(l, df)`; going into the water is loudest (1.0; `clip`, 0.7, is feet in and out again between two reports), a landing with your middle on a tile's rim (within `TUNING.edgeMargin`, 0.2 m) or a big drop (faster than `hardLandVy`) 0.42 (`landNoise`, used by the host and by the landing marker), running on tiles 0.16, wading 0.45 every `wadeStep` (0.62 running, 0.24 creeping), pulling yourself up onto a tile 0.3 (out of the water, or a jump that came up just short: `mantle`), valves 1.05, a bottle 1.25 and its echo; walking, creeping and landing on the middle of a tile are silent. One mistake makes one noise: a landing or pull-up within `TUNING.oneNoise` (0.3 s) after the same player's last landing noise, pull-up, dip or splash makes no noise of its own (going into the water is always heard). Your browser reports your position on the very step you land, splash or pull up (`sendReport`), so the host judges the rim where you came down, not up to 50 ms later. **Showing it:** every noise gets a label and icon where it happened (bigger for louder; water noises red, other loud ones amber, quiet ones outlined; a teammate's carries their name) and on the noise meter, which also says how you're moving and whether that's silent; while you're in the air `predictLanding` (in the CORE: the real `stepPlayer` run forward) puts a marker where you'll land, a thin pale ring for quiet, a thick amber ring with notches for loud (rim, drop or pull-up) and a red ring with a cross for water, with a red line on the water around your legs when you're about to go in; a clean landing says "quiet". One-line tips (`TIPS`) show once each the first time you do the thing (remembered in `set.tips`), and the How noise works card (menu and pause) lists every cause from loudest to quietest with how far it carries on that difficulty. **Floating tiles** (drawing and sound only; collision and the rules never see it): the stepping tiles and the moving, sinking and memory tiles bob slightly out of step, and a landing kicks its tile (`landKick`, `floatFrame`) with a damped dip and rock sized by the same loudness as the noise label (a clean landing is a soft dip, a small ring and a watery whumph; a rim landing a big tilt, a slosh over the side, a loud ring and a slap). Standing on a tile settles it and leans it toward you, and the drawn player moves with the tile so feet stay planted. Teammates' landings show the same (from their pose flags, made bigger when the host's noise names them). The static tiles move in the vertex shader (`MAT.float`, up to `FLOAT_N` moving at once, nearest first); Reduced motion halves the dip and turns off the rocking and the bob. Each noise shows as rings spreading on the water (the water shader's `uRings`, 14 at a time) and on the HUD's noise meter. **The monster** (`monStep`): there is one, and it follows the party from hall to hall. It drifts (0), goes to look at the loudest thing it remembers (1), freezes and turns towards a fresh noise close by (7, for `TUNING.react` s), then rushes at it at about 14 m/s (2), holds someone (3) or is stunned by a flare (4). When most of the party is in another hall it sinks under the drains (5, `partyRoom`) and rises somewhere in that hall far from everyone (6, `riseSpot`); it hears nothing while it's under. Memory fades over 8 s (`memWeight`), and it paths around tiles and pillars on a 0.5 m grid (`gridPath`). A rush takes anyone within 2 m at the end of it, so the way to survive one is to be far away or to get moving the moment you hear its shriek; otherwise it only takes someone who has just made a noise right next to it (walking into someone makes a bump that counts), so standing still and quiet beside a wandering monster is safe. Being grabbed shows a short face-to-face scare (a hard cut to its face lunging at you, a red strobe and a distorted screech, then black with TAKEN; no blood), with a gentler version in Settings. **Halls** (`ROOMS`, built from a seed by `buildWorld(df, seed)`): each is 56 m wide (`RHW`) and 56 to 70 m long. Its obstacle course is placed somewhere across the hall (`newRoom`), and `furnish` adds stepping-stone trails from the door you came in by to the course and from the course to three doors in the far wall, only one of them open (`W.doors`, `real`; the open one leads into the next hall), plus dead-end trails, lone stones and pillars, all from the seed. The courses: Pillar Hall, Broken Walkway (two routes), Sinking Tiles (light-edged tiles sink a moment after you land), Turning Bridge (planks that line up every 4 s), Moving Tiles, Currents (the water pushes you sideways), Memory Bridge (six rows of three tiles: the safe one in each row lights up in turn, the others sink under you), Crushing Walls (one lane in three is safe, shown by a green light) and the Maintenance Lock: two red valves (hold E, loud) raise the water and a stair, four number pillars give the keypad code, and the door out opens. Everything that moves is worked out from the run's clock and seed (`updateDyn`, `plankAngle`, `moverPos`, `crushOut`, `memLit`), so every browser agrees without sending it. **Items** (1–5): pebbles (6 to start, 3 more from each grey stone pile every 20 s; they skip on the water), bottles (loud, with an echo), wind-up toys (rattle for 8 s), flares (stun the monster for 5 s if it's within 6 m, and free anyone it's holding) and rescue ropes (pull a downed teammate out from 8 m). A thrown item's flight is the same function in the thrower's browser (shown straight away) and on the host (which decides what it does: `stepProj`, `throwVel`). Being held by the monster for its full grab puts you **down**: a teammate holds E next to you (2.6 s) or throws a rope, and you come back with a 3 s shield; while down you watch a teammate. Everyone down sends the party back to the last checkpoint (the start of the furthest room reached). **Online:** each player writes only their own node `rooms/hp-/players/`: `n`, `c`, `x`, `z`, `h`, `ts` (the six the shared rules need), `y`, `j` (when they joined), `my`/`li`/`lv` (their lowest feet since the last update, their landing count and last landing speed: the host decides what those mean), `tp` (how many host moves they've applied), `hd` (what they're holding E on), `a` (pose flags), `up` (upgrade levels, 6 digits), `pk` (items packed for the run), `rd` (ready), `ac` (their last few actions as JSON, each with a rising `i` and the run number `g`), `ch` (proximity chat) and `pg` (a ping). The host is whoever has the highest `he` with a published state, else whoever joined first; it runs the run (`hostSense` turns each player's reported position into noises, falls, downs, checkpoints and coins, and checks speed and floating; `hostAct` checks every throw, pebble pickup, keypad try and rope; `hostStep` runs the monsters, items, valves, revives and the exit) and publishes it as JSON in its own node's `rs` about 10 times a second (`encodeRS`; clients check every value in `decodeRS`). Players move themselves (so jumps feel instant) and the host moves them only by teleport (`tp`), after a fall, a too-fast move, a revive or a checkpoint retry. If the host leaves, the next player rebuilds the run from the last snapshot (`stateFromRS`) and carries on. Someone who drops out keeps their place for 60 s (`TUNING.rejoin`) and the menu offers Rejoin (`hushpools:last`). `?dev=1` adds a fake-lag slider to Settings for testing. **Saved in this browser** (localStorage, all `hushpools:`): `name`, `set` (settings: sensitivity, field of view, volumes, gentler scare, invert, graphics, dev lag, and `tips`, the tips already shown), `save` (coins, upgrade levels, items owned (at most 3 of each), Normal and Hard escapes, best time), `last` (the room of a run in progress, for Rejoin). Items you take into a run leave the shelf and whatever you didn't use comes back after it. **Coins** (no real money anywhere): 10 a room cleared and 50 for the escape, times the difficulty's factor; the lobby's Equipment stall sells bottles 15, toys 25, flares 30 and ropes 25, and the Upgrades stall has six upgrades at 40/90/160 coins a level (throw range, pebble skips and rescue speed from the start; toy battery, flare radius and rope reach once you've owned that item). **stats.js:** `add('escapes')`, `min('fastest', seconds)` (Normal or Hard only), `add('revives')`, `add('rooms')` and `add('hard')`; the Leaderboards show Elo, Fastest escape, Escapes and Rescues (see elo.js for how a co-op escape is rated). **Touch:** shown only on touch screens (`body.touch`): a stick on the left, drag anywhere else to look, and Jump, E, Throw (hold to aim), Run, Creep and Ping buttons; the HUD rearranges itself for an upright or sideways phone. **Tests** aren't in this repo (it has no build step or packages): the core is checked from outside with Node (`node:test`: noise and hearing, wading and climbing out, the monster's states, rush, forgetting and following the party, item checks, seeds, the halls' doors and stepping stones, the memory tiles and keypad, coins and upgrades, checkpoints, wipes, revives and valves), headless bots that play whole runs with the real physics (1 to 4 bots escape on Easy, Normal and Hard), and two headless browsers in one online room (joining, ready, falling in and wading, being grabbed and going down, a rescue and the host leaving). Automated browsers get a test hook, `window.__hp` (`hold(true)` freezes your body, for screenshots of the landing marker). The Blackwade rework was checked with its own Node tests of the CORE (one noise per mistake, the landing marker against the real physics, the body, saves, seeds, halls and loudness unchanged) and a jump matrix comparing the host's verdicts with the real landing spots, also kept outside the repo. - `e63334287a3deaa3/flipline/`: Chromeline (Back Room; formerly Flipline, and the folder, saved data, stats keys and the leaderboard's `d: 'flipline'` keep the old name), a one-button side-view stunt bike game in a neon city at night (Canvas 2D and Web Audio, no Firebase except stats.js). Hold the gas to ride; flips are on the arrows (← spins backwards, → forwards; on the ground they lean the rider back into a wheelie or over the bars). Gravity is on: nothing levels the bike in the air, a spin carries on until the player stops it, and the heavy front end drops the nose. (Until 20 Nov 2026 it was one button: holding in the air tipped the bike backwards and letting go levelled it. Arjun's arrow-key and gravity change, pull request #282, came first; Chromeline's look and track are built on top of it.) **Look**: every slab is a filled dark panel with faint circuit traces, and the surface you ride on is a lit rail in the place's colour (a wide soft glow, the colour, a white core), always the brightest line on screen. Behind it are three parallax layers of towers, signs in invented glyphs, beacons and a sky train, painted once into repeating tiles. There is also a moon with a ring, searchlights, and scanlines with a vignette. All glow is additive strokes or pre-made glow sprites: there is no `shadowBlur` or `filter` in the frame loop (`shadowBlur` is used only while painting the layer tiles). The rider wears a full helmet with a lit visor (what sticks out of the helmet, such as ears, fins, an antenna or a crest, tells riders apart by shape), the bikes have lit wheel rims, a light ribbon trails the back wheel at speed, and the old scarf's rope is now a light streamer. It is deliberately not like the thin neon line-art bike games or any film: everything is a filled, lit shape with depth, and the palette, shapes and names are our own. **Hazards** look the same in every place: hot red with cream stripes and teeth, outlined dark, with a red glow behind. The swinging mace and the spike strips keep their exact shapes from the first version; red is used for nothing else and gold only for coins and ×2 tokens, so hazards read by shape and value as well as colour. "Fewer effects", or the system's reduced-motion setting, turns off shake, streaks, the ribbon, scanlines, beacons and moving lights; there is no full-screen flash (the first clean landing and first loop of a run get a soft glow from the screen edges). One self-contained `index.html` plus `es.js` (Spanish). Everything that decides what happens is the `FL` module between `// ==CORE==` and `// ==END CORE==`, with no DOM in it, so a Node script can run it on its own (the checks for this version did exactly that). **Physics** (`P`, every number with its unit): a chassis with two sprung wheel contacts and a belly skid, stepped 240 times a second whatever the screen does; `step(tr, s, hold, lean)` takes the gas (true/false) and the lean (-1 ←, 0, 1 →). Gas on the ground: the back wheel pushes, 11.9 m/s² from rest, fading to nothing at 19.2 m/s (13% more than Flipline), never more than grip × load, and none once the ground tips past vertical, so the top of a loop is carried by the speed you bring. Top speed on flat ground is 17.2 m/s (Flipline's was 15.3). Off the gas it coasts with a little rolling resistance. In the air an arrow spins the bike that way (18 rad/s², up to 8 rad/s, `AIR_ACC`, `AIR_WMAX`); with no arrow the spin only fades slowly (`AIR_DAMP`), and gravity drops the nose all the time (`GRAV_PITCH` × cos(angle), so an untouched bike noses over on long jumps but small hops still land). On the ground an arrow adds a lean torque (`LEAN_G`); the automatic forward lean that stops a wheelie looping over is off while ← is held. A crash is the head or body touching the ground, a hazard, falling into a pit, landing more than 75° off the slope, or not moving forward for 5 s. Flips are counted from the rotation in the air against the change in ground slope (a flip from 308°), and only banked 0.22 s after a landing that didn't crash. Inputs are one small code (`inCode(hold, lean)`: bit 0 the gas, bits 1–2 the lean + 1); they carry their timestamps and take effect on the physics step they fall in, so the same timing gives the same run at 30, 60 or 144 Hz. **Loops** (`loopRing`) are two overlapping half-circles of one-sided edges, tagged per edge in `tr.eg`: the way up (bottom, right side, over the top) and the way down. Each run keeps a flag per loop (`s.lp`), set once the bike is past the top, and only the half matching the flag collides. So the floor through the bottom never traps the bike, and it leaves at the bottom instead of going round again. With the gas on all the way round, the lowest entry speeds that still go round (on the arrow-key physics) are about 10 m/s (radius 3 m), 11.5 (4 m), 13.6 (5 m) and 15.6 (6 m); the checker asks for `loopVmin(R)` = 2R + 4.7, at least 11, a margin for a bike that has just landed. Big loops come with a boost strip in the run-up. A full loop scores 200 and adds to the combo. **Boost strips** (`tr.eb` on their edges) push the wheels 26 m/s² up to 25 m/s, held or not. **Drop platforms** (mover kind `drop`) fall 0.45 s after the first touch, so the whole bike must be off by then. **Laser gates** (hazard kind `gate`) are off for 1.1 s around the moment a bike at the design speed arrives. **×2 tokens** (`tr.pk`) double trick points for 8 s. **Scoring**: 1 point a metre. Flips score 100 / 300 / 600 / 1000…. A clean landing (within 15° of the slope after a real jump) scores +75 per flip plus 75, and it and every loop add to the combo, which multiplies the next tricks (×1.5, ×2 … ×8) until a sloppy landing. Near misses past a hazard score +40 (+60 when very close); long air earns a bonus; coins are +10. **Track** (`MOD`): modules that write ground from the cursor and end on level ground. The original 34 are flat, recover, roll, whoop, hill, valley, hump, kick, dkick, bigkick, tabletop, stepup, stepdown, stairsup, stairsdown, gap, gap2, gapup, gapdown, longjump, pillars, bridge, lpipe, dropin, seesaw, shuttle, lift, pend (the mace), rotor, beams, crusher, saw, spikes and spikeroll. Chromeline adds loop, loop2, jumploop (a jump straight into a loop: land clean and keep the gas on), hpipe (half-pipe), launch (boost strip, kicker, long gap, landing ramp up or down), boost, crumble (drop platforms over a pit), gates, pads (narrow landing pads, each a step down over a gap) and rush (a rare overdrive stretch with an ×2 token). lpipe and hpipe end in a straight 1.5 m run at the launch angle (62–70°), so the bike leaves nose-high and lands on a steep down ramp: with no arrows the nose doesn't come round in time, so you steer it round with → (or flip it with ←). Moving hazards start their clock when the bike comes within 34 m and are timed for a bike at a good pace (`VD`, 15.5 m/s). **Endless** (`endless(seed)`, `extend`) opens the same way every run: a small kick at about 26 m (under 3 s), a big kicker over a drop at about 45 m (about 4 s; with no arrows the nose drops and you land on your head), a forgiving loop (in at about 9 s, round by about 10.5 s), a short spike run, then at about 13 s a quarter-pipe or half-pipe you have to steer round to land. After that it picks modules by weight; difficulty (`endlessD`) climbs from 0 to 1 over the next 1,100 m and on to 1.5 by about 3,600 m, giving wider gaps, more and faster hazards, bigger loops and more of the hard pieces. Every new module is checked by `vRun`, a point that always holds the gas at full and at 85% power. It follows the ground, flies off lips, lands, times moving hazards and gates, asks for the loop entry speed and the drop-platform speed, and gets the boost; a module that hits a wall, falls in a pit, stalls, is too slow for a loop or a drop platform, or touches a hazard is taken back out and replaced. The Daily run uses one seed per UTC day (`dailySeed`). **Levels** (`LEVELS`): 24 in four tiers of six, each `{id, n: name, th: place, f: flips target, t: time target in seconds, c: course}`, the course written as module tokens, for example `kick:1:24:12 loop:3.4:12 spikes:2.5`. The ids are Flipline's, so medals already earned stay attached, but the courses were rebuilt for Chromeline; Level 1 shows a jump at about 4 s and a loop at about 11 s. All 24 were finished by the bot (`botRun`, which plays from physics prediction by trying a few gas and flip patterns ahead, `PLANS`: gas pattern, then which arrow to hold for how long after take-off, and steers the bike in the air toward the slope it will land on, `botLevel`). The bot also set the time targets on the arrow-key physics (its time + 12% + 1 s) and the flips targets (what a flip-seeking version of the bot managed). The track editor writes the same tokens, and its share code is `FL1.` + the text in base64; tracks stay on the device. **Saving**: localStorage `flipline:save` (versioned, `v: 1`, unchanged from Flipline), holding coins, owned and chosen vehicle, rider and place, Endless and Daily bests, per-level medals (bits 1 finish, 2 flips, 4 time), best time and the ghost, challenge state, totals, secret-vehicle feats and settings. The ghost (`g`) is one number per input change: step number × 8 + input code, replayed through the same physics. Medals and Endless/Daily bests set on Flipline's easier track stay as they were. A level's best time and ghost from before Chromeline are not shown as a ghost, and the first finish on the new course replaces them, saving `gv: 3`. That covers ghosts with no `gv` (one-button) and `gv: 2` (arrow keys on Flipline's courses). Vehicles (12 bought with coins, 3 secret), riders (8) and places (6) are looks only; their ids are unchanged, and some display names changed (Volt Hopper, Neon Tuk, Static Ball; places Circuit City, Cryo Grid, Harbour Lights, Bio Dome, Night Market, Ultraviolet Yard). **Sound** is synthesised in code: an electric-motor whine, a kick and hats under each place's own original loop, and a low-pass on the music that opens up with speed. **Board**: `BackRoomStats.max('distance')`, `max('score')` and `add('runs')` after an Endless run, `max('medals')` after a level; Chromeline's entry in leaderboard.js (`d: 'flipline'`) shows them. Controls through keybinds.js: Gas (Space, up arrow, W; or the mouse, or touch anywhere), Lean back / backflip (←, A), Lean forward / front flip (→, D), Restart (R), Pause (Esc, P). On touch screens two round buttons in the bottom-left (`#lean`, touch only, dark glass to match) are the two leans, and touching anywhere else is the gas, so both can be held at once; the hint sits above the buttons. On the title screen, Space or pressing the city outside the menu card starts Endless at once. Restart is instant; after a crash a press of the gas goes again. Test hooks (`window.__fl`, with manual stepping: `advance(n, hold, draw, lean)`, `inputAt(t, hold, lean)`) exist only when `navigator.webdriver` is set. Nobody has played this version by hand or listened to it yet; the feel numbers in `P` and the music volumes are the first things to adjust. - `e63334287a3deaa3/tidewick/`: Tidewick (Back Room), a classic 8-bit style side-scrolling platformer for one player (Canvas 2D and Web Audio, no Firebase except stats.js). Pip, a child in a yellow raincoat, crosses a rainy harbour at dusk in two stages: **HARBOR 1** (the quay, about 210 tiles) and **HARBOR 2: THE BREAKWATER** (a short stone fortress over dark water, about 100 tiles) with a boss at the end. Unlike the other Back Room games it isn't one self-contained `index.html`: it's ES modules (the owner asked for them) in `js/`, loaded by ``) and calls `BackRoomElo.report({ id, won, opp: [{ u: uid, s }, { bot: 1, s }] })` once where its online match or round ends (search each game for `BackRoomElo`): `opp` is everyone you played against, not teammates, and `s` is your result against that one opponent (1 beat them or your team won, 0 lost, 0.5 drew), so team games give every opponent the same `s`, races and free-for-alls go by finishing place, Driftfall counts everyone already out as beaten and everyone still alive as a loss, Tumble Trials rates once per show (when you go out or the final ends), and in Chromaflage a seeker beats each hider that was found while a hider beats the seekers by staying hidden. Hush Pools is co-op, so it has no opponents in that sense: when an online party escapes, each player is compared with each teammate by what they did for the party (`runScore`: 10 a rescue, 4 a valve opened or the keypad solved, minus 6 for each time they went down), and the one with the higher score "beats" the other (equal is a draw). The change is the usual Elo one (K 36 for the first 10 matches, then 24), averaged over the opponents and multiplied by the number of real opponents (×1 for one, 25% more for each extra, at most ×3); bots count as rated 1000, and a match with no real opponent isn't rated, so practice and bot-only rooms never move a rating. Everyone starts at 1000 and stays in 100–3000. `id` stops a match being rated twice (results screens can be drawn more than once). Storage: this browser's `elo:` (`{ r, g, wn, pk, uid }`) and the Realtime Database at `rooms/elo-/players/` (`n, c, x, z, h, ts` as the shared rules need, plus `r, g, wn, pk`), written by the player's own browser; on load the account's saved rating wins, and opponents' ratings are read from their nodes when a match is reported. So, like every Back Room stat, it is self-reported and not cheat-proof. It never signs in or makes a Firebase app itself (it uses the game's), and every call swallows its own errors, so it can't stop a game. After a rated match a small pill at the top shows the new rating and the change. stats.js reads `elo:` into the game's `elo` stat (the list of folders is next to `READ`), and leaderboard.js has an Elo board first for each of these games (for Slipstream, after its lap and record boards); as with Shell Crackers, the board keeps the best value it has seen, so it shows a player's highest rating. To rate another game: add the script tag and one `report` call, add its folder to the list in stats.js, and add the Elo row to its entry in leaderboard.js. +- `e63334287a3deaa3/elo.js`: ranked ratings (Elo), one per game, for the online games that end with a winner: Boostball, Rumble Karts, Backrooms 1v1–4v4, Driftfall, Slipstream, Turbo Trail, Tumble Trials, Chromaflage, Odd One Out, Puffer Party, Deepword's Brawl, Lokop, Sky Duel and Blackwade. Shell Crackers keeps its own older rating (`shellcr-rank`, `rooms/sc-ratings`) and doesn't load this file; the maths here is the same as its. Each game loads it next to stats.js (``) and calls `BackRoomElo.report({ id, won, opp: [{ u: uid, s }, { bot: 1, s }] })` once where its online match or round ends (search each game for `BackRoomElo`): `opp` is everyone you played against, not teammates, and `s` is your result against that one opponent (1 beat them or your team won, 0 lost, 0.5 drew), so team games give every opponent the same `s`, races and free-for-alls go by finishing place, Driftfall counts everyone already out as beaten and everyone still alive as a loss, Tumble Trials rates once per show (when you go out or the final ends), and in Chromaflage a seeker beats each hider that was found while a hider beats the seekers by staying hidden. Hush Pools is co-op, so it has no opponents in that sense: when an online party escapes, each player is compared with each teammate by what they did for the party (`runScore`: 10 a rescue, 4 a valve opened or the keypad solved, minus 6 for each time they went down), and the one with the higher score "beats" the other (equal is a draw). The change is the usual Elo one (K 36 for the first 10 matches, then 24), averaged over the opponents and multiplied by the number of real opponents (×1 for one, 25% more for each extra, at most ×3); bots count as rated 1000, and a match with no real opponent isn't rated, so practice and bot-only rooms never move a rating. Everyone starts at 1000 and stays in 100–3000. `id` stops a match being rated twice (results screens can be drawn more than once). Storage: this browser's `elo:` (`{ r, g, wn, pk, uid }`) and the Realtime Database at `rooms/elo-/players/` (`n, c, x, z, h, ts` as the shared rules need, plus `r, g, wn, pk`), written by the player's own browser; on load the account's saved rating wins, and opponents' ratings are read from their nodes when a match is reported. So, like every Back Room stat, it is self-reported and not cheat-proof. It never signs in or makes a Firebase app itself (it uses the game's), and every call swallows its own errors, so it can't stop a game. After a rated match a small pill at the top shows the new rating and the change. stats.js reads `elo:` into the game's `elo` stat (the list of folders is next to `READ`), and leaderboard.js has an Elo board first for each of these games (for Slipstream, after its lap and record boards); as with Shell Crackers, the board keeps the best value it has seen, so it shows a player's highest rating. To rate another game: add the script tag and one `report` call, add its folder to the list in stats.js, and add the Elo row to its entry in leaderboard.js. - `e63334287a3deaa3/netrelay.js`, `colyseus.js` and `netrelay-config.js`: the game relay. Online rooms of the games listed in `netrelay-config.js` (`RELAY_PREFIXES`, and Rumble Karts, whose rooms have no prefix) go through our own Colyseus server instead of the Firebase Realtime Database: the code is in the separate `ASCoding11/game-server` repo, hosted on Colyseus Cloud (US East, Newark) at the address in `netrelay-config.js`, and redeployed by every push to that repo's `main`. `netrelay.js` (copied from that repo's `client/`) wraps `firebase.database()` and looks like it, so a game only changes the line that makes its database: `NetRelay.database(firebase.database(), window.RELAY_ROOMS)`. **On the relay (20 Nov 2026):** the real-time games: Coil, Slipstream, Boostball, Kartwheel, Rumble Karts, Shell Crackers, Backrooms 1v1, Driftfall, Blockstorm, Sky Duel, Hail Mary, Updraft, Spire, Tumble Trials, Turbo Trail, Escapade, Chromaflage, Hush Pools, Putterby, Lokop and Lanternhold (Coil first, the rest the same evening). **Still on Firebase:** the turn-based and word games (Showdown, Deepword, Odd One Out, Puffer Party), Quarry (its worlds stay in the room for days), Rampline (boards and community tracks), and the shared nodes `sc-ratings`, `br-queue` and `hm-queue` (`KEEP_ON_FIREBASE`), which hold ratings and matchmaking across rooms. Only that game's `rooms/-` go to the relay; leaderboards, ratings, parties and the lobby stay on Firebase. Players still sign in with Firebase, and the relay checks their sign-in token. Relay rooms live in the server's memory, so they last while someone is in them and 2 minutes after; games that keep data in their room for days (Quarry's worlds) must stay on Firebase. `colyseus.js` is the Colyseus browser library (MIT). **Off switch:** blank the `url` in `netrelay-config.js` and every game goes back to Firebase at once. **One game back to Firebase:** take its prefix out of `RELAY_PREFIXES` (for Rumble Karts, set `RELAY_RUMBLE_KARTS` to false). **Moving another game over:** load the three files before its script, change its database line, add its prefix to `RELAY_PREFIXES` (`playingnow.js` reads `RELAY_ROOMS` too, so it counts players in relay rooms), and test with two browser windows in the same room. - `e63334287a3deaa3/netsmooth.js`: smooth movement for other players in the online games. Updates over school Wi-Fi and Firebase arrive late and in bursts, so a game that moves someone to their newest update makes them lurch and stall, and one that shows them a fixed time in the past freezes them whenever an update is later than that. Each remote player gets a `NetSmooth.lag()`, which measures how late their updates really arrive and shows them just far enough in the past that the next one is almost always already here (about a tenth of a second on good Wi-Fi, more on bad, never more than 0.45 s), easing that delay so the timeline never jumps; `NetSmooth.sample()` draws them between the two updates around that moment and carries them on for up to 0.3 s if an update is late. Used by Shell Crackers, Backrooms 1v1–4v4, Hail Mary, Coil, Quarry, Chromaflage, Odd One Out, Spire, Turbo Trail, Escapade, Updraft, Driftfall, Blockstorm, Lanternhold (teammates' pointers), Sky Duel and Putterby. Kartwheel, Slipstream, Boostball, Rumble Karts and Tumble Trials keep their own approach: cars, karts and racers are projected forward to the present from their speed, which matters more there than perfectly even motion. Settings were tuned with a simulation of good, school and bad Wi-Fi: compared with chasing the newest update, other players stall about a fifth as often and almost never lurch, for roughly a tenth of a second more delay. - `e63334287a3deaa3/autores.js`: automatic resolution for the 3D games, so they stay smooth on school laptops. Every three.js game except Quarry (which has its own version) loads it right after `three.min.js`. It watches the frame rate, and when frames drop below about 45 a second it makes every three.js renderer on the page draw at a lower resolution, a tenth at a time, down to half; when frames stay smooth it steps back up (more slowly towards a resolution that was too slow before, so it doesn't keep flipping). It multiplies whatever `setPixelRatio` the game asks for, so a game's own graphics setting still counts. The scale each game settles on is remembered in the browser (`localStorage` key `autores:`), so the next visit starts there. No game code calls it; it wraps `THREE.WebGLRenderer`. `AutoRes.scale` shows the current scale and `AutoRes.off()` turns it off for a visit. diff --git a/e63334287a3deaa3/d06440218d1813a3/index.html b/e63334287a3deaa3/d06440218d1813a3/index.html index 5ac5b20e..5638e2ae 100644 --- a/e63334287a3deaa3/d06440218d1813a3/index.html +++ b/e63334287a3deaa3/d06440218d1813a3/index.html @@ -1047,7 +1047,7 @@

Can't read feedback

// field so the node's messages are never downloaded. Nothing in this section writes anything. var P={rows:[],now:0,loadedAt:0,sort:'last',dir:'desc',open:'',show:PAGE,seq:0,extra:{}},P_DAYS=60,ONLINE_STALE=75000; // Game names for the Online node's g (the invite prefixes, social.js's GAMES). - var OL_GAMES={sc:'Shell Crackers',rk:'Rumble Karts',ss:'Slipstream',bb:'Boostball',cl:'Coil',sd:'Showdown',br:'Backrooms 1v1–4v4',cf:'Chromaflage',tw:'Spire',sr:'Turbo Trail',er:'Escapade',up:'Updraft',ph:'Odd One Out',ko:'Tumble Trials',dw:'Deepword',pf:'Puffer Party',bs:'Blockstorm',lh:'Lanternhold',hp:'Hush Pools',vq:'Sky Duel',qg:'Putterby',tv:'Trivium',hm:'Hail Mary',qy:'Quarry',kw:'Kartwheel',st:'Starhop',ab:'Abyssal',bx:'Boxed',hc:'Hype Cycle Exchange'}; + var OL_GAMES={sc:'Shell Crackers',rk:'Rumble Karts',ss:'Slipstream',bb:'Boostball',cl:'Coil',sd:'Showdown',br:'Backrooms 1v1–4v4',cf:'Chromaflage',tw:'Spire',sr:'Turbo Trail',er:'Escapade',up:'Updraft',ph:'Odd One Out',ko:'Tumble Trials',dw:'Deepword',pf:'Puffer Party',bs:'Blockstorm',lh:'Lanternhold',hp:'Blackwade',vq:'Sky Duel',qg:'Putterby',tv:'Trivium',hm:'Hail Mary',qy:'Quarry',kw:'Kartwheel',st:'Starhop',ab:'Abyssal',bx:'Boxed',hc:'Hype Cycle Exchange'}; function pNow(){return P.now+(Date.now()-P.loadedAt)} function okNum(x){return typeof x==='number'&&isFinite(x)} // Play seconds per day for the last P_DAYS days from the node's d, checked like the Stats tab: real dates, games the boards diff --git a/e63334287a3deaa3/es.js b/e63334287a3deaa3/es.js index d0445ba6..c8fae5f3 100644 --- a/e63334287a3deaa3/es.js +++ b/e63334287a3deaa3/es.js @@ -33,7 +33,7 @@ "Open Asteroid Run": "Abrir Asteroid Run", "More about Asteroid Run": "Más sobre Asteroid Run", "Open Overdrop": "Abrir Overdrop", "More about Overdrop": "Más sobre Overdrop", "Open Escapade": "Abrir Escapade", "More about Escapade": "Más sobre Escapade", - "Open Hush Pools": "Abrir Hush Pools", "More about Hush Pools": "Más sobre Hush Pools", + "Open Blackwade": "Abrir Blackwade", "More about Blackwade": "Más sobre Blackwade", "Open Chromaflage": "Abrir Chromaflage", "More about Chromaflage": "Más sobre Chromaflage", "Open Odd One Out": "Abrir Odd One Out", "More about Odd One Out": "Más sobre Odd One Out", "Open Showdown": "Abrir Showdown", "More about Showdown": "Más sobre Showdown", @@ -437,7 +437,7 @@ "Horror obby": "Obby de terror", "New · Horror obby": "Nuevo · Obby de terror", "Cross the flooded pool halls without a splash. It hears you.": "Cruza los pasillos de piscinas inundados sin salpicar. Te oye.", - "A co-op horror obby in huge, misty, flooded tile halls. Hop from tile to tile across nine halls while something tall and blind hunts you through the mist. It can't see you, but it hears everything: every landing, every running step and every splash sends rings across the water, and when it hears you it comes, very fast. Stand still and quiet and it walks right past. Throw a pebble the other way and it follows the sound. The water is only knee deep, so you can wade and climb back out, but wading is slow and loud. Find your way through the mist to the far wall of each hall: there are three doors, and only one of them is open.": "Un obby de terror cooperativo en enormes pasillos de azulejos inundados y llenos de niebla. Salta de azulejo en azulejo por nueve salas mientras algo alto y ciego te caza entre la niebla. No te ve, pero lo oye todo: cada aterrizaje, cada paso corriendo y cada salpicadura manda ondas por el agua, y cuando te oye viene, muy rápido. Quédate quieto y en silencio y pasa de largo. Tira una piedrita hacia el otro lado y sigue el sonido. El agua solo te llega a las rodillas, así que puedes caminar por ella y volver a subir, pero caminar por el agua es lento y ruidoso. Encuentra el camino entre la niebla hasta la pared del fondo de cada sala: hay tres puertas y solo una está abierta.", + "A co-op horror obby (formerly Hush Pools) in huge, misty, flooded pool halls that were shut and left in the dark for decades. Hop from tile to tile across nine halls while something tall and blind hunts you through the mist. It can't see you, but it hears everything: a landing on a tile's rim, every running step and every splash sends rings across the water, and when it hears you it comes, very fast. Stand still and quiet and it walks right past. Throw a pebble the other way and it follows the sound. The water is only knee deep, so you can wade and climb back out, but wading is slow and loud. Find your way through the mist to the far wall of each hall: there are three doors, and only one of them is open.": "Un obby de terror cooperativo (antes Hush Pools) en enormes pasillos de piscinas inundados y llenos de niebla, que cerraron y quedaron a oscuras durante décadas. Salta de azulejo en azulejo por nueve salas mientras algo alto y ciego te caza entre la niebla. No te ve, pero lo oye todo: cada aterrizaje en el borde de una baldosa, cada paso corriendo y cada salpicadura manda ondas por el agua, y cuando te oye viene, muy rápido. Quédate quieto y en silencio y pasa de largo. Tira una piedrita hacia el otro lado y sigue el sonido. El agua solo te llega a las rodillas, así que puedes caminar por ella y volver a subir, pero caminar por el agua es lento y ruidoso. Encuentra el camino entre la niebla hasta la pared del fondo de cada sala: hay tres puertas y solo una está abierta.", "Nine rooms: Pillar Hall, Broken Walkway, Sinking Tiles, Turning Bridge, Moving Tiles, Currents, Memory Bridge, Crushing Walls and the Maintenance Lock, where two loud valves raise the water, a keypad needs four numbers from the pillars, and the door out opens": "Nueve salas: Pillar Hall, Broken Walkway, Sinking Tiles, Turning Bridge, Moving Tiles, Currents, Memory Bridge, Crushing Walls y el Maintenance Lock, donde dos válvulas ruidosas suben el agua, un teclado pide cuatro números de los pilares y se abre la puerta de salida", "Online rooms for 1 to 4 players with an invite link, or Quick match. If you go down, a teammate holds E next to you or throws a rope; if everyone goes down, the party goes back to the last checkpoint": "Salas en línea de 1 a 4 jugadores con enlace de invitación, o Partida rápida. Si caes, un compañero mantiene E a tu lado o te tira una cuerda; si caen todos, el grupo vuelve al último punto de control", "Five things to throw: pebbles (free, and they skip on the water), bottles, wind-up toys, flares that stun it, and rescue ropes": "Cinco cosas para tirar: piedritas (gratis, y rebotan en el agua), botellas, juguetes a cuerda, bengalas que lo aturden y cuerdas de rescate", diff --git a/e63334287a3deaa3/feedback.js b/e63334287a3deaa3/feedback.js index 82c63e52..bf35544f 100644 --- a/e63334287a3deaa3/feedback.js +++ b/e63334287a3deaa3/feedback.js @@ -44,7 +44,7 @@ ['slipstream', 'Slipstream'], ['boostball', 'Boostball'], ['coil', 'Coil'], ['trivium', 'Trivium'], ['showdown', 'Showdown'], ['chromaflage', 'Chromaflage'], ['spire', 'Spire'], ['turbo-trail', 'Turbo Trail'], ['escapade', 'Escapade'], ['updraft', 'Updraft'], ['odd-one-out', 'Odd One Out'], ['tumble-trials', 'Tumble Trials'], - ['puffer-party', 'Puffer Party'], ['blockstorm', 'Blockstorm'], ['lanternhold', 'Lanternhold'], ['hush-pools', 'Hush Pools'], ['sky-duel', 'Sky Duel'], ['putterby', 'Putterby'], ['daily', 'Daily Puzzles (any daily puzzle)'], ['other', 'Something else (the site, parties…)'] + ['puffer-party', 'Puffer Party'], ['blockstorm', 'Blockstorm'], ['lanternhold', 'Lanternhold'], ['hush-pools', 'Blackwade'], ['sky-duel', 'Sky Duel'], ['putterby', 'Putterby'], ['daily', 'Daily Puzzles (any daily puzzle)'], ['other', 'Something else (the site, parties…)'] ]; var KINDS = [['idea', 'Idea or change'], ['bug', 'Bug'], ['other', 'Something else']]; var MAX = { msg: 1000, name: 40, contact: 80, page: 200 }; diff --git a/e63334287a3deaa3/hush-pools/index.html b/e63334287a3deaa3/hush-pools/index.html index 3b6f3b70..cb1095ab 100644 --- a/e63334287a3deaa3/hush-pools/index.html +++ b/e63334287a3deaa3/hush-pools/index.html @@ -4,10 +4,10 @@ -Hush Pools +Blackwade - + @@ -15,18 +15,19 @@ - - -
+ + +
@@ -263,21 +300,21 @@ + + @@ -374,7 +420,9 @@

YOU ESCAPED

loud: { fall: 1.0, clip: 0.7, hard: 0.42, sprint: 0.16, wade: 0.45, wadeRun: 0.62, wadeCreep: 0.24, climb: 0.3, struggle: 0.24, pebbleWater: 0.75, skip: 0.5, pebbleTile: 0.3, bottle: 1.25, echo: 0.6, toy: 0.6, valve: 1.05, bump: 0.5, keypad: 0.3 }, baseRadius: 20, - hardLandVy: -9.5, edgeMargin: 0.2, sprintStep: 0.36, struggleEvery: 2.6, + // oneNoise: a landing or pull-up within this many seconds after the same player's last landing noise, pull-up, dip or + // splash into the water makes no noise of its own (one noise per mistake; going into the water is always heard) + hardLandVy: -9.5, edgeMargin: 0.2, oneNoise: 0.3, sprintStep: 0.36, struggleEvery: 2.6, // the monster (there's one): it freezes for \`react\` seconds when it hears something close, then rushes there at monHunt memory: 8, huntRange: 14, grabRange: 2.0, grabHigh: 3.8, warnRange: 4.5, noisyGrab: 1.0, dashReach: 3, monIdle: 1.3, monInvestigate: 4.2, monHunt: 14, react: 0.6, grabTime: 1.6, monCooldown: 4.5, linger: 2.6, @@ -924,6 +972,30 @@

YOU ESCAPED

return best; } const edgeDist = (b, x, z) => b.type === 'rot' ? 1 : Math.min(x - b.x0, b.x1 - x, z - b.z0, b.z1 - z); +// What a landing on sup at (x, z) at speed lv sounds like: 'hard' (a big drop), 'edge' (your middle on the rim) or '' +// (quiet). The host uses it to decide, and every browser uses it to show the landing marker before you land. +function landNoise(sup, x, z, lv) { + if (!sup) return ''; + if (lv < TUNING.hardLandVy) return 'hard'; + return edgeDist(sup, x, z) < TUNING.edgeMargin ? 'edge' : ''; +} +// Where the body will come down if the input stays as it is: steps a copy of it (the real stepPlayer, the world as it +// is now) until it lands, pulls itself up onto a tile, or goes into the water. Returns { x, y, z, k, t } with k 'quiet', +// 'edge', 'hard', 'climb' (caught a tile's side and pulled up) or 'fall' (into the water), or null within maxT seconds. +const predBody = newBody(0, 0, 0); +function predictLanding(W, p, inp, maxT) { + const q = predBody, h = 1 / 60, n = Math.ceil((maxT || 2) / h); + Object.assign(q, { x: p.x, y: p.y, z: p.z, vx: p.vx, vy: p.vy, vz: p.vz, gr: p.gr, inW: p.inW, mant: 0, my: p.y, li: 0, lv: 0, h: p.h || 0 }); + const qi = { mx: inp.mx, mz: inp.mz, jump: false, sprint: inp.sprint, crouch: inp.crouch }; + for (let i = 1; i <= n; i++) { + stepPlayer(W, q, qi, h); + const ev = q.ev; + if (ev.includes('splash')) return { x: q.x, y: waterY(W, q.z), z: q.z, k: 'fall', t: i * h }; + if (ev.includes('climb')) return { x: q.x, y: q.y, z: q.z, k: 'climb', t: i * h }; + if (ev.includes('land')) { const k = landNoise(q.gr, q.x, q.z, q.lv); return { x: q.x, y: q.y, z: q.z, k: k || 'quiet', t: i * h, sup: q.gr }; } + } + return null; +} // ---- Thrown things: the same flight on the host (which decides what they do) and in the thrower's browser (for show) ---- // Returns '' while flying, else 'tile', 'water' or 'skip' (a pebble bouncing on the water). @@ -1016,8 +1088,9 @@

YOU ESCAPED

if (sup && !sup.type && (sup.k === 'deck' || sup.k === 'stable' || sup.k === 'tile' || sup.k === 'lane')) P.safe = { x: clamp(rep.x, sup.x0 + 0.3, sup.x1 - 0.3), y: sup.y1, z: clamp(rep.z, sup.z0 + 0.3, sup.z1 - 0.3) }; // feet in the water: going in is a splash; every few steps in it is a splash too, louder the faster you go const inW = rep.y < wy - 0.08, touched = rep.my < wy - 0.08; - if (inW && !P.inW) emit(S, W, rep.x, wy, rep.z, TUNING.loud.fall, 'fall', u); - else if (!inW && !P.inW && touched) emit(S, W, rep.x, wy, rep.z, TUNING.loud.clip, 'clip', u); // in and out between two reports + // one noise per mistake: going in, a quick dip or a climb out (P.mk, when) isn't followed by a landing noise as well + if (inW && !P.inW) { emit(S, W, rep.x, wy, rep.z, TUNING.loud.fall, 'fall', u); P.mk = S.t; } + else if (!inW && !P.inW && touched) { emit(S, W, rep.x, wy, rep.z, TUNING.loud.clip, 'clip', u); P.mk = S.t; } // in and out between two reports if (inW && P.inW && P.has && dt > 0) { P.wsp += (hd / Math.max(dt, 0.03) - P.wsp) * 0.35; P.wd += hd; if (P.wd >= TUNING.wadeStep) { @@ -1027,10 +1100,11 @@

YOU ESCAPED

} else if (!inW) { P.wd = 0; P.wsp = 0; } P.inW = inW; if (P.li != null && rep.li !== P.li && !inW && sup) { - if (rep.lv === -1) emit(S, W, rep.x, sup.y1 != null ? sup.y1 : TOP, rep.z, TUNING.loud.climb, 'climb', u); // pulled up out of the water - else { - const hard = rep.lv < TUNING.hardLandVy, edge = edgeDist(sup, rep.x, rep.z) < TUNING.edgeMargin; - if (hard || edge) emit(S, W, rep.x, sup.y1 != null ? sup.y1 : TOP, rep.z, TUNING.loud.hard, hard ? 'hard' : 'edge', u); + const again = P.mk != null && S.t - P.mk < TUNING.oneNoise; + if (rep.lv === -1) { if (!again) emit(S, W, rep.x, sup.y1 != null ? sup.y1 : TOP, rep.z, TUNING.loud.climb, 'climb', u); P.mk = S.t; } // pulled up onto a tile (out of the water, or a jump that came up short) + else if (!again) { + const k = landNoise(sup, rep.x, rep.z, rep.lv); + if (k) { emit(S, W, rep.x, sup.y1 != null ? sup.y1 : TOP, rep.z, TUNING.loud.hard, k, u); P.mk = S.t; } } } P.li = rep.li; @@ -1275,68 +1349,241 @@

YOU ESCAPED

// water shader, the fog and the tiles agree. // ===================================================================== const $ = id => document.getElementById(id); -// The halls are full of mist: you see about 20 m, the far wall and the monster only when you're close. -const FOG = 0xaec3c0, FOG_NEAR = 1, FOG_FAR = 17; +// The halls are full of mist, and it's dark in there now: you see about 15 m, the far wall and the monster only when +// you're close. The mist is a dim green-grey, so far things sink into murk rather than into white. +const FOG = 0x18211d, FOG_NEAR = 1, FOG_FAR = 17; let gfx = 2; +const REDUCED = matchMedia('(prefers-reduced-motion: reduce)').matches; const renderer = new THREE.WebGLRenderer({ canvas: $('view'), antialias: true, powerPreference: 'high-performance' }); renderer.setClearColor(FOG); const scene = new THREE.Scene(); scene.fog = new THREE.Fog(FOG, FOG_NEAR, FOG_FAR); const camera = new THREE.PerspectiveCamera(75, innerWidth / innerHeight, 0.05, 60); -scene.add(new THREE.HemisphereLight(0xf4ffff, 0x3a9a93, 0.72)); -const sun = new THREE.DirectionalLight(0xffffff, 0.32); sun.position.set(4, 10, -3); scene.add(sun); -scene.add(new THREE.AmbientLight(0xbfe6e2, 0.12)); -const U = { time: { value: 0 } }; // shared by every shader that ripples -// A procedural caustic: bright wavy cells, the kind light makes through moving water. -const GLSL_CAUSTIC = ` -float caustic(vec2 p, float t){ - vec2 q = p; float v = 0.0; - for (int i = 0; i < 3; i++) { q = vec2(sin(q.y * 1.37 + t * 0.61), cos(q.x * 1.73 - t * 0.47)) * 1.3 + p * 0.85; v += abs(sin(q.x + q.y)); } - return pow(max(0.0, 1.0 - v / 3.0), 3.0) * 2.4; +// The halls have been dark for years: a dim cold fill so the route still reads, and the light comes from the few +// ceiling panels that still work (the "lamps" below), so you move from pool of light to pool of light. +scene.add(new THREE.HemisphereLight(0x9fb6aa, 0x18241f, 0.62)); +const sun = new THREE.DirectionalLight(0xc9d6cf, 0.14); sun.position.set(4, 10, -3); scene.add(sun); +scene.add(new THREE.AmbientLight(0x34423b, 0.24)); +const U = { time: { value: 0 } }; // shared by every shader that moves +// One small tiling noise texture (blurred random values, a different pattern in each channel) that every grime, mould, +// rust, scum and mist layer samples: cheaper on phones than working noise out in the shader. +const NOISE_TEX = (() => { + const N = 128, d = new Uint8Array(N * N * 4), f = new Float32Array(N * N); + for (let c = 0; c < 4; c++) { + for (let i = 0; i < N * N; i++) f[i] = Math.random(); + for (let pass = 0; pass < 4; pass++) for (let y = 0; y < N; y++) for (let x = 0; x < N; x++) { + let s = 0; for (let j = -1; j <= 1; j++) for (let k = -1; k <= 1; k++) s += f[((y + j + N) % N) * N + (x + k + N) % N]; + f[y * N + x] = s / 9; + } + let lo = 1, hi = 0; for (let i = 0; i < N * N; i++) { lo = Math.min(lo, f[i]); hi = Math.max(hi, f[i]); } + for (let i = 0; i < N * N; i++) d[i * 4 + c] = Math.round((f[i] - lo) / (hi - lo) * 255); + } + const t = new THREE.DataTexture(d, N, N, THREE.RGBAFormat); t.wrapS = t.wrapT = THREE.RepeatWrapping; t.magFilter = t.minFilter = THREE.LinearFilter; t.needsUpdate = true; return t; +})(); +// Working ceiling lights: the nearest LAMP_N to you each frame (see lampFrame), shared by every lit material and the water. +const LAMP_N = 8; +const LAMPU = { uLamp: { value: Array.from({ length: LAMP_N }, () => new THREE.Vector4()) }, uLampC: { value: Array.from({ length: LAMP_N }, () => new THREE.Color()) }, uNoise: { value: NOISE_TEX } }; +const GLSL_LAMPS = ` +uniform vec4 uLamp[${LAMP_N}]; uniform vec3 uLampC[${LAMP_N}]; uniform sampler2D uNoise; +vec3 lampLight(vec3 p, vec3 n) { + vec3 s = vec3(0.0); + for (int i = 0; i < ${LAMP_N}; i++) { + vec4 L = uLamp[i]; if (L.w <= 0.0) continue; + vec3 d = L.xyz - p; float r2 = dot(d, d); + float a = L.w * (1.0 - smoothstep(1.2, 7.5, length(d.xz))) / (1.0 + 0.045 * r2); + s += uLampC[i] * a * (0.3 + 0.7 * max(dot(n, d * inversesqrt(r2)), 0.0)); + } + return min(s, vec3(1.15)); // nothing close to a lamp glows }`; -// Tiled surfaces worked out from where the pixel is in the world, so one material fits boxes of any size (and instancing). +// Any Lambert or Phong material lit by the lamps too, with an optional rim (uRim) so dark shapes separate from the dark. +function lampPatch(m, rim, key) { + m.userData.lu = Object.assign({ uRim: { value: new THREE.Color(rim || 0) } }, LAMPU); + m.onBeforeCompile = sh => { + Object.assign(sh.uniforms, m.userData.lu); + sh.vertexShader = sh.vertexShader.replace('#include ', '#include \nvarying vec3 vLW; varying vec3 vLN;') + .replace('#include ', `#include + vec4 lw = vec4(transformed, 1.0); vec3 ln = objectNormal; + #ifdef USE_INSTANCING + lw = instanceMatrix * lw; ln = mat3(instanceMatrix) * ln; + #endif + lw = modelMatrix * lw; vLW = lw.xyz; vLN = normalize(mat3(modelMatrix) * ln);`); + sh.fragmentShader = sh.fragmentShader.replace('#include ', '#include \nvarying vec3 vLW; varying vec3 vLN; uniform vec3 uRim;' + GLSL_LAMPS) + .replace('#include ', `#include + vec3 lnn = normalize(vLN); + totalEmissiveRadiance += diffuseColor.rgb * lampLight(vLW, lnn) * 0.8; + totalEmissiveRadiance += uRim * pow(1.0 - max(dot(lnn, normalize(cameraPosition - vLW)), 0.0), 2.5);`); + }; + m.customProgramCacheKey = () => 'bw-lamp'; // the same code for every material it patches + return m; +} +// Tiled surfaces worked out from where the pixel is in the world, so one material fits boxes of any size (and +// instancing), with layers of age on top: stained grout, cracked and missing tiles, grime, green-black mould rising +// from the water, rust runs under the old pipes, peeling paint on the ceiling. Walkable tops (o.lip) show a dark, +// chipped rim exactly TUNING.edgeMargin wide (landing with your middle on it is loud) and a worn, cleaner middle. +// Floating tiles (visual only: collision and the rules never see this). Each frame floatFrame works out up to FLOAT_N +// tiles that are moving (a landing's dip and rock, someone standing on it) and hands them to the shader; every floating +// tile also bobs very slightly, out of step with its neighbours. +const FLOAT_N = 12; +const FLOATU = { uFl: { value: Array.from({ length: FLOAT_N }, () => new THREE.Vector4()) }, uFlT: { value: Array.from({ length: FLOAT_N }, () => new THREE.Vector2()) }, uBob: { value: REDUCED ? 0 : 1 } }; +const BOB_A = 0.012; +const bobAt = (cx, cz, t) => BOB_A * Math.sin(t * 1.3 + 6.2832 * (((cx * 0.618 + cz * 0.371) % 1 + 1) % 1)); +// Which tiles float: the stepping tiles (not decks, stairs, lanes or the broken walkway) and the moving, sinking and +// memory tiles (LV.dynOf). A landing "kicks" its tile: a damped dip and rock sized by the same loudness the noise label +// uses (landNoise), so a clean landing is a soft dip and a small ring, a rim landing a big tilt, a slosh and a loud ring. +const FLOATS = new Set(['tile', 'stable', 'ledge', 'current']); +const FK = []; +const isFloat = b => !!b && b.x0 != null && (FLOATS.has(b.k) || (LV && LV.dynOf && LV.dynOf.has(b))); +const FO = { y: 0, tx: 0, tz: 0 }; +// how a floating tile sits right now: y (its drawn offset, the idle bob included) and tx, tz (its slope, metres per metre) +function floatOf(b) { + FO.y = 0; FO.tx = 0; FO.tz = 0; if (!isFloat(b)) return FO; + if (!REDUCED) FO.y = bobAt((b.x0 + b.x1) / 2, (b.z0 + b.z1) / 2, U.time.value); + const f = LV.fl && LV.fl.get(b); if (f) { FO.y -= f.dip; FO.tx = f.tx; FO.tz = f.tz; } + return FO; +} +// the drawn height change at (x, z) on tile b: what the feet of anyone standing there move by +function floatAt(b, x, z) { if (!isFloat(b)) return 0; const f = floatOf(b); return f.y + f.tx * (x - (b.x0 + b.x1) / 2) + f.tz * (z - (b.z0 + b.z1) / 2); } +function landKick(b, x, z, loud, quietSound) { + if (!isFloat(b) || !G.W) return; + const now = U.time.value, cx = (b.x0 + b.x1) / 2, cz = (b.z0 + b.z1) / 2, hx = (b.x1 - b.x0) / 2, hz = (b.z1 - b.z0) / 2; + const ox = clamp((x - cx) / hx, -1, 1), oz = clamp((z - cz) / hz, -1, 1), A = (0.03 + loud * 0.12) * (REDUCED ? 0.5 : 1), S = REDUCED ? 0 : 0.012 + loud * 0.17; + let k = FK.find(k => k.b === b && now - k.t0 < 0.4); + if (k) { if (loud <= k.loud) return; Object.assign(k, { A, sx: -ox * S / hx, sz: -oz * S / hz, loud }); } + else { if (FK.length > 24) FK.shift(); FK.push({ b, t0: now, A, sx: -ox * S / hx, sz: -oz * S / hz, loud }); } + // the water answers: a ring from the tile's edge, and on a bad landing spray and a slosh over the side you came down on + const wy = waterY(G.W, cz), r0 = Math.max(hx, hz); + G.rings.push({ x: cx, z: cz, R: r0 + 0.9 + loud * 4.5, r0, t: 0, l: loud > 0 ? loud : -0.4 }); if (G.rings.length > RINGS) G.rings.shift(); + if (loud > 0 && gfx > 0) { + const side = Math.abs(ox) > Math.abs(oz), px = side ? (ox > 0 ? b.x1 : b.x0) : clamp(x, b.x0, b.x1), pz = side ? clamp(z, b.z0, b.z1) : (oz > 0 ? b.z1 : b.z0); + splash(px, wy, pz, Math.round(8 + loud * 26), 1.6 + loud * 5); + if (loud >= TUNING.loud.hard && Math.hypot(ox, oz) < 0.6) for (const [qx, qz] of [[b.x0, cz], [b.x1, cz], [cx, b.z0], [cx, b.z1]]) splash(qx, wy, qz, 7, 2.5); + } + if (quietSound != null) sfx(loud > 0 ? 'slosh' : 'land', x, b.y1 != null ? b.y1 : TOP, z, loud > 0 ? 0.6 + loud : 1); +} +// each frame: the kicks, people standing on tiles (a little lower, leaning toward where they stand), and the nearest +// FLOAT_N moving static tiles handed to the shader (moving, sinking and memory tiles take theirs in drawWorld) +const flSlots = []; +function floatFrame(dt) { + if (!LV || !LV.fl) return; + const now = U.time.value; LV.fl.clear(); + const add = (b, dip, tx, tz) => { let f = LV.fl.get(b); if (!f) LV.fl.set(b, f = { dip: 0, tx: 0, tz: 0 }); f.dip += dip; f.tx += tx; f.tz += tz; }; + for (let i = FK.length - 1; i >= 0; i--) { const k = FK[i], t = now - k.t0; if (t > 2.2) { FK.splice(i, 1); continue; } + const sp = Math.exp(-3.4 * t) * Math.cos(9.5 * t), rk = Math.exp(-2.8 * t) * Math.cos(7 * t); add(k.b, k.A * sp, k.sx * rk, k.sz * rk); } + const want = new Map(), stand = (b, x, z) => { if (isFloat(b)) want.set(b, [x, z]); }; + if (G.mode === 'play' && G.body.gr && !G.body.inW) stand(G.body.gr, G.body.x, G.body.z); + for (const [, o] of G.others) if (o.view && o.smp && !(o.a & 24)) stand(supportAt(G.W, o.smp.x, o.smp.y, o.smp.z, 0.1), o.smp.x, o.smp.z); + for (const [b, w] of want) { let st = LV.st.get(b); if (!st) LV.st.set(b, st = { v: 0, x: w[0], z: w[1] }); st.x = w[0]; st.z = w[1]; } + for (const [b, st] of LV.st) { + st.v += ((want.has(b) ? 1 : 0) - st.v) * Math.min(1, dt * 4); if (!want.has(b) && st.v < 0.01) { LV.st.delete(b); continue; } + const cx = (b.x0 + b.x1) / 2, cz = (b.z0 + b.z1) / 2, hx = (b.x1 - b.x0) / 2, hz = (b.z1 - b.z0) / 2, L = REDUCED ? 0 : 0.012; + add(b, (REDUCED ? 0.01 : 0.018) * st.v, -clamp((st.x - cx) / hx, -1, 1) * L / hx * st.v, -clamp((st.z - cz) / hz, -1, 1) * L / hz * st.v); + } + flSlots.length = 0; for (const [b, f] of LV.fl) if (FLOATS.has(b.k) && !LV.dynOf.has(b)) { f.b = b; f.d = Math.hypot((b.x0 + b.x1) / 2 - camera.position.x, (b.z0 + b.z1) / 2 - camera.position.z); flSlots.push(f); } + flSlots.sort((a, c) => a.d - c.d); + const U4 = FLOATU.uFl.value, U2 = FLOATU.uFlT.value; + for (let i = 0; i < FLOAT_N; i++) { const f = flSlots[i]; if (!f) { U4[i].w = 0; continue; } U4[i].set((f.b.x0 + f.b.x1) / 2, (f.b.z0 + f.b.z1) / 2, f.dip, 1); U2[i].set(f.tx, f.tz); } +} function tileMat(o) { const m = new THREE.MeshLambertMaterial({ color: 0xffffff }); - m.userData.u = { uBase: { value: new THREE.Color(o.base) }, uGrout: { value: new THREE.Color(o.grout) }, uSize: { value: o.size || 0.5 }, uGw: { value: o.gw || 0.06 }, - uBand: { value: new THREE.Color(o.band || o.base) }, uBandY: { value: new THREE.Vector2(o.bandY ? o.bandY[0] : 99, o.bandY ? o.bandY[1] : 99) }, uCaus: { value: o.caus == null ? 1 : o.caus }, uTime: U.time }; + m.userData.u = Object.assign({ uBase: { value: new THREE.Color(o.base) }, uGrout: { value: new THREE.Color(o.grout) }, uSize: { value: o.size || 0.5 }, uGw: { value: o.gw || 0.06 }, + uBand: { value: new THREE.Color(o.band || o.base) }, uBandY: { value: new THREE.Vector2(o.bandY ? o.bandY[0] : 99, o.bandY ? o.bandY[1] : 99) }, + uLip: { value: o.lip ? TUNING.edgeMargin : 0 }, uDirt: { value: o.dirt == null ? 1 : o.dirt }, uMiss: { value: o.miss || 0 }, uRustY: { value: o.rust || -99 }, uPeel: { value: o.peel || 0 }, uTime: U.time }, LAMPU, o.float ? FLOATU : {}); m.onBeforeCompile = sh => { Object.assign(sh.uniforms, m.userData.u); - sh.vertexShader = sh.vertexShader.replace('#include ', '#include \nvarying vec3 vWP; varying vec3 vWN;') + sh.vertexShader = sh.vertexShader.replace('#include ', '#include \nvarying vec3 vWP; varying vec3 vWN; varying vec2 vLP; varying vec2 vHS;' + (o.float ? ` +uniform vec4 uFl[${FLOAT_N}]; uniform vec2 uFlT[${FLOAT_N}]; uniform float uBob; uniform float uTime;` : '')) .replace('#include ', `#include - vec4 hpW = vec4(transformed, 1.0); vec3 hpN = objectNormal; + vec4 hpW = vec4(transformed, 1.0); vec3 hpN = objectNormal; mat4 hpM = modelMatrix; #ifdef USE_INSTANCING - hpW = instanceMatrix * hpW; hpN = mat3(instanceMatrix) * hpN; + hpW = instanceMatrix * hpW; hpN = mat3(instanceMatrix) * hpN; hpM = modelMatrix * instanceMatrix; #endif - hpW = modelMatrix * hpW; vWP = hpW.xyz; vWN = normalize(mat3(modelMatrix) * hpN);`); - sh.fragmentShader = sh.fragmentShader.replace('#include ', '#include \nvarying vec3 vWP; varying vec3 vWN;\nuniform vec3 uBase; uniform vec3 uGrout; uniform float uSize; uniform float uGw; uniform vec3 uBand; uniform vec2 uBandY; uniform float uCaus; uniform float uTime;' + GLSL_CAUSTIC) + hpW = modelMatrix * hpW; vWP = hpW.xyz; vWN = normalize(mat3(modelMatrix) * hpN); + vec2 hpS = vec2(length(hpM[0].xyz), length(hpM[2].xyz)); vLP = position.xz * hpS; vHS = 0.5 * hpS;` + (o.float ? ` + vec2 fc = hpM[3].xz, fl = vWP.xz - fc; + float fdy = uBob * ${BOB_A} * sin(uTime * 1.3 + 6.2832 * fract(fc.x * 0.618 + fc.y * 0.371)); + for (int i = 0; i < ${FLOAT_N}; i++) { vec4 f = uFl[i]; if (f.w > 0.0 && distance(f.xy, fc) < 0.05) fdy += -f.z + dot(uFlT[i], fl); } + transformed.y += fdy / max(length(hpM[1].xyz), 1e-3); vWP.y += fdy;` : '')); + sh.fragmentShader = sh.fragmentShader.replace('#include ', '#include \nvarying vec3 vWP; varying vec3 vWN; varying vec2 vLP; varying vec2 vHS;\nuniform vec3 uBase; uniform vec3 uGrout; uniform float uSize; uniform float uGw; uniform vec3 uBand; uniform vec2 uBandY; uniform float uLip; uniform float uDirt; uniform float uMiss; uniform float uRustY; uniform float uPeel; uniform float uTime;' + GLSL_LAMPS) .replace('#include ', `#include vec3 an = abs(vWN); - vec2 tuv = an.y > 0.5 ? vWP.xz : (an.x > 0.5 ? vWP.zy : vWP.xy); - tuv /= uSize; + bool top = vWN.y > 0.5; + vec2 wq = an.y > 0.5 ? vWP.xz : (an.x > 0.5 ? vWP.zy : vWP.xy); + vec2 tuv = wq / uSize; vec2 tf = abs(fract(tuv) - 0.5); float tg = smoothstep(0.5 - uGw, 0.5 - uGw * 0.45, max(tf.x, tf.y)); - float th = fract(sin(dot(floor(tuv), vec2(12.9898, 78.233))) * 43758.5453); + vec2 cell = floor(tuv); + float th = fract(sin(dot(cell, vec2(12.9898, 78.233))) * 43758.5453), th2 = fract(th * 37.31); + float n1 = texture2D(uNoise, wq * 0.043).r, n2 = texture2D(uNoise, wq * 0.19).g, n3 = texture2D(uNoise, wq * 0.83).b; + // the rim and the worn middle of anything you can stand on + float lip = 0.0, worn = 0.0, ed = 9.0; + if (uLip > 0.0 && top) { vec2 e2 = vHS - abs(vLP); ed = min(e2.x, e2.y); lip = 1.0 - smoothstep(uLip - 0.012, uLip + 0.012, ed); worn = smoothstep(uLip + 0.12, uLip + 0.75, ed); } vec3 tc = (vWP.y > uBandY.x && vWP.y < uBandY.y && an.y < 0.5) ? uBand : uBase; - tc *= 0.955 + 0.06 * th; - diffuseColor.rgb *= mix(tc, uGrout, tg);`) + tc *= 0.84 + 0.2 * th; + vec3 grout = mix(uGrout, vec3(0.09, 0.09, 0.06), 0.5 + 0.35 * n2); + vec3 col = mix(tc, grout, tg); + // missing tiles: bare, dark concrete (never on what you stand on) + float miss = step(th2, uMiss) * (top && uLip > 0.0 ? 0.0 : 1.0); + col = mix(col, vec3(0.15, 0.15, 0.13) * (0.6 + 0.7 * n3), miss); + // hairline cracks across some tiles + vec2 cf = fract(tuv) - 0.5; float ca = th2 * 6.2832; + float crk = step(0.82, th) * smoothstep(0.022, 0.0, abs(dot(cf, vec2(cos(ca), sin(ca))) + (th - 0.91) * 1.5)); + col *= 1.0 - 0.65 * crk * uDirt; + // grime: blotchy brown-black, lighter where feet have worn it away + float grime = smoothstep(0.3, 0.78, n1 * 0.65 + n2 * 0.35) * uDirt * (1.0 - 0.75 * worn); + col = mix(col, col * vec3(0.4, 0.38, 0.31), grime * 0.9); + // mould and slime climbing from the water line, heaviest on walls and in corners + float up = vWP.y; + float rise = (1.0 - smoothstep(0.0, 1.0 + 1.6 * n1, up)) * (an.y < 0.5 ? 1.0 : 0.3); + col = mix(col, vec3(0.06, 0.09, 0.05) + 0.06 * n3 * vec3(0.6, 1.0, 0.4), clamp(rise * (0.5 + 0.7 * n2), 0.0, 0.94) * uDirt); + col = mix(col, vec3(0.04, 0.07, 0.05), step(up, -0.02) * 0.75 * uDirt); + // rust runs streaking down from the old pipes + if (an.y < 0.5 && uRustY > 0.0 && vWP.y < uRustY) { + float st = texture2D(uNoise, vec2(wq.x * 1.3, vWP.y * 0.018)).r; + float run = smoothstep(0.6, 0.85, st) * (1.0 - smoothstep(0.0, 2.6 + 2.0 * n2, uRustY - vWP.y)); + col = mix(col, vec3(0.30, 0.13, 0.05) * (0.7 + 0.5 * n3), run * 0.85); + } + // the ceiling's paint coming away in flakes, and old water stains + if (uPeel > 0.0) { + float fl = smoothstep(0.5, 0.56, n1 * 0.55 + n2 * 0.45); + col = mix(vec3(0.33, 0.35, 0.31) * (0.8 + 0.3 * n1), vec3(0.17, 0.17, 0.15), fl); + col *= 1.0 - 0.45 * smoothstep(0.02, 0.0, abs(n1 - 0.62)) - 0.25 * smoothstep(0.55, 0.8, n1); + } + // rim and worn middle on top of everything + if (uLip > 0.0 && top) { + col = mix(col, col * 1.22 + vec3(0.025), worn * 0.6); + col = mix(col, vec3(0.07, 0.065, 0.05) * (0.8 + 0.4 * n3), lip * 0.95); + col += vec3(0.45, 0.43, 0.36) * smoothstep(0.024, 0.0, abs(ed - uLip)) * 0.75; + } + diffuseColor.rgb *= col;`) .replace('#include ', `#include - float cb = (1.0 - smoothstep(0.0, 2.6, vWP.y)) * step(-2.95, vWP.y); - totalEmissiveRadiance += vec3(0.30, 0.62, 0.62) * caustic(vWP.xz * 0.55 + vWP.y * 0.3, uTime) * cb * uCaus * (vWP.y < 0.0 ? 0.55 : 1.0 - an.y * 0.8);`); + totalEmissiveRadiance += diffuseColor.rgb * lampLight(vWP, normalize(vWN));`); }; + m.customProgramCacheKey = () => o.float ? 'bw-tile-float' : 'bw-tile'; return m; } const MAT = { - tile: tileMat({ base: 0xe4eeec, grout: 0xa9c3c0, size: 0.5, band: 0x8fd6cf, bandY: [0.6, 0.78] }), - pillar: tileMat({ base: 0xdff2ef, grout: 0x8bb5b1, size: 0.22, band: 0x2bb3a8, bandY: [1.9, 2.1] }), - wall: tileMat({ base: 0xf2f7f5, grout: 0xb4cac7, size: 0.3, band: 0x46b9b0, bandY: [1.15, 1.35] }), - floor: tileMat({ base: 0x7fd3cb, grout: 0x4f9e98, size: 0.5, caus: 1.6 }), - ceil: tileMat({ base: 0xe9efee, grout: 0xc4d0ce, size: 0.6, caus: 0 }), - mem: tileMat({ base: 0xc9d6d4, grout: 0x8ea3a1, size: 0.3 }), - lane: tileMat({ base: 0xe8efed, grout: 0x9db5b2, size: 0.4, band: 0x506b6e, bandY: [-0.2, 0.58] }), - crush: new THREE.MeshLambertMaterial({ color: 0x59646a }), - door: new THREE.MeshLambertMaterial({ color: 0x6a7d86 }), - dark: new THREE.MeshLambertMaterial({ color: 0x23393b }) + tile: tileMat({ base: 0xcfcbb6, grout: 0x58584b, size: 0.5, band: 0x6f8d84, bandY: [0.6, 0.78], lip: 1 }), + float: tileMat({ base: 0xcfcbb6, grout: 0x58584b, size: 0.5, band: 0x6f8d84, bandY: [0.6, 0.78], lip: 1, float: 1 }), + pillar: tileMat({ base: 0xb8bcaf, grout: 0x4c524a, size: 0.22, band: 0x3f6a60, bandY: [1.9, 2.1], miss: 0.07, rust: 5.6 }), + wall: tileMat({ base: 0x9fa69a, grout: 0x404840, size: 0.3, band: 0x3d6058, bandY: [1.15, 1.35], miss: 0.05, rust: 4.75 }), + floor: tileMat({ base: 0x2d3d36, grout: 0x18201c, size: 0.5, miss: 0.08 }), + ceil: tileMat({ base: 0x5a5e57, grout: 0x2c2f2a, size: 0.6, gw: 0, peel: 1 }), + mem: tileMat({ base: 0xb0b2a3, grout: 0x4a4f47, size: 0.3, lip: 1 }), + lane: tileMat({ base: 0xc7c3ae, grout: 0x55574b, size: 0.4, band: 0x3a4a48, bandY: [-0.2, 0.58], lip: 1 }), + crush: lampPatch(new THREE.MeshLambertMaterial({ color: 0x5d564c }), 0x0d1110, 'crush'), + door: lampPatch(new THREE.MeshLambertMaterial({ color: 0x585e58 }), 0, 'door'), + dark: lampPatch(new THREE.MeshLambertMaterial({ color: 0x1c2420 }), 0, 'dark'), + rust: lampPatch(new THREE.MeshLambertMaterial({ color: 0x5a3523 }), 0, 'rust'), + debris: lampPatch(new THREE.MeshLambertMaterial({ color: 0xffffff }), 0, 'debris') }; +// Years of dirt on anything printed or painted: blotches, a dark tide at the bottom and drips running down. +function grime(g, w, h, seed, amt) { + const r = mulberry32(hash32('grime' + seed)); amt = amt == null ? 1 : amt; + for (let i = 0; i < 26 * amt; i++) { const x = r() * w, y = r() * h, rr = (0.05 + r() * 0.22) * Math.max(w, h) * 0.5, gr = g.createRadialGradient(x, y, 0, x, y, rr); + gr.addColorStop(0, 'rgba(40,34,20,' + (0.08 + r() * 0.2) * amt + ')'); gr.addColorStop(1, 'rgba(40,34,20,0)'); g.fillStyle = gr; g.fillRect(x - rr, y - rr, rr * 2, rr * 2); } + const tide = g.createLinearGradient(0, h * 0.7, 0, h); tide.addColorStop(0, 'rgba(25,30,18,0)'); tide.addColorStop(1, 'rgba(25,30,18,' + 0.45 * amt + ')'); g.fillStyle = tide; g.fillRect(0, 0, w, h); + for (let i = 0; i < 9 * amt; i++) { const x = r() * w, y0 = r() * h * 0.3, len = (0.25 + r() * 0.6) * h; g.fillStyle = 'rgba(70,40,16,' + (0.12 + r() * 0.2) + ')'; g.fillRect(x, y0, 1.5 + r() * 3, len); } +} // One unit box for every static wall, tile and pillar, scaled per instance. const BOX = new THREE.BoxGeometry(1, 1, 1); function canvasTex(w, h, draw) { const c = document.createElement('canvas'); c.width = w; c.height = h; draw(c.getContext('2d'), w, h); const t = new THREE.CanvasTexture(c); t.anisotropy = 4; return t; } @@ -1344,25 +1591,26 @@

YOU ESCAPED

const MIST_TEX = (() => { const t = canvasTex(256, 256, (g, w) => { g.clearRect(0, 0, w, w); let s = 7; const r = () => (s = (s * 16807) % 2147483647) / 2147483647; for (let i = 0; i < 46; i++) { const x = r() * w, y = r() * w, rad = 18 + r() * 60; for (const dx of [-w, 0, w]) for (const dy of [-w, 0, w]) { const gr = g.createRadialGradient(x + dx, y + dy, 0, x + dx, y + dy, rad); gr.addColorStop(0, 'rgba(255,255,255,' + (0.18 + r() * 0.25) + ')'); gr.addColorStop(1, 'rgba(255,255,255,0)'); g.fillStyle = gr; g.fillRect(x + dx - rad, y + dy - rad, rad * 2, rad * 2); } } }); t.wrapS = t.wrapT = THREE.RepeatWrapping; return t; })(); -const BLOB_TEX = canvasTex(64, 64, (g, w) => { const r = g.createRadialGradient(32, 32, 2, 32, 32, 31); r.addColorStop(0, 'rgba(0,30,32,.55)'); r.addColorStop(1, 'rgba(0,30,32,0)'); g.fillStyle = r; g.fillRect(0, 0, w, w); }); -const ARROW_TEX = canvasTex(256, 128, (g, w, h) => { g.fillStyle = '#2bb3a8'; for (let i = 0; i < 3; i++) { const x = 24 + i * 70; g.beginPath(); g.moveTo(x, 18); g.lineTo(x + 50, 64); g.lineTo(x, 110); g.lineTo(x + 18, 110); g.lineTo(x + 68, 64); g.lineTo(x + 18, 18); g.closePath(); g.fill(); } }); -const CURRENT_TEX = (() => { const t = canvasTex(128, 128, (g, w) => { g.clearRect(0, 0, w, w); g.fillStyle = 'rgba(29,139,131,.85)'; for (let y = 0; y < 2; y++) { const yy = 16 + y * 64; g.beginPath(); g.moveTo(20, yy); g.lineTo(70, yy + 16); g.lineTo(20, yy + 32); g.lineTo(34, yy + 16); g.closePath(); g.fill(); g.beginPath(); g.moveTo(70, yy); g.lineTo(120, yy + 16); g.lineTo(70, yy + 32); g.lineTo(84, yy + 16); g.closePath(); g.fill(); } }); t.wrapS = t.wrapT = THREE.RepeatWrapping; return t; })(); -const PLANK_TEX = (() => { const t = canvasTex(64, 256, (g, w, h) => { for (let i = 0; i < 8; i++) { g.fillStyle = i % 2 ? '#f4f7f6' : '#3b8fd1'; g.fillRect(0, i * 32, w, 32); } g.fillStyle = 'rgba(0,0,0,.12)'; g.fillRect(0, 0, 4, h); g.fillRect(w - 4, 0, 4, h); }); t.wrapT = THREE.RepeatWrapping; return t; })(); +const BLOB_TEX = canvasTex(64, 64, (g, w) => { const r = g.createRadialGradient(32, 32, 2, 32, 32, 31); r.addColorStop(0, 'rgba(0,0,0,.6)'); r.addColorStop(1, 'rgba(0,0,0,0)'); g.fillStyle = r; g.fillRect(0, 0, w, w); }); +const ARROW_TEX = canvasTex(256, 128, (g, w, h) => { g.fillStyle = '#4f9a8a'; for (let i = 0; i < 3; i++) { const x = 24 + i * 70; g.beginPath(); g.moveTo(x, 18); g.lineTo(x + 50, 64); g.lineTo(x, 110); g.lineTo(x + 18, 110); g.lineTo(x + 68, 64); g.lineTo(x + 18, 18); g.closePath(); g.fill(); } }); +const CURRENT_TEX = (() => { const t = canvasTex(128, 128, (g, w) => { g.clearRect(0, 0, w, w); g.fillStyle = 'rgba(96,196,176,.85)'; for (let y = 0; y < 2; y++) { const yy = 16 + y * 64; g.beginPath(); g.moveTo(20, yy); g.lineTo(70, yy + 16); g.lineTo(20, yy + 32); g.lineTo(34, yy + 16); g.closePath(); g.fill(); g.beginPath(); g.moveTo(70, yy); g.lineTo(120, yy + 16); g.lineTo(70, yy + 32); g.lineTo(84, yy + 16); g.closePath(); g.fill(); } }); t.wrapS = t.wrapT = THREE.RepeatWrapping; return t; })(); +const PLANK_TEX = (() => { const t = canvasTex(64, 256, (g, w, h) => { for (let i = 0; i < 8; i++) { g.fillStyle = i % 2 ? '#c9c5b2' : '#35607a'; g.fillRect(0, i * 32, w, 32); } g.fillStyle = 'rgba(0,0,0,.25)'; g.fillRect(0, 0, 4, h); g.fillRect(w - 4, 0, 4, h); grime(g, w, h, 'plank', 0.8); }); t.wrapT = THREE.RepeatWrapping; return t; })(); function signTex(text, o) { o = o || {}; const lines = String(text).split('|'); return canvasTex(1024, 256, (g, w, h) => { - g.fillStyle = o.bg || '#f6fbfa'; g.fillRect(0, 0, w, h); - g.strokeStyle = o.edge || '#1d8b83'; g.lineWidth = 14; g.strokeRect(10, 10, w - 20, h - 20); - g.fillStyle = o.ink || '#0d3b3f'; g.textAlign = 'center'; g.textBaseline = 'middle'; + g.fillStyle = o.bg || '#cfc9b2'; g.fillRect(0, 0, w, h); + g.strokeStyle = o.edge || '#3b5a50'; g.lineWidth = 14; g.strokeRect(10, 10, w - 20, h - 20); + if (!o.clean) grime(g, w, h, text, 0.7); + g.fillStyle = o.ink || '#141a17'; g.textAlign = 'center'; g.textBaseline = 'middle'; g.font = '900 ' + (lines.length > 1 ? 74 : 96) + 'px Archivo, Arial, sans-serif'; g.fillText(lines[0], w / 2, lines.length > 1 ? 92 : h / 2, w - 60); - if (lines[1]) { g.font = '600 40px "IBM Plex Mono", Menlo, monospace'; g.fillStyle = o.ink2 || '#2a5c5e'; g.fillText(lines[1], w / 2, 178, w - 60); } + if (lines[1]) { g.font = '600 40px "IBM Plex Mono", Menlo, monospace'; g.fillStyle = o.ink2 || '#2c3d37'; g.fillText(lines[1], w / 2, 178, w - 60); } }); } function digitTex(n, d) { return canvasTex(128, 256, (g, w, h) => { - g.fillStyle = '#e8f4f2'; g.fillRect(0, 0, w, h); g.fillStyle = '#0d3b3f'; g.fillRect(0, 0, w, 54); + g.fillStyle = '#d6d1bd'; g.fillRect(0, 0, w, h); grime(g, w, h, 'digit' + n, 0.6); g.fillStyle = '#16211d'; g.fillRect(0, 0, w, 54); g.fillStyle = '#7ff5e8'; g.textAlign = 'center'; g.textBaseline = 'middle'; g.font = '600 34px "IBM Plex Mono", monospace'; g.fillText('#' + (n + 1), w / 2, 28); g.fillStyle = '#c0392b'; g.font = '900 150px Archivo, Arial, sans-serif'; g.fillText(String(d), w / 2, 160); }); @@ -1381,12 +1629,13 @@

YOU ESCAPED

function buildLevel(W) { disposeLevel(); const G = new THREE.Group(); scene.add(G); - LV = { group: G, W, dyn: [], planks: [], waters: [], stones: [], valves: [], lights: [], flick: [], mist: [], doors: [], keypadLamp: null }; - const stat = { tile: [], pillar: [], wall: [], mem: [], lane: [], crush: [], door: [], dark: [] }; + LV = { group: G, W, dyn: [], planks: [], waters: [], stones: [], valves: [], lights: [], flick: [], mist: [], doors: [], lamps: [], keypadLamp: null }; + const rnd = mulberry32(hash32('decor:' + W.df)); // the same dressing in every browser + const stat = { tile: [], float: [], pillar: [], wall: [], mem: [], lane: [], crush: [], door: [], dark: [] }; const dynBoxes = new Set(W.dyn.map(d => d.b)); for (const b of W.boxes) { if (dynBoxes.has(b)) continue; - const k = b.k === 'pillar' ? 'pillar' : b.k === 'wall' ? 'wall' : b.k === 'lane' ? 'lane' : b.k === 'crusher' ? 'crush' : 'tile'; + const k = b.k === 'pillar' ? 'pillar' : b.k === 'wall' ? 'wall' : b.k === 'lane' ? 'lane' : b.k === 'crusher' ? 'crush' : FLOATS.has(b.k) ? 'float' : 'tile'; stat[k].push(b); } const m4 = new THREE.Matrix4(), q = new THREE.Quaternion(), v = new THREE.Vector3(), s = new THREE.Vector3(); @@ -1401,11 +1650,12 @@

YOU ESCAPED

const FR = { sink: frameMat(0xfff2b8), stable: frameMat(0x173235), mover: frameMat(0x3b8fd1), mem: frameMat(0x6d8583) }; const PLANE = new THREE.PlaneGeometry(1, 1); PLANE.userData.shared = 1; PLANE.rotateX(-Math.PI / 2); const addFrame = (b, mat) => { const f = new THREE.Mesh(PLANE, mat); f.position.set((b.x0 + b.x1) / 2, b.y1 + 0.006, (b.z0 + b.z1) / 2); f.scale.set(b.x1 - b.x0, 1, b.z1 - b.z0); G.add(f); return f; }; - for (const b of W.boxes) if (b.k === 'stable' && !dynBoxes.has(b)) addFrame(b, FR.stable); + LV.fframes = []; + for (const b of W.boxes) if (b.k === 'stable' && !dynBoxes.has(b)) LV.fframes.push({ f: addFrame(b, FR.stable), b }); for (const b of W.boxes) if (b.k === 'current') { const t = CURRENT_TEX.clone(); t.needsUpdate = true; t.repeat.set(b.cur > 0 ? 2 : -2, 2); const m = ownMat(new THREE.MeshBasicMaterial({ map: t, transparent: true, depthWrite: false })); - const f = addFrame(b, m); f.userData.cur = b.cur; LV.flick.push({ cur: f }); + const f = addFrame(b, m); f.userData.cur = b.cur; LV.flick.push({ cur: f }); LV.fframes.push({ f, b }); } for (const d of W.dyn) { const b = d.b; @@ -1418,6 +1668,7 @@

YOU ESCAPED

if (d.type === 'push') { e.stripe = new THREE.Mesh(BOX, ownMat(new THREE.MeshBasicMaterial({ color: 0xd8432f }))); G.add(e.stripe); } LV.dyn.push(e); } + LV.dynOf = new Set(W.dyn.filter(d => d.type === 'sink' || d.type === 'mem' || d.type === 'move').map(d => d.b)); LV.fl = new Map(); LV.st = new Map(); FK.length = 0; // housings that never push: a green light says this lane is open for (const h of W.housings) { const m = new THREE.Mesh(BOX, MAT.crush); m.position.set(h.x - 0.3, h.y, h.z); m.scale.set(1.2, 2.2, 2.4); G.add(m); @@ -1427,12 +1678,15 @@

YOU ESCAPED

const PL = new THREE.BoxGeometry(1, 0.22, 1); for (const p of W.planks) { const t = PLANK_TEX.clone(); t.needsUpdate = true; t.repeat.set(1, p.hl * 2 / 2.4); - const m = new THREE.Mesh(PL, ownMat(new THREE.MeshLambertMaterial({ map: t }))); m.scale.set(p.hw * 2, 1, p.hl * 2); G.add(m); + const m = new THREE.Mesh(PL, ownMat(lampPatch(new THREE.MeshLambertMaterial({ map: t }), 0x0a0d0c))); m.scale.set(p.hw * 2, 1, p.hl * 2); G.add(m); const hub = new THREE.Mesh(new THREE.CylinderGeometry(0.22, 0.3, 3.6, 12), MAT.dark); hub.position.set(p.cx, p.top - 1.9, p.cz); G.add(hub); LV.planks.push({ p, m }); } // the pool floor, the water and the ceiling of each room (and the lobby's little pool) const rooms = [W.lobby].concat(W.rooms); + const near = (R, x, z) => R.boxes.some(b => x > b.x0 - 0.4 && x < b.x1 + 0.4 && z > b.z0 - 0.4 && z < b.z1 + 0.4); + const deco = { rub: [], flo: [], lad: [], pipe: [], buoy: [] }; + const PANEL = new THREE.PlaneGeometry(2.2, 1.1).rotateX(Math.PI / 2); for (const R of rooms) { const len = R.z1 - R.z0, cz = (R.z0 + R.z1) / 2; const hw = R.hw; @@ -1441,28 +1695,77 @@

YOU ESCAPED

if (R.i >= 0 && gfx > 0) for (const [y, o, sp] of [[0.3, 0.55, 0.012], [1.3, 0.38, -0.008]]) { // low mist lying over the water, drifting const mt = MIST_TEX.clone(); mt.needsUpdate = true; mt.repeat.set(hw / 7, len / 7); - const mm = new THREE.Mesh(new THREE.PlaneGeometry(2 * hw, len).rotateX(-Math.PI / 2), ownMat(new THREE.MeshBasicMaterial({ map: mt, color: FOG, transparent: true, opacity: o, depthWrite: false, fog: true }))); + const mm = new THREE.Mesh(new THREE.PlaneGeometry(2 * hw, len).rotateX(-Math.PI / 2), ownMat(new THREE.MeshBasicMaterial({ map: mt, color: 0x4a5a52, transparent: true, opacity: o, depthWrite: false, fog: true }))); // dim grey-green so it reads against the dark mm.position.set(0, y, cz); mm.renderOrder = 3; G.add(mm); LV.mist.push({ t: mt, sp }); } if (R.i >= 0) { const wm = new THREE.Mesh(new THREE.PlaneGeometry(2 * hw, len, 1, 1).rotateX(-Math.PI / 2), WATER); wm.position.set(0, 0, cz); wm.renderOrder = 2; G.add(wm); LV.waters.push({ R, m: wm }); } else { const wm = new THREE.Mesh(new THREE.PlaneGeometry(10, 7).rotateX(-Math.PI / 2), WATER); wm.position.set(0, 0, -12.5); wm.renderOrder = 2; G.add(wm); } - // light panels in the ceiling, one of them flickering + // ceiling panels: most are dead (a few hang loose), a few still work over the way across, one in a room flickers const pts = []; for (let z = R.z0 + 3; z < R.z1 - 1; z += 6) for (let x = -hw + 4; x <= hw - 4; x += 8) pts.push([x, z]); - const im = new THREE.InstancedMesh(new THREE.PlaneGeometry(2.2, 1.1).rotateX(Math.PI / 2), ownMat(new THREE.MeshBasicMaterial({ color: 0xffffff })), pts.length); - const c = new THREE.Color(0xffffff); - pts.forEach((p, i) => { m4.compose(v.set(p[0], CEIL - 0.01, p[1]), q, s.set(1, 1, 1)); im.setMatrixAt(i, m4); im.setColorAt(i, c.setHex(0xfbfffd)); }); - im.instanceMatrix.needsUpdate = true; if (im.instanceColor) im.instanceColor.needsUpdate = true; G.add(im); - LV.flick.push({ im, i: (R.i * 7 + 3) % pts.length, ph: R.i * 1.7 }); + const kind = pts.map(() => 'dead'); + const stops = R.i < 0 ? [{ x: 0, z: -4 }, { x: -9, z: -12.5 }, { x: 9, z: -12.5 }, { x: 0, z: -21 }] : R.stops.filter((st, i) => i % 3 === 0 || i === R.stops.length - 1); + let on = 0; + for (const st of stops) { + let bi = 0, bd = 1e9; pts.forEach((p, i) => { const d = Math.hypot(p[0] - st.x, p[1] - st.z); if (d < bd) { bd = d; bi = i; } }); + if (kind[bi] === 'dead' && on < 7 && !pts.some((p, i) => kind[i] === 'on' && Math.hypot(p[0] - pts[bi][0], p[1] - pts[bi][1]) < 6.5)) { kind[bi] = 'on'; on++; } + } + const fi = pts.findIndex((p, i) => kind[i] === 'dead' && rnd() < 0.3); if (fi >= 0) kind[fi] = 'flick'; + const im = new THREE.InstancedMesh(PANEL, ownMat(new THREE.MeshBasicMaterial({ color: 0xffffff })), pts.length); + const c = new THREE.Color(); + pts.forEach((p, i) => { + const hang = kind[i] === 'dead' && rnd() < 0.3; + q.setFromEuler(new THREE.Euler(hang ? (rnd() - 0.5) * 0.9 : 0, 0, hang ? (rnd() - 0.5) * 0.5 : 0)); + m4.compose(v.set(p[0], CEIL - 0.01 - (hang ? 0.35 : 0), p[1]), q, s.set(1, 1, 1)); im.setMatrixAt(i, m4); + im.setColorAt(i, c.setHex(kind[i] === 'on' ? 0xeee6cc : kind[i] === 'flick' ? 0xc9dccf : 0x1b201d)); + if (kind[i] !== 'dead') LV.lamps.push({ x: p[0], y: CEIL - 0.4, z: p[1], w: kind[i] === 'on' ? 2.0 : 1.6, k: kind[i], ph: rnd() * 50, im, i, col: kind[i] === 'on' ? 0xf4dcae : 0xc6e0d2, cur: 1 }); + }); + q.identity(); + im.instanceMatrix.needsUpdate = true; if (im.instanceColor) im.instanceColor.needsUpdate = true; im.frustumCulled = false; G.add(im); + // dressing: old pipes along the top of the walls, pool ladders, a lifebuoy, broken tile on the decks, rubbish on the water + if (R.i >= 0) { + for (const sx of [-1, 1]) { deco.pipe.push([sx * (hw - 0.2), 4.85, cz, len, 0.11]); deco.pipe.push([sx * (hw - 0.16), 5.2, cz, len, 0.06]); } + const dk = R.boxes.find(b => b.k === 'deck' && b.z0 <= R.z0 + 0.01); + if (dk && R.i < ROOMS.length - 1) for (const lx of [dk.x0 + 1.2, dk.x1 - 1.2]) if (rnd() < 0.75) deco.lad.push([lx, dk.z1 + 0.1]); + for (const bs of [-1, 1]) if (rnd() < 0.7) deco.buoy.push([bs * (hw - 0.12), 2.1, R.z0 + 6 + rnd() * (len - 12), bs]); + for (let n = 0; n < 2; n++) { const bx = (rnd() - 0.5) * 2 * (hw - 3), bz = R.z0 + 8 + rnd() * (len - 14); if (!near(R, bx, bz)) deco.buoy.push([bx, 0.02, bz, 0]); } + for (let n = 0; n < 70; n++) { const x = (rnd() - 0.5) * 2 * (hw - 1), z = R.z0 + 5 + rnd() * (len - 9); if (!near(R, x, z)) deco.flo.push([x, z, rnd()]); } + } + // broken tile heaped at the ends of each deck, against the walls + const decks = R.boxes.filter(b => b.k === 'deck' && b.y1 <= TOP + 0.01 && b.x1 - b.x0 > 3); + for (const b of decks) for (let n = 0; n < 14; n++) { + const end = rnd() < 0.5, x = end ? b.x0 + 0.25 + rnd() * rnd() * 2.5 : b.x1 - 0.25 - rnd() * rnd() * 2.5, z = b.z0 + 0.2 + rnd() * (b.z1 - b.z0 - 0.4); + deco.rub.push([x, b.y1, z, rnd()]); + } } + // all the dressing as a handful of instanced meshes (a few draw calls for the whole level) + const inst = (geo, mat, list, place) => { if (!list.length) return null; const im = new THREE.InstancedMesh(geo, mat, list.length); const c = new THREE.Color(); + list.forEach((e, i) => { place(e, c); im.setMatrixAt(i, m4); if (c.r + c.g + c.b < 2.99) im.setColorAt(i, c); }); im.instanceMatrix.needsUpdate = true; if (im.instanceColor) im.instanceColor.needsUpdate = true; im.frustumCulled = false; G.add(im); return im; }; // (instances spread over the whole level: the base shape's bounds would cull them wrongly) + const PIPE = new THREE.CylinderGeometry(1, 1, 1, 10).rotateX(Math.PI / 2); + inst(PIPE, MAT.rust, deco.pipe, (e, c) => { m4.compose(v.set(e[0], e[1], e[2]), q.identity(), s.set(e[4], e[4], e[3])); c.setRGB(1, 1, 1); }); + const LADP = []; for (const l of deco.lad) { for (const dx of [-0.28, 0.28]) { LADP.push([l[0] + dx, -0.4, l[1] + 0.06, 0.05, 2.4, 0.05]); LADP.push([l[0] + dx, TOP + 0.85, l[1] - 0.12, 0.05, 0.05, 0.36]); LADP.push([l[0] + dx, TOP + 0.42, l[1] - 0.3, 0.05, 0.86, 0.05]); } for (const y of [-0.3, 0.1, 0.5]) LADP.push([l[0], y, l[1] + 0.06, 0.56, 0.04, 0.04]); } + inst(BOX, MAT.door, LADP, (e, c) => { m4.compose(v.set(e[0], e[1], e[2]), q.identity(), s.set(e[3], e[4], e[5])); c.setRGB(0.75, 0.62, 0.5); }); + const buoyM = ownMat(lampPatch(new THREE.MeshLambertMaterial({ map: canvasTex(64, 16, (g, w, h) => { for (let i = 0; i < 8; i++) { g.fillStyle = i % 2 ? '#c8c0aa' : '#8c3326'; g.fillRect(i * 8, 0, 8, h); } grime(g, w, h, 'buoy', 1); }) }), 0x0c0f0e)); + inst(new THREE.TorusGeometry(0.32, 0.085, 6, 14), buoyM, deco.buoy, (e, c) => { q.setFromEuler(new THREE.Euler(e[3] ? 0 : Math.PI / 2, e[3] ? Math.PI / 2 : 0, 0.3)); m4.compose(v.set(e[0], e[1], e[2]), q, s.set(1, 1, 1)); c.setRGB(1, 1, 1); }); + inst(BOX, MAT.debris, deco.rub, (e, c) => { const r = e[3]; q.setFromEuler(new THREE.Euler((r - 0.5) * 0.3, r * 9, (r - 0.5) * 0.3)); const sz = 0.08 + r * r * 0.3; + m4.compose(v.set(e[0], e[1] + 0.02, e[2]), q, s.set(sz, 0.035 + r * 0.04, sz * (0.6 + r))); const k = r < 0.5 ? 0.55 + r * 0.6 : 0.22 + r * 0.2; c.setRGB(k, k * 0.97, k * 0.86); }); + inst(BOX, MAT.debris, deco.flo, (e, c) => { const r = e[2]; q.setFromEuler(new THREE.Euler(0, r * 17, 0)); m4.compose(v.set(e[0], 0.012, e[1]), q, s.set(0.12 + r * 0.6, 0.02, 0.08 + r * 0.25)); + if (r < 0.35) c.setRGB(0.32, 0.22, 0.13); else if (r < 0.7) c.setRGB(0.2, 0.24, 0.13); else c.setRGB(0.52, 0.5, 0.42); }); + // light falling through the mist under each working panel, and the mist itself + if (LV.lamps.length) { + const CONE = new THREE.CylinderGeometry(0.75, 2.6, 5.1, 18, 1, true); + LV.cones = inst(CONE, CONE_MAT, LV.lamps, (e, c) => { m4.compose(v.set(e.x, CEIL - 0.1 - 2.55, e.z), q.identity(), s.set(1, 1, 1)); c.setRGB(0.99, 0.99, 0.99); }); + if (LV.cones) LV.cones.renderOrder = 4; + } + if (LV.cones) LV.cones.visible = gfx > 0; // signs, arrows, stones, valves, numbers, keypad, the exit for (const sg of W.signs) { - const m = new THREE.Mesh(new THREE.PlaneGeometry(4.2, 1.05), ownMat(new THREE.MeshBasicMaterial({ map: signTex(sg.text), fog: true }))); + const m = new THREE.Mesh(new THREE.PlaneGeometry(4.2, 1.05), ownMat(new THREE.MeshBasicMaterial({ map: signTex(sg.text), color: 0x9d9a8e, fog: true }))); m.position.set(sg.x, sg.y, sg.z); m.rotation.y = Math.PI; G.add(m); const rod = new THREE.Mesh(BOX, MAT.dark); rod.position.set(sg.x, (sg.y + CEIL) / 2 + 0.3, sg.z); rod.scale.set(0.04, CEIL - sg.y - 0.5, 0.04); G.add(rod); } const arrowMat = ownMat(new THREE.MeshBasicMaterial({ map: ARROW_TEX, transparent: true, depthWrite: false })); for (const a of W.arrows) { const m = new THREE.Mesh(new THREE.PlaneGeometry(1.6, 0.8), arrowMat); m.position.set(a.x - a.side * 0.01, a.y, a.z); m.rotation.y = a.side < 0 ? Math.PI / 2 : -Math.PI / 2; if (a.side < 0) m.scale.x = -1; G.add(m); } - const rockG = new THREE.DodecahedronGeometry(0.16, 0), rockM = ownMat(new THREE.MeshLambertMaterial({ color: 0x8c9394 })); + const rockG = new THREE.DodecahedronGeometry(0.16, 0), rockM = ownMat(lampPatch(new THREE.MeshLambertMaterial({ color: 0x9aa09a }), 0x2a3330)); for (const st of W.stones) { const g = new THREE.Group(); g.position.set(st.x, st.y, st.z); for (let i = 0; i < 6; i++) { const r = new THREE.Mesh(rockG, rockM); const a = i * 1.9; r.position.set(Math.cos(a) * 0.22 * (i % 3), 0.08, Math.sin(a) * 0.2 * (i % 2 + 0.5)); r.scale.setScalar(0.7 + (i * 37 % 5) * 0.12); r.rotation.set(i, i * 2, 0); g.add(r); } @@ -1472,14 +1775,14 @@

YOU ESCAPED

const g = new THREE.Group(); g.position.set(V.x, V.y, V.z); const pipe = new THREE.Mesh(new THREE.CylinderGeometry(0.12, 0.12, 1.1, 10), MAT.door); pipe.position.y = 0.55; g.add(pipe); const wheel = new THREE.Group(); wheel.position.set(0, 1.12, 0); g.add(wheel); - const red = ownMat(new THREE.MeshLambertMaterial({ color: 0xd8342b, emissive: 0x3a0806 })); + const red = ownMat(lampPatch(new THREE.MeshLambertMaterial({ color: 0xc9352b, emissive: 0x4a0a07 }), 0x301010)); const tor = new THREE.Mesh(new THREE.TorusGeometry(0.42, 0.055, 8, 24), red); tor.rotation.x = Math.PI / 2; wheel.add(tor); for (let i = 0; i < 4; i++) { const sp = new THREE.Mesh(BOX, red); sp.scale.set(0.84, 0.05, 0.05); sp.rotation.y = i * Math.PI / 4 * 2 / 2 + (i % 2) * Math.PI / 2; wheel.add(sp); } const lamp = new THREE.Mesh(new THREE.SphereGeometry(0.09, 10, 8), ownMat(new THREE.MeshBasicMaterial({ color: 0xff4b3e }))); lamp.position.y = 1.5; g.add(lamp); G.add(g); LV.valves.push({ g, wheel, lamp, red }); } for (const D of W.digits) { - const tex = digitTex(D.n, D.d), mat = ownMat(new THREE.MeshBasicMaterial({ map: tex, fog: true })); + const tex = digitTex(D.n, D.d), mat = ownMat(new THREE.MeshBasicMaterial({ map: tex, color: 0xcfcbbd, fog: true })); // a number on every face of the pillar: front (-z), back, left, right const faces = [[0, -0.355, Math.PI], [0, 0.355, 0], [-0.355, 0, -Math.PI / 2], [0.355, 0, Math.PI / 2]]; for (const f of faces) { const m = new THREE.Mesh(new THREE.PlaneGeometry(0.66, 1.32), mat); m.position.set(D.x + f[0], D.y, D.z + 0.35 + f[1]); m.rotation.y = f[2]; G.add(m); } @@ -1490,12 +1793,12 @@

YOU ESCAPED

face.position.set(K.x - 0.065, K.y, K.z); face.rotation.y = -Math.PI / 2; G.add(face); LV.keypadLamp = new THREE.Mesh(new THREE.SphereGeometry(0.05, 8, 6), ownMat(new THREE.MeshBasicMaterial({ color: 0xff4b3e }))); LV.keypadLamp.position.set(K.x - 0.07, K.y + 0.38, K.z); G.add(LV.keypadLamp); const R9 = W.rooms[W.rooms.length - 1]; - const ex = new THREE.Mesh(new THREE.PlaneGeometry(1.6, 0.5), ownMat(new THREE.MeshBasicMaterial({ map: signTex('EXIT', { bg: '#0f6b3f', edge: '#7cf0b0', ink: '#eafff2' }) }))); + const ex = new THREE.Mesh(new THREE.PlaneGeometry(1.6, 0.5), ownMat(new THREE.MeshBasicMaterial({ map: signTex('EXIT', { bg: '#0f6b3f', edge: '#7cf0b0', ink: '#eafff2', clean: 1 }) }))); ex.position.set(R9.cx, CORR_TOP + 3.1, R9.z1 - 0.02); ex.rotation.y = Math.PI; G.add(ex); const glow = new THREE.Mesh(new THREE.PlaneGeometry(8, 6), ownMat(new THREE.MeshBasicMaterial({ color: 0xffffff }))); glow.position.set(R9.cx, CORR_TOP + 2, R9.z1 + 6.95); glow.rotation.y = Math.PI; G.add(glow); } // the doors in each far wall: a dark frame, a lamp and an EXIT sign on every one; the shut ones are barred - const exitTex = signTex('EXIT', { bg: '#0f6b3f', edge: '#7cf0b0', ink: '#eafff2' }), exitMat = ownMat(new THREE.MeshBasicMaterial({ map: exitTex, fog: true })); + const exitTex = signTex('EXIT', { bg: '#0f6b3f', edge: '#7cf0b0', ink: '#eafff2', clean: 1 }), exitMat = ownMat(new THREE.MeshBasicMaterial({ map: exitTex, fog: true })); const lampMat = ownMat(new THREE.MeshBasicMaterial({ color: 0xffd27a, fog: true })); for (const D of W.doors) { const z = D.z - 0.27, g = new THREE.Group(); g.position.set(D.x, TOP, z); G.add(g); @@ -1508,6 +1811,8 @@

YOU ESCAPED

for (const y of [0.9, 2.3]) { const b = new THREE.Mesh(BOX, MAT.door); b.position.set(0, y, -0.06); b.scale.set(3.9, 0.08, 0.06); g.add(b); } } LV.doors.push({ D, lamp }); + // each door's lamp lights the way to it (the open one a little warmer and brighter) + LV.lamps.push({ x: D.x, y: TOP + 4.0, z: z - 0.6, w: D.real ? 1.5 : 1.1, k: 'door', ph: 0, im: null, i: 0, col: D.real ? 0xffcf7a : 0xd8b878, cur: 1 }); } // the lobby: two stalls and the party pad const L = W.lobby; @@ -1516,45 +1821,89 @@

YOU ESCAPED

const desk = new THREE.Mesh(BOX, MAT.lane); desk.position.y = 0.5; desk.scale.set(3.2, 1, 1.2); g.add(desk); const post1 = new THREE.Mesh(BOX, MAT.dark); post1.position.set(-1.5, 1.4, -0.5); post1.scale.set(0.08, 2.8, 0.08); g.add(post1); const post2 = post1.clone(); post2.position.x = 1.5; g.add(post2); - const can = new THREE.Mesh(BOX, ownMat(new THREE.MeshLambertMaterial({ color: st.k === 'equip' ? 0x2bb3a8 : 0xf2c14e }))); can.position.set(0, 2.85, -0.2); can.scale.set(3.6, 0.14, 1.8); g.add(can); - const sg = new THREE.Mesh(new THREE.PlaneGeometry(3, 0.75), ownMat(new THREE.MeshBasicMaterial({ map: signTex(st.n.toUpperCase() + '|Walk up and press E') }))); sg.position.set(0, 2.3, 0.45); g.add(sg); + const can = new THREE.Mesh(BOX, ownMat(lampPatch(new THREE.MeshLambertMaterial({ color: st.k === 'equip' ? 0x3f8f80 : 0xc99a3c })))); can.position.set(0, 2.85, -0.2); can.scale.set(3.6, 0.14, 1.8); g.add(can); + const sg = new THREE.Mesh(new THREE.PlaneGeometry(3, 0.75), ownMat(new THREE.MeshBasicMaterial({ map: signTex(st.n.toUpperCase() + '|Walk up and press E'), color: 0xb5b2a6 }))); sg.position.set(0, 2.3, 0.45); g.add(sg); G.add(g); } const pad = new THREE.Mesh(new THREE.RingGeometry(L.pad.r - 0.25, L.pad.r, 48).rotateX(-Math.PI / 2), ownMat(new THREE.MeshBasicMaterial({ color: 0x46f0d8, transparent: true, opacity: 0.85 }))); pad.position.set(L.pad.x, L.pad.y + 0.01, L.pad.z); G.add(pad); LV.pad = pad; - const ps = new THREE.Mesh(new THREE.PlaneGeometry(4.2, 1.05), ownMat(new THREE.MeshBasicMaterial({ map: signTex('TOUCH TO CREATE A PARTY|Stand in the ring · Tab opens it too') }))); + const ps = new THREE.Mesh(new THREE.PlaneGeometry(4.2, 1.05), ownMat(new THREE.MeshBasicMaterial({ map: signTex('TOUCH TO CREATE A PARTY|Stand in the ring · Tab opens it too'), color: 0xb5b2a6 }))); ps.position.set(0, 3.2, -1.2); ps.rotation.y = Math.PI; G.add(ps); - const ls = new THREE.Mesh(new THREE.PlaneGeometry(4.2, 1.05), ownMat(new THREE.MeshBasicMaterial({ map: signTex('HUSH POOLS|Don\'t splash. Escape together.') }))); + const ls = new THREE.Mesh(new THREE.PlaneGeometry(4.2, 1.05), ownMat(new THREE.MeshBasicMaterial({ map: signTex('BLACKWADE|Don\'t splash. Escape together.'), color: 0xb5b2a6 }))); ls.position.set(0, 3.4, -25.9); G.add(ls); return LV; } -// The water: see-through teal with moving caustics, and the noise rings drawn into it. +// The water: murky green-black under a scum film, flecked with the lamps' reflections, with something pale now and then +// just under the surface, and the noise rings drawn into it (pale and sharp, so they read on the dark water). const RINGS = 14; const WATER = new THREE.ShaderMaterial({ transparent: true, depthWrite: false, - uniforms: { uTime: U.time, uRings: { value: Array.from({ length: RINGS }, () => new THREE.Vector4()) }, uCam: { value: new THREE.Vector3() }, - uFog: { value: new THREE.Color(FOG) }, uNear: { value: FOG_NEAR }, uFar: { value: FOG_FAR }, uFlare: { value: new THREE.Vector4(0, 0, 0, 0) } }, + uniforms: Object.assign({ uTime: U.time, uRings: { value: Array.from({ length: RINGS }, () => new THREE.Vector4()) }, uCam: { value: new THREE.Vector3() }, + uFog: { value: new THREE.Color(FOG) }, uNear: { value: FOG_NEAR }, uFar: { value: FOG_FAR }, uFlare: { value: new THREE.Vector4(0, 0, 0, 0) }, uShapes: { value: REDUCED ? 0 : 1 } }, LAMPU), vertexShader: 'varying vec3 vWP; void main(){ vec4 w = modelMatrix * vec4(position, 1.0); vWP = w.xyz; gl_Position = projectionMatrix * viewMatrix * w; }', - fragmentShader: `uniform float uTime; uniform vec4 uRings[${RINGS}]; uniform vec3 uCam; uniform vec3 uFog; uniform float uNear; uniform float uFar; uniform vec4 uFlare; varying vec3 vWP;` + GLSL_CAUSTIC + ` + fragmentShader: `uniform float uTime; uniform vec4 uRings[${RINGS}]; uniform vec3 uCam; uniform vec3 uFog; uniform float uNear; uniform float uFar; uniform vec4 uFlare; uniform float uShapes; varying vec3 vWP;` + GLSL_LAMPS + ` void main(){ - vec2 p = vWP.xz; - float w = sin(p.x * 1.7 + uTime * 0.9) * 0.5 + sin(p.y * 2.3 - uTime * 1.1) * 0.5 + sin((p.x + p.y) * 3.1 + uTime * 1.7) * 0.25; - vec3 col = mix(vec3(0.16, 0.55, 0.56), vec3(0.42, 0.80, 0.78), 0.5 + 0.1 * w) + vec3(0.6, 0.95, 0.92) * caustic(p * 0.45, uTime * 0.8) * 0.16; + vec2 p = vWP.xz; float t = uTime; + float n1 = texture2D(uNoise, p * 0.05 + vec2(t * 0.003, t * 0.0015)).r; + float n2 = texture2D(uNoise, p * 0.09 - vec2(t * 0.004, -t * 0.002)).g; + vec2 q = p * 0.13 + vec2(t * 0.011, t * 0.007); + float hA = texture2D(uNoise, q).b, hB = texture2D(uNoise, q + vec2(0.04, 0.0)).b, hC = texture2D(uNoise, q + vec2(0.0, 0.04)).b; + vec3 N = normalize(vec3((hA - hB) * 0.9, 1.0, (hA - hC) * 0.9)); + vec3 col = mix(vec3(0.018, 0.034, 0.028), vec3(0.04, 0.066, 0.05), n1); + // scum: a dull green-brown film in drifting patches + float scum = smoothstep(0.55, 0.8, n1 * 0.6 + n2 * 0.4); + col = mix(col, vec3(0.13, 0.14, 0.085) * (0.8 + 0.4 * n2), scum * 0.7); + // something pale just under the surface, drifting, never clear + vec2 cl = floor(p / 9.0); float hh = fract(sin(dot(cl, vec2(41.3, 289.1))) * 43758.5); + if (hh > 0.62 && uShapes > 0.0) { + vec2 c = cl * 9.0 + 4.5 + vec2(sin(t * 0.07 + hh * 20.0), cos(t * 0.05 + hh * 13.0)) * 2.4; + float an = hh * 6.28 + t * 0.03; vec2 d = p - c; d = vec2(d.x * cos(an) - d.y * sin(an), d.x * sin(an) + d.y * cos(an)); + float sh = smoothstep(1.0, 0.0, length(d * vec2(1.0, 3.2))) * (0.55 + 0.45 * sin(t * 0.4 + hh * 9.0)); + col += vec3(0.05, 0.065, 0.055) * sh * (1.0 - scum); + } + // the lamps: a dim pool on the water under each, and a sharp glint where it reflects toward you + vec3 V = normalize(uCam - vWP), R = reflect(-V, N), lit = vec3(0.0); + for (int i = 0; i < ${LAMP_N}; i++) { + vec4 L = uLamp[i]; if (L.w <= 0.0) continue; + vec3 d = L.xyz - vWP; float r2 = dot(d, d); + float a = L.w * (1.0 - smoothstep(1.2, 8.0, length(d.xz))) / (1.0 + 0.045 * r2); + lit += uLampC[i] * (a * 0.16 + L.w * pow(max(dot(R, d * inversesqrt(r2)), 0.0), 90.0) * 0.6 / (1.0 + 0.012 * r2)); + } + col += lit * (1.0 - 0.6 * scum); float ring = 0.0; - for (int i = 0; i < ${RINGS}; i++) { vec4 r = uRings[i]; if (r.w <= 0.0) continue; float d = abs(length(p - r.xy) - r.z); ring += r.w * (smoothstep(0.28, 0.0, d) + 0.3 * smoothstep(1.4, 0.0, d) * step(length(p - r.xy), r.z)); } - col += vec3(0.9, 1.0, 1.0) * min(ring, 1.4); + for (int i = 0; i < ${RINGS}; i++) { vec4 r = uRings[i]; if (r.w <= 0.0) continue; float dd = length(p - r.xy), d = abs(dd - r.z); ring += r.w * (smoothstep(0.24, 0.0, d) + 0.22 * smoothstep(1.4, 0.0, d) * step(dd, r.z) + smoothstep(0.45, 0.0, dd) * (1.0 - smoothstep(0.3, 1.2, r.z))); } + col += vec3(0.78, 0.92, 0.84) * min(ring, 1.3) * 0.9; if (uFlare.w > 0.0) col += vec3(1.0, 0.25, 0.2) * uFlare.w * smoothstep(7.0, 0.0, length(p - uFlare.xy)) * 0.5; - vec3 v = normalize(uCam - vWP); float fr = pow(1.0 - max(v.y, 0.0), 3.0); - col = mix(col, vec3(0.86, 0.97, 0.96), fr * 0.45); + float fr = pow(1.0 - max(V.y, 0.0), 3.0); + col = mix(col, uFog * 2.2 + vec3(0.02, 0.03, 0.025), fr * 0.35); float fogF = smoothstep(uNear, uFar, length(uCam - vWP)); - // shallow and clear: you can see the floor tiles (and its feet) through it, but not ripples' worth of detail - gl_FragColor = vec4(mix(col, uFog, fogF), mix(0.5 + fr * 0.38 + min(ring, 1.0) * 0.25, 1.0, fogF)); + // knee deep and murky: the floor and feet show through only faintly + gl_FragColor = vec4(mix(col, uFog, fogF), mix(0.8 + fr * 0.15 + min(ring, 1.0) * 0.08, 1.0, fogF)); }` }); +// Light falling through the air under a working panel: brightest at the top, soft at the edges, and gone when the camera +// is close or inside it (so it never washes over the screen). +const CONE_MAT = new THREE.ShaderMaterial({ + transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide, uniforms: { uTint: { value: new THREE.Color(0x2a261d) } }, + vertexShader: `varying float vV; varying vec3 vWP; varying vec3 vWN; varying vec3 vC; + void main(){ vec4 w = vec4(position, 1.0); vec3 n = normal; vC = vec3(1.0); + #ifdef USE_INSTANCING + w = instanceMatrix * w; n = mat3(instanceMatrix) * n; + #endif + #ifdef USE_INSTANCING_COLOR + vC = instanceColor; + #endif + w = modelMatrix * w; vWP = w.xyz; vWN = normalize(mat3(modelMatrix) * n); vV = uv.y; gl_Position = projectionMatrix * viewMatrix * w; }`, + fragmentShader: `uniform vec3 uTint; varying float vV; varying vec3 vWP; varying vec3 vWN; varying vec3 vC; + void main(){ vec3 V = cameraPosition - vWP; float d = length(V); + float k = pow(vV, 1.6) * abs(dot(normalize(vWN), V / d)) * smoothstep(1.5, 5.5, d) * (1.0 - smoothstep(22.0, 32.0, d)); + gl_FragColor = vec4(uTint * vC * k * 1.6, 1.0); }` +}); // ---- People and the monster ---- const SKIN = 0xe8c4a8; function makeSwimmer(color) { - const g = new THREE.Group(), cm = new THREE.MeshLambertMaterial({ color }), dm = new THREE.MeshLambertMaterial({ color: 0x24363a }), sm = new THREE.MeshLambertMaterial({ color: SKIN }); + // a soft warm rim on every swimmer so teammates (and you) stay findable in the dark + const g = new THREE.Group(), cm = lampPatch(new THREE.MeshLambertMaterial({ color }), 0x3a3428), dm = lampPatch(new THREE.MeshLambertMaterial({ color: 0x2a3433 }), 0x2a2a22), sm = lampPatch(new THREE.MeshLambertMaterial({ color: SKIN }), 0x3a3428); const body = new THREE.Group(); g.add(body); const torso = new THREE.Mesh(new THREE.CylinderGeometry(0.24, 0.27, 0.72, 12), cm); torso.position.y = 1.08; body.add(torso); const hood = new THREE.Mesh(new THREE.SphereGeometry(0.25, 12, 10, 0, Math.PI * 2, 0, Math.PI / 2), cm); hood.position.y = 1.43; body.add(hood); @@ -1586,7 +1935,8 @@

YOU ESCAPED

// The monster: very tall, starved and hunched, dark wet skin like something that's been in the water too long, milky // blind eyes, long black hair stuck to it, a mouth that splits back to where ears would be, arms long enough to trail // in the water, and knees that bend the wrong way. -const MON_MAT = new THREE.MeshPhongMaterial({ color: 0x4c5650, specular: 0x6c7f7a, shininess: 90, emissive: 0x050706 }); +// (Blackwade: lit by the working lamps too, with a cold rim so its silhouette still reads against the dark halls) +const MON_MAT = lampPatch(new THREE.MeshPhongMaterial({ color: 0x4c5650, specular: 0x6c7f7a, shininess: 90, emissive: 0x050706 }), 0x55716b); const MON_EYE = new THREE.MeshPhongMaterial({ color: 0xc9d3cc, specular: 0x9aa6a0, shininess: 40, emissive: 0x3a4440 }); const MON_HAIR = new THREE.MeshPhongMaterial({ color: 0x070808, specular: 0x5c6a68, shininess: 120, side: THREE.DoubleSide }); const MON_DARK = new THREE.MeshBasicMaterial({ color: 0x050404 }); @@ -1714,7 +2064,7 @@

YOU ESCAPED

const DROPS = 260; const dropPos = new Float32Array(DROPS * 3), dropVel = new Float32Array(DROPS * 3), dropLife = new Float32Array(DROPS); const dropGeo = new THREE.BufferGeometry(); dropGeo.setAttribute('position', new THREE.BufferAttribute(dropPos, 3)); -const drops = new THREE.Points(dropGeo, new THREE.PointsMaterial({ color: 0xe9fffb, size: 0.09, transparent: true, opacity: 0.9, depthWrite: false })); +const drops = new THREE.Points(dropGeo, new THREE.PointsMaterial({ color: 0xa9bcaf, size: 0.09, transparent: true, opacity: 0.85, depthWrite: false })); drops.frustumCulled = false; scene.add(drops); let dropNext = 0; function splash(x, y, z, n, up) { @@ -1749,6 +2099,36 @@

YOU ESCAPED

const arcEnd = new THREE.Mesh(new THREE.RingGeometry(0.22, 0.32, 24).rotateX(-Math.PI / 2), new THREE.MeshBasicMaterial({ color: 0xf2c14e, transparent: true, opacity: 0.9, depthWrite: false })); arcEnd.visible = false; scene.add(arcEnd); const arcP = { x: 0, y: 0, z: 0, vx: 0, vy: 0, vz: 0, k: 0, skips: 0 }; +// The landing marker: while you're in the air, where you'll come down and what it will sound like. Three looks that +// differ in shape as well as colour: a thin pale ring (quiet), a thick amber ring with notches (loud), a red ring with a +// cross (wet). And a red water line around your legs when your feet are about to touch the surface. +const MARK_TEX = { + quiet: canvasTex(128, 128, (g) => { g.strokeStyle = '#8fe0cd'; g.lineWidth = 7; g.beginPath(); g.arc(64, 64, 50, 0, 7); g.stroke(); g.fillStyle = 'rgba(143,224,205,.14)'; g.fill(); g.fillStyle = '#8fe0cd'; g.beginPath(); g.arc(64, 64, 6, 0, 7); g.fill(); }), + loud: canvasTex(128, 128, (g) => { g.strokeStyle = '#eab54e'; g.lineWidth = 12; g.beginPath(); g.arc(64, 64, 48, 0, 7); g.stroke(); g.lineWidth = 8; for (let i = 0; i < 4; i++) { const a = i * Math.PI / 2 + Math.PI / 4; g.beginPath(); g.moveTo(64 + Math.cos(a) * 18, 64 + Math.sin(a) * 18); g.lineTo(64 + Math.cos(a) * 34, 64 + Math.sin(a) * 34); g.stroke(); } }), + wet: canvasTex(128, 128, (g) => { g.strokeStyle = '#ff5d4d'; g.lineWidth = 9; g.setLineDash([16, 9]); g.beginPath(); g.arc(64, 64, 50, 0, 7); g.stroke(); g.setLineDash([]); g.lineWidth = 10; g.beginPath(); g.moveTo(44, 44); g.lineTo(84, 84); g.moveTo(84, 44); g.lineTo(44, 84); g.stroke(); }) +}; +const MARK_WORD = { quiet: 'quiet', edge: 'loud · rim', hard: 'loud · drop', climb: 'pull-up · noisy', fall: 'water · loud' }; +const marker = new THREE.Mesh(new THREE.PlaneGeometry(0.95, 0.95).rotateX(-Math.PI / 2), new THREE.MeshBasicMaterial({ map: MARK_TEX.quiet, transparent: true, depthWrite: false, fog: false })); +marker.renderOrder = 5; marker.visible = false; scene.add(marker); +const wline = new THREE.Mesh(new THREE.RingGeometry(0.31, 0.4, 36).rotateX(-Math.PI / 2), new THREE.MeshBasicMaterial({ color: 0xff5d4d, transparent: true, depthWrite: false, fog: false })); +wline.renderOrder = 5; wline.visible = false; scene.add(wline); +function drawMarker(W, me, V) { + const p = G.body, up = me && me.st === 0 && G.mode === 'play' && (V.ph === 'run' || V.ph === 'lobby' || V.ph === 'count'); + G.pred = up && !p.gr && !p.inW && G.inp ? predictLanding(W, p, G.inp, 2) : null; + const pr = G.pred; + marker.visible = !!pr && pr.t > 0.06; + if (marker.visible) { + const k = pr.k, tex = k === 'quiet' ? MARK_TEX.quiet : k === 'fall' ? MARK_TEX.wet : MARK_TEX.loud; + if (marker.material.map !== tex) { marker.material.map = tex; marker.material.needsUpdate = true; } + marker.position.set(pr.x, (k === 'fall' ? waterY(W, pr.z) : pr.y) + 0.03, pr.z); + const sc = REDUCED ? 1 : 1 + Math.min(0.3, pr.t * 0.3); marker.scale.set(sc, 1, sc); + if (V.ph === 'run') tip('air'); + } + // the water line: about to touch the surface, or standing on a tile that's going under + const wy = waterY(W, p.z), sinking = p.gr && p.gr.y1 != null && p.gr.y1 < wy + 0.3; + wline.visible = !!up && !p.inW && (sinking || (!!pr && pr.k === 'fall' && p.y - wy < 1.1)); + if (wline.visible) { wline.position.set(p.x, wy + 0.015, p.z); wline.material.opacity = REDUCED ? 0.85 : 0.6 + 0.35 * Math.sin(U.time.value * 9); } +} function drawArc(W, o, v, k, skips) { Object.assign(arcP, { x: o[0], y: o[1], z: o[2], vx: v[0], vy: v[1], vz: v[2], k, skips }); let n = 0, end = ''; @@ -1796,7 +2176,7 @@

YOU ESCAPED

AU.noise = C.createBuffer(1, C.sampleRate * 2, C.sampleRate); const nd = AU.noise.getChannelData(0); for (let i = 0; i < nd.length; i++) nd[i] = Math.random() * 2 - 1; // the hum of the lights, a low drone, a far-off rumble const buzz = C.createOscillator(); buzz.type = 'sawtooth'; buzz.frequency.value = 120; const bp = C.createBiquadFilter(); bp.type = 'bandpass'; bp.frequency.value = 2400; bp.Q.value = 9; - const bg = C.createGain(); bg.gain.value = 0.02; buzz.connect(bp); bp.connect(bg); bg.connect(AU.amb); buzz.start(); + const bg = C.createGain(); bg.gain.value = 0.007; buzz.connect(bp); bp.connect(bg); bg.connect(AU.amb); buzz.start(); for (const f of [55, 82.4]) { const o = C.createOscillator(); o.frequency.value = f; const g = C.createGain(); g.gain.value = 0.028; o.connect(g); g.connect(AU.amb); g.connect(AU.revIn); o.start(); } const rn = C.createBufferSource(); rn.buffer = AU.noise; rn.loop = true; const lp = C.createBiquadFilter(); lp.type = 'lowpass'; lp.frequency.value = 260; const rg = C.createGain(); rg.gain.value = 0.05; rn.connect(lp); lp.connect(rg); rg.connect(AU.amb); rn.start(); AU.buzzG = bg; @@ -1835,7 +2215,8 @@

YOU ESCAPED

case 'hard': case 'edge': tn(d, t, 130, 55, 0.2, 'sine', 0.6 * k); nz(d, t, 0.1, 'lowpass', 700, 1, 0.3 * k); break; case 'sprint': nz(d, t, 0.07, 'bandpass', 2600, 2, 0.16 * k); break; case 'step': nz(d, t, 0.05, 'lowpass', 900, 1, 0.05 * k); break; - case 'land': nz(d, t, 0.08, 'lowpass', 600, 1, 0.12 * k); break; + case 'land': tn(d, t, 92, 46, 0.3, 'sine', 0.2 * k); nz(d, t, 0.09, 'lowpass', 520, 1, 0.08 * k); nz(d, t + 0.13, 0.4, 'bandpass', 720, 1.3, 0.045 * k, 360); break; // a soft watery whumph, then the lap + case 'slosh': tn(d, t, 120, 50, 0.22, 'sine', 0.25 * k); nz(d, t, 0.06, 'highpass', 1800, 0.8, 0.12 * k); nz(d, t + 0.04, 0.55, 'bandpass', 1300, 1, 0.2 * k, 420); nz(d, t + 0.32, 0.4, 'bandpass', 800, 1.2, 0.08 * k, 400); break; // a slap and the water slopping back case 'pebble': tn(d, t, 1900, 1200, 0.09, 'triangle', 0.25 * k); nz(d, t + 0.01, 0.25, 'bandpass', 1800, 1.5, 0.3 * k, 900); break; case 'skip': tn(d, t, 2300, 1700, 0.06, 'triangle', 0.2 * k); nz(d, t, 0.12, 'bandpass', 2200, 2, 0.2 * k); break; case 'bottle': case 'echo': { const v = name === 'echo' ? 0.4 : 1; nz(d, t, 0.5, 'highpass', 3000, 0.7, 0.6 * k * v); for (let i = 0; i < 6; i++) tn(d, t + Math.random() * 0.3, 2500 + Math.random() * 2200, 2200, 0.12, 'sine', 0.12 * k * v); break; } @@ -1864,6 +2245,12 @@

YOU ESCAPED

case 'drip': tn(d, t, 1500 + Math.random() * 900, 700, 0.12, 'sine', 0.12 * k); break; case 'escape': [523, 659, 784, 1047].forEach((f, i) => tn(d, t + i * 0.14, f, f, 0.35, 'triangle', 0.12)); break; case 'click': tn(d, t, 700, 700, 0.03, 'square', 0.04); break; + // far-off sounds of the building itself (never splashes, so they can't be mistaken for a noise it hears) + case 'clank': { const f = 260 + Math.random() * 160; [1, 1.47, 2.31, 3.1].forEach((m, i) => tn(d, t + i * 0.004, f * m, f * m * 0.985, 1.4 - i * 0.25, 'sine', 0.05 * k / (i + 1))); nz(d, t, 0.06, 'bandpass', 1800, 2, 0.08 * k); break; } + case 'groan': { const o = AU.ctx.createOscillator(), f = AU.ctx.createBiquadFilter(), g = AU.ctx.createGain(), f0 = 38 + Math.random() * 22; + o.type = 'sawtooth'; o.frequency.setValueAtTime(f0, t); o.frequency.linearRampToValueAtTime(f0 * 1.35, t + 1.1); o.frequency.linearRampToValueAtTime(f0 * 0.9, t + 2.6); + f.type = 'lowpass'; f.frequency.value = 260; f.Q.value = 6; g.gain.setValueAtTime(0.0001, t); g.gain.exponentialRampToValueAtTime(0.07 * k, t + 0.7); g.gain.exponentialRampToValueAtTime(0.0001, t + 2.8); + o.connect(f); f.connect(g); g.connect(d); o.start(t); o.stop(t + 2.9); break; } } } // A harsh edge for the shrieks (one shared shaper), and the rest of the sound dipping under the scare. @@ -1902,6 +2289,7 @@

YOU ESCAPED

heartT: 0, dripT: 2, toastT: 0, lastValves: 0, lastDoor: 0, lastKb: 0, kpCode: '', noiseShow: 0, noiseLbl: 'Silent', menuT: 0, others: new Map(), monViews: [], lastCp: 0, sawWon: -1 }; G.V = G.S; +Object.assign(G, { tipQ: [], tipT: 0, tipGap: 0, tipK: '', pred: null, inp: null, noiseCls: '', moveT: 0, ambT: 8 }); let ME = null; // my swimmer mesh function ensureWorld(df, seed) { const k = df + ':' + seed; if (G.Wk === k && G.W) return; @@ -2299,12 +2687,16 @@

YOU ESCAPED

function addPing(u, n, k, x, y, z) { for (let i = pingList.length - 1; i >= 0; i--) if (pingList[i].u === u) { pingList[i].el.remove(); pingList.splice(i, 1); } const el = document.createElement('div'); el.className = 'pg' + (k === 3 ? ' danger' : ''); el.textContent = PINGS[k] || 'HERE'; $('tags').appendChild(el); pingList.push({ u, x, y: y + 0.4, z, t: performance.now(), el }); } // ---- Panels ---- -function closePanels() { ['party', 'shop', 'keypad', 'settings', 'pause'].forEach(id => $(id).hidden = true); if (G.panel === 'chat') closeChat(); G.panel = ''; lockPointer(); } +function closePanels() { ['party', 'shop', 'keypad', 'settings', 'pause', 'nhelp'].forEach(id => $(id).hidden = true); if (G.panel === 'chat') closeChat(); G.panel = ''; lockPointer(); } function openPanel(id) { closePanels(); G.panel = id; $(id).hidden = false; if (document.pointerLockElement) document.exitPointerLock(); } function openPause() { openPanel('pause'); $('pauseSub').textContent = G.online ? 'The run keeps going for everyone else.' : 'The run is paused.'; } $('resume').onclick = () => closePanels(); $('pauseParty').onclick = () => openParty(); $('pauseSet').onclick = () => openSettings(); +$('pauseHelp').onclick = () => { openPanel('nhelp'); renderNoiseHelp(); }; +$('helpBtn').onclick = () => { renderNoiseHelp(); $('nhelp').hidden = false; }; +$('nhelpClose').onclick = () => { $('nhelp').hidden = true; if (G.mode === 'play') closePanels(); }; +$('nhelpTips').onclick = () => { SET.tips = {}; saveSet(); $('nhelpTips').textContent = 'Tips will show again'; }; $('leave').onclick = () => toMenu(); $('menuBtn').onclick = () => openPause(); function openParty() { openPanel('party'); renderParty(); } @@ -2404,7 +2796,7 @@

YOU ESCAPED

} $('setBtn').onclick = () => { $('settings').hidden = false; openSettings(); G.panel = G.mode === 'play' ? 'settings' : ''; $('menu').hidden = G.mode !== 'menu' ? true : false; }; $('setClose').onclick = () => { $('settings').hidden = true; if (G.mode === 'play') closePanels(); else G.panel = ''; }; -function applyGfx() { gfx = SET.gfx; renderer.setPixelRatio(Math.min(devicePixelRatio || 1, gfx >= 2 ? 2 : gfx === 1 ? 1.25 : 0.8)); G.fogK = null; drops.visible = gfx > 0; resize(); } +function applyGfx() { gfx = SET.gfx; renderer.setPixelRatio(Math.min(devicePixelRatio || 1, gfx >= 2 ? 2 : gfx === 1 ? 1.25 : 0.8)); G.fogK = null; drops.visible = gfx > 0; if (LV && LV.cones) LV.cones.visible = gfx > 0; resize(); } // results $('again').onclick = () => { if (!G.host) { $('resMsg').textContent = 'Waiting for the host…'; return; } $('result').hidden = true; G.panel = ''; hostStartRun(G.S.df); lockPointer(); }; $('toLobby').onclick = () => { @@ -2457,7 +2849,73 @@

YOU ESCAPED

else if (G.online) { for (const p of partyPeople()) h += '
' + esc(p.n) + '' + (p.rd ? 'READY' : '') + '
'; } if (G.teamKey !== h) { G.teamKey = h; $('team').innerHTML = h; } } -const NOISE_LBL = { fall: 'SPLASH!', clip: 'Feet in the water', hard: 'Hard landing', edge: 'Landed on the edge', sprint: 'Running steps', wade: 'Wading', wadeRun: 'Running in water!', wadeCreep: 'Wading slowly', climb: 'Climbed out', struggle: 'Struggling', bump: 'Bumped it!' }; +// What made each noise, in words and a small icon. wet: a water noise (shown red); the rest go amber when loud. +const SVG = d => ''; +const NIC = { + drop: SVG(''), + wave: SVG(''), + land: SVG(''), + steps: SVG(''), + bump: SVG(''), + burst: SVG(''), + quiet: SVG(''), + ring: SVG('') +}; +const NOISE_INFO = { + fall: { t: 'Into the water', ic: 'drop', wet: 1 }, clip: { t: 'Feet touched water', ic: 'drop', wet: 1 }, struggle: { t: 'Struggling', ic: 'wave', wet: 1 }, + wade: { t: 'Wading', ic: 'wave', wet: 1 }, wadeRun: { t: 'Running in water', ic: 'wave', wet: 1 }, wadeCreep: { t: 'Wading slowly', ic: 'wave', wet: 1 }, climb: { t: 'Pulled up onto a tile', ic: 'land' }, + hard: { t: 'Hard landing', ic: 'land' }, edge: { t: 'Edge landing', ic: 'land' }, sprint: { t: 'Running', ic: 'steps' }, bump: { t: 'Bumped into it', ic: 'bump' }, + pebble: { t: 'Pebble', ic: 'burst' }, skip: { t: 'Pebble skip', ic: 'burst' }, bottle: { t: 'Bottle smash', ic: 'burst' }, echo: { t: 'Echo', ic: 'burst' }, toy: { t: 'Wind-up toy', ic: 'burst' }, + valve: { t: 'Valve', ic: 'burst' }, keypad: { t: 'Wrong code', ic: 'burst' } +}; +const noiseTier = (src, l) => (NOISE_INFO[src] || {}).wet ? 'l3' : l >= 0.4 ? 'l2' : 'l1'; +// Labels where a noise happened: scaled by loudness, rising a little and fading. Quiet ones (a clean landing) are small and calm. +const noiseTags = []; +function noiseTag(x, y, z, html, cls, scale, life) { + if (noiseTags.length >= 10) { const o = noiseTags.shift(); o.el.remove(); } + const el = document.createElement('div'); el.className = 'nz ' + cls; el.innerHTML = html; $('tags').appendChild(el); + noiseTags.push({ el, x, y, z, t: 0, life: life || 1.8, sc: scale || 1 }); +} +// One short lesson per idea, the first time you do the thing; remembered in this browser's settings (SET.tips). +const TIPS = { + quiet: ['quiet', 'Walking and creeping are silent. It hunts by sound alone.'], + air: ['land', 'The ring under you is where you\'ll land: pale is quiet, amber is loud, red is water.'], + rim: ['land', 'Loud landing. Come down on the worn middle of a tile, not its dark rim.'], + run: ['steps', TOUCH ? 'Running is loud. Turn RUN off to walk silently.' : 'Running is loud. Let go of Shift to walk silently.'], + wet: ['drop', 'Water is loud. Going in splashes, and every step you wade splashes again. Get back onto a tile.'], + climb: ['land', 'Pulling yourself up onto a tile is a little noisy. Jump long enough to land on top.'], + ring: ['ring', 'Rings on the water show how far a sound carried. Outside the ring, it didn\'t hear.'], + still: ['bump', 'It\'s close. Stand still and quiet: it can\'t see you.'] +}; +function tip(k) { SET.tips = SET.tips || {}; if (SET.tips[k] || G.tipQ.includes(k) || G.tipK === k) return; G.tipQ.push(k); } +function tipFrame(dt) { + const el = $('teach'); + const busy = G.V.ph !== 'run' || (myRec() && myRec().st !== 0) || !!G.scare; // never over the scare, or while you're down + if (G.tipT > 0) { G.tipT -= dt; if (G.tipT <= 0 || busy) { el.classList.remove('on'); G.tipK = ''; G.tipT = 0; G.tipGap = 0.8; } return; } + if (G.tipGap > 0) { G.tipGap -= dt; return; } + if (busy || G.panel || !G.tipQ.length || G.toastT > 0) return; // (one message at a time: a toast goes first) + const k = G.tipQ.shift(); SET.tips = SET.tips || {}; SET.tips[k] = 1; saveSet(); + G.tipK = k; G.tipT = 4.8; el.innerHTML = NIC[TIPS[k][0]] + '' + TIPS[k][1] + ''; el.classList.add('on'); +} +// The "How noise works" card: every cause from loudest to quietest, with how far each carries on this difficulty. +function renderNoiseHelp() { + const df = G.V && G.V.ph !== 'lobby' && G.V.ph !== 'count' ? G.V.df : (G.S.df || 1), L = TUNING.loud, top = hearRadius(L.bottle, df); + const row = (ic, t, l, d, wet) => '
' + NIC[ic] + '' + t + '
' + (l ? '' : '') + '
' + d + (l ? ' Heard up to ' + Math.round(hearRadius(l, df)) + ' m away.' : '') + '
'; + $('nhelpList').innerHTML = '

What you do · ' + DIFFS[df].n + '

' + + row('drop', 'Going into the water', L.fall, 'Stepping, falling or coming up short into it. (Out again before anyone heard the splash: feet touching water, ' + Math.round(hearRadius(L.clip, df)) + ' m.)', 1) + + row('wave', 'Running in the water', L.wadeRun, 'Every ' + TUNING.wadeStep + ' m you wade at a run.', 1) + + row('wave', 'Wading', L.wade, 'Every ' + TUNING.wadeStep + ' m you wade at a walk.', 1) + + row('wave', 'Wading slowly (creeping)', L.wadeCreep, 'Every ' + TUNING.wadeStep + ' m you creep through it. Quieter, never silent.', 1) + + row('bump', 'Bumping into it', L.bump, 'Walking right into it.') + + row('land', 'Edge or hard landing', L.hard, 'Landing with your middle on a tile\'s dark rim, or a big drop. The ring under you shows it before you land.') + + row('land', 'Pulling yourself up onto a tile', L.climb, 'Out of the water, or after a jump that comes up just short.') + + row('steps', 'Running', L.sprint, 'Each step while you run on a tile.') + + row('quiet', 'Walking, creeping, standing still on tiles', 0, 'Silent. So is landing on the worn middle of a tile.') + + '

What you use

' + + row('burst', 'Bottle', L.bottle, 'Smashes, then echoes a moment later.') + row('burst', 'Valve', L.valve, 'All the time you hold E on it.') + + row('burst', 'Pebble into water', L.pebbleWater, 'A pebble that skips is quieter each bounce.') + row('burst', 'Wind-up toy', L.toy, 'Rattles where it lands.') + + row('burst', 'Pebble on a tile', L.pebbleTile, 'Clatters, quietly.') + row('burst', 'Wrong keypad code', L.keypad, 'A short buzz.'); +} function objective() { const V = G.V, R = roomAt(G.W, G.body.z); if (V.ph === 'lobby' || V.ph === 'count') return ['Lobby', V.ph === 'count' ? 'Starting in ' + Math.ceil(V.count) + '…' : 'Stalls for gear and upgrades. Press E in the glowing ring to start a run.']; @@ -2508,6 +2966,7 @@

YOU ESCAPED

camera.lookAt(Math.sin(a) * 2, 0.8, camera.position.z + 8); drawMonsters(A.S.mons, dt, -1); if (ME) { ME.g.visible = false; ME.blob.visible = false; } + lampFrame(camera.position.x, camera.position.z + 6); floatFrame(dt); WATER.uniforms.uCam.value.copy(camera.position); updateRings(dt); stepDrops(dt); @@ -2554,7 +3013,9 @@

YOU ESCAPED

if (!G.host && V.ph === 'run') { const est = V.t + Math.max(0, Net.now() - V.ts) / 1000; G.clock = Math.abs(G.clock + dt - est) > 0.3 ? est : G.clock + dt + (est - G.clock - dt) * 0.1; } else if (G.host) G.clock = G.S.t; // teleports from the host - if (me && me.tp && me.tp[0] > G.tpSeen) { G.tpSeen = me.tp[0]; G.body = newBody(me.tp[1], me.tp[2], me.tp[3]); } + // (the landing count carries over: the host compares it with the last one it saw, so restarting it at 0 could hide + // the first landing after a teleport) + if (me && me.tp && me.tp[0] > G.tpSeen) { G.tpSeen = me.tp[0]; const li = G.body.li; G.body = newBody(me.tp[1], me.tp[2], me.tp[3]); G.body.li = li; } if (V.ph === 'lobby' && !G.online && !me) G.S.pl.me = newPlayerRec(myName()); // look const sens = 0.0022 * SET.sens; @@ -2564,23 +3025,23 @@

YOU ESCAPED

G.crouch = !!(keys.ControlLeft || keys.ControlRight || keys.KeyC || G.crouchT) && !G.panel; const iv = inputVec(); const inp = { mx: iv.mx, mz: iv.mz, jump: jumpQ && !G.panel, sprint: isSprint() && !G.panel, crouch: G.crouch }; - jumpQ = false; + jumpQ = false; G.inp = inp; if (alive) { if (!G.host || V.ph !== 'run') updateDyn(W, G.clock, dt, dynFeet(), V); - const n = Math.ceil(dt / (1 / 60)), h = dt / n; - for (let i = 0; i < n; i++) { stepPlayer(W, G.body, inp, h); if (i === 0) inp.jump = false; bodyEvents(); } - } else if (!G.host) updateDyn(W, G.clock, dt, dynFeet(), V); + const n = G.hold ? 0 : Math.ceil(dt / (1 / 60)), h = dt / Math.max(1, n); // G.hold: test browsers freeze your body + for (let i = 0; i < n; i++) { + stepPlayer(W, G.body, inp, h); if (i === 0) inp.jump = false; bodyEvents(); G.repT += h; + // a landing, a splash or a pull-up is reported on the step it happens, so the host judges the rim where you really + // came down (with 20 Hz reports alone it judged about 6% of landings from a spot 50 ms later) + if (G.body.ev.includes('land') || G.body.ev.includes('splash') || G.body.ev.includes('climb')) sendReport(); + } + if (V.ph === 'run' && Math.hypot(G.body.vx, G.body.vz) > 1 && roomAt(W, G.body.z).i === 0) { G.moveT += dt; if (G.moveT > 1) tip('quiet'); } + } else { G.repT += dt; if (!G.host) updateDyn(W, G.clock, dt, dynFeet(), V); } // hold E const it = interactTarget(); G.eAct = G.eHeld && it && it.hold ? it.hold : ''; if (G.host && G.S.pl[myUid()]) G.S.pl[myUid()].hold = alive ? G.eAct : ''; // tell the room (or the host part of this page) where we are, 20 times a second - G.repT += dt; - if (G.repT >= 0.05) { - const rep = { x: G.body.x, y: G.body.y, z: G.body.z, my: G.body.my, li: G.body.li, lv: G.body.lv, tp: G.tpSeen }; - if (G.host) { if (!G.S.pl[myUid()]) G.S.pl[myUid()] = newPlayerRec(myName()); hostSense(G.S, W, myUid(), rep, G.repT); } - if (G.online) { if (G.host) hostPublish(); else Net.upd(nodeBase()); } - G.body.my = G.body.y; G.repT = 0; - } + if (G.repT >= 0.05) sendReport(); if (G.online && !G.host && performance.now() - Net.hbT > 1500) Net.upd(nodeBase()); // things that happened in the run runEvents(dt); @@ -2588,6 +3049,12 @@

YOU ESCAPED

drawWorld(dt, it); drawHud(dt, it); } +function sendReport() { + const rep = { x: G.body.x, y: G.body.y, z: G.body.z, my: G.body.my, li: G.body.li, lv: G.body.lv, tp: G.tpSeen }; + if (G.host) { if (!G.S.pl[myUid()]) G.S.pl[myUid()] = newPlayerRec(myName()); hostSense(G.S, G.W, myUid(), rep, Math.max(G.repT, 1 / 120)); } + if (G.online) { if (G.host) hostPublish(); else Net.upd(nodeBase()); } + G.body.my = G.body.y; G.repT = 0; +} function dynFeet() { const f = [G.body]; for (const [, o] of G.others) if (o.view) f.push(o.view.g.position); return f; } @@ -2595,12 +3062,15 @@

YOU ESCAPED

const p = G.body; for (const e of p.ev) { if (e === 'jump') sfx('step', p.x, p.y, p.z, 0.8); - else if (e === 'land') sfx('land', p.x, p.y, p.z); + else if (e === 'land' && isFloat(p.gr)) { const k = landNoise(p.gr, p.x, p.z, p.lv); landKick(p.gr, p.x, p.z, k ? TUNING.loud.hard : 0, 1); + // a clean landing says so, softly, so you learn what's safe (the host decides; this uses the same rule) + if (G.V.ph === 'run' && p.lv < -3 && p.gr && !landNoise(p.gr, p.x, p.z, p.lv)) noiseTag(p.x, (p.gr.y1 != null ? p.gr.y1 : p.gr.top) + 0.25, p.z, NIC.quiet + 'quiet', 'q', 1, 1.1); } else if (e === 'splash') { splash(p.x, waterY(G.W, p.z), p.z, 30, 5); } - else if (e === 'climb') splash(p.x, waterY(G.W, p.z), p.z, 8, 2); + else if (e === 'climb') { splash(p.x, waterY(G.W, p.z), p.z, 8, 2); landKick(p.gr, p.x, p.z, TUNING.loud.climb); } + else if (e === 'land') sfx('land', p.x, p.y, p.z, 0.6); } // footsteps (quiet; the host decides whether running is heard) - if (p.gr && !p.inW && Math.hypot(p.vx, p.vz) > 1) { G.stepT = (G.stepT || 0) - 1 / 60; if (G.stepT <= 0) { G.stepT = isSprint() ? 0.3 : G.crouch ? 0.6 : 0.42; if (!G.crouch) sfx('step', p.x, p.y, p.z, isSprint() ? 1 : 0.6); } } + if (p.gr && !p.inW && Math.hypot(p.vx, p.vz) > 1) { G.stepT = (G.stepT || 0) - 1 / 60; if (G.stepT <= 0) { G.stepT = isSprint() ? 0.3 : G.crouch ? 0.6 : 0.42; if (!G.crouch) sfx('step', p.x, p.y, p.z, isSprint() ? 1 : 0.25); } } } function hostFrame(dt) { const S = G.S; @@ -2626,7 +3096,16 @@

YOU ESCAPED

sfx(e.src === 'toy' ? 'toy' : e.src === 'echo' ? 'echo' : e.src, e.x, e.y, e.z, 1); if (['fall', 'pebble', 'bottle', 'skip', 'struggle', 'wade', 'wadeRun', 'wadeCreep'].includes(e.src)) splash(e.x, e.y, e.z, e.src === 'fall' ? 26 : e.src === 'bottle' ? 18 : e.src === 'wadeRun' ? 12 : 6, e.src === 'fall' ? 5 : e.src.startsWith('wade') ? 2 : 3); if (e.src === 'bottle') { for (const gh of G.ghosts) if (gh.k === 1) gh.age = 99; } - if (e.u === myUid() && e.src !== 'struggle') { G.noiseShow = clamp(e.l / 1.1, 0.08, 1); G.noiseLbl = NOISE_LBL[e.src] || 'Noise'; G.noiseHold = 1.2; G.myNoiseT = performance.now(); } + const info = NOISE_INFO[e.src] || { t: 'Noise', ic: 'burst' }, mine = e.u === myUid(); + if (e.src === 'edge' || e.src === 'hard' || e.src === 'climb') landKick(supportAt(W, e.x, e.y, e.z, 0.45), e.x, e.z, e.l); + if (Math.hypot(e.x - camera.position.x, e.z - camera.position.z) < 26 && G.mode === 'play') { + const who = !mine && e.u && V.pl && V.pl[e.u] ? esc(V.pl[e.u].n) + ' · ' : ''; + noiseTag(e.x, e.y + 0.5, e.z, NIC[info.ic] + '' + who + info.t + '', noiseTier(e.src, e.l), 0.8 + Math.min(1.25, e.l) * 0.45, 1.9); + } + if (mine && e.src !== 'struggle') { + G.noiseShow = clamp(e.l / 1.1, 0.08, 1); G.noiseLbl = NIC[info.ic] + esc(info.t); G.noiseCls = info.wet ? 'wet' : 'hot'; G.noiseHold = 1.6; G.myNoiseT = performance.now(); + if (V.ph === 'run') { if (e.src === 'edge' || e.src === 'hard') tip('rim'); else if (e.src === 'sprint') tip('run'); else if (e.src === 'climb') tip('climb'); else if (info.wet) tip('wet'); tip('ring'); } + } } if (V.ph !== 'run' && V.ph !== 'wipe' && V.ph !== 'won') return; if (!me) return; @@ -2684,19 +3163,50 @@

YOU ESCAPED

if (!opp.length) return; try { BackRoomElo.report({ id: G.room + ':' + V.g + ':' + V.seed, won: true, opp }); } catch (e) {} } +// ---- The lamps: which still work, the flicker, and the nearest LAMP_N handed to the shaders ---- +// A flickering panel steps between on, dim and off at most a couple of times a second, and only its own pool of light +// changes (never the whole screen); with Reduced motion it just stays dim. +function lampLevel(L, t) { + if (L.k !== 'flick') return 1; + if (REDUCED) return 0.55; + const seg = Math.floor(t * 1.6 + L.ph), h = Math.abs(Math.sin(seg * 91.7 + L.ph * 3.1) * 43758.5453) % 1; + return h < 0.55 ? 1 : h < 0.8 ? 0.35 : 0.04; +} +const lampSort = [], lampDead = new THREE.Color(0x1b201d), lampLit = new THREE.Color(); +function lampFrame(px, pz) { + if (!LV) return; + const t = U.time.value; let dirtyC = false; + LV.lamps.forEach((L, li) => { + const lv = lampLevel(L, t); + if (Math.abs(lv - L.cur) > 0.01) { + L.cur = lv; if (!L.im) return; lampLit.setHex(L.k === "on" ? 0xeee6cc : 0xc9dccf); L.im.setColorAt(L.i, tmpColor.copy(lampDead).lerp(lampLit, lv)); L.im.instanceColor.needsUpdate = true; + if (LV.cones && li < LV.cones.count) { LV.cones.setColorAt(li, tmpColor.setRGB(lv, lv, lv)); dirtyC = true; } + } + }); + if (dirtyC) LV.cones.instanceColor.needsUpdate = true; + lampSort.length = 0; for (const L of LV.lamps) { L.d = Math.hypot(L.x - px, L.z - pz); lampSort.push(L); } + lampSort.sort((a, b) => a.d - b.d); + const P = LAMPU.uLamp.value, C = LAMPU.uLampC.value; let k = 0; + if (G.scare && !SET.soft) { P[0].set(camera.position.x, camera.position.y + 0.6, camera.position.z, 0.9); C[0].setHex(0xb9cad2); k = 1; } // its face, lit from where you are + for (let i = 0; k < LAMP_N; i++, k++) { const L = lampSort[i]; if (!L) { P[k].w = 0; continue; } P[k].set(L.x, L.y, L.z, L.w * L.cur); C[k].setHex(L.col); } +} // ---- Drawing each frame ---- function drawWorld(dt, it) { const W = G.W, V = G.V, me = myRec(); + floatFrame(dt); // moving floors for (const e of LV.dyn) { const b = e.d.b, c = boxCenter(b), m = e.mesh; m.position.set(c[0], c[1], c[2]); m.scale.set(b.x1 - b.x0, Math.max(0.01, b.y1 - b.y0), b.z1 - b.z0); m.visible = e.d.type !== 'stair' || b.y1 > FLOOR + 0.2; - if (e.frame) { e.frame.position.set(c[0], b.y1 + 0.006, c[2]); e.frame.visible = b.y1 > -0.8; } - if (e.glow) { const lit = V.ph === 'run' ? memLit(W, G.clock) : -1; e.glow.position.set(c[0], b.y1 + 0.01, c[2]); e.glow.material.opacity = e.d.safe && lit === b.row ? 0.95 : Math.max(0, e.glow.material.opacity - dt * 2.5); } + const fo = e.d.type === 'stair' || e.d.type === 'push' || e.d.type === 'door' ? null : floatOf(b); // moving, sinking and memory tiles float too, on top of what the rules do + if (fo) { m.position.y += fo.y; m.rotation.set(-Math.atan(fo.tz), 0, Math.atan(fo.tx)); } else m.rotation.set(0, 0, 0); + if (e.frame) { e.frame.position.set(c[0], b.y1 + 0.006 + (fo ? fo.y : 0), c[2]); e.frame.rotation.set(fo ? -Math.atan(fo.tz) : 0, 0, fo ? Math.atan(fo.tx) : 0); e.frame.visible = b.y1 > -0.8; } + if (e.glow) { const lit = V.ph === 'run' ? memLit(W, G.clock) : -1; e.glow.position.set(c[0], b.y1 + 0.01 + (fo ? fo.y : 0), c[2]); e.glow.material.opacity = e.d.safe && lit === b.row ? 0.95 : Math.max(0, e.glow.material.opacity - dt * 2.5); } if (e.stripe) { e.stripe.position.set(b.x1 + 0.01, c[1] + 0.5, c[2]); e.stripe.scale.set(0.04, 0.3, b.z1 - b.z0 - 0.2); } } for (const p of LV.planks) { p.m.position.set(p.p.cx, p.p.top - 0.11, p.p.cz); p.m.rotation.y = -p.p.ang; } + for (const ff of LV.fframes) { const fo = floatOf(ff.b), c = boxCenter(ff.b); ff.f.position.set(c[0], ff.b.y1 + 0.006 + fo.y, c[2]); ff.f.rotation.set(-Math.atan(fo.tz), 0, Math.atan(fo.tx)); } for (const w of LV.waters) w.m.position.y = w.R.wy; // mist: the lobby is clear, the halls are thick with it (eased, so walking through the door isn't a jump) const fogT = G.body && G.body.z > 0.5 ? 1 : 0; G.fogK = G.fogK == null ? fogT : G.fogK + (fogT - G.fogK) * Math.min(1, dt * 2.5); @@ -2704,9 +3214,9 @@

YOU ESCAPED

WATER.uniforms.uNear.value = scene.fog.near; WATER.uniforms.uFar.value = scene.fog.far; for (const m of LV.mist) { m.t.offset.x += dt * m.sp; m.t.offset.y += dt * m.sp * 0.6; } for (const f of LV.flick) { - if (f.cur) { f.cur.material.map.offset.x -= dt * 0.6 * Math.sign(f.cur.userData.cur); continue; } - const on = Math.sin(U.time.value * 23 + f.ph) > 0.2 || Math.sin(U.time.value * 1.3 + f.ph) > -0.6; f.im.setColorAt(f.i, tmpColor.setHex(on ? 0xfbfffd : 0x8a9a98)); f.im.instanceColor.needsUpdate = true; + if (f.cur) f.cur.material.map.offset.x -= dt * 0.6 * Math.sign(f.cur.userData.cur); } + lampFrame(G.body.x, G.body.z); if (LV.pad) LV.pad.material.opacity = 0.55 + Math.sin(U.time.value * 3) * 0.3; // stones, valves, keypad W.stones.forEach((s, i) => { const cd = V === G.S ? (V.stoneCd[i] || 0) - V.t : (V.stoneCd[i] || 0); LV.stones[i].scale.setScalar(cd > 0 ? 0.45 : 1); }); @@ -2720,7 +3230,7 @@

YOU ESCAPED

let dh = face - (ME.face || 0); dh = Math.atan2(Math.sin(dh), Math.cos(dh)); ME.face = (ME.face || 0) + dh * Math.min(1, dt * 12); if (down) poseSwimmer(ME, { x: me.dx, y: me.dy, z: me.dz, h: ME.face, speed: 0, down: true }); else if (held) { const m = V.mons.find(m => m.grab === myUid()); poseSwimmer(ME, { x: m ? m.x + Math.sin(m.h) * 0.75 : p.x, y: FLOOR + 1.5, z: m ? m.z + Math.cos(m.h) * 0.75 : p.z, h: m ? m.h + Math.PI : ME.face, speed: 0, air: true }); } - else poseSwimmer(ME, { x: p.x, y: p.y, z: p.z, h: ME.face, speed: Math.hypot(p.vx, p.vz), air: !p.gr && !p.inW, inW: p.inW, crouch: G.crouch, gy }); + else { const fy = p.gr && !p.inW ? floatAt(p.gr, p.x, p.z) : 0; poseSwimmer(ME, { x: p.x, y: p.y + fy, z: p.z, h: ME.face, speed: Math.hypot(p.vx, p.vz), air: !p.gr && !p.inW, inW: p.inW, crouch: G.crouch, gy: gy != null ? gy + fy : null }); } ME.g.visible = !(G.scare && !SET.soft); const sh = me && me.sh > 0 && V.ph === 'run'; ME.cm.emissive && ME.cm.emissive.setHex(sh && Math.sin(U.time.value * 12) > 0 ? 0x225555 : 0); } @@ -2736,7 +3246,13 @@

YOU ESCAPED

const inPlay = V.ph === 'run' || V.ph === 'wipe'; if (inPlay && P && P.st === 2) poseSwimmer(o.view, { x: P.dx, y: P.dy, z: P.dz, h: o.face || 0, speed: 0, down: true }); else if (inPlay && P && P.st === 1) { const m = V.mons.find(m => m.grab === u); poseSwimmer(o.view, { x: m ? m.x + Math.sin(m.h) * 0.75 : s.x, y: FLOOR + 1.5, z: m ? m.z + Math.cos(m.h) * 0.75 : s.z, h: m ? m.h + Math.PI : o.face || 0, speed: 0, air: true }); } - else { const gy = supportAt(W, s.x, s.y, s.z, 0.1) ? s.y : null; poseSwimmer(o.view, { x: s.x, y: s.y, z: s.z, h: o.face || 0, speed: sp, air: !!(o.a & 16), inW: !!(o.a & 8), crouch: !!(o.a & 4), gy }); } + else { + const sup = supportAt(W, s.x, s.y, s.z, 0.1), gy = sup ? s.y : null, air = !!(o.a & 16), inW = !!(o.a & 8), fy = sup && !air && !inW ? floatAt(sup, s.x, s.z) : 0; + // a teammate coming down on a tile: the same dip and ring you'd see for your own (the host's noise makes it bigger if it was loud) + if (o.wasAir && !air && !inW && sup) landKick(sup, s.x, s.z, 0, 1); + o.wasAir = air && inPlay; + poseSwimmer(o.view, { x: s.x, y: s.y + fy, z: s.z, h: o.face || 0, speed: sp, air, inW, crouch: !!(o.a & 4), gy: gy != null ? gy + fy : null }); + } o.view.g.visible = !(P && P.st === 3); } // monsters: only the rooms near you @@ -2770,6 +3286,7 @@

YOU ESCAPED

// aim arc const meUp = me && me.st === 0 && V.ph === 'run'; if (G.aiming && meUp && G.sel < 4) drawArc(W, aimOrigin(), aimVel(), G.sel, skipsOf(SAVE.up)); else { arc.visible = false; arcEnd.visible = false; } + drawMarker(W, me, V); // camera placeCamera(dt, me); WATER.uniforms.uCam.value.copy(camera.position); @@ -2798,7 +3315,7 @@

YOU ESCAPED

const r = G.rings[i]; if (!r) { R[i].set(0, 0, 0, 0); continue; } const u = Math.min(1, r.t / 1.3), e = 1 - Math.pow(1 - u, 2.2); - R[i].set(r.x, r.z, Math.max(0.2, r.R * e), Math.min(1, 0.35 + r.l * 0.6) * (1 - Math.max(0, (r.t - 0.9) / 0.9))); + R[i].set(r.x, r.z, r.r0 ? r.r0 + (r.R - r.r0) * e : Math.max(0.2, r.R * e), Math.min(1, 0.35 + r.l * 0.6) * (1 - Math.max(0, (r.t - 0.9) / 0.9))); } } function placeCamera(dt, me) { @@ -2884,10 +3401,13 @@

YOU ESCAPED

} // too close: red edges and your heart const k = near < TUNING.warnRange ? 1 - near / TUNING.warnRange : 0; + if (near < 6 && V.ph === 'run') tip('still'); $('vig').style.opacity = k > 0 ? (0.25 + k * 0.6).toFixed(3) : (G.scare ? 0.8 : 0); if (k > 0) { G.heartT -= dt; if (G.heartT <= 0) { G.heartT = 0.95 - k * 0.5; sfx('heart', null, null, null, 0.6 + k * 0.6); } } else G.heartT = 0; // drips somewhere in the hall G.dripT -= dt; if (G.dripT <= 0) { G.dripT = 1.2 + Math.random() * 4; sfx('drip', p.x + (Math.random() - 0.5) * 20, 0, p.z + (Math.random() - 0.5) * 20, 0.6 + Math.random() * 0.6); } + // now and then something far off in the building: a clank in the pipes or a long groan + G.ambT -= dt; if (G.ambT <= 0) { G.ambT = 7 + Math.random() * 11; const a = Math.random() * 6.28; sfx(Math.random() < 0.55 ? 'clank' : 'groan', p.x + Math.cos(a) * 24, 4.5, p.z + Math.sin(a) * 24, 0.7 + Math.random() * 0.5); } } // ---- HUD each frame ---- const tagEls = new Map(); @@ -2898,8 +3418,30 @@

YOU ESCAPED

$('clockT').textContent = V.ph === 'lobby' || V.ph === 'count' ? (G.online ? 'Room ' + G.room.replace(/^hp-/, '') : 'Solo') : fmtT(t); $('clockC').textContent = (me && (V.ph === 'run' || V.ph === 'wipe' || V.ph === 'won') ? '+' + me.coins + ' · ' : '') + SAVE.coins + ' coins'; // noise meter: what you did last - if (G.noiseHold > 0) G.noiseHold -= dt; else { G.noiseShow = Math.max(0, G.noiseShow - dt * 0.6); if (G.noiseShow <= 0.02) G.noiseLbl = G.body.inW ? (Math.hypot(G.body.vx, G.body.vz) > 0.3 ? 'In the water' : 'Still in the water (silent)') : G.crouch ? 'Creeping (silent)' : isSprint() && G.body.gr ? 'Running' : 'Silent'; } - $('noiseBar').style.width = Math.round(G.noiseShow * 100) + '%'; $('noiseLb').textContent = G.noiseLbl; + if (G.noiseHold > 0) G.noiseHold -= dt; else { G.noiseShow = Math.max(0, G.noiseShow - dt * 0.6); if (G.noiseShow <= 0.02) { G.noiseLbl = 'Silent'; G.noiseCls = ''; } } + $('noiseBar').style.width = Math.round(G.noiseShow * 100) + '%'; + if ($('noiseLb').dataset.h !== G.noiseLbl) { $('noiseLb').innerHTML = G.noiseLbl; $('noiseLb').dataset.h = G.noiseLbl; } + if (G.noiseClsW !== G.noiseCls) { G.noiseClsW = G.noiseCls; $('noise').className = 'hcard' + (G.noiseCls ? ' ' + G.noiseCls : ''); } + // how you're moving, and whether that makes a sound + { const p = G.body, sp = Math.hypot(p.vx, p.vz); let sn = 'Still', sv = 'silent', loud = false; + if (!me || me.st !== 0) { sn = me && me.st === 2 ? 'Down' : 'Held'; sv = ''; } + else if (p.inW) { sn = G.crouch ? 'Wading slow' : isSprint() ? 'Wading fast' : 'Wading'; sv = Math.hypot(p.vx, p.vz) > 0.3 ? 'noisy' : 'quiet'; loud = sv === 'noisy'; } + else if (!p.gr) { const k = G.pred ? G.pred.k : ''; sn = 'Jumping'; sv = k === 'quiet' ? 'quiet' : k === 'edge' || k === 'hard' ? 'loud' : k === 'climb' ? 'pull-up' : k === 'fall' ? 'water!' : ''; loud = !!k && k !== 'quiet'; } + else if (sp > 0.4) { if (G.crouch) sn = 'Creeping'; else if (isSprint() && sp > TUNING.walk * 1.1) { sn = 'Running'; sv = 'noisy'; loud = true; } else sn = 'Walking'; } + const key = sn + sv; if (G.stanceK !== key) { G.stanceK = key; $('stanceN').textContent = sn; const b = $('stanceV'); b.textContent = sv; b.className = loud ? 'n' : 's'; } } + // labels where noises happened + for (let i = noiseTags.length - 1; i >= 0; i--) { + const n = noiseTags[i]; n.t += dt; if (n.t > n.life) { n.el.remove(); noiseTags.splice(i, 1); continue; } + tmpV.set(n.x, n.y + (REDUCED ? 0 : n.t * 0.35), n.z).project(camera); if (tmpV.z > 1) { n.el.style.opacity = 0; continue; } + n.el.style.opacity = Math.min(1, (n.life - n.t) / 0.5).toFixed(2); + n.el.style.transform = 'translate(' + ((tmpV.x * 0.5 + 0.5) * innerWidth - n.el.offsetWidth / 2).toFixed(0) + 'px,' + ((-tmpV.y * 0.5 + 0.5) * innerHeight - n.el.offsetHeight).toFixed(0) + 'px) scale(' + n.sc.toFixed(2) + ')'; + } + // the word under the landing marker + const mk = $('mkTag'); + if (marker.visible && G.pred) { tmpV.copy(marker.position).project(camera); if (tmpV.z < 1) { const k = G.pred.k, txt = MARK_WORD[k]; if (mk.dataset.k !== k) { mk.dataset.k = k; mk.textContent = txt; mk.className = 'mk ' + k; } mk.hidden = false; + mk.style.transform = 'translate(' + ((tmpV.x * 0.5 + 0.5) * innerWidth - mk.offsetWidth / 2).toFixed(0) + 'px,' + ((-tmpV.y * 0.5 + 0.5) * innerHeight + (TOUCH ? -34 - mk.offsetHeight : 10)).toFixed(0) + 'px)'; } else mk.hidden = true; } // on touch the word goes above the ring, away from the buttons + else mk.hidden = true; + tipFrame(dt); // E prompt with its fill ring const pr = $('prompt'); if (it && !G.panel) { pr.hidden = false; if (G.prKey !== it.tx) { G.prKey = it.tx; $('promptTx').innerHTML = TOUCH ? it.tx.replace(/E<\/kbd>/g, 'E') : it.tx; } $('ring').style.strokeDashoffset = (94.25 * (1 - (it.prog || 0))).toFixed(1); } @@ -2960,7 +3502,8 @@

YOU ESCAPED

requestAnimationFrame(t => { last = t; frame(t); }); // Test hook (automated browsers only) if (navigator.webdriver) window.__hp = { G, Net, SAVE: () => SAVE, get S() { return G.S; }, get V() { return G.V; }, get W() { return G.W; }, hostStartRun, enterPlay, toMenu, keys, TUNING, stepPlayer, newBody, camera, renderer, scene, setYaw(y, p) { G.yaw = y; if (p != null) G.pitch = p; }, - tp(x, y, z) { G.body = newBody(x, y, z); const P = G.S.pl[myUid()]; if (P) { P.x = x; P.y = y; P.z = z; P.has = false; P.unsup = 0; } }, jump() { jumpQ = true; }, useItem, pressE, sel(i) { G.sel = i; }, openParty, openShop, buildLevel }; + tp(x, y, z) { const li = G.body.li; G.body = newBody(x, y, z); G.body.li = li; const P = G.S.pl[myUid()]; if (P) { P.x = x; P.y = y; P.z = z; P.has = false; P.unsup = 0; } }, jump() { jumpQ = true; }, useItem, pressE, sel(i) { G.sel = i; }, openParty, openShop, buildLevel, + hold(on) { G.hold = !!on; }, SET, renderNoiseHelp, predictLanding, landNoise }; diff --git a/e63334287a3deaa3/hush-pools/preview.jpg b/e63334287a3deaa3/hush-pools/preview.jpg index 64a1796d..0f6a471c 100644 Binary files a/e63334287a3deaa3/hush-pools/preview.jpg and b/e63334287a3deaa3/hush-pools/preview.jpg differ diff --git a/e63334287a3deaa3/index.html b/e63334287a3deaa3/index.html index e2550861..e51fa2e8 100644 --- a/e63334287a3deaa3/index.html +++ b/e63334287a3deaa3/index.html @@ -578,18 +578,18 @@

Escapade

- - Hush Pools in play: a misty, flooded hall of pale teal tiles with square pillars fading into the fog, ceiling light panels and turquoise water. A swimmer in a blue cap stands on a tiled platform, two teammates named Maya and Jordan wait on other platforms, ripple rings spread across the water, and a tall, thin, eyeless figure wades between them just ahead. The room name and goal are at the top left, the timer and coins at the top right, a noise meter at the bottom left and five item slots along the bottom. + + Blackwade in play: a dark, flooded pool hall left to rot, where one ceiling light still works and throws a shaft of light through the mist onto grimy, cracked tiles floating on the murky water. A swimmer in a blue cap stands on a tile, two teammates named Maya and Jordan wait on tiles further on, a Pebble label marks where a pebble hit the water, and a tall, thin, hunched figure wades in the water nearby inside a spreading ring. The room name and goal are at the top left, the timer and coins at the top right, the noise meter at the bottom left and five item slots along the bottom. NewHorror obby
-

Hush Pools

+

Blackwade

Cross the flooded pool halls without a splash. It hears you.

  • Online co-op · up to 4
  • Solo
  • New · Horror obby
- +
-

A co-op horror obby in huge, misty, flooded tile halls. Hop from tile to tile across nine halls while something tall and blind hunts you through the mist. It can't see you, but it hears everything: every landing, every running step and every splash sends rings across the water, and when it hears you it comes, very fast. Stand still and quiet and it walks right past. Throw a pebble the other way and it follows the sound. The water is only knee deep, so you can wade and climb back out, but wading is slow and loud. Find your way through the mist to the far wall of each hall: there are three doors, and only one of them is open.

+

A co-op horror obby (formerly Hush Pools) in huge, misty, flooded pool halls that were shut and left in the dark for decades. Hop from tile to tile across nine halls while something tall and blind hunts you through the mist. It can't see you, but it hears everything: a landing on a tile's rim, every running step and every splash sends rings across the water, and when it hears you it comes, very fast. Stand still and quiet and it walks right past. Throw a pebble the other way and it follows the sound. The water is only knee deep, so you can wade and climb back out, but wading is slow and loud. Find your way through the mist to the far wall of each hall: there are three doors, and only one of them is open.

  • Nine rooms: Pillar Hall, Broken Walkway, Sinking Tiles, Turning Bridge, Moving Tiles, Currents, Memory Bridge, Crushing Walls and the Maintenance Lock, where two loud valves raise the water, a keypad needs four numbers from the pillars, and the door out opens
  • Online rooms for 1 to 4 players with an invite link, or Quick match. If you go down, a teammate holds E next to you or throws a rope; if everyone goes down, the party goes back to the last checkpoint
  • diff --git a/e63334287a3deaa3/leaderboard.js b/e63334287a3deaa3/leaderboard.js index 25f4abb7..8bc240e0 100644 --- a/e63334287a3deaa3/leaderboard.js +++ b/e63334287a3deaa3/leaderboard.js @@ -318,7 +318,7 @@ { d: 'melon-merge', n: 'Melon Merge', st: [{ k: 'score', l: 'Best score', f: 'n', u: 'pt', hi: 1e7 }, { k: 'melons', l: 'Watermelons grown (all time)', chip: 'Watermelons', f: 'n', u: 'watermelon', rate: 0.05 }] }, { d: 'patchwork-tower', n: 'Patchwork Tower', st: [{ k: 'score', l: 'Best score', f: 'n', u: 'pt', hi: 9999999 }] }, { d: 'flickerwood', n: 'Flickerwood', st: [{ k: 'score', l: 'Best score', f: 'n', u: 'pt', hi: 9999999 }] }, - { d: 'hush-pools', n: 'Hush Pools', st: [{ k: 'elo', l: 'Elo', f: 'elo', lo: 100, hi: 3000 }, + { d: 'hush-pools', n: 'Blackwade', st: [{ k: 'elo', l: 'Elo', f: 'elo', lo: 100, hi: 3000 }, { k: 'fastest', l: 'Fastest escape (Normal or Hard)', chip: 'Fastest escape', f: 'time', lo: 45, hi: 36000 }, { k: 'escapes', l: 'Escapes (all time)', chip: 'Escapes', f: 'n', u: 'escape', rate: 1 / 60 }, { k: 'revives', l: 'Teammates pulled out (all time)', chip: 'Rescues', f: 'n', u: 'rescue', rate: 1 / 8 }] }, diff --git a/e63334287a3deaa3/m/index.html b/e63334287a3deaa3/m/index.html index 75a96c8f..e5acf852 100644 --- a/e63334287a3deaa3/m/index.html +++ b/e63334287a3deaa3/m/index.html @@ -202,7 +202,7 @@

    Arjun's games

    ['asteroid-run','Asteroid Run','Run tile tunnels in space. Take a wall and the tunnel turns.',0], ['rollaway','Overdrop','Plunge a chrome ball down a neon skyway and dodge everything at speed.',0], ['escapade','Escapade','World after world of escape rooms. Find the key, crack the code.',1], - ['hush-pools','Hush Pools','A co-op horror obby for up to 4. Cross the flooded halls quietly: it hears every splash.',1] + ['hush-pools','Blackwade','A co-op horror obby for up to 4. Cross the flooded halls quietly: it hears every splash.',1] ],'parkour'], ['Hide, bluff and shout',[ ['chromaflage','Chromaflage','Paint yourself to match the room, then hide. Or hunt the painted.',1], diff --git a/e63334287a3deaa3/m/thumbs/hush-pools.jpg b/e63334287a3deaa3/m/thumbs/hush-pools.jpg index 0ff63a90..85562309 100644 Binary files a/e63334287a3deaa3/m/thumbs/hush-pools.jpg and b/e63334287a3deaa3/m/thumbs/hush-pools.jpg differ diff --git a/e63334287a3deaa3/news-es.js b/e63334287a3deaa3/news-es.js index c12e57bb..20a4f231 100644 --- a/e63334287a3deaa3/news-es.js +++ b/e63334287a3deaa3/news-es.js @@ -6,6 +6,10 @@ (function () { if (!window.BackRoomLang) return; BackRoomLang.add({ + "Hush Pools is now Blackwade": "Hush Pools ahora se llama Blackwade", + "Hush Pools has a new name and a new look: Blackwade, with darker, misty halls.": "Hush Pools tiene nombre y aspecto nuevos: Blackwade, con salas más oscuras y con niebla.", + "Every noise shows a label where it happened, and a meter tells you how loud you are being.": "Cada ruido muestra una etiqueta donde ocurrió, y un medidor te dice cuánto ruido haces.", + "Invite links, coins, upgrades and ratings carry over.": "Los enlaces de invitación, las monedas, las mejoras y las puntuaciones se conservan.", "Beatvault is now Pulsebox": "Beatvault ahora se llama Pulsebox", "Beatvault has a new name and a new look: Pulsebox, a neon disco with a lighting rig over every stage.": "Beatvault tiene nombre y aspecto nuevos: Pulsebox, una discoteca de neón con focos sobre cada escenario.", "Every song is about 6% faster.": "Todas las canciones van un 6% más rápido, más o menos.", diff --git a/e63334287a3deaa3/news.js b/e63334287a3deaa3/news.js index b3387292..add7669c 100644 --- a/e63334287a3deaa3/news.js +++ b/e63334287a3deaa3/news.js @@ -85,6 +85,12 @@ */ (function () { var NEWS = [ + {date: '2026-11-23', version: '1.45', title: 'Hush Pools is now Blackwade', kind: 'feature', + img: 'm/thumbs/hush-pools.jpg', tags: ['Blackwade'], items: [ + 'Hush Pools has a new name and a new look: Blackwade, with darker, misty halls.', + 'Every noise shows a label where it happened, and a meter tells you how loud you are being.', + 'Invite links, coins, upgrades and ratings carry over.' + ]}, {date: '2026-11-23', version: '1.44', title: 'Beatvault is now Pulsebox', kind: 'feature', img: 'm/thumbs/beatvault.jpg', tags: ['Pulsebox'], items: [ 'Beatvault has a new name and a new look: Pulsebox, a neon disco with a lighting rig over every stage.', diff --git a/e63334287a3deaa3/party.js b/e63334287a3deaa3/party.js index 4ba5ad83..f6b74ea9 100644 --- a/e63334287a3deaa3/party.js +++ b/e63334287a3deaa3/party.js @@ -155,7 +155,7 @@ { k: 'dz', n: 'Driftfall', d: 'drop-zone', max: 30, nk: 'driftfall:name' }, { k: 'bs', n: 'Blockstorm', d: 'blockstorm', max: 12, nk: 'blockstorm:name' }, { k: 'lh', n: 'Lanternhold', d: 'lanternhold', max: 4, nk: 'lanternhold:name' }, - { k: 'hp', n: 'Hush Pools', d: 'hush-pools', max: 4, nk: 'hushpools:name' }, + { k: 'hp', n: 'Blackwade', d: 'hush-pools', max: 4, nk: 'hushpools:name' }, { k: 'vq', n: 'Sky Duel', d: 'sky-duel', max: 8, nk: 'skyduel-name' }, { k: 'gd', n: 'Lokop', d: 'lunge-line', max: 8, nk: 'lungeline:name' }, { k: 'dw', n: 'Deepword', d: 'deepword', max: 12, nk: 'deepword-name' }, diff --git a/e63334287a3deaa3/social.js b/e63334287a3deaa3/social.js index 3f7d62cb..bff8dc81 100644 --- a/e63334287a3deaa3/social.js +++ b/e63334287a3deaa3/social.js @@ -227,7 +227,7 @@ { k: 'pf', n: 'Puffer Party', d: 'puffer-party', room: ROOM }, { k: 'bs', n: 'Blockstorm', d: 'blockstorm', room: ROOM }, { k: 'lh', n: 'Lanternhold', d: 'lanternhold', room: ROOM }, - { k: 'hp', n: 'Hush Pools', d: 'hush-pools', room: ROOM }, + { k: 'hp', n: 'Blackwade', d: 'hush-pools', room: ROOM }, { k: 'vq', n: 'Sky Duel', d: 'sky-duel', room: ROOM }, { k: 'qg', n: 'Putterby', d: 'putterby', room: ROOM }, { k: 'tv', n: 'Trivium', d: 'trivium', room: /^[a-z]{5}$/ },