Skip to content

tarpat/hackhackgoose

Repository files navigation

Duck Trouble

1v1 browser fighting game. Move your head to move your bird. Yell into your mic to launch eggs. Go to http://hackhackgoose.onrender.com/ to play!


Run it

Requirements: Python 3.10+, a webcam, a microphone, Chrome or Firefox.

git clone https://github.com/tarpat/hackhackgoose
cd hackhackgoose
cp .env.example .env        # add your ANTHROPIC_API_KEY if you want Claude taunts
./start.sh

The browser opens automatically. Click Create Room, share the 4-letter code with your opponent.


Playing with someone on a different network

By default the game only works on the same WiFi. For cross-network play, do this once:

1. Install cloudflared

brew install cloudflare/cloudflare/cloudflared

2. Deploy the signaling service (maps room codes to your tunnel URL)

Go to render.com, create a new Web Service from this repo, and set the start command to:

uvicorn signaling.main:app --host 0.0.0.0 --port $PORT

Copy the URL Render gives you (e.g. https://hackhackgoose.onrender.com).

3. Add it to .env

SIGNALING_URL=https://hackhackgoose.onrender.com

Now ./start.sh will print a public tunnel URL. Your opponent opens that URL, enters your room code, and you're in — no matter what network they're on.


How to play

Setup

  1. Host runs ./start.sh, clicks Create Room
  2. Share the 4-letter code with your opponent
  3. Opponent opens the game URL, clicks Join Room, enters the code
  4. Press Start Calibration and hold still for 3 seconds
  5. Fight

Controls

Move Head gesture
Up Tilt head up
Down Nod down
Left Lean left
Right Lean right
Attack How
Make noise Fills your honk meter
Meter hits 100% Fires an egg at your opponent

Powerup Crates

Crates spawn on the map every 5–10 seconds (up to 3 at a time). Walk over one to pick it up. Your next honk uses the powerup.

Crate Effect
Shotgun Fires 3 eggs simultaneously across 3 rows
Boomerang Egg travels forward then returns — hits on both passes
Bomb Slow projectile that explodes on impact, deals AOE damage and destroys nearby walls

Terrain

Each round generates a random set of wall tiles (hay bales). Eggs are blocked by walls. Bombs destroy walls in a 3×3 area around the impact point.

Winning

  • Each round: 100 HP, 90 second timer
  • First to 0 HP loses the round
  • First player to win 1 round wins the match
  • Claude generates a trash-talk message at the end (requires ANTHROPIC_API_KEY in .env)

Project structure

server/             Python game server (FastAPI + WebSockets)
  main.py           Routes, WebSocket handler, 20Hz server-authoritative game loop
  game.py           All game logic: movement, eggs, powerups, walls, HP, rounds
  room_manager.py   Room creation and player slots
  claude_api.py     Claude API call for victory message

signaling/          Tiny relay service — deploy once to Render/Railway
  main.py           Maps room code → tunnel URL

static/             Browser frontend
  index.html        Create / join room
  game.html         Game screen with calibration, pause, end screen
  style.css         Global styles
  js/audio.js       Mic calibration and volume meter
  js/camera.js      MediaPipe head tracking
  js/renderer.js    Canvas drawing
  js/network.js     WebSocket client
  *.mp3             Sound effects (honk, hit, explosion)
  dead_duck.png     End screen image
  dead_goose.png    End screen image

start.sh            Starts the server, cloudflared tunnel, and opens the browser

.env

ANTHROPIC_API_KEY=sk-ant-...     # optional — enables Claude victory messages
SIGNALING_URL=https://...        # optional — enables cross-network play

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors