COSMIC INVADERS

A Space Invaders arcade game built by 4 AI agents collaborating in real-time

2,875
Lines of Code
23
Source Files
~25 min
Total Build Time
$0
API Cost
4
AI Agents

🚀 What We Built

A fully playable Space Invaders-style arcade game featuring Three.js with WebGPU/WebGL rendering, custom GLSL post-processing (bloom, CRT scanlines, chromatic aberration, vignette), GPU-instanced particles, procedural 3D geometry, oscillator-based retro audio, and a complete game loop with wave progression, power-ups, destructible barriers, and combo scoring.

🎮 Gameplay

  • 5×11 invader formation with 3 enemy types
  • Destructible barrier shields
  • Power-ups: speed, multishot, shield
  • Combo scoring with multiplier
  • Progressive difficulty per wave
  • High score via localStorage

✨ Graphics

  • WebGPU renderer with WebGL fallback
  • GPU particle explosions & bullet trails
  • Bloom + CRT + chromatic aberration + vignette
  • Parallax starfield with nebula
  • Procedural ship & invader geometry
  • Screen shake on player hit

🔊 Audio & UI

  • Web Audio oscillator SFX (no asset files)
  • HUD overlay (score, lives, wave, combo)
  • Title screen with neon glow animation
  • Game over & pause screens
  • Retro monospace styling

🤖 The Agent Team

Four AI agents worked in parallel inside a tmux workspace orchestrated by smux — each with a specialized role. Communication happened via tmux-bridge for cross-pane messaging.

🟢
nemo-1
Nemotron 3-Nano 4B · Local GPU · $0
RoleScaffolding & boilerplate
ModelNVIDIA Nemotron 4B Q4_K_M
Inference~51 t/s (RTX 3050 Ti)
Context64K (TurboQuant turbo3)
Tasks4/5 passed
Lines written~280
🟠
claude-1
Claude Opus 4.6 · MAX Subscription · $0
RoleLead dev · Graphics · Bug fixes
ModelClaude Opus 4.6 (1M ctx)
AuthClaude MAX (OAuth)
Tasks5/5 passed
Lines written~1,800
Bugs fixed10 (3 from others)
🟩
codex-1
GPT-5.4 · ChatGPT Plus · $0
RoleImplementation · Integration · QA
ModelGPT-5.4
AuthChatGPT Plus
Tasks3/3 passed
Lines written~800
Bugs found7 in code review
🟣
Hermes
Claude Opus 4.6 · Orchestrator
RolePlanning · Dispatch · Metrics
Coordinationtmux-bridge messaging
Tasks dispatched13
Build verifications4

📊 Lines of Code by Agent

1,800
claude-1
800
codex-1
280
nemo-1

⏱️ Build Timeline

0:00 — Phase 1
Scaffolding nemo-1
package.json, vite config, index.html, Config.js, Input.js · ~3.5 min
3:30 — Phase 2
Core Engine claude-1
Renderer.js, Game.js, Player.js, main.js · Fixed nemo's bugs · 1m 35s
5:05 — Phase 3
Enemies & Gameplay codex-1 nemo-1
6 gameplay files (codex) + Score.js (nemo) · Running in parallel · ~2.4 min
7:30 — Phase 4
Graphics & Shaders claude-1
WGSL shaders, particles, post-FX, starfield, procedural models · 2m 38s
10:08 — Phase 5 (attempt 1)
Audio & UI nemo-1 FAILED
Nemotron hallucinated tool call XML instead of invoking tools on complex multi-file task
11:30 — Phase 5+6
Audio, UI, Integration, Polish claude-1 codex-1
Claude: audio + UI + polish (6m 20s) · Codex: full integration + build verify (2m 12s) · Parallel
18:00 — Phase 7
Code Review codex-1
Found 7 real bugs (2 HIGH, 3 MEDIUM, 2 LOW) · ~2 min
20:00 — Bug Fixes
Fix All 7 Bugs claude-1
All 7 code review bugs fixed · 1m 45s
22:00 — Rendering Fix
Fix Black Screen claude-1
PostFX incompatible with WebGPU — guarded by renderer type check · 2m 23s

📋 Full Task Log

#TaskAgentTimeStatus
1.1Project scaffoldingnemo-1~90s
1.2Config.jsnemo-1~60s
1.3Input.jsnemo-1~60s
2.xRenderer + Game + Player + main.jsclaude-195s
3.xInvader, Grid, Bullet, Collision, Barrier, PowerUpcodex-1~85s
3.5Score.jsnemo-1~60s
4.xShaders, Particles, PostFX, Background, Modelsclaude-1158s
5.xAudioManager, HUD, Menu, CSSnemo-1~90s
5.xAudioManager, HUD, Menu, CSS (retry)claude-1~120s
6.xFull integration + build verifycodex-1~132s
6.xPolish: models, pool, shake, flashclaude-1~260s
7.1Full code reviewcodex-1~120s
7.2Fix all 7 bugsclaude-1105s
7.3Fix black screen (rendering)claude-1143s

🔍 Code Review Results

Codex performed a comprehensive code review reading all 23 source files. 7 issues found, all fixed by Claude in a single 1m 45s pass.

SeverityIssueFile
HIGHInvader flash timer never advanced — non-lethal hits leave invaders permanently whiteInvader.js
HIGHDuplicate Background + PostFX instances consuming GPU resourcesRenderer.js
MEDIUMPlayer bullets survive wave transitionsGame.js
MEDIUMrenderer.update() never called — screen shake was dead codeGame.js
MEDIUMStar sizes not rendered — PointsMaterial ignores per-vertex sizeBackground.js
LOWUnused _vec3 variableParticleSystem.js
LOWLeaked template BoxGeometry on Barrier constructionBarrier.js

💡 Key Insights

Tiered model strategy works. Nemotron ($0, local GPU) handled 4 boilerplate tasks. Claude (MAX sub) handled all complex architecture and graphics. Codex (Plus sub) did bulk implementation and QA. Total API cost: $0 beyond existing subscriptions.
Small models fail on complex multi-file tasks. Nemotron hallucinated tool call XML tags instead of invoking Hermes tools when asked to create 4 files at once. Keep local model tasks simple and single-file.
Claude proactively fixes other agents' bugs. When assigned its own tasks, Claude also identified and fixed 3 bugs in nemo's code (Input.js this binding, outdated Three.js version, CommonJS → ESM in vite config). It acts as a senior dev reviewing junior work.
Codex excels at code review. Found 7 real integration bugs that Claude and nemo missed, including a critical rendering issue (duplicate PostFX pipeline) and subtle gameplay logic bugs. Its build-verify-then-report workflow is thorough.
Parallel work creates file conflicts. Both Claude and Codex modified Game.js and Player.js. Last writer wins. Future improvement: assign file ownership per agent or use git branches.
Task files > inline prompts. Writing tasks to .md files and having agents read them avoids shell quoting issues. Codex crashed with a bash syntax error when parentheses were in an inline prompt.

🛠️ Infrastructure

Hardware

GPURTX 3050 Ti (4GB)
CPUIntel i7 (16 threads)
RAM16GB DDR4
Nemotron VRAM3,305 / 4,096 MiB

Software Stack

Orchestrationsmux + tmux-bridge
Local inferenceTurboQuant (turbo3 KV)
KV compression~5x (3.25 bpv)
Context64K @ ngl=99
BundlerVite 4.5

🎯 Recommended Agent Roles

RoleBest AgentWhy
Config, boilerplate, simple modulesNemotron (local)Free, fast for single-file tasks
Architecture, shaders, complex codeClaude Code (MAX)Highest quality, fixes others' bugs
Bulk implementation, integrationCodex (Plus)Fast, self-verifies with build tools
Code review, QACodex (Plus)Thorough, finds real integration bugs
Orchestration, planningHermesCoordinates via tmux-bridge