跳到正文
DEV Community· Mir Shah·· 3 小時前AI 評分44

COLD SWEAT:恐慌會加快倒數引信

COLD SWEAT | Your Panic Speeds Up the Fuse

AI 導讀

COLD SWEAT 是一款使用 Presage SmartSpectra SDK 的 3D 拆彈遊戲,透過網絡攝影機即時讀取玩家的脈搏和呼吸,並以此調節引信速度。玩家的緊張程度越高,引信燃燒越快;保持冷靜則可爭取更多時間。遊戲亦提供可選的 AI 炸彈設計功能,並以規則檢查器驗證設計。

正文

This is a submission for the Presage SmartSpectra SDK Challenge

COLD SWEAT: the bomb listens to your heart

Defuse bombs while your webcam reads your real pulse and breathing. Stay calm and the fuse slows down. Panic and it races.

What I Built

COLD SWEAT is a 3D bomb-defusal game where your own body is the hardest part of the puzzle.

You walk around a little hex island, find the bomb, open it up, and cut the right wires using the bomb's manual. Easy, right? Except the fuse is wired to you. The Presage SmartSpectra SDK reads your pulse and breathing live from the camera, and the more tense you get, the faster the fuse burns.

The whole game in one line

Your calm = more time.

Your panic = less time.

Your heartbeat = the real timer.



Live vitals

Real pulse and breathing from your webcam, every second.

Endless levels

More bombs, shorter fuses, trickier rules, forever.

AI bomb designer

Optional AI writes new wiring and a new manual for every bomb.

3 camera views

Press C: overhead, behind the agent, or first person.

How a run goes

1. The menu

A 3D lobby with your agent, a moving camera and a random season: spring, summer, autumn or winter.

2. Consent first

You tick I am 18 or older and allow the camera. Nothing turns on before that.

3. Ready Check

Pick your camera (I used my phone through DroidCam), press Start camera, and watch the checks turn green: Camera, Presage, Face, Pulse, Breathing.

The heart icon beats at your real pulse, and the breathing icon swells with every breath you take.

Then Find your calm: sit still for 45 seconds so the game learns your resting pulse and breathing.


4. The mission

Walk with WASD, follow the beacon, press E at the bomb.

Read the manual (M), find the right wire, click to cut.

Wrong wire? BOOM.



5. Level up

Every level adds bombs, shortens the fuse, adds wires, cuts and rules, and moves to the next season, with rain, storms, falling leaves and snow.

Demo

What to watch for in the video

The Ready Check with my live pulse and breathing.

The fuse speed going above x1.0 when my Tension rises.

Pressing C to switch to first person, and the AI-designed bombs.



Code

GitHub logo abbasmir12 / coldsweat

A 3D bomb-defusal game where your real pulse and breathing set the fuse. Stay calm and it slows down, panic and it races. Built with Presage SmartSpectra, Electron and Three.js.

COLD SWEAT is a fun reaction game, not a medical device. It does not diagnose, detect or assess any health condition.


What it is

You walk around a small hex island, find the bomb, open it up, and cut the right wires using that bomb's manual. The catch: the fuse is wired to you.

The Presage SmartSpectra SDK reads your pulse and breathing live from your webcam. The game compares them with your own calm level and turns the difference into Tension. The higher your Tension, the faster the fuse burns.

Live vitals Real pulse and breathing from the

…

Quick start

Built with Electron, Three.js and @smartspectra/node-sdk, in plain JavaScript.

git clone https://github.com/abbasmir12/coldsweat.git
cd coldsweat
npm install
copy .env.example .env      # then paste your SMARTSPECTRA_API_KEY
npm start                   # live mode with your webcam
npm run start:sim           # no camera? try it with sliders

3D models

The .glb models are too big for git. Download them from the Google Drive link in assets/models/README.md and drop them into assets/models/.

Get COLD SWEAT on GitHub

How It Responds to Human Signals

COLD SWEAT uses two live Presage signals:

Pulse rate (MetricType.PULSE_RATE)

Shown live on the Ready Check and in the in-game HUD, with a beating 3D heart.

Breathing rate (breathingMetrics)

Shown live with a breathing 3D lungs gauge. In winter you even see your agent's breath puff out in the cold, at your real breathing rate.

From your face to the fuse

Step 1: Camera to SDK

The renderer uses the SDK's SmartSpectraSDK from @smartspectra/node-sdk/renderer. If you pick a camera, I open it with getUserMedia and hand it over with sdk.useMediaStream(stream).

The main process runs the native SDK through bindSmartSpectraIpc(win) from @smartspectra/node-sdk/main.

Step 2: SDK to numbers

Every metrics event is decoded with decodeMetrics() from @smartspectra/node-sdk/messages, and I take the newest pulse and breathing value.

validationStatus tells me if the face is OK (kOk), missing (kNoFaceFound), too dark (kTooDark) and so on. Those hints show up right on the camera view.

Step 3: Numbers to Tension

Values are smoothed with a moving average, then compared with your own calm level from the 45-second check.

Pulse and breathing above your calm level push Tension up. Staying at or under it gives a small calm bonus.

Step 4: Tension to the game

Tension sets the fuse speed (x1.0 and up).

High Tension makes the camera push in and wobble, and your agent switches to a panicking model.

No face in view? The fuse pauses, so the game never runs on stale numbers.

Built to be fair

Small warnings like low light or a low frame rate only show a hint; they don't stop the game while pulse and breathing keep arriving.

If SmartSpectra ends a session (for example error 14, frame rate too low), the camera is released and you press Start camera again.

The optional AI bomb designer

What it does

It designs every bomb for the level you're on: the wiring, the wire colors and the manual's rules, plus a theme like lighthouse keeper or flooded mine.

Higher levels mean more wires, more cuts and trickier rules.

Any provider you like

Works with any OpenAI-compatible provider. OpenRouter is the default; change AI_BASE_URL and AI_MODEL in .env to switch.

The AI never judges

The game's own rule checker validates every design. Anything unfair or broken is thrown out and replaced with a bomb from the local generator.

Off by default. It only gets game settings (level number and counts), never the camera, pulse, breathing or Tension.

Press C to change your view

Overhead: the classic top-down island view (default).

Behind: the camera follows your agent from behind.

Eyes: first person, right through your agent's eyes. Walking up to a ticking bomb this way is intense.

Prize Categories

Most Creative or Delightful Use

The inspiration

Every bomb movie has that moment: hands shaking, heart pounding, red wire or blue wire? I wanted players to feel that, not just watch it.

What makes it original

Your body isn't a stat on a screen; it is the timer. Being calm is the skill.

You can be great at the puzzle and still lose because your heart rate spiked.

And breathing slowly to calm down actually wins you time, which makes for a fun little calming loop inside a stressful game.

Consent and Data Handling

COLD SWEAT is a fun reaction game, not a medical device. It does not diagnose, detect or assess any health condition.

Consent before anything

A consent screen comes first. You must tick I am 18 or older and allow the camera. The camera never turns on before that.

Electron only grants video access to the app's own page. Microphone access is never allowed.

Always visible

A CAMERA ON badge is shown whenever the camera is running.

The camera stops when you press Stop camera, go back to the menu, finish the game or close the app.

What is stored

Nothing about your body. Pulse, breathing and Tension live in memory only while you play and are gone when you close the game.

The game saves only settings on your computer (localStorage): volume, weather effects, your chosen camera and the flip setting.

SmartSpectra SDK and telemetry

Camera frames are processed by the Presage SmartSpectra SDK to get pulse and breathing.

The SDK's telemetry is on (its default). It sends Presage session summaries and readiness reports with device and SDK details, but never video frames or vital signs, according to Presage's docs. Developers can turn it off with enableTelemetry: false.

Optional AI

Off by default. When you turn it on, only game settings are sent to the AI provider you choose. Camera, pulse, breathing and Tension are never sent.

API keys stay in .env in the main process and are never committed or logged.



Can you keep your cool?

Clone it, sit in good light, and try not to panic.

來源:DEV Community · dev.to