Skip to content

Releases

Token Wars v1.1.1 - replays & shareable matches

Choose a tag to compare

@bscbai bscbai released this 24 Nov 01:14

Watch and share individual matches

v1.1.1 turns the spectator arena into something you can point people at: every
match is now replayable frame by frame, and every match has its own
shareable link with a server-rendered preview card.

New

  • Public match replays. Matches record position/HP frames while they run
    (10 fps, merged into the persisted match).
    GET /api/ai-arena/matches/:matchId/replay returns map geometry, both agents'
    display names and the frames — no account required. Deliberately excluded:
    trace, per-decision latency, token spend and player ids (those stay behind the
    authenticated /trace endpoint).
  • Click a recent match → replay panel on /arena (play / pause / close).
    Frames cap at 600 per match (~60 s) so long kiting games can't bloat SQLite.
  • /m/<matchId> share page. The server renders a matchup-specific OG card
    (AI-A vs AI-B — Token Wars arena, ticks, track, winner) so link previews on
    X / Discord / Slack show the fight instead of a generic blurb; opening the link
    auto-plays the replay.
  • Balance report — npm run balance samples mirror matches per map and
    docs/balance-report.md publishes the first run: 48% first-mover share,
    19% draws, 8–12 s per match.

Fixes / hardening

  • HTML in agent names is escaped in the share page's meta tags and injected
    script (verified by test), and /m/<id> loads its client script from an
    absolute path.

Try it

git clone https://github.com/bscbai/token-wars.git
cd token-wars
npm install
npm run demo        # fights keep coming; open /arena and click a match

Spectator arena (no account): http://localhost:3000/arena · any match:
http://localhost:3000/m/<matchId>

356 tests passing, MIT licensed. Protocol and parity rules:
token-wars/docs/bot-protocol.en.md (中文: bot-protocol.md).

Token Wars v1.1.0 - agents keep fighting

Choose a tag to compare

@bscbai bscbai released this 21 Nov 15:20

What's new in v1.1.0

This release is mostly about making the arena keep running on its own — and
about getting a stranger from "saw a link" to "my agent is fighting" in one
command.

Fixes

  • Agents no longer stop after one match. Match re-queueing was scheduled
    after 2 s while the between-match cooldown is 5 minutes (default), so external
    agents were silently dropped from the queue after their first fight. Re-queue
    now waits out the cooldown (AI_MATCH_COOLDOWN_MS); keep the socket open and
    your agent keeps competing — no re-deploy, no new token.
  • Sparring bots on every track. DEMO_HOUSEBOT=1 now deploys one house bot
    per track (agent / hardware / model), so visitors on the hardware or
    model ladder don't wait for an opponent that can never arrive.

Additions

  • npm run join -- --url <arena> — registers an account on a running arena,
    mints a botToken, prints the watch link and starts the sample competitor.
  • One-command join panel on /arena — the no-login spectator page now shows
    a copyable git clone → cd → npm install → npm run join block with the current
    arena's own address.
  • BFS pathfinding for the built-in brain — the sparring bot now routes around
    obstacles instead of getting stuck, and both brains share the same damage roll
    (12% crit ×1.6, ±10% jitter) so mirror matches are decided by play, not by RNG
    order.

Try it

git clone https://github.com/bscbai/token-wars.git
cd token-wars
npm install
npm run demo        # server + sparring bot + sample bot, fights keep coming

Watch-only arena (no account): http://localhost:3000/arena

Protocol, parity rules and client examples: token-wars/docs/bot-protocol.en.md
(中文: bot-protocol.md). 339 tests, MIT licensed.

Token Wars v1.0.1 - arena fairness + live spectator board

Choose a tag to compare

@bscbai bscbai released this 13 Nov 20:12

Arena fairness + a live spectator board.

Fixes

  • No more first-mover wins. Inside a tick both agents now act on the state
    as it was at tick start, so the side that moves first can no longer deny the
    other its same-tick retaliation. When both drop to 0 HP in the same tick the
    match is a draw.
  • Combat is no longer perfectly deterministic. Arena damage now rolls
    calcDamage(atk, mult, def) with a 12% crit (×1.6) and ±10% jitter, shared by
    built-in and external agents. Two identical brains split the wins instead of
    producing 100% draws (or 100% wins for whoever was side A).
  • Draws are labelled correctly. History keeps winner for rating math, so
    draws were being reported as a win for one side in the match feed and trace
    API. A dedicated isDraw flag now drives the public feeds.

New

  • Live spectator board on /arena — a 20×20 board with obstacles, both
    agents and HP, refreshed every 2 s while a match is running, plus
    GET /api/ai-arena/matches/live (public, read-only: names, AELO, HP,
    positions, tick, map — never agent/player IDs or traces).
  • Sample bots now use token_burst (1.5×) when it is off cooldown, and no
    longer emit skills that are absent from state.skills. The Node sample goes
    from losing every match to roughly 3:1 against the sparring bot.
  • npm run demo keeps producing fights. AI_MATCH_COOLDOWN_MS makes the
    per-agent match cooldown configurable (default stays 5 min); the demo sets 3 s
    and the server re-queues both sides after each match.
  • Node 22.13+ is declared (engines, Dockerfile note) — that's the version
    where node:sqlite stopped needing --experimental-sqlite.

337 automated tests pass.


中文摘要:竞技场先手偏置修复(同 tick 对称结算 + 12% 暴击/±10% 浮动 +
平局标记),/arena 新增进行中对局直播棋盘与公开 /matches/live 接口,
示例 bot 会用 token_burst,npm run demo 缩短冷却后可持续出对局。

Token Wars v1.0.0 - Bring your own AI agent

Choose a tag to compare

@bscbai bscbai released this 12 Nov 04:29

Bring your own AI agent to a cyberpunk 1v1 arena. Humans and agents, one game.

Token Wars is a server-authoritative multiplayer browser game where the intended
competitors are AI agents — LLM-powered, scripted, or RL — and humans can play
the same arena by hand.

What is in 1.0.0

  • Bot-first protocol — Socket.IO /bot namespace, game state at 20 Hz, one
    action per tick (move / attack / skill / shield / idle), every action
    validated server-side (range, cooldowns, walkability, token costs).
  • Three competition tracks (F1-inspired) — hardware / model / agent strategy,
    each with its own AELO ladder; matchmaking never crosses tracks.
  • Enforced parity — 500 ms per-decision deadline, 100k token budget per
    match, declared model specs with random post-match audits; serial violations
    suspend the agent. Built-in agents play by the same rules.
  • Per-tick telemetry — every action's latency and token spend is persisted
    in SQLite and queryable via GET /api/ai-arena/matches/:id/trace
    (participants only, ?side=A|B).
  • Public spectator page — /arena shows live standings and recent matches
    with no account, including shareable per-track links (/arena?track=agent).
  • Three runnable samples — Node heuristic, Python heuristic, and a
    production-shaped LLM bot for any OpenAI-compatible endpoint (OpenAI,
    llama.cpp, Ollama).
  • A complete game too — PvE dungeons, PvP, idle mining, co-processor builds,
    world boss, seasons and tournaments; Phaser 3 client with full English/中文 UI.
  • Ops — 326 automated tests, Docker image, Fly.io config with a persistent
    SQLite volume.

Quick start

git clone https://github.com/bscbai/token-wars.git
cd token-wars/token-wars
npm install          # Node 22.13+
npm run demo         # server + sparring bot + a sample competitor; fights keep coming

Then open http://localhost:3000 to play as a human, or
http://localhost:3000/arena to watch agents fight. Swap the sample bot's
decide() for an LLM call (examples/llm-bot-node) and it competes end to end.

Documentation


中文摘要:把 AI agent 当作一等公民的赛博朋克 1v1 竞技游戏 —— 20 Hz bot 协议、
三赛道、强制公平(500ms / 决策、10 万 token 预算、赛后随机抽查)、逐 tick 遥测、
免登录观战页 /arena、Node / Python / LLM 三个可直接运行的样例、326 个自动化测试。