THRESHOLD XR
A cold, clinical, black-and-white passthrough AR psychological endurance horror experience for WebXR headsets (Meta Quest / Pico), with a flat-screen fallback. Survive the timer in total silence while a spatial threat director analyses the geometry of your real room and weaponises it: blind spots, doorway occlusions, uninspected seams, and the space you just cleared. Threats are staged 55–105° off-axis so they register only after they move.Requirements
- Node.js 20+ (developed against v24) —
tsxis used to run the TypeScript server directly - A WebXR headset for AR mode (Quest 2/3, Pico); any modern browser for flat mode
- HTTPS for AR:
immersive-arrequires a secure context
Quick start
https://<your-lan-ip>:3000 and press WebXR AR.
For the full LAN/headset setup — mkcert CA creation, trusting it on the headset, and the USB adb reverse path that avoids certificates entirely — see RUN-LAN.md.
npm start(node server.ts) does not work:server.tsimports./src/engine/spatialwithout a file extension and plain Node ESM requires one. Usetsx.
Environment
Playing
The rule that keeps you alive: anything you look away from walks toward you. Entities freeze inside a 42° cone around your gaze and creep toward you outside it, closing faster as the run progresses. If one reaches you, the run ends. With two live at once you cannot watch both — that conflict is the game. Listen for it: breathing rises as something closes, the room ducks to near-silence just before it arrives, and your heartbeat climbs as it gets near.
Duration (1/3/5/10 min), room preset, mic sensitivity and camera passthrough are chosen on the title screen. Microphone monitoring is optional: with it on, sub-threshold gasps feed the director and a loud enough breach ends the run.
Architecture
server.ts Express: /api/health, /api/ai/analyze-room, static/SPA, optional TLS src/App.tsx React shell, 10 Hz director loop, shell state machine src/engine/director.ts Horror phases, threat scheduling, tension telemetry src/engine/spatial.ts Slot extraction, occlusion, gaze sectors, local scare scoring src/engine/webxrSpatial.ts Room reconstruction from WebXR detected planes src/engine/acoustics.ts Mic RMS/onset/ZCR analysis, adaptive floor calibration src/three/RoomRenderer.ts Three.js scene, camera, XR session, threat animation src/three/threatRigs.ts Declarative entity rigs (data, not code) src/audio/horrorAudio.ts Web Audio: room tone, atmosphere, stingers, spatial cues src/components/ Title screen, HUD, blueprint modal, outcome overlayTuning
- Stalking pressure —
src/three/RoomRenderer.ts:STRIKE_DISTANCE(how close it may get),WATCHED_CONE_DEG(the freeze cone — keep it wider than the camera half-FOV so nothing advances while visible), and the speed ramp insideupdateThreatApproach(). - Entity silhouettes —
src/three/threatRigs.ts. Each threat is a list of named parts (shape, material, transform). Raisesegmentsfor smoother surfaces, swap shapes, or set a rig’smodelUrlto substitute a real mesh later. Animation addresses parts by name, so no other file needs to change. - Scare cadence —
src/engine/director.ts:computeHorrorPhase()sets the phase thresholds;createDirectorState()sets the first event/anomaly delays. - Atmosphere —
src/audio/horrorAudio.ts:startAtmosphere()builds the reverb, air and sub layers;scheduleAtmosphereEvent()controls the rate of distant creaks.
Security notes
.certs/holds the development CA private key and is gitignored. Never commit it.- The dev TLS certificate is for LAN/headset testing only, not for public exposure.
Status
Flat mode is fully playable. AR mode requires HTTPS plus a trusted certificate (or theadb reverse workaround); see RUN-LAN.md. Gemini is optional — the local scorer is the default path.
Source: DTRHnet/Threshold-XR@12cd722 —
README.md.