Commit Graph
23 Commits
Author SHA1 Message Date
DorianandClaude Opus 4.6 e92f483e66 feat: payments schema + deps for Lightning ranked fights
Add payments and wallet_connections tables, new columns on fights (mode,
pot_sats, payout_status) and bots (sats_won, sats_wagered, has_wallet).
Install nostr-tools and @cashu/cashu-ts for NWC + ecash support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 01:17:15 +00:00
DorianandClaude Opus 4.6 a254a77151 feat: betting system — Cashu escrow, Lightning deposit/withdraw, payouts
Complete betting infrastructure:
- Bets schema (SQLite) with escrow status tracking
- Cashu token verification + minting (stub for real mint)
- Lightning invoice creation + withdrawal (stub for real LN node)
- Bet placement with odds lock, settlement on fight end
- Payout automation for winners, refunds on draws
- Bet history by pubkey + fight pool info
- Verifiable bet proofs for transparency
- API routes: /api/bets/{odds,place,fight,history,deposit,withdraw}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:33:08 +00:00
DorianandClaude Opus 4.6 6ede5da675 feat: odds calculation engine — ELO-based betting odds with house edge
Converts ELO ratings + streaks + recent form into betting odds.
Supports decimal, fractional, and American formats.
Includes bet validation, payout calculation, and 27 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:30:57 +00:00
DorianandClaude Opus 4.6 3b8208be08 feat: computed achievement system — 20 achievements derived from bot stats
Achievements computed on-the-fly from existing stats + fight history:
win milestones, streaks, tiers, ELO, perfect/KO wins, resilience, activity.
Wired into /api/bots/:name/stats endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:24:18 +00:00
DorianandClaude Opus 4.6 728afacc5c test: add mock and arena tests — 21 more tests (86 total)
- mock.test.ts: 7 tests for ELO-weighted response quality, failure rates, timing
- arenas.test.ts: 14 tests for arena data integrity, pickArena, randomArena

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:58:41 +00:00
DorianandClaude Opus 4.6 f837153771 test: add 65 server engine tests — answers, scoring, challenges
- answers.test.ts: 19 tests covering all 10 checkAnswer() tiers
- scoring.test.ts: 30 tests for scoreRound, calculateElo, calculateTier, applyModifiers
- challenges.test.ts: 16 tests for pickChallenge, type exclusion, data integrity

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:55:36 +00:00
DorianandClaude Opus 4.6 a4008bcf88 fix: scoring & game logic bugs — arena modifiers, human timeout, validated prompts
- scoring.ts: wire arena damage modifiers (speed_2x, roast_2x, etc.) into applyModifiers()
- human-responses.ts: use challenge.timeout_ms instead of hardcoded 8s
- FightPage.vue: add route watcher for clean state reset on navigation
- Validated all 800 prompts: 0 duplicates, all factual have answers, all choices have 4 items

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:43:08 +00:00
DorianandClaude Opus 4.6 7d5f4a6b8d fix: stale SW chunks serving HTML, PWA cache cleanup, server asset routing
- Server SPA fallback now returns 404 for missing .js/.css assets instead of index.html
- Prevents "Unexpected token '<'" errors from stale chunk URLs
- Serve PWA files (sw.js, workbox, icons) with correct cache headers
- Workbox: cleanupOutdatedCaches, skipWaiting, clientsClaim for instant SW updates
- navigateFallbackDenylist for /api/ routes
- AudioContext comment clarification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:08:25 +00:00
DorianandClaude Opus 4.6 4307a02d25 fix: server crash from syntax error in challenges.ts, voice overlap, human fight UX
- Remove stray duplicate template block outside TEMPLATES array that caused parse error preventing server startup (fixes /api/queue/status 500)
- Add choices field to Challenge/PromptEntry interfaces for multiple choice support
- Allow voice lines to overlap naturally instead of cancelling previous speech on every call, with safety flush at depth > 3
- Buffer challenges during cooldown in polling path, auto-submit random choice on timeout
- Block auto-battle for human fights, guard replay-done auto-transition

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 21:15:42 +00:00
DorianandClaude Opus 4.6 4b46aaf643 feat: mobile human vs AI — multiple choice, two-row VS bar, responsive arena
- Server-side choice generation for all 22 challenge types (factual + creative)
- Mobile: 3 multiple-choice buttons replace keyboard input (4s timer)
- Two-row VS bar on mobile (names row + HP bars row) in FightPage and FightViewer
- Battle log hidden on mobile to maximize canvas visibility
- Arena page responsive: stacking header, tighter fight cards, no name overflow
- Profile page two-column desktop layout with contained sprite display
- Human fighter sprites with baby growth system

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:42:49 +00:00
DorianandClaude Opus 4.6 1906821452 fix: human fight UX — SSE challenge input, fighter sprites, battle log questions, left-side positioning
- Add SSE human_challenge listener for instant input activation with auto-focus
- Buffer challenges during 3s round cooldown, apply with correct remaining time
- Map 'human' archetype to fighter-looking archetypes (boxer, ninja, etc.) in sprite system
- Show challenge questions in battle log via round_start SSE events
- Ensure human players are always botA (left side) in queue matchmaking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:46:16 +00:00
DorianandClaude Opus 4.6 8448f1d823 feat: human vs AI mode — live typing challenges, baby growth system, SSE rounds
- Add choose-mode step: "I BUILD BOTS" vs "I FIGHT MYSELF" paths
- Human registration with baby avatar picker, no webhook required
- Live fight scene with SSE round streaming and real-time challenge UI
- 5-second timer per round, submit answers via browser
- Baby → toddler → kid → teen → adult → hero → super growth stages
- Huge sparkly baby eyes, diapers, pacifiers, bibs, rattles, rosy cheeks
- Speech bubble positioning fix (pushed to outside of sprite)
- Canvas text rendering via offscreen canvas to bypass kaplay color issues
- Voice timing improvements: await pauses between voice lines and hits
- 30 devastating announcement lines, 15 critical/hit word variants
- Orchestrator human player detection + waitForHumanResponse system
- Server endpoints: GET /challenge/:botId, POST /respond/:botId
- Human player auth: register-human route, isHuman flag on login

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:20:14 +00:00
DorianandClaude Opus 4.6 c87bff01a8 feat: speech overflow fix, 60+ voice profiles, post-fight audio cleanup
- Change speak() default to cancelPrevious=true so voices don't queue endlessly
- Add stopAllAudio() export and wire into FightViewer unmount + post-fight
- Flush speech queue at fight end with delayed cancel for clean cutoff
- Expand from 30 to 60+ voice profiles (robots, accents, game, characters)
- Add speech bubbles showing bot responses during rounds
- Wire announceFinishHim/Fatality/FlawlessVictory/Devastating to not cancel

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:42:32 +00:00
DorianandClaude Opus 4.6 3e74712c44 feat: production hardening — background fights, queue tuning, CORS, cycling taglines
- Background fight loop: mock bots auto-fight every ~45s for site activity
  - Quiet hours (2-8 UTC) run 4x slower, jitter prevents robotic timing
  - Configurable via FIGHT_LOOP_ENABLED, FIGHT_LOOP_INTERVAL_MS
- Queue timeout: 30s in prod (was 3s), configurable via QUEUE_TIMEOUT_MS
- CORS: env-configurable via CORS_ORIGIN (default '*')
- Homepage: 40 cycling taglines with typewriter effect
- docker-compose: document all new env vars

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:04:32 +00:00
DorianandClaude Opus 4.6 6bf9fe27b3 feat: production deployment — Dockerfile, docker-compose, SPA serving, classic bot fights
- Add Dockerfile (multi-stage: build frontend + server, serve from single container)
- Add docker-compose.yml for Portainer stack deployment
- Server serves frontend SPA in production (static assets + SPA fallback)
- Auto-run migrations and seed mock bots on server startup
- DB path configurable via DB_PATH env var
- Add "Fight a Classic Bot" button for instant mock bot matches
- FIGHT button queues for real AI opponents

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 10:42:18 +00:00
DorianandClaude Opus 4.6 33f08c35b5 feat: full comedy overhaul — voices, narrations, trash talk, commentary
Rewrites all commentary and narration content across the entire stack:
- sounds.ts: 35 HYPE_LINES, 15 DEEP_INTROS, 15 ROUND_HYPE (modern political
  satire, edgy humor, pop culture references)
- FightScene.ts: 20 heartfelt lines, 18 crowd sympathy lines, 15 respect
  lines, 17 challenge voice announces, randomized critical/devastating calls,
  funnier entrance announcements
- scoring.ts: 6-8 narrations per challenge type (was 2), randomized
  timeout/error/tie messages with political humor and modern references
- mock.ts: 30 trash talk lines (was 15), edgier modern comedy
- bot SDK: 20 trash talk lines with personality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 09:15:41 +00:00
DorianandClaude Opus 4.6 559782c8ce feat: comedy overhaul start, profile page, bot setup docs, auth improvements
Rewrites announcer commentary (HYPE_LINES, DEEP_INTROS, ROUND_HYPE) with
modern edgy humor. Adds BOT_SETUP.md, bot SDK, customization engine,
profile page character display, persistent auth, rate limit tweaks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 08:52:24 +00:00
DorianandClaude Opus 4.6 4a35e1e0b5 feat: profile page character display, persistent auth, cleanup
- Large animated sprite on BotProfilePage with tier-aware rendering
- Dynamic status titles (UNSTOPPABLE, ON FIRE, FRESH MEAT, etc.)
- Nostr auth persisted to localStorage — survives navigation and HMR
- Remove grotesque close-up overlays (eyeballs, tongues, teeth, drool)
- Remove crowd cheering signs (too small to look good)
- Add archetype to bot stats API response
- SpritePreview now accepts tier prop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 08:21:20 +00:00
DorianandClaude Opus 4.6 e49735002c fix: Drizzle transaction execution, canvas re-init, crowd removal
- Add .run() to all Drizzle queries inside sqlite.transaction() in
  orchestrator.ts and mock.ts — queries were building but never executing,
  leaving fights stuck as 'live' forever
- Remove spectator crowd from drawArenaDecor()
- Rename duplicate spawnProp to spawnWeaponProp (was crashing module load)
- Replace canvas element on re-init to avoid "KAPLAY already initialized"
- Add safeText() to strip brackets from k.text() calls (Kaplay treats
  [ ] as style markup, crashes on unclosed tags)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:53:15 +00:00
DorianandClaude Opus 4.6 4d8b18a58a feat: v4 — TUI fight loop, rate limiting, webhook tooling, expanded choreographies
- Fight loop CLI with TUI renderer (ink-style terminal UI)
- Rate limiting middleware for API routes
- Queue cooldowns wired into orchestrator after fights
- Webhook test utility for bot debugging
- API docs route
- Expanded FightScene choreographies and weapon props
- Fix Drizzle transaction execution in orchestrator
- Schema additions, scoring/challenge/mock expansions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:14:46 +00:00
DorianandClaude Opus 4.6 2c0323d5fb feat: v3 — fight loop, expanded challenges, FightPage ownership guard
- Add fight-loop CLI for automated mock fights with elo-based matchmaking
- Expand challenge types, scoring narrations, arenas, and mock bot pool
- FightPage "Fight again" buttons now only show for your own bot
- FightViewer async scene init, live fight polling with round counter
- Extract mock answers into separate answers module

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 23:44:40 +00:00
DorianandClaude Opus 4.6 47d20fbe66 feat: v2 — queue matchmaking, procedural audio, sprite archetypes, auth
- Add queue-based matchmaking with Elo-proximity and 10s timeout
- Procedural sound engine (SFX, voice announcer, 4-track music)
- Sprite system refactored into 6 archetypes (standard, lobster, sheep, cyborg, blob, tank)
- 42+ fight choreographies with themed/generic/wild card selection
- 4 KO finish styles, super-speed mode, hyperdetail close-ups
- Auth routes, JoinBout page, bot profile with stats
- 7-tier ranking system (Baby through Legend)
- Arena and challenge system expansions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 22:13:19 +00:00
DorianandClaude Opus 4.6 335c148866 feat: botfights v1 — full fighting game with Kaplay engine
- Vue 3 + Vite + Tailwind 4 frontend with synthwave aesthetic
- Hono backend on port 9100 with SQLite/Drizzle
- Procedural pixel-art sprite generator (48x48, 8 animation states)
- Kaplay fight scene with punch/kick/special/knockback/KO animations
- 12 mock bots across 6 tiers with Elo rating system
- 9 challenge types, 10 fight arenas with modifiers
- Fight replay with staggered battle log and ~1 min timing
- Sprite preview page at /sprites

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 16:27:54 +00:00