BWAPI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
BWAPI::AIModule Class Reference

#include <AIModule.h>

Inheritance diagram for BWAPI::AIModule:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 AIModule ()
virtual ~AIModule ()
virtual void onStart ()
virtual void onEnd (bool isWinner)
virtual void onFrame ()
virtual void onSendText (std::string text)
virtual void onReceiveText (Player *player, std::string text)
virtual void onPlayerLeft (Player *player)
virtual void onNukeDetect (Position target)
virtual void onUnitDiscover (Unit *unit)
virtual void onUnitEvade (Unit *unit)
virtual void onUnitShow (Unit *unit)
virtual void onUnitHide (Unit *unit)
virtual void onUnitCreate (Unit *unit)
virtual void onUnitDestroy (Unit *unit)
virtual void onUnitMorph (Unit *unit)
virtual void onUnitRenegade (Unit *unit)
virtual void onSaveGame (std::string gameName)
virtual void onUnitComplete (Unit *unit)
virtual void onPlayerDropped (Player *player)

Detailed Description

AIModule is a virtual class that is intended to be implemented or inherited by a custom AI class.

Note:
Using BWAPI in a different thread than the default one will produce unexpected results and possibly crash the program. Multi-threaded AIs are possible so long as all BWAPI interaction is limited to the default thread (during one of the call-backs).

Constructor & Destructor Documentation


Member Function Documentation

void BWAPI::AIModule::onEnd ( bool  isWinner) [virtual]

BWAPI calls this at the end of the match. isWinner will be true if the AIModule won the game. If the game is a replay, isWinner will always be false.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, and TestMap1.

Here is the caller graph for this function:

void BWAPI::AIModule::onFrame ( ) [virtual]

BWAPI calls this on every logical frame in the game.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, TestModule, DefaultTestModule, ExistenceTest, InterceptorTest, TestMap1, and MicroTest.

Here is the caller graph for this function:

void BWAPI::AIModule::onNukeDetect ( Position  target) [virtual]

BWAPI calls this when a nuclear launch has been detected. If the target position is visible, or if Complete Map Information is enabled, the target position will also be provided. If Complete Map Information is disabled and the target position is not visible, target will be set to Positions::Unknown.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, and TestMap1.

Here is the caller graph for this function:

void BWAPI::AIModule::onPlayerDropped ( Player player) [virtual]

Reimplemented in ExampleTournamentAI.

Here is the caller graph for this function:

void BWAPI::AIModule::onPlayerLeft ( Player player) [virtual]

BWAPI calls this when a player leaves the game.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, and TestMap1.

Here is the caller graph for this function:

void BWAPI::AIModule::onReceiveText ( Player player,
std::string  text 
) [virtual]

BWAPI calls this when another player sends a message.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, and EventTest.

Here is the caller graph for this function:

void BWAPI::AIModule::onSaveGame ( std::string  gameName) [virtual]

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, and TestMap1.

Here is the caller graph for this function:

void BWAPI::AIModule::onSendText ( std::string  text) [virtual]

If Flag::UserInput is enabled, BWAPI will call this each time a user enters a message into the chat.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, and TestMap1.

Here is the caller graph for this function:

void BWAPI::AIModule::onStart ( ) [virtual]

BWAPI calls this at the start of a match. Typically an AI will execute set up code in this method (initialize data structures, load build orders, etc).

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, DefaultTestModule, ExistenceTest, InterceptorTest, MapTest, ProtossTest, TerranTest, ZergTest, MicroTest, and TestMap1.

Here is the caller graph for this function:

void BWAPI::AIModule::onUnitComplete ( BWAPI::Unit unit) [virtual]

Reimplemented in ExampleTournamentAI, and ExampleAIModule.

Here is the caller graph for this function:

void BWAPI::AIModule::onUnitCreate ( BWAPI::Unit unit) [virtual]

BWAPI calls this when a unit is created. Note that this is NOT called when a unit changes type (such as larva into egg or egg into drone). Building a refinery/assimilator/extractor will not produce an onUnitCreate call since the vespene geyser changes to the unit type of the refinery/assimilator/extractor. If Complete Map Information is enabled, this will also be called for new units that are hidden by the fog of war. If the unit is visible upon creation, onUnitShow will be called shortly after onUnitCreate is called.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, TestMap1, TestModule, and ExistenceTest.

Here is the caller graph for this function:

void BWAPI::AIModule::onUnitDestroy ( BWAPI::Unit unit) [virtual]

BWAPI calls this when a unit dies or otherwise removed from the game (i.e. a mined out mineral patch). When a zerg drone becomes an extractor, the Vespene geyser changes to the Zerg Extractor type and the drone is removed. If Complete Map Information is enabled, this will also be called for units that are hidden by the fog of war. If a unit that was visible gets destroyed, onUnitHide will be called right before onUnitDestroy is called.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, TestMap1, TestModule, and ExistenceTest.

Here is the caller graph for this function:

void BWAPI::AIModule::onUnitDiscover ( BWAPI::Unit unit) [virtual]

BWAPI calls this when a unit becomes accessible.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, and EventTest.

Here is the caller graph for this function:

void BWAPI::AIModule::onUnitEvade ( BWAPI::Unit unit) [virtual]

BWAPI calls this when a unit becomes inaccessible.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, and EventTest.

Here is the caller graph for this function:

void BWAPI::AIModule::onUnitHide ( BWAPI::Unit unit) [virtual]

BWAPI calls this right before a unit becomes invisible, so if you want your non-cheating AI to remember where it last saw a unit, this callback would be a good place to implement it. The complete map information flag has no effect on this callback.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, and TestMap1.

Here is the caller graph for this function:

void BWAPI::AIModule::onUnitMorph ( BWAPI::Unit unit) [virtual]

BWAPI calls this when a unit changes type, such as from a Zerg Drone to a Zerg Hatchery, or from a Terran Siege Tank Tank Mode to Terran Siege Tank Siege Mode. This is not called when the type changes to or from UnitTypes::Unknown (which happens when a unit becomes visible or invisible).

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, and TestMap1.

Here is the caller graph for this function:

void BWAPI::AIModule::onUnitRenegade ( BWAPI::Unit unit) [virtual]

BWAPI calls this when an accessible unit changes ownership.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, and TestMap1.

Here is the caller graph for this function:

void BWAPI::AIModule::onUnitShow ( BWAPI::Unit unit) [virtual]

BWAPI calls this the instant a previously invisible unit becomes visible. The complete map information flag has no effect on this callback.

Reimplemented in BWScriptEmulator, DevAIModule, ExampleTournamentAI, ExampleAIModule, EventTest, and TestMap1.

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines