TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
Game state. More...
#include <state.h>
Public Member Functions | |
State (std::shared_ptr< tc::Client > client) | |
State (State const &)=delete | |
virtual | ~State () |
std::unordered_map< int32_t, tc::Unit * > const & | units () const |
tc::Unit * | unit (int32_t id) const |
FrameNum | currentFrame () const |
float | currentGameTime () const |
Current game time in seconds, assuming "fastest" speed. More... | |
FrameNum | latencyFrames () const |
PlayerId | playerId () const |
PlayerId | neutralId () const |
void | setPerspective (PlayerId id) |
For replays, treat units from this player as allied units. More... | |
int | mapWidth () const |
int | mapHeight () const |
const std::string | mapName () const |
const std::string | mapTitle () const |
Rect | mapRect () const |
tc::Resources | resources () const |
Blackboard * | board () const |
BWEM::Map * | map () const |
template<typename T , typename... Args> | |
std::shared_ptr< T > | addTracker (Args &&...args) |
std::list< std::shared_ptr< Tracker > > const & | trackers () const |
UnitsInfo & | unitsInfo () |
TilesInfo & | tilesInfo () |
AreaInfo & | areaInfo () |
std::vector< std::pair< std::string, std::chrono::milliseconds > > | getStateUpdateTimes () const |
UpgradeLevel | getUpgradeLevel (const BuildType *upgrade) const |
Get the current level of a given upgrade. More... | |
bool | hasResearched (const BuildType *tech) const |
Check whether a given technology has been researched. More... | |
void | update () |
Updates internal mappings after the torchcraft state has been updated. More... | |
tc::BW::Race | myRace () const |
Get my race as reported by the game. More... | |
PlayerId | firstOpponent () const |
Get the player id of the first opponent. More... | |
tc::BW::Race | raceFromClient (PlayerId playerId) const |
Get the race that the game returns, for a given player. More... | |
bool | gameEnded () const |
Returns true if the game has ended. More... | |
bool | won () const |
bool | lost () const |
tc::State * | tcstate () |
The underlying TorchCraft state. More... | |
void | setCollectTimers (bool collect) |
UnitsInfo * | unitsInfoPtr () |
TilesInfo * | tilesInfoPtr () |
AreaInfo * | areaInfoPtr () |
void | setMapHack (bool h) |
bool | mapHack () |
Game state.
The game state serves as the main input and output for bot modules. It provides a global (player-wide) blackboard and access to the TorchCraft::State object in the form of wrapper functions and data structures.
|
explicit |
|
delete |
|
virtual |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Current game time in seconds, assuming "fastest" speed.
PlayerId cherrypi::State::firstOpponent | ( | ) | const |
Get the player id of the first opponent.
bool cherrypi::State::gameEnded | ( | ) | const |
Returns true if the game has ended.
This will be the case if either player doesn't control any units for a some frames or if TorchCraft signals that the game has ended.
|
inline |
UpgradeLevel cherrypi::State::getUpgradeLevel | ( | const BuildType * | upgrade | ) | const |
Get the current level of a given upgrade.
upgrade | Upgrade for which to check the level |
bool cherrypi::State::hasResearched | ( | const BuildType * | tech | ) | const |
Check whether a given technology has been researched.
tech | Technology to check for |
|
inline |
bool cherrypi::State::lost | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
tc::BW::Race cherrypi::State::myRace | ( | ) | const |
Get my race as reported by the game.
|
inline |
|
inline |
tc::BW::Race cherrypi::State::raceFromClient | ( | PlayerId | playerId | ) | const |
Get the race that the game returns, for a given player.
tc::Resources cherrypi::State::resources | ( | ) | const |
void cherrypi::State::setCollectTimers | ( | bool | collect | ) |
|
inline |
void cherrypi::State::setPerspective | ( | PlayerId | id | ) |
For replays, treat units from this player as allied units.
|
inline |
The underlying TorchCraft state.
It's recommended to access the game state via the other functions of this class instead.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void cherrypi::State::update | ( | ) |
Updates internal mappings after the torchcraft state has been updated.
bool cherrypi::State::won | ( | ) | const |