Skip to content

Compile and Execute Guide

MarcoMeter edited this page Apr 29, 2016 · 17 revisions

This guide explains in detail how StarCraft, the BWAPI and my AiClient are being setup, compiled and executed.

##1. Install StarCraft: BroodWar

At first StarCraft and its Expansion BroodWar needs to be installed. It doesn't matter which location you choose for the game to be saved at. Make sure to update StarCraft: BroodWar to the version 1.16.1

##2. Install BWAPI 4.1.2

Next, download the BWAPI_412_Setup.exe and run the setup procedure. Afterwards execute the \BWAPI\ChaoslauncherChaoslauncher.exe and check if the path to the StarCraft directory is set.

Chaoslauncher Settings

You may uncheck "Warn about missing adminprivilegues". I also recommend to execute the Chaoslauncher as admin.

##3. Try out the ExampleAiModule.dll

Download the build ExampleAIModule.dll and paste it in the directory \Starcraft\bwapi-data\AI\ (if it doesn't exist). After that check "BWAPI 4.1.2 Injector [Release]" inside the Chaoslauncher "Plugins" tab. You may also check W-MODE 1.02, which will execute StarCraft in window mode.

Chaoslauncher config

After that you have to configure the bwapi.ini by selecting "BWAPI 4.1.2 Injector [Release]" and clicking on the "Config" button. The very first paragraph deals with referencing the AiModule binary. So make sure that the ExmapleAIModule.dll is referenced like this:

ai = bwapi-data/AI/ExampleAIModule.dll

Now save the bwapi.ini start StarCraft using the Chaoslauncher. Go to Single Player, choose the Expansion, select a player ID or create one, go to Play Custom, choose a map, set the Game Type to Melee and hit Ok. If everything works accordingly, some messages like "Hello World!" should be posted on the screen.

First execution of StarCraft

This ExampleAIModule is a project inside the BWAPI solution located inside the repository of BWAPI.

##4. Preparing my AiClient

Now you'll need to retrieve these files:

Place all these binaries inside the new directory \Starcraft\bwapi-data\AI\cs\ . Next, reference the BroodwarLoader.dll as ai inside the bwapi.ini

ai = bwapi-data/AI/cs/BroodwarLoader.dll, bwapi-data/AI/cs/BroodwarLoader.dll

Referencing a second dll (seperated by comma) comes in handy for working with several instances of StarCraft later on (instance one chooses the first dll and the second one goes for the second entry). The BroodwarLoader.dll.config is supposed to reference to the Assembly (NetworkTrainingModule.dll) and to the Module class, which derives from AiBase (NeuralNetTraining.TrainingModule). The convention of the value goes by namespace.className.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<appSettings>
		<add key="Path" value="" />
		<add key="Assembly" value="NetworkTrainingModule.dll" />
		<add key="Module" value="NeuralNetTraining.TrainingModule" />
	</appSettings>
</configuration>

After referencing the just downloaded binaries, download and add this map to the folder \maps\thesis. This is basically a blank map for two players owning 10 marines each. The only condition is to defeat the opponent's marines.

##5. Injecting my AiClient

Pretty much everything is setup to run the NetworkTrainingModule. You just now have to use the "Chaoslauncher - MultiInstance". It enables you to run multiple instances of StarCraft on the same time. Now follow these steps:

  • start two instances of StarCraft
  • on both instances: select Multiplayer and choose the Expansion
  • on both instances: select Local PC on Select Connection, hit ok
  • on both instances: Create or select a player name/id
  • on the hosting instance: click on Create Game and browse to the earlier pasted map
  • on the hosting instance: select "Use Map Settings" as game type and move on with Ok
  • on the client instance: wait inside the lobby until the just hosted match pops up
  • on the client instance: double click in order to join the match
  • on the hosting instance: Start the match by clicking on Ok as soon as the client connected

If everything worked as supposed, both marine armies should fight each other.

##6. Automating the setup using bwapi.ini

Navigating through all the menus, especially on multiple instances, can be quiet tedious. Using this bwapi.ini will automate the whole matter for matches being played over and over again:

bwapi.ini

Note that this line requires the player name, who is going to host the match;

; game = name of the game to join
;	i.e., game = BWAPI
;	will join the game called "BWAPI"
;	If the game does not exist and the "map" entry is not blank, then the game will be created instead
;	If this entry is blank, then it will follow the rules of the "map" entry
game = Marco

##7. Compiling my AiClient

I make my builds using Visual Studio 2015 and target the x86 architecture as platform. It's just pretty much about opening the StarcraftNeuralNetAi.sln and build the TrainingModule project.

Clone this wiki locally