Skip to content
tanushchauhanPublic

About

Pixel-art spellcasting RPG played with custom wearable Arduino Uno R4 WiFi gloves & MediaPipe body-pose vision: weave timed rituals, dodge & parry in real time, and battle across laptops in Co-op & PvP.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Aethren

A pixel-art spellcasting adventure played with custom wearable Arduino gloves & full-body computer vision

Twist a physical rotary dial on your wrist to spin a 12-spell elemental grimoire, weave timed spell rituals with fingertip buttons, swings and webcam body poses, dodge and parry incoming enemy strikes in real time, and battle across two laptops in co-op or high-speed PvP duels.

React 19 Vite 6 TypeScript 5 Arduino Uno R4 WiFi MediaPipe Pose

The Enchanted Gloves · The Story · Spell Weaving · Combat & Vision Defense · Co-op · Duel (PvP) · Architecture · Quick Start


Two custom wearable Arduino Uno R4 WiFi enchanted gloves in front of the Aethren title screen
Hardware meets dark-fantasy pixel art. Two custom-built wearable Arduino Uno R4 WiFi spellcasting gloves paired over Wi-Fi UDP to the live Aethren game client.


Highlights at a Glance

  • Two Custom Wearable Spellcasting Gloves: Built from Arduino Uno R4 WiFi boards, Grove Base Shields, fingertip capacitive touch and tactile button sensors, a wrist-mounted rotary dial, a 3-axis I2C accelerometer, a piezo buzzer, and a 16×2 RGB LCD—streaming raw telemetry over Wi-Fi UDP at 40 Hz.
  • Timed Ritual Spell Weaving: Every spell in the 12-rune grimoire (Fire, Frost, Storm) is cast by chaining physical glove inputs (B1, B2, T, Swing) and live webcam body poses (↑ Raise Arm) against a sweet-spot timing bar (★ Perfect ×1.45 power).
  • Full-Body Computer Vision Defense: MediaPipe Pose Landmarker runs locally in the browser at 30 fps. When enemies attack, a translucent silhouette of your body and shrinking impact rings appear on screen—physically sidestep, duck, or raise your arm to dodge or block.
  • Two-Screen Co-op & Real-Time PvP Speed Duels: Two laptops on the same hotspot pair automatically through the Glove Hub. Team up against the 360 HP Ruined Gatekeeper in first-person co-op, or race head-to-head in Duel (PvP)—weaving spells at up to 2× Blitz speed while dodging staggered Osu!-style target circles on your body pose.

The Enchanted Gloves

Each controller is a wearable gauntlet built around an Arduino Uno R4 WiFi and a Grove Base Shield V2. The firmware (firmware/enchanted_glove/enchanted_glove.ino) is a zero-blocking state machine (millis()-driven, no delay() calls) that streams raw sensor frames over Wi-Fi UDP 40 times per second while driving non-blocking piezo haptic melodies and live LCD prompts.

Close-up of the glove's 16x2 LCD showing live B1: Play and B2: Co-op prompts Fingertip Grove capacitive touch sensor and tactile buttons wired along the fingers
Live context-aware LCD. The 16×2 Grove LCD updates dynamically as you navigate menus and weave spells (here showing B1: Play / B2: Co-op on the title screen). Fingertip spell triggers. Capacitive touch pad (T) on the index finger and tactile buttons (B1, B2) on the middle and ring fingers.
Wrist-mounted Grove LCD and rotary potentiometer dial on the glove Back-of-hand enclosure and wrist strap securing the microcontroller and battery pack
Rotary spell dial (A0). Mounted beside the LCD so you can spin the 12-slot spell wheel and menu highlights with your thumb. Untethered wearable build. Portable power pack and microcontroller housing strapped to the wrist for full-body movement and swings.

Glove controls diagram: rotary dial, buttons B1 and B2, touch pad T, accelerometer, webcam pose, buzzer and RGB LCD

Hardware Pinout & Sensor Roles

Grove Socket Component Role in Aethren
A0 Rotary Angle Sensor (Potentiometer) Spins the 12-wedge radial spell wheel & navigates every menu with slot hysteresis so boundaries never flicker
D4 Tactile Button 1 (B1) Opens the selected spell's ritual stage, performs [B1] ritual steps, and confirms menu choices
D8 Tactile Button 2 (B2) Jumps between Fire / Frost / Storm on the wheel, performs [B2] ritual steps, Hold B2 to Rest (+MP & Stance) or skip dialogue, and parries on enemy turns
D7 / D3 Capacitive Touch Sensor (T) Cycles enemy targets (or Cast Speed in Duel mode), performs [T] ritual steps, parries incoming attacks, and Hold T opens the Pause/Settings menu
I2C 3-Axis Digital Accelerometer Auto-detects LIS3DHTR, ADXL345, or MMA7660. Swings over 1.85 g classify as slash, thrust, or shake to complete [Swing] steps (up to ×1.45 power) or trigger a Glove Ward parry
D5 Piezo Buzzer Non-blocking haptic audio cues: tick (dial step / parry / turn start), rising cast chirp, falling fizzle on refused/dodged casts, and double-thud hit when wounded
I2C 16×2 RGB Backlight LCD (0x3E / 0x62) Displays active spell name, MP cost, HP/MP bars, and button hints on LCD v4; uses status backlight color coding (Orange / Green / Red) on LCD v2

The Story & World

A rift of light splits a rainy forest at midnight, and a child steps out of it. Two hooded figures watch from the trees. One whispers run, little shadow, and the other says stay. Whatever you choose, something in the undergrowth has already found you.

Two hooded figures stand over the child in a dark rainy forest The Stay or Run choice
The Rift. Hand-authored visual-novel scenes with dynamic rain, lightning, and synthesized character voices. …Which? Choose Stay (B1) or Run (B2) straight from the glove.
A wolf emerges from the undergrowth The child running through the forest toward a distant castle
The Wolf Emerges. The pack surrounds you in the moonlit clearing. The Escape. A desperate sprint through the storm toward a ruined keep.
A deserted gothic castle gate in the rain The Ruined Gatekeeper, an armored knight with a purple-flamed axe
The Castle Gate. Silent and sealed—until the sky falls. The Ruined Gatekeeper. "No one enters."

Story flow: Title, The Rift, the Stay or Run choice, Glove Training, Wolf Pack battle, Escape, At the Gate, and the Gatekeeper boss


Spell Weaving & Elemental Synergies

There are 12 spells across Fire, Frost, and Storm. In the story campaign you begin knowing three starter runes (Ember Bolt, Frost Shard, Storm Spark) and unlock the remaining nine mid-battle by reading grimoire hints and weaving their rituals.

Casting loop: turn the dial, tap T to aim, press B1 to open the ritual, hit each timed step, release the spell

The radial spell wheel in the wolf battle The ritual stage showing Raise Arm, Press B1 and Swing Glove steps with a timing bar
The 12-Rune Spell Wheel. Turn the Dial to select a wedge, tap T to switch targets, and press B1 to open the ritual stage. Timed Ritual Stage. Hit each required pose and glove input as the cursor crosses ★ PERFECT (×1.45).

Complete 12-Spell Grimoire

Element Spell Cost Ritual Sequence Effect & Elemental Combo
🔥 Fire Ember Bolt (Starter) 2 MP ↑ Arm → B1 → Swing 14 dmg. Quick & cheap. Shatters Chilled or Frozen foes for +50% damage.
🔥 Fire Fire Lance 4 MP ↑ Arm → B1 → B2 → Swing 32 dmg that pierces armor. Shatters Chilled/Frozen (+50% dmg).
🔥 Fire Immolate 3 MP B2 → Swing 8 dmg + applies Burning (6 armor-ignoring dmg/turn for 3 turns). Primes Storm Conductive.
🔥 Fire Meteor 7 MP ↑ Arm → B1 → B2 → T → Swing 34 dmg to primary target + 16 splash dmg to all other foes. Undodgeable pack devastation.
❄️ Frost Frost Shard (Starter) 2 MP T → Swing 10 dmg + applies Chilled (−30% attack & stance dmg; blocks Jaw & Grab).
❄️ Frost Ice Shield 3 MP ↑ Arm → T → B1 Self ward: absorbs 18 damage for 2 turns and blocks Bleeding, Scorn, and Eclipse curses.
❄️ Frost Frost Prison 5 MP ↑ Arm → T → B1 → Swing Encases target in ice: strips Roused and Freezes for 2 turns (1 turn on Gatekeeper).
❄️ Frost Frost Nova 4 MP T → B2 → Swing 12 area dmg to every enemy and applies Chilled to the entire pack. Undodgeable.
⚡ Storm Storm Spark (Starter) 1 MP ↑ Arm → B2 → B1 7 dmg. Near-instant bolt. Conducts on Burning/Chilled foes (+4 dmg & refunds 1 MP).
⚡ Storm Chain Lightning 4 MP ↑ Arm → B2 → T → Swing 16 dmg to primary target, then arcs to remaining enemies for 10 and 6 dmg. Undodgeable.
⚡ Storm Static Shock 3 MP T → B1 8 dmg, strips Roused (+5 bonus dmg), and Drains all energy so the foe must Rest.
⚡ Storm Overcharge 2 MP ↑ Arm → B2 → Swing Self buff: your next damaging spell deals ×1.5 damage (and refunds 1 MP if Storm).

Combat & Webcam Body Defense

Glove Training tutorial: Spin the Spell Wheel

The opening encounter walks new players through an interactive 6-step Glove Training tutorial (spinning the dial, switching elements, cycling targets, weaving a ritual, casting, and parrying a mid-lunge wolf attack).

Defending with Your Body & Glove

When enemies attack, you can defend physically in two ways:

  1. Webcam Pose Defense (MediaPipe Vision):
    • Stand in front of your laptop camera to calibrate your neutral torso zone (with automatic virtual-hip estimation when sitting or standing close to a laptop webcam).
    • During an enemy windup, a translucent cyan projection of your body and shrinking impact rings appear over the targeted area:
      • Sidestep Left / Right: Move your entire torso past the red danger line to completely evade lunges and grabs.
      • Duck: Drop your shoulder line below the horizontal danger line to slip under high slashes.
      • Raise Right Arm: Hold your guard arm up to block (cuts health damage to 25%, halves stance damage, and prevents Bleeding and boss curses).
  2. Glove Ward Parry:
    • Shake the glove or tap T / B2 during an enemy attack to raise a Glove Ward—halving incoming damage and reflecting 6 damage back at the attacker.

The Ruined Gatekeeper (Final Boss)

Battle against the Ruined Gatekeeper at the castle gate

At the castle gate, the Ruined Gatekeeper crashes down from the battlements (240 HP solo / 360 HP in co-op, 4 armor) wreathed in purple Scorn flames:

  • Scorn Cleave: Heavy axe slash that inflicts Scorn (−3 HP per turn) and carves a jagged purple gash across the screen.
  • Eclipse of Scorn: Dark shockwave that inflicts Eclipse (−4 HP per turn and halts passive MP regeneration).
  • Scorn Inferno: Ultimate blast that ignites the entire battlefield for 5 turns.

Two-Laptop Co-op

Two enchanted gloves ready for two-player co-op or PvP duel
Two gloves, two laptops, one shared battlefield. Each player claims their own wireless glove through the Glove Hub.

Two players on separate laptops—each wearing their own enchanted glove—can team up against the Ruined Gatekeeper:

  1. Automatic Gate Pairing: When both laptops reach the castle gate (or click Boss fight in the bottom-left dev tools on the title screen), they discover each other automatically over the Glove Hub WebSocket relay (:8765).
  2. Shared Turn-Based Boss Battle: Turns alternate Host → Partner → Gatekeeper (360 HP). The Gatekeeper's single-target Scorn Cleave dynamically targets whichever hero dealt him the most damage since his last swing.
  3. First-Person Partner VFX & Low-Latency Defense: Your spells launch from your own hand in the center, while your partner's spells streak in from the right edge of your screen. Both players can parry with their gloves or dodge/block on their own webcams with optimistic local feedback.

Duel Mode (PvP & AI Speed Contest)

Select Duel (PvP) on the title screen to enter the moonlit forest clearing and face a Rival Spellbearer in a real-time Speed Spellcasting Contest—either against a second player on another laptop, or solo against the AI Speed Caster.

  • Left-Docked 12-Spell Wheel & Live Rival Telemetry: Uses the exact moonlit clearing stage, rain atmosphere, and 12-spell radial wheel + ritual bar as the main game, docked to the left side of the screen so the Rival Spellbearer sprite in the center of the clearing stays completely unobstructed. Above your rival's health bar, live intent tags show which spell they are weaving in real time (⚡ Weaving Fire Lance (2/4) · 1.5× Rapid).
  • Selectable Spell Cast Speed Tiers (1× Swift, 1.5× Rapid, 2× Blitz): Tap T on the wheel (or click the speed buttons in the top bar) to choose how fast your ritual slider moves—and how fast the Osu! target circles shrink on your opponent's body:
Cast Speed Tier Ritual Slider Duration Enemy Osu! Ring Windup Stagger Between Rings Damage Multiplier
1× Swift 2.20 s / step 1.45 s 0.65 s ×1.00
1.5× Rapid (Default) 1.45 s / step 1.05 s 0.48 s ×1.15
2× Blitz 0.95 s / step 0.76 s 0.36 s ×1.30
  • Disjoint (Staggered) Osu! Body-Part Rings: Every offensive spell spawns 2 to 3 Osu!-style shrinking target circles locked onto random locations on the defender's projected body pose (#1 HEAD, #2 L ARM, #3 R ARM, #4 CORE) with disjoint, staggered start and impact timers. Each ring locks onto your body part at the exact millisecond its individual timer begins—so you cannot clear all of them with a single early movement; you must dodge or parry Ring #1, then #2, then #3 in sequence.
  • Simultaneous Weaving & Defense: You never stop casting to defend. Move the targeted body part out of each shrinking circle (or raise your right arm, shake the glove, or tap T to Parry the next closing ring for 70% damage reduction) while continuing to weave your own spell ritual with B1, B2, and Swing.

Architecture & Low-Latency Pipeline

Architecture diagram: Arduino gloves send 40Hz UDP to the Glove Hub, which bridges over TCP_NODELAY WebSocket to browser clients and relays Co-op and Duel state

Layer Stack Responsibilities & Latency Optimizations
Glove Firmware (firmware/enchanted_glove) Arduino C++ (WiFiS3, rgb_lcd, Wire) Reads digital pins (D3/D7, D4, D8), rotary ADC (A0), and I2C accelerometer (LIS3DH / ADXL345 / MMA7660) at 40 Hz; streams compact JSON over UDP :4211; steps non-blocking piezo melodies and LCD pages on :4210.
Glove & Co-op Hub (firmware/glove-hub.ts) Node.js (zero external deps, raw UDP + WebSocket) Bridges UDP :4211 to WebSocket :8765 with socket.setNoDelay(true) (TCP_NODELAY), manages exclusive per-player glove claims, filters 40 Hz sensor streams per owner so secondary laptops only receive their own glove's frames, and relays Co-op & Duel packets.
Game Client (client/) React 19 · Vite 6 · Zustand · Motion · MediaPipe Runs the visual novel, 12-spell radial wheel, timed ritual engine, Web Audio synthesized spell SFX, MediaPipe Pose Landmarker, zero-re-render SVG Osu! defense overlay, and in-memory HTMLImageElement.decode() asset preloader.
Story & Combat Server (server/) Express · Socket.IO Serves the production client bundle with immutable asset caching (Cache-Control: public, max-age=86400, immutable), hosts 4-letter story room codes, and runs the round-based combat engine for /debug/server.
Shared Contracts (packages/shared) TypeScript Shared pose landmark indices, calibration thresholds, buzzer patterns, and Socket.IO payload types.

Getting Started

Requirements: Node >=22 and pnpm >=10. The game is 100% playable with or without the physical Arduino gloves.

pnpm install

Combined One-Command Launchers

Every start script launches both the Game Server and the Glove Hub together in a single terminal (Ctrl+C cleanly stops all processes):

# Development mode: Vite client (:5173) + Game Server (:3001) + Glove Hub (:8765 / UDP :4211)
pnpm dev

# Production demo mode: builds client/dist and launches Game Server (:3001) + Glove Hub (:8765)
pnpm demo

# Fast start: launches Game Server (:3001) + Glove Hub (:8765) using the existing build
pnpm start

Connecting Physical Gloves & a Second Laptop

  1. Copy firmware/enchanted_glove/wifi_secrets.example.h to firmware/enchanted_glove/wifi_secrets.h and set WIFI_SSID and WIFI_PASS to your Wi-Fi hotspot (enable 2.4 GHz / Maximize Compatibility on iPhone hotspots).
  2. Flash each Arduino Uno R4 WiFi glove with its hardware variant and unique ID:
    cd firmware
    ./flash.sh v4      # Glove 1 (LCD v4, Touch on D7)
    ./flash.sh v2 2    # Glove 2 (LCD v2, Touch on D3)
  3. On the host laptop, run pnpm demo (or pnpm dev). The hub prints its LAN WebSocket address on startup.
  4. On the second laptop, open the host's LAN URL with the ?hub= parameter:
    http://<host-laptop-ip>:3001/?hub=ws://<host-laptop-ip>:8765
    
  5. Click Preload game in the bottom-left corner of the title screen on each laptop to download and pre-decode all scene art, audio, video, and MediaPipe WASM/model files into RAM before playing.

(To test multi-glove features without physical boards, run pnpm --dir firmware hub:simulate to spawn two simulated Wi-Fi gloves.)

Testing & Verification

pnpm typecheck
pnpm test

Debug & Hardware Bring-Up Labs

All engineering and hardware diagnostic tools live under /debug:

Route Diagnostic Lab
/debug Command center & route index
/debug/hardware Live 40 Hz glove telemetry, interactive Grove Wiring Map (auto-detects misplaced pins and I2C addresses), LCD text/RGB tester, and software glove simulator
/debug/vision Webcam MediaPipe pose calibration, Osu! shrinking body-part ring tester, whole-body strobe blasts, and the 15-wave Survival Gauntlet
/debug/combined Side-by-side physical glove + live webcam pose integration testbed
/debug/audio Zero-API neural narrator voice lab (Kokoro-82M ONNX, Edge Neural TTS, macOS say) + Web Audio DSP FX rack
/debug/server Dual-seat multiplayer combat simulator against the authoritative Socket.IO server

Repository Layout

.
├── client/                 React 19 + Vite 6 frontend
│   ├── public/art/         Pixel art scenes, spellbearer & wolf sprites, boss MP4 clips, particles
│   ├── public/audio/       Original soundtrack, rain ambience, and combat SFX
│   └── src/
│       ├── combat/         12-spell catalogue, timed rituals, battle store, status effects, boss AI
│       ├── duel/           Real-time PvP & AI speed duel arena, speed tiers, staggered Osu! rings
│       ├── glove/          Glove session provider, menu navigation, radial spell wheel & ritual UI
│       ├── hardware/       WebSocket hub client, wiring map diagnostics, Web Serial & simulator
│       ├── vision/         MediaPipe PoseLandmarker service, torso/dodge classifiers, survival gauntlet
│       ├── net/            Two-laptop Co-op relay link, room store, in-memory decoded image preloader
│       └── ui/             Visual novel scenes, Wolf & Gatekeeper stages, HUD, synthesized spell VFX
├── firmware/               Arduino Uno R4 WiFi sketch (enchanted_glove.ino), flash.sh, and glove-hub.ts
├── server/                 Express + Socket.IO server, room service, and round-based combat engine
├── packages/shared/        Shared TypeScript contracts and constants
└── docs/                   Architecture diagrams, hardware photos, and combat design reference

Spell particle masks by Kenney. Pixel fonts: Pixelify Sans, Silkscreen, and VT323 (OFL).

About

Pixel-art spellcasting RPG played with custom wearable Arduino Uno R4 WiFi gloves & MediaPipe body-pose vision: weave timed rituals, dodge & parry in real time, and battle across laptops in Co-op & PvP.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages