Inspiration

Most "chat plays" games give viewers a vote and nothing else. We wanted viewers to be in the game, as real players with their own bodies, goals and progression, while the streamer stays the star of the show. A dungeon raid works perfectly for that: there is one hero (the streamer) and a whole nest of goblins (the community).

What it does

Goblins vs Hero is an asymmetric party game that runs entirely in the browser.

  • The Hero (streamer) plays a first-person dungeon crawler on PC: draw 3 tools from a roulette, sneak past goblins, pull the lever that opens the vault, grab the treasure and get back out alive within 4 minutes. The trip home is half the game.
  • The Goblins (viewers) scan a QR code or type a 6-digit room code and join from a phone or PC, with no install and no account. Up to 5 humans play goblins, and AI goblins fill the empty slots and get replaced the moment a human joins. Goblins can:
    • control their goblin directly, or give it Auto orders (chase the hero, train, dig through a sealed hole, go to bed to heal)
    • throw stones, use goblin-only tunnels and wall climbs
    • train and evolve: Goblin → Hobgoblin → Goblin King → Goblin Lord (a dark knight). Bigger forms hit harder but can no longer fit through the small tunnels.
    • die, respawn as a baby goblin and grow back up
    • flip an optional "Kin-slaying" switch to hunt other goblins for EXP, so the nest has its own drama while the hero is sneaking around
  • Everyone else in chat can still change the game. The streamer opens a 20-second vote, and viewers type 1, 2 or 3 in Twitch chat:
    1. Darkness: the hero's screen goes dark for 8 seconds
    2. Noise: a loud sound at the hero's position pulls the AI goblins in
    3. Snacks: every living goblin heals
  • Progress carries over. The hero keeps a treasure vault (12 treasures, from common to legendary), spends gold in a shop and unlocks new roulette tools. Goblins earn lifetime titles and scarf colors.
  • Two ways to stream it: "the streamer is always the hero" or "rotate the hero every round" with friends.

    How we built it (with Codex)

    I'm a solo developer, and Codex wrote the implementation. I acted as the director: I wrote the game design in plain language, played every build, and told Codex what felt wrong.

  • Architecture Codex built: a Node.js lobby and relay server (WebSocket) handles rooms, matchmaking and role assignment. The hero's browser runs the authoritative simulation (movement, combat, AI, HP, food, evolution) and streams state at about 10 Hz, while goblin clients send input at about 20 Hz. It's deployed behind Cloudflare and nginx.

  • Twitch integration: each streamer authorizes their own channel through OAuth (user:read:chat), and votes are read with EventSub WebSocket. Votes are scoped per room so two streamers never mix, there's one vote per viewer (they can change it), and events are de-duplicated by ID.

  • 3D: Three.js, a first-person view for the hero and a third-person follow camera for goblins, plus rigged GLB monsters. Codex retargeted a single punch animation onto every goblin form by converting bone rotations without touching bone lengths, so each form keeps its body shape.

  • Quality: Codex wrote 84 automated tests (jumping, kin-slaying protection, stone throwing, rest healing, attack timing and more) and a safe deploy script with staging, backup and automatic rollback.

  • The full development log is in the repo at docs/codex-development-log.md.

    Challenges we ran into

  • Making a multiplayer game when you're one person. AI goblins that idle, patrol, hear footsteps and search the last place they saw you made it playable and testable at any player count.

  • Fairness on phones. Touch controls track each finger separately, so you can move and attack at the same time.

  • Disconnects. Viewers' phones sleep, so goblins get a 90-second grace period to come back as the same goblin with the same EXP.

    Accomplishments that we're proud of

  • A viewer can go from watching the stream to playing as a goblin in about 10 seconds: scan the QR code and they're in.

  • Evolution is a real trade-off. Being stronger means losing your tunnels.

    What we learned

    Codex is strongest when the design doc is concrete. Writing numbers (HP, cooldowns, timers) into the spec and asking Codex to keep the spec and the code in sync saved many rounds of back-and-forth.

What's next

  • Hero host migration (if the streamer's browser drops, the match survives)
  • More nests (an abandoned mine, an old castle) and the Cyclops boss (the model is ready)
  • Goblin-placed traps, and more chat vote events driven by Channel Points

Built With

Share this project:

Updates

Submission history