Dota 2 AI Coach
An intelligent AI assistant for Dota 2 that analyzes game situations in real-time and provides tactical advice through an overlay. The system uses RAG (Retrieval-Augmented Generation) for more relevant and well-grounded responses.

Features
- ๐ฎ Dota 2 Integration via GSI (Game State Integration)
- ๐ค AI Provider Support: Google Gemini and OpenRouter
- ๐ RAG System: Searches relevant information from knowledge base before generating responses
- ๐ฌ Automatic Advice every N seconds
- โ Interactive Questions directly in-game
- โจ๏ธ Hotkey Management
- ๐ Built-in Knowledge Base with information about heroes, abilities, items
Requirements
- Go 1.24.0+
- Windows (uses WinAPI)
- Dota 2
- API key from Gemini or OpenRouter
Installation
# Clone the repository
git clone https://github.com/BrightGir/game-ai-helper.git
cd GameHelper
# Download dependencies
go mod tidy
Configuration
1. API Key
Create a .env file in the project root directory:
API_KEY=your_api_key_here
MODELS_DIR=storage (or folder where the BERT model will be located)
Where to get an API key:
- Gemini: https://makersuite.google.com/app/apikey
- OpenRouter: https://openrouter.ai/keys (paid models, some free options available)
๐ก Tip: For best results, use advanced models. Free models work well for basic advice.
2. Dota 2 GSI Configuration
Before using the application, you need to configure Dota 2 to send game data to GameHelper:
- Locate your Dota 2 GSI config folder:
C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\dota\cfg\gamestate_integration\
๐ก Tip: If the
gamestate_integrationfolder doesn't exist, create it manually.
-
Create a new file in this folder named:
gamestate_integration_aicoach.cfg -
Copy and paste the following content into the file:
"Dota 2 Integration Configuration" { "uri" "http://localhost:6000" "timeout" "5.0" "buffer" "0.1" "throttle" "0.1" "heartbeat" "30.0" "data" { "provider" "1" "map" "1" "player" "1" "hero" "1" "abilities" "1" "items" "1" } } -
Save the file and restart Dota 2 if it's already running.
3. Application Settings
Edit config.json:
{
"local_gsi_port": 6000,
"provider": "openrouter",
"model": "openai/gpt-4o-mini",
"request_interval_seconds": 60,
"silence_duration_seconds": 60,
"hotkey_turn_overlay": 120,
"hotkey_focus_overlay": 121,
"minSimilarity": 0.7
}
Parameters:
local_gsi_portโ port for GSI server (default 6000)providerโ"gemini"or"openrouter"modelโ AI model:- Gemini:
gemini-2.5-flash,gemini-2.5-pro - OpenRouter:
google/gemma-3-27b-it:free,meta-llama/llama-3.2-3b-instruct:free,openai/gpt-4o-mini
- Gemini:
request_interval_secondsโ automatic advice interval (seconds)silence_duration_secondsโ pause after question before auto-advice (seconds)hotkey_turn_overlayโ toggle overlay key (120=F9)hotkey_focus_overlayโ focus key (121=F10)minSimilarityโ minimum similarity threshold for RAG search (default 0.7)
โ ๏ธ Important: Advice quality depends on the model. Advanced models provide significantly better results.
Usage ๐ฎ
First Launch
Development mode:
go run ./cmd/game-helper
Or build and run:
# Build
go build -o GameHelper.exe ./cmd/game-helper
# Run
./GameHelper.exe
What happens on first run:
- BERT models for embedding are downloaded (may take a few minutes)
- Knowledge base is indexed in Chroma DB.
- You will see overlay
- Subsequent runs will be faster (uses cache)
Keep the console window open โ closing it will stop the application.
Starting Dota 2
- Launch Dota 2 in Windowed Mode (Settings โ Video โ Display Mode โ Borderless Window)
โ ๏ธ IMPORTANT: Dota 2 must be running in Windowed Mode (not Fullscreen) for the overlay to work correctly.
Using the Overlay
The overlay consists of three main areas:
- AI Advice Panel โ Shows automatic tactical advice and AI responses
- Question Input Field โ Type your questions here
- Context Input Field โ Add additional game context/notes
Hotkeys Reference
| Key | Action | Description |
|---|---|---|
F9 |
Toggle Overlay | Show or hide the entire overlay |
F10 |
Focus Overlay | Enable/disable text input mode (allows typing) |
Enter |
Submit | Send your question or save context |
How to Ask Questions
- Press
F10to focus the overlay (you'll see the input fields become active) - Click on the Question Input Field
- Type your question, for example:
- "What items should I buy next?"
- "How do I counter this hero?"
- "What's the best strategy for this situation?"
- Press
Enterto send the question - The AI will process your question and display the answer in the AI Advice Panel
Adding Game Context
You can provide additional context to help the AI give better advice:
- Press
F10to focus the overlay - Click on the Context Input Field (bottom section)
- Type relevant information, for example:
- "Enemy team has strong magic damage"
- "I'm playing as support"
- This context will be included in all future AI requests
Automatic Advice
The application automatically provides tactical advice every N seconds (configured in config.json as request_interval_seconds, default: 60 seconds).
- Advice appears automatically in the AI Advice Panel
- The system analyzes your current game state (hero, items, abilities, gold, etc.)
- Advice pauses for N seconds after you ask a manual question (configured as
silence_duration_seconds)
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Dota 2 Game Client โ
โ (Sends Game State) โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTP POST (JSON)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GSI Handler โ
โ (transport/http_gsi.go) โ
โ localhost:6000 โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Parser โ
โ (dota/parser.go) โ
โ JSON โ GameState โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Store (Thread-safe) โ
โ (state/store.go) โ
โ RWMutex + GameState โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โ Reads state
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
โ Prompt Handler โ โ Overlay (UI) โ
โ (prompt.go) โโโโโโโโโโโโโโโโ (ui/*.go) โ
โ โ userPromptChan โ
โ โข Timer (auto) โ โ โข RayLib window โ
โ โข User questions โ โ โข Hotkeys โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ โ โข Text input โ
โ โ โข GetContextText()โ
โ Calls Build() โ (user notes) โ
โผ โโโโโโโโโโโฌโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ Builder (prompt/builder.go) โโโโโโโโโโ
โ โ ContextProvider
โ 1. store.Get() โ GameState โ (user notes)
โ 2. ctxProvider.GetContextText() โ
โ 3. Formats: hero, items, โ
โ abilities, user notes โ
โ 4. pipeline.Execute() โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ gameContext + question
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Pipeline (prompt/pipeline.go) [RAG SYSTEM] โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 1. generateSearchQueries() โ โ
โ โ AI request โ JSON with search queries โโโโโโบโโโโบ AI Client
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ (Gemini/OpenRouter)
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 2. retrieveKnowledge() โ โ
โ โ Search in vector DB โโโโโโบโโโโบ Retriever
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ (BERT + Chroma)
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 3. buildFinalPrompt() โ โ
โ โ knowledge + gameState + question โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ finalPrompt (string)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ promptChan โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Worker (ai_worker.go) โ
โ โ
โ fetchAdviceWithRetry(): โ
โ โข aiProvider.Ask(systemPrompt, finalPrompt) โโโโโโโบโโโโบ AI Client
โ โข Retry logic (3 attempts) โ (Gemini/OpenRouter)
โ โข Error handling โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ advice (AI response)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ adviceChan โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Advice Consumer (ai_worker.go) โ
โ โ
โ overlay.SetAiAdvice(advice) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Overlay displays โ
โ advice to user โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
Project Structure
GameHelper/
โโโ cmd/
โ โโโ game-helper/ # Main application
โ โ โโโ main.go # Entry point, initialization
โ โ โโโ app.go # App structure, coordinates all components
โ โ โโโ ai_worker.go # AI request handler with retry logic
โ โ โโโ prompt.go # Prompt queue and timer management
โ โโโ rag/ # RAG system tools
โ โโโ base-knowledge-loader/ # Loads JSON knowledge bases and create chunks with LLM
โ โโโ knowledge-vectorizer/ # Converts text to vectors and saves to assets/rag/knowledge.json
โ โโโ prompt-debug/ # Debug tool for running prompt scenarios
โโโ internal/
โ โโโ ai/ # AI provider integration
โ โ โโโ gemini/ # Google Gemini API client
โ โ โ โโโ client.go # Sends requests to Gemini API
โ โ โ โโโ types.go # Request/response structures
โ โ โโโ openrouter/ # OpenRouter API client
โ โ โ โโโ client.go # Sends requests to OpenRouter API
โ โ โ โโโ types.go # Request/response structures
โ โ โโโ factory/ # Factory for creating AI clients
โ โ โ โโโ factory.go # Selects client based on config
โ โ โโโ types.go # Common Client interface
โ โ โโโ errors/ # API error handling
โ โ โโโ errors.go # ShouldRetry, APIError structures
โ โโโ dota/ # Game State Integration (GSI)
โ โ โโโ parser.go # Parses JSON from Dota 2
โ โ โโโ types.go # GameState, Hero, Items, Abilities types
โ โโโ prompt/ # AI prompt generation using RAG
โ โ โโโ builder.go # Composes context from state + knowledge
โ โ โโโ pipeline.go # RAG pipeline: queries โ search โ prompt
โ โ โโโ templates.go # Text templates for prompts
โ โโโ retriever/ # Knowledge search (RAG component)
โ โ โโโ retriever.go # Vector search + similarity filtering
โ โ โโโ bert.go # BERT model initialization
โ โ โโโ types.go # Searcher interface, result types
โ โโโ state/ # Thread-safe game state storage
โ โ โโโ store.go # RWMutex for concurrent access
โ โโโ config/ # Configuration management
โ โ โโโ config.go # Config structure + LoadConfig
โ โโโ transport/ # HTTP handler for GSI data
โ โ โโโ http_gsi.go # Receives POST from Dota 2
โ โโโ ui/ # Graphical overlay (RayLib)
โ โโโ types.go # Overlay structure, UI state
โ โโโ engine.go # Main rendering loop
โ โโโ draw.go # Text rendering
โ โโโ calculator.go # Layout calculations
โ โโโ click.go # Windows API for transparency
โ โโโ input.go # Input handling
โ โโโ keyboard.go # Hotkey handling
โโโ assets/ # Embedded data and templates
โ โโโ data/ # Knowledge base in JSON
โ โโโ prompts/ # Text templates for prompts
โ โ โโโ base-coach-system-prompt.txt
โ โ โโโ bd-queries-generator.txt
โ โ โโโ final-prompt.txt
โ โ โโโ *.txt
โ โโโ rag/
โ โ โโโ knowledge.json # Combined knowledge base
โ โโโ embed.go # go:embed directives
โโโ storage/ # Batches cache and models
โ โโโ cache/ # LLM response cache
โ โโโ aghs_desc/
โ โโโ heroes/
โ โโโ items/
โโโ config.json # Application configuration
โโโ .env # API key (create this)
โโโ gamestate_integration_aicoach.cfg # Dota 2 GSI config (example)
โโโ go.mod
โโโ go.sum
โโโ README.md
โโโ LICENSE
Advanced
RAG Tools
These tools are for developers who want to rebuild or modify the knowledge base.
Loading Knowledge
go run ./cmd/rag/base-knowledge-loader
Loads base knowledge (heroes, items, abilities) from JSON files (dotaconstants, Stratz API) and creates text chunks using LLM.
Vectorization
go run ./cmd/rag/knowledge-vectorizer
Converts text knowledge to BERT vectors and stores them in assets/rag/knowledge.json
Prompt Debugging
go run ./cmd/rag/prompt-debug
Generation of final prompts based on data in internal/prompt/testdata
License
This project is distributed under the MIT License.