RaphaelRoyerRivard / MicroMachine

Starcraft 2 Bot
MIT License
12 stars 0 forks source link

MicroMachine: AI Bot for StarCraft II

This Terran bot is built on top of CommandCenter, a popular C++ bot that is great for beginners. A lot of work has been put in this project and has now diverged a lot from CommandCenter. MicroMachine is considered to be the strongest bot amongst community made bots in the SC2AI community. Check out its bio on the AI Arena website.

CommandCenter: AI Bot for Broodwar and Starcraft II

CommandCenter is a StarCraft AI bot that can play both StarCraft: Broodwar and StarCraft 2.

CommandCenter Screenshot

CommandCenter is written in C++ using BWAPI and Blizzard's StarCraft II AI API. It provides many wrapper functions around both APIs that allow it to perform the same functionality in both games via the same source code. It is written by David Churchill, Assistant Professor of Computer Science at Memorial University, and organizer of the AIIDE StarCraft AI Competition.

CommandCenter is based on the architecture of UAlbertaBot, and is intended to be an easy to use architecture for you to quickly modify, play with, and build your own bot. The bot itself does not contain much in the way of hard-coded strategy or tactics, however it provides a good starting point for you to implement your own strategies for any race.

CommandCenter currently provides the following features:

CommandCenter should eventually have all of the functionality of UAlbertaBot, however much of its features are not currently completed. Here is an up-to-date list of features currently missing from CommandCenter that will be implemented soon:

Download and Run CommandCenter

StarCraft BW: You must have StarCraft: Broodwar version 1.16.1 installed, as well as BWAPI.

StarCraft 2: You must have an up-to-date retail version of StarCraft II installed to run the bot. You must also download and install some maps to use with the bot, which you can find here: https://github.com/Blizzard/s2client-proto#downloads. Please note that there is a password provided on that page to extract the maps from the zip files.

The bot comes with a configuration file named BotConfig.txt in which you can modify build orders, print various debug information to the screen, and set some bot parameters. You can define multiple builds orders in the 'Strategies' section of the file, and choose which named strategy to implement when the bot plays a specific race. Unit names in the build-order are case sensitive, and must be exactly how they appear in-game with no spaces. Some of the options in the configuration file are currently not implemented, such as the KiteWithRangedUnits option.

Please note that this config file is in JSON format, and the bot will not run unless it is well-formatted JSON. The configuration file must be in the same directory as CommandCenter.exe in order for the bot to run correctly. If you have made an error in the JSON syntax and can't find it on your own, you can use an online JSON Validator to check for you.

By default when you run CommandCenter.exe, it will play as Random race vs. a Random race built-in SC2 Easy AI. You can modify which races are played in the configuration file via the "BotRace" and "EnemyRace" options. You can also modify which map to be played by specifying the "MapFile" option. Please note that the MapFile option is relative to your StarCraft II maps directory, which by default is located in your StarCraft_Install_Directory/maps/, and the bot will not run without specifying a valid map file.

If the bot crashes or does other nasty things, please bear with me while I make it more stable :)

Developer Install / Compile Instructions (Windows)

Developer Install / Compile Instructions (Linux and OS X)

With these steps you should be able to build and install the SC2 API and include it into CommandCenter. It has been tested successfully for aba2d3813571c344090f3de5b58a5c912cd5acb3, so if the install instructions below don't work checkout that version of the SC2 API

$ git checkout aba2d3813571c344090f3de5b58a5c912cd5acb3 .

and repeat the instructions.

Install SC2 API headers

$ sudo mkdir -p /opt/local/include $ sudo cp -R include/sc2api /opt/local/include $ sudo cp -R include/sc2utils /opt/local/include $ sudo cp -R build/generated/s2clientprotocol /opt/local/include

Install protobuf headers

$ sudo cp -R contrib/protobuf/src/google /opt/local/include/sc2api

Install SC2 API libraries

$ sudo mkdir -p /opt/local/lib/sc2api $ sudo cp build/bin/libcivetweb.a /opt/local/lib/sc2api $ sudo cp build/bin/libprotobuf.a /opt/local/lib/sc2api $ sudo cp build/bin/libsc2api.a /opt/local/lib/sc2api $ sudo cp build/bin/libsc2lib.a /opt/local/lib/sc2api $ sudo cp build/bin/libsc2protocol.a /opt/local/lib/sc2api $ sudo cp build/bin/libsc2utils.a /opt/local/lib/sc2api


* Build the bot
```bash
$ git clone https://github.com/RaphaelRoyerRivard/commandcenter.git && cd commandcenter
$ cmake .
$ make

Bot Development

If you are familiar with the architecture of UAlbertaBot, the logic of CommandCenter is quite similar. The biggest difference is that information relating to the map, baselocation, etc are no longer globally accessible. This data now lives inside the main CCBot class, and must be accessed via a reference to the instance of that class. Because of this, most classes in CommandCenter carry with them a reference to the bot's main CCBot object, from which all game related information, observations, and queries can be made.

An in-depth development guide will be coming soon, but please refer to the UAlbertaBot wiki for now since the architecture is so similar (minus the build order planner and combat simulator).