Skip to content

Build instructions

Anderson edited this page Oct 4, 2018 · 15 revisions

Requirements

Pre-requisites:

  • Windows 7 (these instructions were tested on Windows 7 64 bits, but might work on posterior versions. Won't work on Windows XP because Visual Studio 2017 cannot be installed there)
  • StarCraft patched to 1.16.1

For the items below, install and configuration instructions are given on this page:

  • BWAPI 3.7.4
  • Visual Studio 2017
  • Microsoft Visual C++ 2008 with SP1
  • Microsoft Visual C++ 2010
  • Boost 1.60.0

Instructions

BWAPI

  • Get BWAPI.3.7.4.7z file here
  • (If you don't have 7zip to unpack .7z files, grab it here)
  • Extract the contents of BWAPI.3.7.4.7z to c:\software and rename the folder to BWAPI3.7.4(without space)
  • Copy the contents of c :\software\BWAPI3.7.4\starcraft to your Starcraft folder.
  • Copy the contents of c:\software\BWAPI3.7.4\WINDOWS to c:\Windows

Visual Studios

  • Download and install Visual C++ 2008 with Service Pack 1 - link here

  • Download and install Visual C++ 2010 - link here

  • Download and install Visual Studio 2017 - link here (Select only Desktop development with C++ as a workload and hit Install)

All three versions are required for building it because the code can only be compiled through VC++ 2008's toolset due to portability issues and VC++2010 is what allow us to use this toolset on Visual Studio 2017.

Boost

  • Download boost_1_60_0-msvc-9.0-32.exe from here (This link goes directly to the 32 bit version compatible with VC++2008 and should work. If, for some reason, you need another version, look here)
  • Install Boost 1.60.0 to c:\software\boost
  • Rename directory c:\software\boost\lib32-msvc-9.0 to C:\software\boost\lib

Environment Variables

You must configure 2 environment variables:

  • BWAPI_DIR pointing to where you unpacked BWAPI (if you followed these instructions it will be: c:\software\BWAPI3.7.4
  • BOOST_DIR pointing to where you installed Boost (if you followed these instructions it will be: c:\software\boost

On Windows 7, the procedure is as follows:

  • Open Start menu, right click "Computer" then "Properties"
  • Click "Advanced system settings"
  • In "Advanced" tab, click "Environment variables"
  • In "System variables" click "New"
  • Set the name and value as indicated (e.g.: name: BWAPI_DIR / value: c:\software\BWAPI3.7.4)

Compiling sub-bots

Skynet

  • Get Skynet from here and extract it. We'll name the destination directory SKYNET_DIR.
  • Go to SKYNET_DIR/src. Extract the contents of Skynet_src.zip to SKYNET_DIR/src. A new directory named Skynet should appear. Enter it.
  • Open Skynet.sln in Visual C++ 2008 with SP1. If you use a newer version of Visual Studio, make sure to use the v90 Platform toolset (right click the project -> Properties. Under 'Configuration', select All Configurations. Under General set the Platform Toolset to Visual Studio 2008 (v90)).
  • Build the solution using Competition configuration.
  • The resulting binary will be located in SKYNET_DIR/src/Competition/Skynet.dll.

Xelnaga

  • Download Xelnaga's code from here
  • Extract the file anywhere.
  • Open the src folder and open Xelnaga.sln in Visual C++ 2008 with SP1. If you use a newer version of Visual Studio, make sure to use the v90 Platform toolset (Accept the 'One-way Upgrade'. Then right click the project -> Properties. Under 'Configuration', select All Configurations. Under General set the Platform Toolset to Visual Studio 2008 (v90)).
  • Build the solution using Release configuration.
  • At the end, Xelnaga.dll will be available on Xelnaga/src/Release

AIUR

  • Download AIUR's code from here
  • Extract the file anywhere.
  • Extract the contents of Aiur/AIUR-2.2.zip
  • Enter AIUR-2.2/ and open AiurProject.sln in Visual C++ 2008 with SP1. If you use a newer version of Visual Studio, make sure to use the v90 Platform toolset (Accept the 'One-way Upgrade'. Then right click the project -> Properties. Under 'Configuration', select All Configurations. Under General set the Platform Toolset to Visual Studio 2008 (v90)).
  • Build the solution using Release configuration.
  • At the end, Aiur.dll will be available on AIUR-2.2/Release

Ximp

  • Download Ximp's code from here
  • Extract the file anywhere.
  • Copy the folder source/ximp/Ximp to your BWAPI_DIR folder (where you extracted the BWAPI3.7.4.zip file).
  • Open Ximp.slninside the folder with Visual C++ 2008 with SP1. If you open with Visual Studio 2017, on the pop-up message that will appear, change the Platform toolset option to No upgrade and hit OK.
  • Make sure the project will be built with VC++2008 (v90) toolset
  • Build the solution using Release configuration.
  • In the end, Ximp.dll will be available on the Release folder.

Compiling MetaBot

  • Get MetaBot's code through the command "git clone https://github.com/andertavares/MetaBot/" on Git
  • Initialize the submodule through the command "git submodule init" and update it with "git submodule update"
  • Go to METABOT_DIR/MetaBot/ and open MetaBot.sln in Visual Studio 2017. METABOT_DIR is where you cloned or unpacked MetaBot's sources.
  • On the pop-up message that will appear, change the Platform toolset option to No upgrade and hit OK
  • Make sure the project will be built with VC++2008 (v90) toolset
  • Build the solution using Release configuration.
  • At the end, MetaBot.dll is available at METABOT_DIR/MetaBot/Release.

Common Problems

"LNK2001: unresolved external symbol[...]"

The project is probably not being built as a Release with Visual Studio 2008(v90). Go on Project->Properties and change Configuration to Release and Plataform Toolset on the General tab to Visual Studio 2008(v90).

"Visual Studio can't find the library BWAPI.h [...]"

Check the BWAPI_DIR variable, one common mistake is mispell the folder's name as "BWAPI 3.7.4" (with space)

"Project file contains ToolsVersion="15.0" [...]"

The project file has been updated to the latest version of Visual Studio (2017). One easy way to solve it is by downloading the project files again at releases.

Game crashing on match start?

Remember to copy the contents of METABOT_DIR/config to STARCRAFT_DIR/bwapi-data/AI so the compiled file can access those informations.

Visual Studio 2017 cannot find standard headers

Try these two choices (#2 seems to be the one that actually worked):

  1. You must install Windows Universal CRT SDK (from https://stackoverflow.com/a/42778079). Follow the steps:
  • On the menu, select: Tools -> Get tools and features
  • Choose the "Individual components" tab
  • Install Windows Universal CRT SDK (in portuguese it is SDK do CRT Universal do Windows)
  1. Reopen the project and select a proper Windows SDK (under Visual Studio 2017)
  • Delete the hidden .vs dir inside METABOT_DIR
  • Reopen the solution
  • When the "Review solution actions" window appear, select the Windows SDK version as 10.0.[lots-of-numbers] and the Platform toolset as No Upgrade