🦜 Cozy Parrot

Stochastic parrots dash a cozy tavern → grab word tokens → throw the right ones into the golden Context Window.

FieldValue
id / runtimeIdcozy-parrot / cozy_parrot
RPCcreate_cozy_parrot_match
type / playerssvelte-component · 2–8
stackSvelte 5 · Threlte 8 · Nakama JS (Goja) · pnpm · 10 Hz
pathgames/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
PhaseTicks≈sTrigger
lobbywait
countdown303≥2 players
play60060tokens every 20 ticks (max 10)
result505winner → lobby

🧠 60-second mental model

Who / whatDoes
HostTab A → Host Match → copy Match ID
JoinTab B → paste Match ID → join (?match= supported)
WASDMove (Move client-trusted; server clamps ±ARENA=10)
SpaceEmpty → Grab nearest token ≤1.5; holding + near hopper → Throw
HopperGolden 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
ServiceHostNotes
Nakama API17350remapped ← container 7350 (avoids kubectl)
Console17351remapped ← 7351
Cockroach UI18080remapped ← 8080
Viteprintedfrontend/.envPUBLIC_NAKAMA_PORT=17350

🎯 Scoring · 📡 Opcodes

EventΔ
Correct next blank @ hopper+1
Complete sentence+3 + new prompt
Wrong word−1 (⌊0⌋)
Rare [IDEA]fills expected blank (+1/+3 as above)
DirName#Payload
C→SMove1{ x, z }
C→SGrab2{}
C→SThrow3{}
S→CGameUpdate1{ state: CozyParrotMatchSnapshot }

📂 File map (games/cozy-parrot/)

PathRole
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

  • pnpm --filter frontend check → 0 errors / 0 warnings
  • pnpm nakama:buildnakama/runtime/build/index.js
  • Headless 2p host/join/grab/throw @ :17350E2E_OK
  • Two-tab QA: Host → Join → WASD → Space grab → throw hopper → HUD scores/result

⚠️ Gotchas

  1. Goja / no spreads — runtime TS must not emit {...} / array spreads (__assign); rebuild + cp + restart.
  2. Named RPCcreate_cozy_parrot_match must be a named function (inline RPCs fail Goja).
  3. Ports — use 17350, not default 7350 (often taken by kubectl port-forward).
  4. AuthorityMove client-trusted (clamped); Grab/Throw server-validated (phase · radius · hopper · score).
  5. Platform — standalone SPP uses this game’s Nakama stack; full Funday registry mount is optional later.

Ask Docs

AI assistant to help answer questions about the documentation. Answers are read-only and cite docs/source.

Hi! How can I help you with the documentation today? Answers are read-only and cite docs/source.

Ctrl+Enter to send