AAA Gesture-Controlled Racing โ The world's first browser-based gesture racing experience
Game Modes ยท Features ยท How It Works ยท Architecture ยท Tech Stack ยท Getting Started
Virtual Steering is a premium browser racing experience with a signature innovation: your hands are the steering wheel in Endless Survival mode. One cohesive game โ not four โ with a unified flow: PLAY โ SELECT TRACK โ SELECT MODE โ RACE.
Race through three premium tracks (Cyber City, Mountain Highway, Space Highway) with dynamic weather, at 60 FPS on desktop and adaptive quality on mobile. Fall back to keyboard, touch, gyroscope, or phone-as-controller on any device.
| Mode | Description | Controls | Track |
|---|---|---|---|
| Endless Survival | Flagship gesture mode โ dodge traffic, chain combos, survive as long as possible | โ Gesture (MediaPipe Hands) | Cyber City / Mountain Highway / Space Highway |
| AI Race | Competitive racing vs 5 named AI personalities with adaptive difficulty | โจ๏ธ Keyboard / ๐ฎ Gamepad | All 3 tracks (3 races per tournament) |
| You vs You (Time Trial) | Race against your own best ghost โ delta timer, sector splits | โจ๏ธ Keyboard / ๐ฎ Gamepad | All 3 tracks |
| Multiplayer | Up to 4 players online via WebRTC (PeerJS public cloud) | โจ๏ธ Keyboard / ๐ฎ Gamepad / ๐ Touch | Endless Survival (no traffic) |
| Tournament | Division ladder (Rookie โ Pro โ Elite โ Champion), 3 races per division | โจ๏ธ Keyboard / ๐ฎ Gamepad | All 3 tracks |
Control method is communicated on the Mode Select screen โ Endless Survival shows โ Gesture, others show โจ๏ธ Keyboard / ๐ฎ Gamepad.
- Drive with both hands โ car accelerates when both hands detected; palm centers mapped to steering angle
- Smooth tracking โ exponential landmark smoothing + dead zone + non-linear steering curve for natural feel
- Live camera panel โ see your hand skeleton overlay while you play
- Interactive calibration โ capture neutral center, dead zone, and EMA smoothing in Settings โ Accessibility
- Keyboard โ
Wgas ยทA/Dsteer ยทUauto-accelerate toggle - Touch controls โ on-screen buttons with one-hand mode (steering + throttle on one side)
- Gyroscope mode โ tilt your phone/laptop to steer
- Phone as controller โ scan QR, pair via PeerJS, use device orientation
- Gamepad โ standard Gamepad API support (where browser supports it)
- Unified InputFrame contract โ priority resolution: Replay โ Phone โ Auto โ Gyro โ Base (hand/keyboard/touch)
- 3 Premium Tracks โ Cyber City (neon/rain), Mountain Highway (fog/sunrise), Space Highway (stars/nebula)
- Dynamic Weather โ per-track state machines (Clear โ Fog โ Rain โ Storm), seeded for replay consistency
- 3D Cockpit HUD โ speed gauge, gear indicator, position/lap, score, combo ring, boost bar, draft meter
- AI Opponents โ 6 personalities (Blaze, Shield, Vector, Risky, Chameleon, Comet) with 7-parameter deterministic model, 5 difficulty tiers, adaptive Chameleon
- Tournament Ladder โ 4 divisions, 3 races each, promotion on top-3 average, division-scaled rewards
- Race Result Gate โ idempotent completion (dedupes by raceId), zero progression from replays
- Procedural Engine Audio โ Web Audio API synth scaled to speed, adaptive music stems (menu โ6dB, race layers)
- Speed Lines & Vignette โ dynamic juice effects at high velocity
- Collision Juice โ hit-stop + slow-mo crash sequence, screen shake
- Coins & XP โ earned every race (even losses), flat 1000 XP/level
- Cosmetic Catalog โ car skins, neon trails, driver titles (visual-only, no stat impact)
- High Scores โ local per track/mode, sanitized storage, XSS-hardened
- Driver Profile โ level, XP, equipped cosmetics, completed races
- Deterministic Replay โ fixed 30Hz InputFrame recording, binary codec, seeded RNG
- Ghost Racing โ holographic ghost car (45% transparent cyan, light trail), delta timer (green/red), 3 sector splits
- Replay Viewer โ 4 camera modes (Chase, Orbit, Cinematic, Free), slow-mo (toggle + hold-Shift), Depth of Field (FOCUS slider)
- Photo Mode โ screenshot capture with baked filters (grain, contrast, focus), Web Share API + download fallback
- Session-Only Persistence โ replays never leave the session (by design)
- Colorblind Presets โ Deuteranopia / Protanopia / Tritanopia (CSS token overrides)
- One-Hand Mode โ steering + throttle composed on single touch side
- Reduced Motion โ disables camera fly-through, screen shake, particles, shortens cinematic intros
- High Contrast HUD Theme โ CSS token overrides
- Hold-to-Confirm โ destructive actions (Quit, Leave Lobby) require hold
- Touch Targets โฅ 48px โ WCAG 2.1 AA compliant
- Quality Tiers โ Performance (1.0ร, no post/shadows/weather), Balanced (1.5ร, light bloom), Quality (2.0ร, full effects)
- Auto-Tier Selection โ device-based initial tier
- Dynamic Resolution โ rolling 2s frame budget: sustained >18ms โ step down ร0.8, <16ms โ recover, floor 0.6ร
- GPU Resource Lifecycle โ full disposal of geometries/materials on object removal
- Menu Render Gating โ game renders only during race phases (idle menus skip GPU)
flowchart LR
A[Webcam] --> B[MediaPipe Hands]
B --> C[Palm Center Extraction]
C --> D[Smoothing Filter (EMA + Dead Zone)]
D --> E[Steering Mapping]
E --> F[InputFrame (Unified Contract)]
F --> G[InputManager (Priority Resolution)]
G --> H[Game Simulation]
H --> I[Three.js Rendering]
I --> J[HUD / Feedback / Audio]
K[Keyboard] --> F
L[Touch] --> F
M[Gyroscope] --> F
N[Phone Controller] --> F
O[Gamepad] --> F
P[Replay Playback] -.->|Highest Priority| F
- MediaPipe extracts 21 hand landmarks per frame (up to 2 hands)
- Palm center (wrist + index MCP + middle MCP) mapped to 0โ1 steering axis
- Exponential smoothing removes jitter; dead zone prevents drift
- InputFrame normalized (steering โ [โ1,1], throttle โ [0,1], brake โ [0,1])
- InputManager resolves priority layers โ Replay > Phone > Auto > Gyro > Base
- Game simulation runs at 60Hz, Three.js renders, HUD/audio update
src/
โโโ main.ts # Game bootstrap, game loop, state machine wiring
โโโ game/
โ โโโ Game.ts # Main simulation (road, obstacles, physics, rendering)
โ โโโ GameModeConfig.ts # Declarative mode/track config (4 modes, 3 tracks)
โ โโโ RaceDirector.ts # Race standings, timing, lap counting
โ โโโ TournamentManager.ts # Division ladder (RookieโProโEliteโChampion)
โ โโโ p4/ # Survival mechanics (boost, combo, near-miss, collision juice)
โโโ ai/ # AI Race subsystem
โ โโโ AICar.ts # Individual AI car (perceptionโdecisionโaction)
โ โโโ AIPersonality.ts # Personality profiles + Chameleon adapter
โ โโโ AIRuntime.ts # Race orchestrator (grid, tick loop, HUD telemetry)
โ โโโ CatchUp.ts # Rubber-band catch-up logic
โโโ input/ # Unified input system
โ โโโ HandTracker.ts # MediaPipe Hands pipeline
โ โโโ GestureCalibration.ts # Neutral center + dead-zone + EMA
โ โโโ InputFrame.ts # Normalized input contract
โ โโโ InputManager.ts # Priority resolution (replayโphoneโautoโgyroโbase)
โ โโโ sources/ # Adapters: Hand, Keyboard, Touch, Gyro, Phone
โโโ replay/ # Replay + Ghost system
โ โโโ recorder.ts # Fixed 30Hz race state recording
โ โโโ player.ts # Deterministic playback
โ โโโ ghost.ts # Holographic ghost renderer
โ โโโ hud.ts # Ghost duel HUD (delta, sectors)
โ โโโ viewer.ts # Free camera + slow-mo + DoF
โ โโโ store.ts # IndexedDB best-replay storage
โโโ progression/ # XP/coins, cosmetic catalog, rewards, completion gate
โโโ network/ # PeerJS multiplayer (lobby, WebRTC mesh, remote ghosts)
โโโ graphics/ # PostProcessor (bloom/DoF/grain), WeatherSystem, ParticlePool
โโโ managers/ # Singletons: Audio, Profile, Quality, Save, Scene, UI
โโโ screens/ # All 11 screens + navigation flow
โโโ ui/ # Component library + core systems (focus, nav, transitions, theming)
โโโ core/ # Architecture spine: StateMachine, NavigationSystem, EventBus, RaceStartPipeline
Design Principles:
- Single authoritative flow โ NavigationSystem owns all screen transitions
- Replay at input boundary โ ReplayInputSource has highest priority, zero progression
- Determinism by default โ seeded RNG for AI, weather, traffic, replay
- Cosmetics are visual-only โ ContentCatalog is sole authority, no stat-bearing items
| Layer | Technology |
|---|---|
| Language | TypeScript 5 (strict) |
| 3D Rendering | Three.js 0.170 ยท WebGL 2 |
| Vision AI | MediaPipe Hands (CDN) |
| Build | Vite 6 |
| Audio | Web Audio API (procedural synthesis) |
| Multiplayer | PeerJS 1.5 (WebRTC mesh, public cloud signaling) |
| Testing | Vitest (unit), Playwright (E2E: Chromium + Pixel 5) |
| Lint/Format | ESLint + TypeScript-Eslint + Prettier |
| CI | GitHub Actions (typecheck, lint, test, build) |
| Deployment | Vercel (static + SPA fallback) |
- Node.js 18+
- A webcam (for Endless Survival gesture mode)
- HTTPS or localhost (required for camera access)
# 1. Clone & install
git clone https://github.com/Manthan-13521/GestureKart-AI-Racing.git
cd GestureKart-AI-Racing
npm install
# 2. Run the dev server
npm run dev
# 3. Open the game
# http://localhost:5173| Script | Description |
|---|---|
npm run dev |
Start Vite dev server |
npm run build |
Type-check + production build (dist/) |
npm run preview |
Preview production build locally |
npm run typecheck |
TypeScript compile check (tsc --noEmit) |
npm run lint |
ESLint check |
npm run format |
Prettier write |
npm run format:check |
Prettier check |
npm run test |
Vitest watch mode |
npm run test:coverage |
Vitest run with coverage |
# Unit tests (626 tests, 46 files)
npm run test -- --run
# E2E tests (Chromium + Mobile Pixel 5)
# Requires dev server running: npm run dev
npx playwright test
# E2E against production preview
npm run build && npm run preview
# In another terminal: npx playwright test -c playwright.prod.config.tsVercel (recommended):
- Connect GitHub repo
- Framework preset: Vite
- Build command:
npm run build - Output directory:
dist - Deploy โ SPA fallback handles client-side routing
The build produces:
dist/index.htmlโ Main game (Virtual Steering)dist/phone-controller.htmlโ Phone-as-controller pagedist/kart-racing/โ Legacy arcade kart racing game (standalone)
No environment variables required โ all external services (MediaPipe, PeerJS, Google Fonts) use public CDNs.
- No server, no database โ pure static frontend
- Camera access โ only for MediaPipe hand landmarks; frames never leave the browser
- PeerJS โ uses public signaling server; WebRTC is encrypted; no identity stored
- localStorage/IndexedDB โ settings, high scores, profile, replays (all local)
- XSS hardening โ sanitized storage boundaries + HTML escaping at render
- No secrets, no API keys, no tokens in the codebase
| Gate | Status |
|---|---|
| TypeScript compile | โ PASS |
| ESLint | โ PASS |
| Prettier | โ PASS |
| Production build | โ PASS |
| Unit tests | โ 626 passed (46 files) |
| E2E Chromium | โ 14 passed / 6 skipped |
| E2E Mobile (Pixel 5) | โ 13 passed / 7 skipped |
| Production browser test | โ Both projects green |
- Local multiplayer (split-screen, same device)
- Garage UI (turntable preview, cosmetic purchase flow)
- Achievements screen (badge grid, progress rings)
- Daily / Weekly challenges (return loops)
- Profile screen (level ring, XP bar, stats, best laps)
- Leaderboard screen (global/friends/track tabs)
- How to Play / Tutorial screen
- Friend ghost sync (cloud)
- Cloud leaderboards (serverless)
- SFU upgrade for larger multiplayer lobbies
Contributions, issues, and feature requests are welcome. Fork the repo, make your change, and open a pull request.
All rights reserved.
ยฉ 2026 Manthan Jaiswal โ Built with Three.js, MediaPipe & TypeScript.