Valheim Bot
Computer vision companion for Valheim
An AI companion that watches your Valheim screen via computer vision and offers real-time tips, inventory analysis, and contextual guidance without mods.

- —Screen capture + OCR pipeline to extract game state without mods
- —Real-time inventory analysis with crafting suggestions
- —Contextual tips based on current biome, health, and time of day
- —Discord bot interface — ask questions about the game state in natural language
Valheim doesn't have a modding API in the traditional sense. Getting data out of the game without mods means reading the screen — which is exactly what Valheim Bot does.
The core pipeline: periodic screen captures → OpenCV preprocessing → OCR for text elements (health, stamina, inventory item names) → structured game state → Claude for contextual reasoning → Discord response.
The interesting constraint is latency. Screen capture and OCR are fast. The LLM call is slow. I ended up building a two-tier system: fast local heuristics handle obvious situations (health below 30% → "eat food"), while the LLM handles complex queries ("what should I build next given my current inventory and the frost caves I just found").
What works well: inventory analysis is surprisingly accurate. Valheim's UI is clean and consistent, which makes OCR reliable. Biome detection from visual cues (sky color, terrain texture) is less reliable and currently uses a simpler icon-based approach.
What's still rough: the bot occasionally hallucinates game mechanics that don't exist. Classic LLM problem — it confidently suggests recipes that Valheim doesn't have. The fix is a game data lookup layer that validates suggestions against the actual crafting graph before responding.