A template for creating StarCraft 2 AI bots using the python-sc2 framework. Includes a basic bot setup with a clean configuration system and built-in validation for workshop milestones.
🚀 New to StarCraft 2 AI? Check out the Zerg Rush Bot Workshop for a guided step-by-step build, or jump straight in with the template below.
- Simple configuration via
config.py - Easy setup for local development
- Support for custom maps and AI opponents
- Ready-to-use bot structure
- Built-in milestone validation (
--validate) - Upgradable to Ares framework
- Python 3.8 or newer
- Git
- StarCraft II
- Windows: Install through the Battle.net app
- Linux:
- Option 1: Use the Blizzard SC2 Linux package
- Option 2: Set up Battle.net via WINE using Lutris
Download the StarCraft 2 AI Maps from here. Unzip and place the maps in the Maps folder in your StarCraft II installation directory. If one doesn't exist, create it.
By default, the bot will look for maps in the standard installation location. If your maps are elsewhere, update MAP_PATH in config.py.
If you're using Lutris on Linux, set these environment variables (replace with your actual paths):
export SC2PF=WineLinux
export SC2PATH="/home/YOUR_USERNAME/Games/battlenet/drive_c/Program Files (x86)/StarCraft II/"
export WINE="/home/YOUR_USERNAME/.local/share/lutris/runners/wine/YOUR_WINE_VERSION/bin/wine"- Create your repository — Click the
Use this templatebutton above to create your own copy - Clone your repository
git clone <your-repository-url> cd <repository-name>
- Set up a virtual environment
# Windows python -m venv venv .\venv\Scripts\activate # Linux/Mac python3 -m venv venv source venv/bin/activate
- Install dependencies
pip install -r requirements.txt
- Run the bot
python run.py
Edit config.py to customize:
- Bot name and race (defaults to Zerg for the Zerg Rush workshop)
- Map pool (defaults to workshop maps: Persephone, Pylon, Torches)
- Opponent difficulty and race
- Game mode (realtime or faster simulation)
The template includes a built-in validator that checks your bot against Zerg Rush milestones:
python run.py --validateThis prints a report at game end showing which steps you've completed across 4 stages:
- Economy Foundation — 16 workers, extractor, no supply blocks
- The Rush Core — Spawning Pool at supply 11–14, Zerglings after pool
- The Speed Advantage — Queen, Metabolic Boost after pool
- Attack — Zerglings sent to enemy base
The validator is tuned for the Zerg Rush build. For step-by-step instructions that walk you through each milestone, see the Zerg Rush Bot Workshop.
Edit config.py to change bot name, race, map pool, opponent, and game mode.
Modify bot/bot.py to implement your bot's behavior. The on_step method is where most of your logic goes.
As you add features, keep all new code files in the bot/ folder — it's included when creating the ladder zip.
Ares-sc2 extends python-sc2 with advanced tools for more sophisticated bot behavior. To migrate your bot:
python upgrade_to_ares.pyThe main change is that your bot inherits from AresBot instead of BotAI, and you add super() calls to any hook methods you use. For the full migration guide, see Migrating to Ares.
Create a ladder-ready zip:
python create_ladder_zip.pyUpload the resulting publish/bot.zip to AI Arena or any other SC2 bot ladder.
This project is licensed under the terms found in the LICENSE file.