Skip to content

Epic: Add Bots to End-User Games #95

@tgrunnagle

Description

@tgrunnagle

Overview

Enable adding already-trained neural network bots and rules-based bots to end-user games. Bots run as a separate Python service (FastAPI) that connects to games like regular WebSocket clients. The Go backend proxies requests to the Bot Service.

Background

This feature allows players to add AI opponents to their games dynamically. The Bot Service manages bot lifecycles, loads trained models from the ModelRegistry, and connects bots to game rooms via WebSocket. Both rule-based bots and trained neural network bots are supported.

Architecture:

Frontend/CLI  --->  Go Backend (proxy)  --->  Bot Service (FastAPI)
                         |                           |
                         |<--- WebSocket ------------|
                         |    (bot joins game)       |

Task Breakdown

Task ID Title Dependencies GitHub Issue #
TASK-001 Neural Network Bot Runner #96
TASK-002 WebSocket Bot Client TASK-001 #97
TASK-003 Bot Manager TASK-001, TASK-002 #98
TASK-004 FastAPI Bot Service TASK-003 #99
TASK-005 Go Backend Bot Proxy TASK-004 #100
TASK-006 Taskfile & Dependencies TASK-004, TASK-005 #101

Dependency Graph

#96 (Neural Network Bot Runner)
    |
    v
#97 (WebSocket Bot Client)
    |
    v
#98 (Bot Manager)
    |
    v
#99 (FastAPI Bot Service)
    |
    +--> #100 (Go Backend Bot Proxy)
    |         |
    v         v
#101 (Taskfile & Dependencies)

Acceptance Criteria

  • NeuralNetBot runs inference using ActorCriticNetwork and converts actions to BotAction tuples
  • WebSocketBotClient connects to game server and forwards game state to bot runner
  • BotManager can spawn/destroy bots and load models from ModelRegistry
  • FastAPI service exposes /bots/spawn, /bots/{id}, /bots, /bots/models, /health endpoints
  • Go Backend proxies POST /api/rooms/{roomId}/bots to Bot Service
  • All unit tests pass (task bot2:test:unit, task be:test)
  • Manual verification: spawn rule-based bot, spawn neural net bot, both play in game

References

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:add-botsFeature: Add bots to end-user gamestype:epicEpic-level issue containing multiple tasks

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions