Leave Your Work At the Door! - a Romantic Game
What I Built

Every man who comes home from a grueling day knows the feeling: the lingering stress of deadlines, the racing pulse from traffic, the tension clenched tight in your shoulders. Too often, without meaning to, we walk right through our front door and bring that entire storm inside to the woman who loves us.

True love isn't just saying sweet words or buying gifts. It’s making sure that when you hold your girl, you give her peace, not the residual chaos of the outside world.

Threshold is an interactive, first-person 3D emotional transition ritual and atmospheric adventure. Built with Three.js and powered by contactless optical physiology from the Presage SmartSpectra SDK, it places you in the shoes of a man standing just outside the doorstep of his home in a serene, cel-shaded dream world.

Inside by the fireplace, the girl is waiting with a warm fairy lantern, steaming tea, and quiet solace. But the door between you and her cannot be forced open with brute strength or hurried footsteps.

The Experience
First-Person Exploration: Walk around the dreamy courtyard in first person (WASD + mouse pan), admiring your stylized hands and coat cuffs rendered in a hand-drawn, black-ink comic art style.
Four Memories of Love: Uncover 4 interactive memory points scattered throughout the courtyard:
Memory I — The Rain & The Umbrella: Standing under the bookstore awning, finding an excuse to stand beside her.
Memory II — The Late Train: Her falling asleep on your shoulder during the midnight commute.
Memory III — The Burnt Toast: Laughing together in the smoke-filled kitchen on Sunday morning.
Memory IV — The Quiet Sunday: The gentle silence of two people simply existing together without needing words.
Tactile Mindful Mini-Games:
The Resonant Bell: Strike the hammer and align your breath to release resonant acoustic chords.
The Wind Spinner: A delicate kinetic compass that spins with your exhales.
Zen Stone Stacking: Balance floating cobblestones using focused physical stillness.
The Living Portal Door: At the center of the world stands the solid timber door with three heavy brass locks.
The keyhole pulses visually in real-time synchrony with your actual arterial heartbeat detected through your camera by SmartSpectra's rPPG pipeline.
To unlock the door, you must stand still and take three deep, deliberate, calming breaths. Each prolonged exhalation turns one of the three mechanical brass locks.
The Reunion: Once all three locks disengage, the door glides open. You step across the threshold into the golden sanctuary room, where she turns toward you with a soft smile and whispers: "Welcome home. You brought peace."

Demo

Gameplay Highlights
The Title Screen: Clean frosted glass card with light-mode dreamy aesthetics framing THRESHOLD.
Courtyard Exploration: First-person perspective with expressive ink-bordered hands, floating motes, and soft directional light shafts.
The Living Door: Gilded portal columns, solid snapped timbers, and an escutcheon that flashes and breathes with your cardiovascular pulse trace.
The Sanctuary: A warm hearth, glowing lamp, and the stylized anime-inspired character waiting with her fairy lantern.

Code

The complete source code is open source and hosted on GitHub:

🔗 GitHub Repository: https://github.com/hkhearts/Threshold-Hubby-Game

Quick Start & Setup Instructions
Prerequisites
Node.js (v18.0.0 or higher)
A webcam (or use the built-in simulated demo mode if no camera is available)
Modern web browser (Chrome, Edge, Firefox, or Safari with WebGL & WebSocket support)

  1. Clone & Install bash git clone https://github.com/hkhearts/Threshold-Hubby-Game.git cd threshold npm install
  2. Configure Environment (Optional for Live Presage Camera)

If you have a Presage SmartSpectra API key:

bash
cp .env.example .env

Edit .env and insert your key:

SMARTSPECTRA_API_KEY=your_key_here

(If no API key or camera is present, the built-in physiological simulator automatically provides lifelike cardiovascular and respiratory signals in Demo Mode).

  1. Run the Game bash npm start

Open http://localhost:4310 in your browser.

  1. Run the Automated Test Suite

Threshold includes a comprehensive automated test harness:

bash
npm test

This runs:

npm run check: Strict ES module syntax check across all 25 source files.
node scripts/probe.mjs: 17 backend and signal integrity probes (HTTP endpoints, WebSocket handshake, rPPG signal streams, breath oscillators).
node scripts/test-client.mjs: Automated headless Chrome E2E browser test that simulates player input, verifies UI transitions across all acts, and confirms zero console errors or exceptions.
How It Responds to Human Signals

Threshold uses the Presage SmartSpectra SDK to measure contactless physiological vitals from your face and chest in real time via the webcam. Here is how those signals directly drive the game world:

  1. Arterial Pulse Waveform → → The Living Keyhole Signal: SmartSpectra extracts the user's Blood Volume Pulse (BVP) trace (pulse.waveform and pulse.rate) through subtle facial color fluctuations using remote photoplethysmography (rPPG). In-Game Response: The brass escutcheon and keyhole at (x: 0.96, y: 1.35, z: 0.05) do not simply blink on a timer—they physically expand, glow, and cast dynamic warm light (PointLight) in lockstep with the player's systolic contraction peaks. When your heart is pounding at 95 BPM, the door pulses with urgency. As you pause and relax, the keyhole's rhythm slows to a gentle, steady glow.
  2. Respiratory Dynamics → → Turning the Three Brass Locks Signal: SmartSpectra tracks respiratory chest wall excursions and airflow proxies (metrics.breath.waveform and metrics.breath.rate). In-Game Response: The door is secured by three independent mechanical locks (lock_0, lock_1, lock_2), located on the right jamb: Each lock requires a sustained, intentional exhalation lasting > 3.5 >3.5 seconds. As you exhale, the corresponding lock's keyway cylinder begins rotating (rotation.z = -progress * Math.PI). Upon reaching full exhalation depth, the brass tumbler clicks into place with a mechanical snap, emits an affirmative chime, and permanently stays open. After three conscious, calming exhalations, all three locks have turned, releasing the door latch.
  3. Facial Landmark Framing → → Visual Alignment Signal: 68 facial tracking landmarks detect head pose, pitch, and distance. In-Game Response: A subtle framing silhouette overlay (btn-silhouette) gently indicates whether your face is centered in optimal lighting without breaking immersion or displaying an intrusive video monitor.
  4. Technical Architecture Local Bridge (server/sdk-bridge.mjs): Connects to the SmartSpectra SDK client and exposes a lean, low-latency WebSocket endpoint (ws://localhost:4310/ws). Client Pipeline (client/js/signals.js & client/js/framepump.js): Buffers incoming telemetry into rolling 60Hz ring buffers, applying exponential smoothing (easeToward) to ensure butter-smooth visual animations without jarring frame spikes. Procedural Audio Engine (client/js/audio.js): Web Audio API synthetically generates calming resonant binaural pads, Tibetan singing bowl strikes, and mechanical lock clicks tied directly to your breath phase. Prize Categories 🏆 Most Creative or Delightful Use What Inspired This Project?

Most biometric applications treat human physiology like clinical telemetry: cold charts, graphs, BPM gauges, and calorie counters. But human vitals—our pulse and our breath—are fundamentally emotional.

In romantic relationships, we often hear the advice: "Leave your work at the door." Yet nobody ever gives us a practical tool to actually do it.

I was inspired to ask: What if the physical act of slowing down your body was literally the key to reunite with the one you love?

Why It Is Original, Playful & Unexpected
Biofeedback as a Gesture of Love: Instead of framing physiological regulation as a medical task or a sterile wellness check, Threshold reframes your breath as an act of kindness for your partner. You don't calm down because a watch told you to; you calm down so you can bring peace to the girl waiting for you on the other side of the door.
First-Person Tactile Storytelling: Walking through a dreamy, cel-shaded open courtyard with visible first-person arms, reading tender memories etched into stone pedestals, and interacting with playful kinetic mini-games (knocking a bell with your breath, spinning a wind rose) creates a rich, warm, emotional playground before you ever touch the door.
A Seamless Metaphor Made Real: The three locks on the door are not a gimmick—they represent the three breaths it takes to let go of the workday. The mathematical CAD-like precision of the door snapping, the hand-drawn ink borders, and the soft lighting transform biometric software into an unforgettable poetic experience.
Consent and Data Handling

Privacy and consent are at the very foundation of Threshold’s design. We believe that technology that senses the human body must hold itself to the absolute highest ethical standard:

  1. Two-Step Explicit Consent

Before the webcam is ever queried or activated, players are presented with a clear, full-screen consent disclosure (client/index.html):

What We Sense: Pulse rhythm, respiratory chest movement, and facial alignment for framing.
What We Never Do: Never record video, never store images, never use the microphone, never upload biometric data to any remote server, never track user accounts, and never display advertisements.
Effortless Opt-Out: A prominent "Enter in Demo Mode" button allows anyone to experience the full interactive game, courtyard, mini-games, and story without turning on their camera at all.

  1. Local-Only On-Device Processing All optical sensing operations are processed strictly in local browser memory or via the local loopback WebSocket server on the user's own machine (127.0.0.1:4310). No raw video frames, facial imagery, or sensor coordinates ever leave the local machine.
  2. SDK Telemetry Disabled In accordance with privacy-first development, the SmartSpectra SDK's background telemetry is explicitly turned off: javascript const spectra = new SmartSpectra({ telemetry: false, ... }); The application makes zero third-party tracking or diagnostic calls.
  3. Zero Data Retention & Immediate Erasure The game maintains zero persistent storage for biometric data—no databases, no local storage cookies, and no tracking tokens. Pressing the "Leave" button at any time immediately tears down the WebGL context, closes the WebSocket connection, stops all camera tracks, and clears all volatile buffers from memory.
  4. Medical Disclaimer Not a Medical Device: Threshold is an artistic wellness ritual and romantic narrative experience. It does not provide any diagnosis, prognosis, treatment, or health monitoring of any kind.

Thank you for reading, and may you always bring peace through the door to the one you love.