🦜 Cozy Parrot
Stochastic parrots dash a cozy tavern → grab word tokens → throw the right ones into the golden Context Window.
Field Value id / runtimeId cozy-parrot / cozy_parrotRPC create_cozy_parrot_matchtype / players svelte-component · 2–8 stack Svelte 5 · Threlte 8 · Nakama JS (Goja) · pnpm · 10 Hz path games/cozy-parrot/ (frontend/ · shared/ · nakama/)
📎 Docs: Architecture · Runbook · Opcodes · Nakama Multiplayer · Games Catalog
🔗 🎮 Funday · 📚 Dev Docs · 🎨 Threlte · ⚔️ Nakama · 🧡 Svelte · 📦 pnpm
🗺️ Match flow
stateDiagram-v2
[*] --> lobby
lobby --> countdown: ≥2 players
countdown --> play: 3s / 30 ticks
play --> result: 60s / 600 ticks
result --> lobby: 5s / 50 ticks
lobby --> countdown: still ≥2
Phase Ticks ≈s Trigger lobby— — wait countdown30 3 ≥2 players play600 60 tokens every 20 ticks (max 10 ) result50 5 winner → lobby
🧠 60-second mental model
Who / what Does Host Tab A → Host Match → copy Match ID Join Tab B → paste Match ID → join (?match= supported) WASD Move (Move client-trusted; server clamps ±ARENA=10) Space Empty → Grab nearest token ≤1.5; holding + near hopper → Throw Hopper Golden Context Window {0,0} — correct blank +1 ; wrong −1 (⌊0⌋)
⚡ Ultra run
cd games/cozy-parrot
pnpm install
pnpm nakama:build
mkdir -p nakama/data/modules/build
cp nakama/runtime/build/index.js nakama/data/modules/build/index.js
sudo docker compose -f nakama/docker-compose.yml up -d # API :17350
pnpm --filter frontend dev # open printed URL
Service Host Notes Nakama API 17350 remapped ← container 7350 (avoids kubectl) Console 17351 remapped ← 7351 Cockroach UI 18080 remapped ← 8080 Vite printed frontend/.env → PUBLIC_NAKAMA_PORT=17350
🎯 Scoring · 📡 Opcodes
Event Δ Correct next blank @ hopper +1 Complete sentence +3 + new promptWrong word −1 (⌊0⌋)Rare [IDEA] fills expected blank (+1/+3 as above)
Dir Name # Payload C→S Move1 { x, z }C→S Grab2 {}C→S Throw3 {}S→C GameUpdate1 { state: CozyParrotMatchSnapshot }
📂 File map (games/cozy-parrot/)
Path Role funday-plugin.jsonid cozy-parrot · runtimeId cozy_parrot shared/src/CozyParrot/index.tsopcodes · prompts · arena consts nakama/runtime/src/matchHandlers/cozyParrot/index.tsauthoritative match @ 10 Hz frontend/src/lib/CozyParrotGame.sveltelobby + Threlte scene frontend/src/lib/nakama/CozyParrot/CozyParrotMatchManager.tsclient net / GameUpdate
✅ Verify
⚠️ Gotchas
Goja / no spreads — runtime TS must not emit {...} / array spreads (__assign); rebuild + cp + restart.
Named RPC — create_cozy_parrot_match must be a named function (inline RPCs fail Goja).
Ports — use 17350 , not default 7350 (often taken by kubectl port-forward).
Authority — Move client-trusted (clamped); Grab/Throw server-validated (phase · radius · hopper · score).
Platform — standalone SPP uses this game’s Nakama stack; full Funday registry mount is optional later.