BWAPI is a very strong tool for interacting with StarCraft: Brood War. It allows for the creation of intelligent agents to play the game and for pitting said agents against each other to determine the best.
I needed to run many many games of StarCraft, between various AI agents, on the same machine. While BWAPI allows you to load different agents while running locally, it, for some reason, does not let you have different races set up for each independent agent. Or, at least, I couldn’t find a creative way of doing that. Thus, a bit of C++ solved the problem.
If this is something that you would require (or BWAPI devs find it useful to include in the official release), here’s the quick requirements:
- in AutoMenuManager.cpp (BWAPI), under
this->autoMenuRace = LoadConfigStringUCase("auto_menu", "race", "RANDOM");, just add
std::stringstream raceList(this->autoMenuRace); std::string currentrace = this->autoMenuRace.substr(0, this->autoMenuRace.find_first_of(',')); for (int i = 0; i < (int)gdwProcNum && raceList; ++i) std::getline(raceList, currentrace, ','); auto trimBegin = currentrace.find_first_not_of(" \""); auto trimEnd = currentrace.find_last_not_of(" \"") + 1; currentrace = currentrace.substr(trimBegin, trimEnd - trimBegin); this->autoMenuRace = currentrace;
copy the resulting BWAPI.dll and BWAPI_PluginInjector.bwl to bwapi-data and Chaoslauncher/Plugins respectively
You can now separate multiple races via commas in your bwapi.ini file!
ai = bwapi-data/AI/ZZZKBot.dll, bwapi-data/AI/AI_krasi0_2_35.dll race = Zerg, Terran
And it works too.