Skip to content

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ๏ธ Road Rash Computer Vision Game

A fast-paced Road Rash inspired racing game controlled with real-time hand gestures.
Steer, punch, kick, brake and boost using your webcam โ€” no traditional controller required.


๐ŸŽฎ Overview

Road Rash Computer Vision Game is a desktop racing and brawler game inspired by classic Road Rash gameplay, redesigned around Computer Vision.

Instead of relying only on a keyboard or traditional game controller, the game uses your webcam and MediaPipe Hand Landmarker to track hand movement and gestures in real time.

๐Ÿš€ What This Project Includes

  • ๐Ÿ Solo Campaign with 5 themed levels
  • ๐Ÿคœ Road Combat with punches and kicks
  • ๐Ÿš“ Rivals, Cops and Bosses
  • ๐ŸŒฆ๏ธ Dynamic Weather Effects
  • ๐Ÿ’จ Nitro / Boost System
  • โค๏ธ Health and Damage System
  • ๐Ÿ† Score, Combo and Takedown System
  • ๐Ÿค Local 2-Player Split-Screen Mode
  • โœ‹ Real-Time Hand Landmark Visualization
  • โŒจ๏ธ Keyboard Fallback Controls
  • ๐Ÿ–ฅ๏ธ Fullscreen Mode
  • ๐Ÿ”Š Engine and Gameplay Sound Effects

๐ŸŽฅ Demonstration Video

๐Ÿšง Full Demonstration video will be added here.

โ–ถ๏ธ Watch the Demo

roadrush-optionB-overview.webm

โœจ Key Features

โœ‹ Computer Vision Controls

The game uses your webcam to detect hand landmarks and convert gestures into gameplay actions.

Gesture Action
๐Ÿคš Open Hand Normal control
โœŠ Fist Punch
๐Ÿค Pinch Brake
๐Ÿ‘ Thumbs Up Nitro / Boost
โ˜๏ธ Point Wheelie / Jump
โœŒ๏ธ Two Fingers Kick
โ†”๏ธ Hand Movement Steering

The hand-control system includes:

  • Real-time hand tracking
  • Hand landmark detection
  • Gesture classification
  • Steering prediction
  • Movement smoothing
  • Gesture debouncing
  • Hand tilt detection

๐Ÿค 2-Player Computer Vision Mode

Two players can play using one webcam.

Player Mapping

             WEBCAM
                โ”‚
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚                 โ”‚
   RIGHT HAND         LEFT HAND
       โ”‚                 โ”‚
       โ–ผ                 โ–ผ
   PLAYER 1           PLAYER 2
  • ๐Ÿ‘ค Player 1 โ†’ Right hand
  • ๐Ÿ‘ค Player 2 โ†’ Left hand
  • ๐Ÿ๏ธ Split-screen racing
  • โœŠ Independent punch controls
  • โ†”๏ธ Independent steering
  • ๐Ÿ Race to the finish
  • โค๏ธ Last rider standing can also win

โŒจ๏ธ Keyboard Fallback

The project also includes keyboard controls for testing without a webcam.

Player 1

A / D  โ†’ Steering
F      โ†’ Punch

Player 2

โ† / โ†’  โ†’ Steering
L      โ†’ Punch

๐Ÿ•น๏ธ Game Modes

๐Ÿ Solo Campaign

The Solo Campaign contains 5 themed levels with different gameplay environments.

Features include:

  • Road traffic
  • Rival riders
  • Cops
  • Boss encounters
  • Road hazards
  • Pickups
  • Weather effects
  • Nitro
  • Combat
  • Score system
  • Combo system

Difficulty Levels

Easy
Normal
Hard
Extreme

๐Ÿคœ๐Ÿค› Local Versus

Play against a friend using one webcam.

Each player receives their own side of the split-screen.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚       PLAYER 1        โ”‚       PLAYER 2        โ”‚
โ”‚                       โ”‚                       โ”‚
โ”‚    RIGHT HAND โœ‹      โ”‚      โœ‹ LEFT HAND      โ”‚
โ”‚                       โ”‚                       โ”‚
โ”‚      ๐Ÿ๏ธ               โ”‚               ๐Ÿ๏ธ      โ”‚
โ”‚                       โ”‚                       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿง  Computer Vision Pipeline

The game uses MediaPipe Tasks Vision for real-time hand tracking.

             WEBCAM
                โ”‚
                โ–ผ
         Video Stream
                โ”‚
                โ–ผ
     MediaPipe Hand Landmarker
                โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚                โ”‚
   Hand Landmarks    Hand Position
        โ”‚                โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ–ผ
       Gesture Detection
                โ”‚
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚          โ”‚           โ”‚
     โ–ผ          โ–ผ           โ–ผ
  Steering    Combat      Actions
     โ”‚          โ”‚           โ”‚
     โ”‚       Punch/Kick   Nitro/Brake
     โ”‚                       โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ–ผ
           Game Logic
                โ”‚
                โ–ผ
          Canvas Renderer
                โ”‚
                โ–ผ
             Gameplay

๐Ÿงฉ Technology Stack

Technology Purpose
โš›๏ธ React UI and application structure
๐Ÿ”ท TypeScript Type-safe development
โšก Vite Development and production build
๐ŸŽจ Tailwind CSS UI styling
โœ‹ MediaPipe Tasks Vision Hand tracking and gesture recognition
๐Ÿ–ผ๏ธ HTML Canvas Game rendering
๐Ÿ–ฅ๏ธ Electron Desktop application
๐Ÿ”Š Web Audio API Sound effects and engine audio

๐Ÿ“ Project Structure

Road-Rash-Computer-Vision-Game/
โ”‚
โ”œโ”€โ”€ build/
โ”‚   โ””โ”€โ”€ road-rash.ico
โ”‚
โ”œโ”€โ”€ electron/
โ”‚   โ””โ”€โ”€ main.cjs
โ”‚
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ favicon-16.png
โ”‚   โ”œโ”€โ”€ favicon-32.png
โ”‚   โ”œโ”€โ”€ favicon-64.png
โ”‚   โ”œโ”€โ”€ icon-192.png
โ”‚   โ”œโ”€โ”€ icon-512.png
โ”‚   โ””โ”€โ”€ ...
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ App.tsx
โ”‚   โ”œโ”€โ”€ Game.tsx
โ”‚   โ”œโ”€โ”€ Versus.tsx
โ”‚   โ”œโ”€โ”€ levels.ts
โ”‚   โ”œโ”€โ”€ render.ts
โ”‚   โ”œโ”€โ”€ sound.ts
โ”‚   โ”œโ”€โ”€ useHandControl.ts
โ”‚   โ”œโ”€โ”€ useDualHandControl.ts
โ”‚   โ”œโ”€โ”€ main.tsx
โ”‚   โ””โ”€โ”€ ...
โ”‚
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ package-lock.json
โ”œโ”€โ”€ tsconfig.json
โ””โ”€โ”€ vite.config.ts

โš™๏ธ Requirements

Before running the project, make sure you have:

  • Node.js
  • npm
  • A working webcam
  • A modern browser or Chromium environment
  • A system capable of running Electron

For the best computer-vision experience, use good lighting and keep your hands clearly visible.


๐Ÿš€ Installation

1๏ธโƒฃ Clone the Repository

git clone https://github.com/ENiGMA-101/Road-Rash-Computer-Vision-Game.git

Enter the project directory:

cd Road-Rash-Computer-Vision-Game

2๏ธโƒฃ Install Dependencies

npm install

3๏ธโƒฃ Run Development Server

npm run dev

Vite will display the local development URL in the terminal.

Open that URL in your browser.


๐Ÿ–ฅ๏ธ Electron Development

To run the desktop version during development:

npm run electron:dev

This launches the game inside an Electron desktop window.


๐Ÿ—๏ธ Production Build

Build the web application:

npm run build

Preview the production build:

npm run preview

๐Ÿ“ฆ Build Desktop Application

To create the packaged desktop application:

npm run dist

The generated release files will be available inside:

release/

๐Ÿ“ท Camera Setup

When computer-vision mode is enabled, the application requests permission to access your webcam.

For better hand tracking:

โœ… Recommended

  • Use good lighting
  • Keep your hand inside the camera frame
  • Keep fingers clearly separated when using gestures
  • Avoid very dark environments
  • Keep a reasonable distance from the webcam

๐Ÿ‘ฅ For 2 Players

Stand side-by-side and make sure both players' hands are visible.

       CAMERA

   ๐Ÿ‘ค             ๐Ÿ‘ค
 Player 1       Player 2
   โœ‹               โœ‹
RIGHT HAND      LEFT HAND

๐ŸŽฏ Controls

Solo Mode

Input Function
โ†”๏ธ Hand Movement Steering
๐Ÿคš Hand Tilt Additional steering
โœŠ Fist Punch
โœŒ๏ธ Two Fingers Kick
๐Ÿค Pinch Brake
๐Ÿ‘ Thumbs Up Nitro
โ˜๏ธ Point Wheelie / Jump

2-Player Mode

Player Camera Hand Keyboard
๐Ÿง‘ Player 1 Right Hand A / D + F
๐Ÿง‘ Player 2 Left Hand โ† / โ†’ + L

๐Ÿ—๏ธ Main Architecture

App.tsx

Controls the main menu and game-mode selection.

Main Menu
   โ”‚
   โ”œโ”€โ”€ Solo Campaign
   โ”‚
   โ””โ”€โ”€ Play With Friends

useHandControl.ts

Responsible for single-player computer vision.

Main responsibilities:

  • Webcam access
  • MediaPipe initialization
  • Hand detection
  • Hand landmark extraction
  • Gesture classification
  • Steering calculation
  • Movement smoothing
  • Gesture prediction

useDualHandControl.ts

Responsible for 2-player hand tracking.

It detects up to two hands and maps them according to handedness:

Right Hand โ†’ Player 1
Left Hand  โ†’ Player 2

Game.tsx

Contains the main Solo Campaign game logic.

Includes:

  • Player movement
  • Rival riders
  • Police
  • Bosses
  • Cars
  • Pickups
  • Hazards
  • Combat
  • Nitro
  • Health
  • Score
  • Combo
  • Level progression
  • HUD
  • Game-over system

Versus.tsx

Contains the local multiplayer game.

Features:

  • Split-screen rendering
  • Two-hand tracking
  • Two independent players
  • Racing
  • Combat
  • Health
  • Score
  • Finish detection
  • Winner detection

render.ts

Responsible for drawing game objects onto the HTML Canvas.

Examples:

  • ๐Ÿ๏ธ Bikes
  • ๐Ÿš— Cars
  • ๐ŸŒ„ Scenery
  • ๐Ÿ›ฃ๏ธ Roads
  • ๐Ÿ’ฅ Effects

sound.ts

Handles game audio including:

  • Engine sound
  • Punch effects
  • Collision sounds
  • Game feedback
  • Victory sounds

levels.ts

Contains:

  • Level configuration
  • Difficulty parameters
  • Level themes
  • Weather
  • Gameplay settings

๐Ÿ”ฌ Computer Vision Details

The project uses MediaPipe's hand landmarks to estimate:

21 Hand Landmarks
       โ”‚
       โ”œโ”€โ”€ Finger Positions
       โ”œโ”€โ”€ Palm Position
       โ”œโ”€โ”€ Hand Openness
       โ”œโ”€โ”€ Hand Tilt
       โ””โ”€โ”€ Finger Configuration

These values are converted into gameplay commands.

For example:

Hand moves LEFT
      โ†“
Steering = -1
      โ†“
Bike moves LEFT

And:

Closed Fist
      โ†“
Gesture = FIST
      โ†“
Punch
      โ†“
Opponent takes damage

๐Ÿ“Š Gesture Recognition

The system identifies several hand configurations.

OPEN HAND       โ†’ Normal
FIST            โ†’ Punch
PINCH           โ†’ Brake
THUMBS UP       โ†’ Nitro
POINT           โ†’ Wheelie
TWO FINGERS     โ†’ Kick

A short gesture history is used to reduce accidental gesture changes caused by individual noisy frames.


๐ŸŽจ Game Design

The visual style combines:

  • Dark futuristic backgrounds
  • Neon highlights
  • Arcade racing aesthetics
  • Canvas-based game rendering
  • Responsive HUD
  • Fullscreen gameplay

The interface is designed to keep the gameplay area large and easy to see.


๐Ÿงช Development Concept

This project combines several areas of software engineering:

Computer Vision
       +
Game Development
       +
Frontend Development
       +
Human-Computer Interaction
       +
Desktop Application Development
       โ”‚
       โ–ผ
Road Rash Computer Vision Game

The project demonstrates how a webcam can be used as a natural game controller.


๐Ÿ“Œ Current Status

๐Ÿšง Active Development

Current implementation includes:

  • โœ… Solo Campaign
  • โœ… 5 themed levels
  • โœ… Multiple difficulty levels
  • โœ… Computer-vision steering
  • โœ… Gesture recognition
  • โœ… Punch
  • โœ… Kick
  • โœ… Brake
  • โœ… Nitro
  • โœ… Wheelie / Jump
  • โœ… Rivals
  • โœ… Cops
  • โœ… Boss encounters
  • โœ… Road traffic
  • โœ… Weather effects
  • โœ… Local 2-player mode
  • โœ… Keyboard fallback
  • โœ… Fullscreen mode
  • โœ… Sound effects
  • โœ… Electron desktop support

๐Ÿ”ฎ Future Improvements

Possible future development:

  • ๐ŸŒ Online multiplayer
  • ๐Ÿ๏ธ More bikes
  • ๐Ÿ‘ค More playable characters
  • ๐Ÿ—บ๏ธ More environments
  • ๐Ÿ More race modes
  • ๐Ÿค– Improved opponent AI
  • โœ‹ More advanced gestures
  • ๐ŸŽฎ Controller support
  • ๐Ÿ† Online leaderboard
  • ๐Ÿ’พ Cloud save system
  • ๐ŸŽจ Improved graphics
  • โšก Better low-end performance
  • ๐Ÿ“ฆ Improved installer and release system

๐Ÿค Contributing

Contributions, ideas and improvements are welcome.

Create a feature branch:

git checkout -b feature/your-feature

Make your changes:

git add .

Commit:

git commit -m "Add your feature"

Push:

git push origin feature/your-feature

Then open a Pull Request.


๐Ÿ‘จโ€๐Ÿ’ป Author

ENiGMA-101

GitHub:

https://github.com/ENiGMA-101


โญ Support

If you find this project interesting, consider giving the repository a โญ on GitHub.

Your support helps encourage further development in:

  • Computer Vision
  • Game Development
  • Human-Computer Interaction
  • AI-powered applications
  • Interactive software

๐Ÿ“„ License

No explicit open-source license is currently specified in this repository.

If you plan to distribute or reuse this project, add an appropriate license such as:

  • MIT
  • Apache-2.0
  • GPL-3.0

Choose the license according to your intended usage and distribution requirements.


๐Ÿ๏ธ ROAD RASH ร— โœ‹ COMPUTER VISION ร— ๐ŸŽฎ GAME DEVELOPMENT

Control the road with your hands.

About

๐Ÿ๏ธ A Road Rash-inspired computer vision racing game controlled with real-time hand gestures using MediaPipe and a webcam.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages