|
TournamentModule
Tournament Module tutorial
IntroductionThe tournament module is a RELEASE-only module that is specifically designed to control and monitor the flow of a tournament game. BWAPI's Tournament mode is enabled when a tournament module has been specified in the configuration and loaded by BWAPI successfully. Features
ConfigurationSimply compile the tournament module as you would an AI module and in the configuration under [ai], add tournament= and have it specify the location of your tournament module. An example configuration is below.[ai] ai = bwapi-data\AI\Aiur.dll ai_dbg = bwapi-data\AI\DevAIModule.dll ; Used only for tournaments ; Tournaments can only be run in RELEASE mode tournament = bwapi-data\AI\MyTournamentModule.dll CallbacksIn addition to the normal AI callbacks, the tournament module has its own unique callbacks not available to an AI module.
Using an enumeration for actionType, and the parameter for that action (casted to a pointer for the appropriate parameter if a parameter exists, or ignored if none exist for that enum member), you can allow AI commands by returning true, or have BWAPI ignore them by returning false.
The enumeration in BWAPI::Tournament:: is as follows:
The ExampleTournamentModule has already layed out a switch statement with all of the enumerations, but this article will review a couple of them without the switch statement. The following prevents an AI module from using enableFlag to enable CompleteMapInformation.
Another example converts all printf statements to uppercase and remaps it to sendText to be broadcasted globally.
It is important to note that the tournament module does not restrict calls in itself. This includes calls in ALL the tournament module's callbacks.
When more than one BWAPI player is in a game, it will broadcast a tournament message with a delay based on the current player's ID. After this message has been broadcasted, the other players running BWAPI will not repeat it. The player that broadcasted the message first will call this function, and the other players will ignore it. Again, an example is provided, but here is another.
| |
► Sign in to add a comment