> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leverine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Changelog

> Threshold XR — the original WebXR horror experience: what you look away from walks toward you.

# Changelog

All notable changes to THRESHOLD XR are recorded here.

The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/DTRHnet/Threshold-XR/compare/v0.1.0...HEAD)

### Added

* **Stalking mechanic — entities now come for you.** Each active entity keeps a live position that creeps toward the player whenever it is outside a 42° cone around the view direction, and freezes the moment it is looked at. Speed ramps from 0.10 m/s to 0.38 m/s across a run. Reaching `STRIKE_DISTANCE` (0.85 m) while unobserved fires `RendererCallbacks.onThreatStrike`, which punches the camera, plays a face stinger and **ends the run**. With two entities live you cannot watch both, which is the tension. Measured: ignoring one at 2.5 m costs you the run in 14 s; glancing away 2 s in every 5 s buys \~30 s; near-continuous watching \~50 s. Guards: an entity must be fully manifested (≥0.8) and alive ≥2.5 s before it can strike, so nothing spawns on top of you and instantly kills you.
* **Proximity audio**: `setThreatProximity(distance)` drives a breathing layer that rises sharply as something closes, ducks the whole ambience to near-silence as it arrives (the silence is the warning), and ramps a heartbeat from \~0.9 Hz to \~3.3 Hz.
* Entities now always turn to face the player.

### Changed

* **Outcome copy is honest about why you lost.** `RunSummary.cause` now records `'strike'` vs `'acoustic'`. Being reached shows *PROXIMITY BREACH — It reached you.* instead of the acoustic-vocalisation message, which was simply wrong when an entity grabbed you.
* **The rule is on the title screen**: “Watch them — look away and they close in”. An unexplained instant-death mechanic reads as a bug, not as fear.
* Threat rendering uses the stalking position rather than the fixed spawn slot, so WallPeel / crawler / etc. peel off their surfaces and advance.
* `getNearestThreatDistance()` exposes the closest entity for proximity effects.

### Fixed

* **Shadow map type deprecated on Quest**: `shadowMap.type` was set to `THREE.PCFSoftShadowMap`, whose implementation three r187 removed. Every run logged `THREE.WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead.` and silently downgraded. Now requests `THREE.PCFShadowMap` directly.
* **AI scare plans silently dropped two of the seven archetypes**: the Gemini plan sanitizer in `server.ts` validated archetypes against a five-entry set, so any `InterceptStalker` or `FaceAssault` spot Gemini chose was silently replaced with the slot’s `recommendedArchetype` (which slot generation also never picks from those two). Both archetypes were already fully implemented (rigs, renderer branches, local-director spawns) — the validation set was the only gate. `VALID_ARCHETYPES` now lists all seven. Design note: `FaceAssault` was built as a camera-staged scare; letting the AI director also place its rig on room slots is a deliberate taste call (Kev’s update directive, 2026-12-04). If that purity is ever wanted back, deleting the single `'FaceAssault'` line restores InterceptStalker-only room placement.
* **Director phase tests aligned with the 5% Baseline design**: two `director.test.ts` failures were expectation drift, not an engine bug. Commit `2f9679b` (“cut baseline dead air”, 2026-11-12) deliberately shrank Baseline from 12% to 5% of a run — with a rationale in the commit and the code — but the tests, last touched in `b6ba511`, still asserted the old bands. Expectations now sample the current bands (Baseline sampled at progress 0.02; the Baseline step of the staging test runs at t = 2s of 60s). No engine code changed and no assertion was weakened. Suite: 14/16 before this update, 16/16 after; `tsc --noEmit` clean before and after.

### Verified on device

* Confirmed on a Quest 2 (OculusBrowser 157 / Chrome 157) over the `adb reverse` tunnel: `window.isSecureContext === true` on plain `http://localhost`, `navigator.xr` present, and `navigator.xr.isSessionSupported('immersive-ar') === true`.
* Note for anyone testing via DevTools: `isSessionSupported()` never settles while the page is `document.visibilityState === 'hidden'` (browser panel not displayed), so `enterWebXRPassthrough()` awaits forever and the button appears to do nothing with no capability notice. The browser panel has to be visible in the headset first.

## [0.1.0](https://github.com/DTRHnet/Threshold-XR/releases/tag/v0.1.0) - 2026-11-12

Headset bring-up pass: the build now actually runs in passthrough AR on a Quest 2, and the experience has atmosphere, motion and a much shorter wait before the first scare.

### Added

* **Declarative threat rigs** (`src/three/threatRigs.ts`): every entity silhouette is now data — named parts with shape, material and transform — instead of \~226 lines of hard-coded mesh construction. Animation addresses parts by name, so a future redesign (smoother surfaces, sculpted geometry, or a substituted GLTF model via `modelUrl`) only touches this one file. Includes an exported `THREAT_RIGS` table and a `buildThreatRig()` instantiator.
* **Limb joints and capsules**: arms and legs are split into upper/lower segments with explicit elbow/knee spheres and 16-segment capsules, so figures taper and bend rather than reading as stacked cylinders.
* **Atmospheric audio bed** (`src/audio/horrorAudio.ts`): procedurally generated reverb impulse, breathing air layer with slow filter sweep, 27.5 Hz sub-harmonic swell with its own amplitude LFO, and randomised distant creaks panned around the listener. All layers scale with dread and are torn down with the room tone. No audio assets are shipped.
* **Manifest stinger**: a sub-drop plus air transient, panned to the threat’s azimuth, fired the instant an entity first appears so a silent reveal is never missed.
* **AR dimming overlay**: a camera-locked black plane billboarded from the real head pose, so the Compression phase can close the world in during passthrough. Previously all dimming was silently skipped in XR.
* `README.md` and this changelog; `RUN-LAN.md` headset setup guide.

### Changed

* **Threat materials**: bodies are true void (`0x000000`, roughness 1.0) so they absorb light and read as a hole in passthrough; skin carries a cold self-lit edge (`emissive` 0.85) that survives a bright camera feed; eyes went from `emissiveIntensity` 0.35 to 2.6 and grew 0.011–0.017 m → 0.016–0.023 m so they read as pinpoint glow.
* **`CeilingHang` redesigned**: torso stretched shot past human proportion, drooping head with glowing eyes (it previously had none), arms lengthened, and palms with four splayed fingers per hand added — hands hang \~2.4 m below the anchor.
* **Reveal curve**: `manifestation` is eased with `pow(m, 1.7)`, so entities stay concealed longer and then are simply *there*.
* **Idle motion**: every entity now has a deterministic per-threat tremor, sway and body roll (`threatMotionSeed()`), so nothing is ever perfectly still.
* **Pacing**: `Baseline` shortened from 12% to 5% of the run, first-threat delay from `max(7, dur*0.13)` to `max(4.5, dur*0.055)`, first-anomaly delay from `max(5.5, dur*0.08)` to `max(3.5, dur*0.05)`. First threat now arrives at \~10 s on a 3-minute run (was \~23.4 s) and \~4.5 s on 1 minute (was \~7.9 s).
* Rig scale is applied on an inner group so per-frame animation scale composes with it instead of clobbering it. Standing figures are now \~2.10 m.

### Fixed

* **Express 4 catch-all route**: `app.get('/{*splat}')` is Express 5 / path-to-regexp v8 syntax and returned 404 for every non-root path on Express 4.22. Now `'*'`.
* **HTTPS certificate had no SAN**: the self-signed fallback used `-subj /CN=localhost`, which browsers ignore for hostname matching since Chrome 58, and which could never match a LAN IP. It now emits `-addext subjectAltName=` covering `localhost`, `127.0.0.1` and every non-internal IPv4, and prefers mkcert material at `.certs/lan.pem` when present.
* **`PORT` was hardcoded** to 3000; now `Number(process.env.PORT) || 3000`, which allows running an HTTPS and a plain-HTTP instance side by side for diagnosis.
* **AR had no dimming at all**: `setPassthroughDimness()` early-returned whenever an XR session was active, because fog and tone-mapping exposure cannot darken composited passthrough. The overlay above closes that gap.
* `.gitignore` now excludes `.certs/`, `mkcert` and `.chrome-profile/` — `.certs/` contains the development CA **private key**.

### Notes

* Verified: `tsc --noEmit` clean, production build clean, `POST /api/ai/analyze-room` over HTTPS across three room presets, TLS chain validation, and headless-Chrome render.
* Not verified in this pass: the in-headset immersive session, `dom-overlay` HUD support, and the subjective mix level of the new audio/visuals — these need a real headset.

***

*Source: DTRHnet/Threshold-XR\@12cd722 — `CHANGELOG.md`.*


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.