You are browsing as a guest. Sign up (or log in) to start making projects!

OpenCV Gesture Based Online Arcade

  • 6 Devlogs
  • 31 Total hours

Building a gesture controlled arcade where you play games using just your hands and a webcam. Started in Python, rebuilt in JavaScript so it works in the browser. Three games right now: Hand Pong, Space Shooter and Snake. Each one uses a different hand gesture to control it. I'm pretty new to coding. Found Hack Club through a Google search, starting uni in a few months and needed a summer project. Done robotics hardware before but software is new for me. Learning a lot and having fun with it.

Ship #1

Built a hand gesture controlled arcade where you play games using just your webcam!

Three games: Hand Pong, Space Shooter and Snake, each using a different gesture.

Started in Python with OpenCV and MediaPipe, rebuilt in JavaScript so it runs in the browser with no downloads needed. Not the smoothest or best arcade ever but definitely built with a lot of struggle and I'm still working on making it better everyday!

Learned both languages from scratch during this project. The hardest part was getting MediaPipe working in the browser, went through four different CDN links before finding one that worked!

  • 6 devlogs
  • 31h
Try project → See source code →
Open comments for this post

35m 19s logged

Devlog 03 — Fixing, Tuning and Ready to Ship


What I Fixed This Session

Spent this session purely on debugging and tuning. No new features — just making everything feel right.

Snake controls — went through three different control schemes. Tried fist tilt, tried swipe gestures, finally landed on index finger pointing. The snake steers toward wherever your finger is pointing relative to the snake’s head. Tiny finger movements don’t accidentally change direction:

const dist = Math.sqrt(dx*dx + dy*dy)
if (dist > CELL * 3) { 
}

Space Shooter — enemies were spawning too slowly and too late. Fixed spawn timer to start at 999 so enemies appear immediately, and doubled the spawn rate. Waves feel much more intense now.

Instructions — Added the instructions page correctly so anyone can click [I] to understand required gestures.

Mirror flipping — cursor and menu hover were using inconsistent coordinate systems. Unified everything so palmX is flipped once at the source and all games use the same value.


What the Project Is Now

A fully browser-based hand gesture arcade with three games:

  • Hand Pong — palm height controls your paddle
  • Space Shooter — palm position aims, pinch fires
  • Snake — point your index finger to steer

No downloads. No installs. Just a webcam and a browser.


Shipping

Pushing to GitHub Pages today. Anyone with a webcam can play instantly at the live URL.

Finally ready to ship!

0
0
5
Open comments for this post

10h 9m 45s logged

Devlog 02 - Rebuilding Gesture Arcade for the Web


The Big Decision

Scrapped the entire Python version and rebuilt from scratch in JavaScript. Python with pygame cannot run in a browser, and without a live demo URL Stardance reviewers can’t try the project. The whole point is gesture control — and that needs a webcam running locally. Only solution was JavaScript. Problem? I had never written it before.


Learning JavaScript from Scratch

Coming from Python the syntax felt familiar but the logic was completely different. Hardest part was MediaPipe. In Python it’s 2 lines:

import mediapipe as mp
hands = mp.solutions.hands.Hands()

In JavaScript it’s a whole async setup that took me forever to get right:

const fs = await FilesetResolver.forVisionTasks(
    "https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm"
)
const hl = await HandLandmarker.createFromOptions(fs, {
    baseOptions: { modelAssetPath: "..." },
    numHands: 1,
    runningMode: "VIDEO"
})

Went through 4 different CDN links before finding one that worked. CORS errors, 404s, wrong module formats — been through everything. Eventually got it working with Skypack.


How the Hand Tracking Works

Every frame the camera captures an image, MediaPipe finds 21 landmark points on your hand, and I calculate useful values from those points:

hand.palmX = (lm[0].x + lm[5].x + lm[9].x + lm[13].x + lm[17].x) / 5
hand.palmY = (lm[0].y + lm[5].y + lm[9].y + lm[13].y + lm[17].y) / 5

const dx = lm[4].x - lm[8].x
const dy = lm[4].y - lm[8].y
hand.pinching = Math.sqrt(dx*dx + dy*dy) < 0.07

const up = [lm[8].y < lm[6].y, lm[12].y < lm[10].y, lm[16].y < lm[14].y, lm[20].y < lm[18].y]
hand.fist = up.every(f => !f)

All 3 games share the same hand object that gets updated every single frame.


Bugs I Ran Into

Mirror flipping — spent ages debugging why the cursor moved the wrong way. Camera captures a mirrored image so moving right makes x go in the -x direction. Fixed by flipping palmX at the source:

hand.palmX = 1 - (lm[0].x + lm[5].x + lm[9].x + lm[13].x + lm[17].x) / 5

CDN failures — MediaPipe’s official CDN kept returning 404. Tried jsdelivr, unpkg, and two others before Skypack worked.

Module type errors — JavaScript modules need type="module" on the script tag otherwise imports don’t work at all.


What Needs Fixing Next

  • Space Shooter — not enough enemies spawning, waves feel too sparse. AI enemies too aggressive, players can’t score enough
  • Hand Cursor — white circle cursor looks too similar to the pong ball, confusing during gameplay. Needs a better indicator
  • GitHub Pages — need to push everything live so there’s an actual demo URL
0
0
5
Open comments for this post

5h 41m 57s logged

Devlog 2.01 - Building the Web Version of Gesture Arcade

What I worked on today

Rebuilt the entire Gesture Arcade frontend from Python and Pygame to a fully web-based version using HTML, CSS, and JavaScript! This was a big decision and here’s why I made it…

Why I switched from Python -> Web

  • The Python version runs almost perfectly as a desktop app (that’s a lie, I’ve been struggling a bit with one of the games) but cannot be played in a browser!
  • Gesture control requires webcam access which Python/Pygame cannot expose over the internet.
  • A browser version means -> anyone with a webcam can play instantly!
  • An ‘.exe’ limits who can actually try it.
  • This also counts as an extended Python version.

So, consider this an improvement on the last version. Here on, I’m going to refine the UI/UX, basic gameplay, better my logs, and finish this in a better error-less manner. Ignore all logs till now, it’s only about to get better!

What I built today

  • Retro monospace homepage in HTML/CSS. (Screenshot attached)
  • Integrated MediaPipe Hand Landmarker via JavaScript for real-time hand tracking.

Challenges I ran into

  • MediaPipe CDN kept returning 404 errors (went through about 4 different CDN links before finding one that worked)
  • ‘type=“module”’ was required for the import to work correctly.

What’s Next

  • Build Hand Pong in JavaScript using HTML5 Canvas(??)
  • Connect hand tracking to paddle movement.
  • Add all 4 games one by one.
  • Host on GitHub Pages for a live URL.

Tech Stack

  • HTML + CSS + JavaScript
  • MediaPipe Tasks Vsion 0.10.3.
  • Skypack CDN for module imports.
0
0
5
Open comments for this post

7h 9m 48s logged

Snake game added!

Finished making the Snake game for the arcade!

It’s working, but I don’t think it’s where I want it to be yet. Right now the controls use fist direction, but I’m thinking of switching to palm direction instead because I feel like it’d be more smooth to play.

I also haven’t fully figured out optimizing for different screen sizes yet, and the grid still needs some work so gameplay feels more consistent across displays.

Visually, I want to tweak the snake design a bit too and make it feel less placeholder and more polished.

Still a bunch of things to improve, but honestly every game has been teaching me something new and I’m slowly figuring things out as I go :)

0
0
3
Open comments for this post

3h 7m 25s logged

Small Update - I’m sort of done making Pong!

The paddle on your side is controlled by how far or low you position your palm in front of the camera.

It definitely doesn’t work as well as I want it to yet 😭🙏 but getting the basic gameplay running feels like a milestone!

Right now I’m trying to improve responsiveness, fix weird behavior, and generally figure out as I go.

Still lots to improve, but one game down and have learnt a ton. :D

2
0
35
Open comments for this post

3h 55m 35s logged

OpenCV Hand Gesture Controlled Gaming Arcade 🎮

Hi! I’m currently building a hand gesture controlled gaming arcade using OpenCV!

I’m still pretty new to programming, so this project doesn’t involve a lot of fancy or advanced programming, I’m using it as a way to learn and understand Python. I’ve been reading a lot of documentation, experimenting, failing, and debugging, more than I’d like to admit.

To help plan everything out, I also made a simple flowchart to map the project structure and workflow. I’ve attached it as an image.

The current plan is to include these four games:

  • Hand Pong
  • Fruit Ninja
  • Space Shooter
  • Snake

Here’s the homepage I’ve made. Along with a popup instructions panel. If anyone has suggestions on libraries/ references I should use, please let me know.

1
0
24

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…