Monday, May 31, 2010

Menu automation completed!

Well, not entirely. But we've completed the original goal of automating menus for single player matches, replays, and UDP LAN games as of r2310. You can now specify the game type, and for single player games you can specify the number of computer opponents and their race in the bwapi.ini file. For more information, see the new wiki page on menu automation. Also some non-critical actions can still be automated if needed. For example, I didn't bother to automate game speed selection since you can control it directly with Game::setLocalSpeed. If you need some part of the menu system automated for your AI, create a new issue on the BWAPI Issues List for it and I'll get to it eventually.

Since completion, several users have expressed interest in the automation of Battlenet menus, which sounds useful since it would enable users to create a bot that listens in an IRC channel or Battlenet channel and automatically joins games when requested. I've created a new issue for this though I'll probably focus on some other aspect of BWAPI for at least the next few days.

Friday, May 28, 2010

More menu automation

2 updates:
  1. Menu automation for replays is complete. Bots can now iterate through a list of replays with no manual user input. To do this, in the bwapi.ini file set the map parameter to the first replay in your list, set auto_menu = SINGLE_PLAYER, and add some code to your bot's onEnd() function which updates the map variable to the next replay in your list and also calls Broodwar->leaveGame() to avoid the Exit Replay dialog box. This will be especially useful for participants in the AIIDE 2010 Starcraft Competition who are data mining thousands of replays and applying machine learning algorithms to determine the best strategies.
  2. Race selection for single and multiplayer games can now be automated - just set the race parameter in the bwapi.ini file to the race you want to play as.
Next steps for menu automation: Automate game type selection (Melee/UMS/Free For All/etc), game speed, number of computer players and their races for single player and UDP LAN games.

Wednesday, May 26, 2010

Progress toward menu automation

After a few hours of searching through memory and playing around with different strings that look related to the map name, I found two offsets in memory that control which map Starcraft loads and plays on (at least in single player games). As of the latest revision (r2262) you can now edit the bwapi.ini config file and set 'map' to the name of the map you want to play on and set menu = 1, then you just need to click 'Start' on the Chaoslauncher to start a single player game on that map. So far it looks like it works every time, though there is room for improvement.

In order to select a particular map, BWAPI right now has to enter the Create Game screen, then cancel out, and then re-enter the Create Game screen. While this repetition is automated, it does add a second or two to the setup time which could be avoided if I can find a way to make it work correctly the first time BWAPI enter's the Create Game screen.

Also it only works for single player games, not replays or multiplayer games, so I will keep looking to find a way to automate map/replay file selection for those game types.

Tuesday, May 25, 2010

BWAPI Beta 2.7.2

The latest version of BWAPI is BWAPI Beta 2.7.2. This release just fixes a crash that was accidentally added in BWAPI Beta 2.7.1. BWAPI Beta 2.7.1 was the first release in several months and has quite a few changes and bug fixes, which are detailed in the change log.

Yesterday I started adding some test cases to the TestAIModule (which is in the BWAPI svn). So far it mostly tests basic things, though already I discovered some unexpected output - the player's minerals and cumulativeMinerals are 0 during onStart, and Game::isPaused is true during onStart. I think the easiest way to fix these problems would just be to ignore the first frame and start the ai module on frame one (though adjust the numbering so the AI module still thinks it is starting on frame 0), since it appears the values of these functions are correct on the second frame.

Monday, May 24, 2010

BWAPI Blog

The Brood War Application Programming Interface (BWAPI) is a free and open source C++ framework for creating AI modules for Starcraft: Broodwar. Using BWAPI, programmers can retrieve information on players and individual units in Starcraft as well as issue a wide variety of commands to units, opening the doors for custom AIs with new micro and macro algorithms.

With BWAPI you can:
  • Write competitive AIs for Starcraft: Broodwar by controlling individual units.
  • Read all relevant aspects of the game state.
  • Analyze replays frame-by-frame, and extract trends, build orders, and common strategies.
  • Get comprehensive information on the unit types, upgrades, technologies, weapons, and more.
  • Study and research real-time AI algorithms in a robust commercial RTS environment.
Links: