An AI-powered desktop application that plays Barony autonomously. The bot watches the game log in real time, builds a structured context, asks an AI model for the next action, and executes it via keyboard/mouse simulation — all from a single self-contained binary.
┌─────────────────────────────────────────────────────────────────┐
│ Tauri Desktop App │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ Setup Page │ │ Dashboard │ │ History Page │ │
│ │ (Svelte) │ │ (Svelte) │ │ (Svelte) │ │
│ └──────┬───────┘ └──────┬───────┘ └────────┬─────────┘ │
│ │ │ │ │
│ └──────────────────┼─────────────────────┘ │
│ │ tauri::invoke / events │
│ ┌───────▼────────┐ │
│ │ Rust Backend │ │
│ └───────┬────────┘ │
│ │ │
│ ┌─────────────────────┼──────────────────────┐ │
│ │ │ │ │
│ ┌───▼──────────┐ ┌───────▼──────┐ ┌───────────▼────────┐ │
│ │ LogWatcher │ │ AIProvider │ │ RunAnalyst │ │
│ │ (notify) │ │ (trait) │ │ (post-mortem) │ │
│ └───┬──────────┘ └───────┬──────┘ └───────────┬────────┘ │
│ │ │ │ │
│ ┌───▼──────────┐ ┌───────▼──────────────────┐ │ │
│ │ GameState │ │ Ollama / LMStudio / │ │ │
│ │ (in-memory) │ │ Claude API / OpenAI API │ │ │
│ └───┬──────────┘ └──────────────────────────┘ │ │
│ │ │ │
│ ┌───▼──────────────┐ ┌────────▼─────────┐ │
│ │ GameController │ │ LuaManager │ │
│ │ (enigo input) │ │ (knowledge base)│ │
│ └──────────────────┘ └──────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│ │
▼ ▼
Barony.exe lua/*.lua files
(game process) (persistent AI memory)
barony.log (new line)
│
▼
LogWatcher::parse_line() → LogEvent
│
▼
GameState::apply(event) → updated GameState
│
▼
Build JSON context → { game_state, lua_context, vision_hint? }
│
▼
AIProvider::complete() → JSON action string
│
▼
GameController::execute() → keyboard/mouse event → Barony
│
▼ (on death)
RunAnalyst::analyse() → cause_of_death + Lua patches + RunSummary
│
▼
lua_manager::apply_patch() → updated strategy/death_patterns.lua
| Tool | Version | Notes |
|---|---|---|
| Rust | ≥ 1.77 | Install via rustup |
| Node.js | ≥ 20 | For Svelte/Vite frontend build |
| Tauri CLI | v2 | cargo install tauri-cli --version "^2" |
| Barony | any | The open-source roguelike game |
At least one AI provider must be running or configured:
| Provider | Requirements |
|---|---|
| Ollama | Running on localhost:11434 |
| LM Studio | Running on localhost:1234 with a model loaded |
| Claude API | Anthropic API key |
| OpenAI API | OpenAI API key |
# 1. Clone the repo
git clone https://github.com/AnthonyDpz/BotBarony.git
cd BotBarony
# 2. Install frontend dependencies
npm install
# 3. Development mode (hot-reload)
npm run tauri dev
# 4. Production build
npm run tauri build
# Binary output: src-tauri/target/release/bot-barony
http://localhost:11434llama3, mistral, qwen2.5http://localhost:1234https://api.anthropic.comANTHROPIC_API_KEYclaude-sonnet-4-5, claude-haiku-4-5https://api.openai.comOPENAI_API_KEYgpt-4o, gpt-4o-miniBotBarony/
├── src-tauri/src/
│ ├── main.rs Tauri entry point + command handlers
│ ├── ai_provider/ AIProvider trait + provider implementations
│ ├── game/ Game launcher, controller, log watcher, screenshot
│ ├── lua_manager.rs Lua knowledge base read/write
│ └── run_analyst.rs Post-run AI analysis + history persistence
├── src/ Svelte frontend
│ ├── lib/Setup.svelte Provider config + health check
│ ├── lib/Dashboard.svelte Live run control + log stream
│ └── lib/History.svelte Past runs + AI summaries
├── lua/
│ ├── knowledge.lua Barony game mechanics facts
│ ├── strategy.lua Bot decision priorities
│ └── death_patterns.lua Known failure modes + fixes
└── agents/prompts/
├── system_bot.md In-game bot system prompt
└── analyst.md Post-run analyst system prompt
Issues and PRs welcome. See CLAUDE.md for architecture details and coding conventions.
MIT