-
Notifications
You must be signed in to change notification settings - Fork 1
How to Debug Starcraft Programs (BWAPI bots)
Acquire the file 4160d.dll:
-
Download BWAPI 3.7.4.7z from https://code.google.com/p/bwapi/downloads/list
-
After extracting, copy the file BWAPId.dll from the folder Chaoslauncher/
-
Paste that file into the Starcraft/bwapi-data/revisions/ folder where Starcraft is installed on your computer
-
Rename that file to be 4160d.dll
How to debug a Starcraft BWAPI bot:
-
Ensure that you can compile your bot in Debug mode (not Release). For assistance, see https://code.google.com/p/bwapi/wiki/Debugging
-
Compile your bot in debug mode
-
Run Chaoslauncher, and select BWAPI Injector (1.16.1) Debug (top right of Chaoslauncher window). Its probably best if you also set the value "pause_dbg = ON" in config file (bwapi.ini located in bwapi-data).
-
When Starcraft is at the menu screen before the match starts, go back to Visual Studio. At the top click Debug->Attach to Process...
-
Select the currently running Starcraft.exe process
-
Go back to Starcraft, start the game
-
Now once a breakpoint is hit, Starcraft should wait and you can debug your program. Happy Debugging :)
After finished debugging
-
Change the "pause_dbg = OFF" option in the bwapi.ini config file (Actually you can leave it set to on all the time, does nothing for release mode)
-
In chaoslauncher deselect the DEBUG injector and select the RELEASE injector (checkboxes in the upper left of the chaos launcher window)
Possible Debugging Issues
- When you try to debug the bot, and the breakpoints won't break, the symbols might not have been loaded for the UAlbertaBotd.dll. To verify this, load ChaosLauncher, attach the Starcraft process, and start the game. Go to Debug > Windows > Modules and look for UAlbertaBotd.dll in this list. If it isn't there, the symbols for the bot are not being loaded, so the debugger doesn't know where to break. Something that might fix this problem is by right clicking on the UAlbertaBot project and clicking Properties. Go to Debugging under Configuration Properties. For the Command Arguments field, make sure /MD is present. Rebuild and start the game up with the bot and test a breakpoint on one of the update() calls.