The Client class manages the connection between a BWAPI client program and the BWAPI server running in BWAPI.dll. For examples of how to use this class please see the Example AI Client and the AI Module Loader that are included in the latest release of BWAPI.
The BWAPIClient.lib library contains the implementation of the Client class along with classes which implement the Game, Force, Player, Unit, and Bullet interfaces.
Stand-alone programs made with BWAPIClient should keep all interaction with dynamic BWAPI classes (Game, Force, Player, Unit, Bullet) in a single thread that runs synchronously with Starcraft: Broodwar via calls to update().
Returns true if the client is currently connected to the server.
public boolean connect()
Attempts to connect the client to the server. If it succeeds, it returns true. If Starcraft/BWAPI is not yet running, this will fail and return false.
public void disconnect()
Disconnects the client from the server.
public void update()
This is a blocking command that tells the server to process commands sent from the client and proceed to the next frame in the game. Thus update() will only return once the next game frame (or if in menus, next menu frame) has been received. Once the server proceeds to the next frame, the client will update some local information and then return so the AI can execute its code for the current frame. Rather than sending callbacks to the client for things like AIModule::onUnitCreate, BWAPI generates a list of event objects, which can be accessed via Game::getEvents. These events correspond to AIModule callbacks.