lexdoudkin/tokken

AI models fight. HP is tokens. A 90s arcade fighting game parodying the AI industry — browser, PWA, rollback netcode. Play: tokken.win

JavaScript

0

21 commits

updated Sep 26, 2026

See the code

See what people are saying

README

TOKKEN

AI models fight. HP is tokens. A 90s-arcade 2D fighting game that parodies the AI industry. It runs in your browser: tokken.win

Claude apologizes, then hits you. Codex never runs the tests. DeepSeek distills your ult for 1% of the price. Jev only speaks JSON.

  • 20 fighters, 16 arenas, a live commentary booth, and a crowd of AI leaders holding signs
  • Local versus, VS CPU, and online PvP with invite codes (rollback netcode)
  • Works on phones as an installable PWA with arcade touch controls
  • Public leaderboard

Run it locally

No build step and no dependencies. It's plain JS on a canvas:

python3 -m http.server 8777
open http://localhost:8777

Controls: P1 uses WASD + F G H, P2 uses the arrows + K L ;. Gamepads work too. Test hooks:

  • ?fight=jev,claude&arena=3 jumps straight into a fight
  • ?walklab opens the animation lab

How it works

PieceWhereNotes
Game loopjs/main.js, js/match.js, js/game.jsFixed 60 Hz sim on a 1280×720 logical canvas. The view width adapts to the screen, but the simulation never sees it.
Onlinejs/net.js, js/snap.jsWebRTC via PeerJS. Rollback with full state snapshots, a seeded RNG for all gameplay randomness, and periodic state-hash desync checks. Inputs go over an unreliable "fast lane" and are re-sent until acked. Delay (0-2 frames) is picked from the measured round-trip time. Peers exchange a version handshake before a match can start.
Signaling + TURNworker/worker.jsA Cloudflare Worker with a PeerJS-compatible signaling server (one hibernating Durable Object), short-lived Cloudflare TURN credentials for carrier-grade NAT, and the leaderboard on D1.
Ult comedy scenesjs/ultfx.jsScreen-space set pieces locked to the game clock. They're cosmetic only, so rollback never touches them.
Balancetools/sim.jsA headless simulator that runs the real game code in Node's vm module, CPU vs CPU across every matchup: node tools/sim.js 8.
Art pipelinetools/gen_sheet.py, slice.py, gen_motion.py, gen_legs.pygpt-image-2 pose sheets, sliced with foot and centroid anchors. Walk cycles redraw only the legs, and the torso is composited back pixel-for-pixel.
Voicestools/gen_script.py, booth.py, quips.py, release_voices.py, jev_voice.py, codex_voice.pyElevenLabs v3 (plus OpenAI TTS for Codex), loudness-normalized to -16 LUFS and lazy-loaded per match.
Teststools/xb/*.mjsPlaywright: cross-browser checks, a device and full-screen matrix, and real-network online E2E (with a ?relay=1 flag to force the TURN relay).

The tools expect API keys in tools/.secrets/ (openai, eleven) or in the environment (OPENAI_API_KEY). That folder is gitignored.

Deploying your own

./build.sh builds dist/ with cache-busted URLs. The Pages and Worker deploy scripts in worker/ point at the original author's Cloudflare account. Change account_id in worker/wrangler.toml and the account check in worker/deploy.sh before you use them.

This is a parody. It is not affiliated with, endorsed by, or sponsored by any of the companies, products or people it depicts. All product names, logos, mascots and trademarks belong to their respective owners, and the characters are satirical caricatures.

The code is released under the MIT License. The generated art and voice assets are included so the game runs as-is, but no rights to any third-party trademarks or likenesses are granted. Don't use them to imply endorsement or for commercial purposes.

ai
canvas
cloudflare-workers
fighting-game
game
parody
pwa
rollback-netcode
webrtc

Contributors

lexdoudkin

21 commits

lexdoudkin/tokken

AI models fight. HP is tokens. A 90s arcade fighting game parodying the AI industry — browser, PWA, rollback netcode. Play: tokken.win

JavaScript

0

21 commits

updated Sep 26, 2026

See the code

See what people are saying

README

TOKKEN

AI models fight. HP is tokens. A 90s-arcade 2D fighting game that parodies the AI industry. It runs in your browser: tokken.win

Claude apologizes, then hits you. Codex never runs the tests. DeepSeek distills your ult for 1% of the price. Jev only speaks JSON.

  • 20 fighters, 16 arenas, a live commentary booth, and a crowd of AI leaders holding signs
  • Local versus, VS CPU, and online PvP with invite codes (rollback netcode)
  • Works on phones as an installable PWA with arcade touch controls
  • Public leaderboard

Run it locally

No build step and no dependencies. It's plain JS on a canvas:

python3 -m http.server 8777
open http://localhost:8777

Controls: P1 uses WASD + F G H, P2 uses the arrows + K L ;. Gamepads work too. Test hooks:

  • ?fight=jev,claude&arena=3 jumps straight into a fight
  • ?walklab opens the animation lab

How it works

PieceWhereNotes
Game loopjs/main.js, js/match.js, js/game.jsFixed 60 Hz sim on a 1280×720 logical canvas. The view width adapts to the screen, but the simulation never sees it.
Onlinejs/net.js, js/snap.jsWebRTC via PeerJS. Rollback with full state snapshots, a seeded RNG for all gameplay randomness, and periodic state-hash desync checks. Inputs go over an unreliable "fast lane" and are re-sent until acked. Delay (0-2 frames) is picked from the measured round-trip time. Peers exchange a version handshake before a match can start.
Signaling + TURNworker/worker.jsA Cloudflare Worker with a PeerJS-compatible signaling server (one hibernating Durable Object), short-lived Cloudflare TURN credentials for carrier-grade NAT, and the leaderboard on D1.
Ult comedy scenesjs/ultfx.jsScreen-space set pieces locked to the game clock. They're cosmetic only, so rollback never touches them.
Balancetools/sim.jsA headless simulator that runs the real game code in Node's vm module, CPU vs CPU across every matchup: node tools/sim.js 8.
Art pipelinetools/gen_sheet.py, slice.py, gen_motion.py, gen_legs.pygpt-image-2 pose sheets, sliced with foot and centroid anchors. Walk cycles redraw only the legs, and the torso is composited back pixel-for-pixel.
Voicestools/gen_script.py, booth.py, quips.py, release_voices.py, jev_voice.py, codex_voice.pyElevenLabs v3 (plus OpenAI TTS for Codex), loudness-normalized to -16 LUFS and lazy-loaded per match.
Teststools/xb/*.mjsPlaywright: cross-browser checks, a device and full-screen matrix, and real-network online E2E (with a ?relay=1 flag to force the TURN relay).

The tools expect API keys in tools/.secrets/ (openai, eleven) or in the environment (OPENAI_API_KEY). That folder is gitignored.

Deploying your own

./build.sh builds dist/ with cache-busted URLs. The Pages and Worker deploy scripts in worker/ point at the original author's Cloudflare account. Change account_id in worker/wrangler.toml and the account check in worker/deploy.sh before you use them.

This is a parody. It is not affiliated with, endorsed by, or sponsored by any of the companies, products or people it depicts. All product names, logos, mascots and trademarks belong to their respective owners, and the characters are satirical caricatures.

The code is released under the MIT License. The generated art and voice assets are included so the game runs as-is, but no rights to any third-party trademarks or likenesses are granted. Don't use them to imply endorsement or for commercial purposes.

ai
canvas
cloudflare-workers
fighting-game
game
parody
pwa
rollback-netcode
webrtc

Contributors

lexdoudkin

21 commits

Languages

JavaScript

65.4%

Python

29.0%

HTML

5.2%