Skip to content

Add a new Algorithm

GuilhermeOliveira edited this page Apr 13, 2018 · 1 revision

Algorithm = AIModule

For MetaBot, an algorithm is an AIModule that executes all game actions. So, to implement a new algorithm or behavior, you need to implement an (independent) AIModule and integrate it into MegaBot. This page explains how to do it

Creating a new AIModule

Currently, MetaBot is implemented in BWAPI 3.7.4 (version 3.7.5 is compatible). So, to create a new AIModule, you can start with the ExampleAIModule bundled with BWAPI 3.7.5 and add your code there.

Integrating the new AIModule

Preparing the project

  • Open MetaBot.sln in Visual Studio
  • Right click in Solution 'MetaBot' -> Add -> Existing Project
  • Locate the AIModule .vcproj or .vcxproj file (if an upgrade is asked, accept)
  • Check include directories to grab BWAPI headers from default location
  • Configure the toolset to v90
  • Configure the output to "Library" (.lib)

Incorporating into MetaBot

Add a reference to the project

  • Right click in MetaBot's project -> Properties
  • Go to Common properties -> References
  • Click Add New Reference and check the box of the project to be included

Instantiate the new behavior

In file Strategy/MetaStrategy.h:

  • Give an #include on the new AIModule's header file
  • Add a static const string to the new behavior

In file Strategy/MetaStrategy.cpp:

  • Initialize the new behavior's const string
  • Add a new line with portfolio.insert(make_pair(...)); for the new AIModule

Done! MetaBot will be able to use the new AIModule now.

Clone this wiki locally