Inspiration
It started with a simple observation: when I play games, my physical state directly affects my performance. My heart races during tense moments, I lean forward when concentrating, and I fidget when frustrated. I wondered—what if the game could see these reactions and respond to them? What if instead of fighting against my human limitations, the game could work with them?
This thought collided with Kiroween's challenge to "build something wicked." We realized the most terrifying maze isn't one with predefined monsters—it's one that manifests your own anxieties and rewards your moments of clarity. NeuroLabyrinth was born from this vision: a dungeon crawler where the real boss battle happens within your own mind.
What it does
NeuroLabyrinth is a "self-aware" dungeon crawler that uses your computer's webcam to read your physiological state in real-time. It requires no expensive hardware—just you and your laptop.
- Reads Your Body: It detects heart rate (via photoplethysmography/PPG), facial expressions, gaze direction, and micro-movements to determine stress and focus levels.
- Dynamic World Generation: The maze reshapes itself based on your biofeedback. High stress might cause the environment to darken or spawn "Catastrophizer" enemies, while sustained calm reveals hidden paths.
- Bio-Synchronized Audio: The soundtrack dynamically synchronizes to your heartbeat, allowing you to hear your own physical reaction to the game.
- Privacy-First: All computer vision and signal processing happen locally in the browser; no biometric data is ever sent to a server.
How we built it
This project was a co-development effort between a human developer and Kiro. We utilized a modern web stack (TypeScript, React) alongside complex computer vision libraries (Face-API.js).
- Vibe Coding with Kiro: The development process was conversational. I would provide a human-readable prompt (e.g., "How can I detect heart rate from a webcam?"), and Kiro would implement complex algorithms, such as the PPG signal processing and FFT analysis needed to extract a pulse from video feed.
- Spec-Driven Architecture: We used a
.kiro/specs/directory as our blueprint. I wrote specifications for the ECS (Entity Component System), and Kiro translated them into robust TypeScript interfaces. - Parallel Processing: To keep the game smooth, we implemented
cvWorker.tsto run heavy computer vision tasks in Web Workers, preventing the main thread from blocking. - Agent Hooks: We created "living" hooks where I defined trigger conditions (like a spike in heart rate), and Kiro implemented the logic that altered the game state, effectively allowing the code to "breathe" with the player.
Challenges we ran into
- Performance Optimization: Early versions lagged because the computer vision processing blocked the main game loop. We had to architect a system using Web Workers to offload Face-API.js processing without sacrificing frame rates.
- Signal Reliability: Webcam-based biofeedback is inherently noisy. Implementing clinical-grade smoothing algorithms and quality checks to ensure the heart rate and stress data were accurate was a massive hurdle.
- Integration Complexity: Stitching together computer vision, procedural maze generation, audio synthesis, and game logic was staggering. Maintaining architectural consistency across these disparate systems required rigorous planning.
Accomplishments that we're proud of
- Democratizing Biofeedback: We successfully implemented real-time PPG (heart rate) analysis using nothing but a standard webcam, making technology usually reserved for medical hardware accessible to anyone.
- The "Living Maze": We moved beyond standard procedural generation to reactive generation. Seeing the maze recursively backtrack and modify itself based on human anxiety felt like programming witchcraft.
- The "Flow State" Mechanic: We successfully coded a system that recognizes sustained focus and rewards the player, turning the game into a genuine mindfulness tool.
- Kiro's Collaboration: We proved that AI can be more than a code generator; it acted as a systems architect, suggesting implementations for signal processing and audio synthesis that I wouldn't have been able to build alone in this timeframe.
What we learned
- Computer Vision is Accessible: With the right guidance and libraries, complex CV logic is within reach for web developers.
- Feedback Loops Matter: When a game responds to your physical state, it creates a powerful feedback loop that creates a unique sense of immersion and mindfulness.
- Specification is Power: The better I articulated my vision in the specs, the more "magical" Kiro's implementation became.
- Privacy is Possible: We learned that you don't need the cloud to do advanced AI processing; client-side execution is viable and preferable for biometric data.
What's next for NeuroLabyrinth: Where the Maze Reads Your Mind
NeuroLabyrinth started as a Kiroween project, but it is a proof of concept for a new genre of "self-aware" games. Our roadmap includes:
- Mental Health Integration: Developing short biofeedback training sessions disguised as gameplay for anxiety management.
- Education: Adapting the focus-tracking technology to help students with attention challenges train their concentration.
- Accessibility: exploring how these bio-signals can be used as new forms of controllers for people with physical limitations.
- Research: Polishing the platform to be used by researchers studying human-computer interaction and psychology.
Built With
- computer-vision
- face-api.js
- kiro
- node.js
- react
- tensorflow
- three.js
- tone.js
- typescript
- vercel
- vite
- web-workers
- webgl
- zustand
Log in or sign up for Devpost to join the conversation.