TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
#include <base.h>
Inherits cherrypi::AutoBuildTask.
Inherited by cherrypi::ABBO10HatchLing, cherrypi::ABBO12HatchHydras, cherrypi::ABBO12PoolMuta, cherrypi::ABBO2BaseMutas, cherrypi::ABBO2HatchMuta, cherrypi::ABBO3BasePoolLings, cherrypi::ABBO5Pool, cherrypi::ABBO9PoolSpeedLingMuta, cherrypi::ABBOdelayed4Pool, cherrypi::ABBOhydracheese, cherrypi::ABBOhydras, cherrypi::ABBOmidmassling, cherrypi::ABBOpve2gate1012, cherrypi::ABBOpve4gate, cherrypi::ABBOpvp2gatedt, cherrypi::ABBOpvpgategateobs, cherrypi::ABBOpvzffe5gategoon, cherrypi::ABBOt5rax, cherrypi::ABBOtvpjoyorush, cherrypi::ABBOtvtz2portwraith, cherrypi::ABBOultras, cherrypi::ABBOzve9poolspeed, cherrypi::ABBOzvp10hatch, cherrypi::ABBOzvp3hatchhydra, cherrypi::ABBOzvp6hatchhydra, cherrypi::ABBOzvpmutas, cherrypi::ABBOzvpoverpoolbase, cherrypi::ABBOzvt2basehivebase, cherrypi::ABBOzvt3hatchlurker, cherrypi::ABBOzvtantimech, cherrypi::ABBOzvtMacro, cherrypi::ABBOzvtp1hatchlurker, cherrypi::ABBOzvz12poolhydras, cherrypi::ABBOzvz9gas10pool, cherrypi::ABBOzvz9poolspeed, cherrypi::ABBOzvzoverpool, and cherrypi::ABBOzvzoverpoolplus1.
Public Member Functions | |
ABBOBase (UpcId upcId, State *state, Module *module) | |
void | findNaturalDefencePos (State *) |
Position | getStaticDefencePos (State *, const BuildType *type) |
void | buildSunkens (autobuild::BuildState &st, int n, Position={}, bool morphFirst=false) |
void | buildSpores (autobuild::BuildState &st, int n, Position={}, bool morphFirst=false) |
void | morphSunkens (autobuild::BuildState &, int n=1000) |
void | morphSpores (autobuild::BuildState &, int n=1000) |
void | takeNBases (autobuild::BuildState &, int n) |
void | expand (autobuild::BuildState &st) |
void | calculateArmySupply (const autobuild::BuildState &st) |
Position | findHatcheryPosNear (Position seedPos) |
Position | findSunkenPosNear (const BuildType *type, Position seedPos, bool coverMineralsOnly=false) |
Position | findSunkenPos (const BuildType *type, bool mainBaseOnly=false, bool coverMineralsOnly=false) |
virtual void | preBuild2 (autobuild::BuildState &st) |
virtual void | preBuild (autobuild::BuildState &st) overridefinal |
One of the three steps of processing a build order. More... | |
virtual void | postBuild2 (autobuild::BuildState &st) |
virtual void | postBuild (autobuild::BuildState &st) overridefinal |
The final step of processing a build order. More... | |
virtual void | buildStep2 (autobuild::BuildState &) |
virtual void | buildStep (autobuild::BuildState &) overridefinal |
The meat of a build order lives in buildStep(). More... | |
Public Member Functions inherited from cherrypi::AutoBuildTask | |
void | postBlackboardKey (std::string const &key, Blackboard::Data const &data) |
bool | cancelGas () |
AutoBuildTask (int upcId, State *state, Module *module) | |
virtual | ~AutoBuildTask () override |
virtual void | update (State *state) override |
void | evaluate (State *state, Module *module) |
void | simEvaluateFor (autobuild::BuildState &st, FrameNum frames) |
void | build (const BuildType *type, Position pos, std::function< void()> builtCallback) |
Builds a building at a specific position. More... | |
void | build (const BuildType *type, std::function< void()> builtCallback) |
Builds a unit/building, upgrade, or technology. More... | |
void | build (const BuildType *type, Position pos) |
Builds a building at a specific position. More... | |
void | build (const BuildType *type) |
Builds a unit/building, upgrade, or technology. More... | |
bool | buildN (const BuildType *type, int n) |
Builds up to N of a unit/building. More... | |
bool | buildN (const BuildType *type, int n, int simultaneous) |
Builds up to N of a unit/building, with an optional limit on how many to build consecutively. More... | |
bool | buildN (const BuildType *type, int n, Position positionIfWeBuildMore) |
Builds up to N of a building, specifying a position for the next new building. More... | |
bool | upgrade (const BuildType *type) |
Researches an Upgrade or Tech Enqueues any required but missing prerequisites (like adding a Lair if you request Lurker Aspect). More... | |
autobuild::BuildState & | lastEvaluateCurrentState () |
autobuild::BuildState & | lastEvaluateTargetState () |
Public Member Functions inherited from cherrypi::MultiProxyTask | |
MultiProxyTask (std::vector< UpcId > targetUpcIds, UpcId upcId) | |
virtual | ~MultiProxyTask ()=default |
void | setPolicyForStatus (TaskStatus status, ProxyPolicy policy) |
virtual void | cancel (State *state) override |
virtual std::unordered_set< Unit * > const & | proxiedUnits () const override |
A set of units occupied performing this task. More... | |
std::vector< std::shared_ptr< Task > > | targets () const |
Public Member Functions inherited from cherrypi::Task | |
Task (UpcId upcId, std::unordered_set< Unit * > units={}) | |
virtual | ~Task () |
TaskStatus | status () const |
void | setStatus (TaskStatus status) |
bool | finished () const |
UpcId | upcId () const |
UPC id in Blackboard that caused this Task to be spawned. More... | |
std::unordered_set< Unit * > const & | units () const |
A set of units occupied performing this task. More... | |
void | removeUnit (Unit *unit) |
virtual const char * | getName () const |
A name for this task, for debugging purposes. More... | |
Protected Member Functions | |
virtual void | draw (State *state) override |
Draws any debugging information to the screen. More... | |
Protected Member Functions inherited from cherrypi::MultiProxyTask | |
bool | matchStatus (TaskStatus status) |
Protected Member Functions inherited from cherrypi::Task | |
std::unordered_set< Unit * > & | units () |
virtual void | removeDeadOrReassignedUnits (State *state) |
Remove units that have been assigned to another task and units that have died. More... | |
Additional Inherited Members | |
Protected Attributes inherited from cherrypi::MultiProxyTask | |
std::vector< UpcId > | targetUpcIds_ |
std::vector< std::shared_ptr< Task > > | targets_ |
std::unordered_set< Unit * > | proxiedUnits_ |
std::map< TaskStatus, ProxyPolicy > | policy_ |
TaskStatus | defaultTargetStatus_ = TaskStatus::Unknown |
void cherrypi::ABBOBase::buildSpores | ( | autobuild::BuildState & | st, |
int | n, | ||
Position | position = {} , |
||
bool | morphFirst = false |
||
) |
|
finaloverridevirtual |
The meat of a build order lives in buildStep().
This is where you decide what to build, and in what order.
Here's how buildStep() works:
After preBuild(), AutoBuildTask invokes buildStep() with a BuildState reflecting the current state of the game. That includes the amount of minerals, gas, and supply you have. It also has an empty queue of things to build.
In your implementation of buildStep(), you can specify everything you want to build, via methods like build() and upgrade(). These methods add your requested items to the queue in BuildState.
However, only the last request which would modify the queue actually modifies the BuildState. This request goes to the end of the build queue. The BuildState updates to reflect the request: minerals/gas is spent, supply is updated, etc.
Then, if anything was changed, buildStep() is invoked again with the new BuildState. The last request from the previous build is now reflected in the new BuildState. For example, if you have no Spawning Pool, and the last request was buildN(Spawning_Pool, 1), the BuildState will now contain the Spawning Pool you requested.
This continues until either the queue has reached a certain length (several minutes into the future) or all requests are enqueued.
Reimplemented from cherrypi::AutoBuildTask.
|
inlinevirtual |
Reimplemented in cherrypi::ABBOzvpoverpoolbase, cherrypi::ABBOzvt2basehivebase, cherrypi::ABBOmidmassling, cherrypi::ABBOzvzoverpool, cherrypi::ABBOzvt3hatchlurker, cherrypi::ABBOzvp3hatchhydra, cherrypi::ABBOzvp6hatchhydra, cherrypi::ABBOzvz9poolspeed, cherrypi::ABBOzvz9gas10pool, cherrypi::ABBOzvp10hatch, cherrypi::ABBO12PoolMuta, cherrypi::ABBO3BasePoolLings, cherrypi::ABBO10HatchLing, cherrypi::ABBOzvtMacro, cherrypi::ABBO2HatchMuta, cherrypi::ABBOzvtantimech, cherrypi::ABBO9PoolSpeedLingMuta, cherrypi::ABBOzvpmutas, cherrypi::ABBOzvzoverpoolplus1, cherrypi::ABBOzve9poolspeed, cherrypi::ABBOzvz12poolhydras, cherrypi::ABBOzvtp1hatchlurker, cherrypi::ABBOdelayed4Pool, cherrypi::ABBOpvp2gatedt, cherrypi::ABBOpvpgategateobs, cherrypi::ABBOtvpjoyorush, cherrypi::ABBOpve2gate1012, cherrypi::ABBOpvzffe5gategoon, cherrypi::ABBOhydracheese, cherrypi::ABBOpve4gate, cherrypi::ABBOt5rax, cherrypi::ABBO5Pool, cherrypi::ABBO12HatchHydras, cherrypi::ABBOhydras, cherrypi::ABBOtvtz2portwraith, cherrypi::ABBOultras, and cherrypi::ABBO2BaseMutas.
void cherrypi::ABBOBase::buildSunkens | ( | autobuild::BuildState & | st, |
int | n, | ||
Position | position = {} , |
||
bool | morphFirst = false |
||
) |
void cherrypi::ABBOBase::calculateArmySupply | ( | const autobuild::BuildState & | st | ) |
|
overrideprotectedvirtual |
Draws any debugging information to the screen.
Reimplemented from cherrypi::AutoBuildTask.
void cherrypi::ABBOBase::expand | ( | autobuild::BuildState & | st | ) |
void cherrypi::ABBOBase::findNaturalDefencePos | ( | State * | state | ) |
Position cherrypi::ABBOBase::findSunkenPos | ( | const BuildType * | type, |
bool | mainBaseOnly = false , |
||
bool | coverMineralsOnly = false |
||
) |
Position cherrypi::ABBOBase::findSunkenPosNear | ( | const BuildType * | type, |
Position | seedPos, | ||
bool | coverMineralsOnly = false |
||
) |
void cherrypi::ABBOBase::morphSpores | ( | autobuild::BuildState & | st, |
int | n = 1000 |
||
) |
void cherrypi::ABBOBase::morphSunkens | ( | autobuild::BuildState & | st, |
int | n = 1000 |
||
) |
|
finaloverridevirtual |
The final step of processing a build order.
postBuild() is invoked after the last invocation of buildStep().
Reimplemented from cherrypi::AutoBuildTask.
|
inlinevirtual |
|
finaloverridevirtual |
One of the three steps of processing a build order.
preBuild() is invoked once before stepping through the build order.
Because it's invoked exactly once (unlike buildStep() which is invoked repeatedly) preBuild is a good place for making decisions that don't directly involve the build queue, like deciding whether to attack or deciding whether to mine gas.
Reimplemented from cherrypi::AutoBuildTask.
|
inlinevirtual |
Reimplemented in cherrypi::ABBOzvpoverpoolbase, cherrypi::ABBOmidmassling, cherrypi::ABBOzvt3hatchlurker, cherrypi::ABBOzvzoverpool, cherrypi::ABBOzvt2basehivebase, cherrypi::ABBOzvp3hatchhydra, cherrypi::ABBOzvz9gas10pool, cherrypi::ABBOzvz9poolspeed, cherrypi::ABBOzve9poolspeed, cherrypi::ABBOzvtp1hatchlurker, cherrypi::ABBOzvz12poolhydras, cherrypi::ABBOzvzoverpoolplus1, cherrypi::ABBOzvp6hatchhydra, cherrypi::ABBOzvtMacro, cherrypi::ABBO10HatchLing, cherrypi::ABBOdelayed4Pool, cherrypi::ABBOpvpgategateobs, cherrypi::ABBO12PoolMuta, cherrypi::ABBOzvp10hatch, cherrypi::ABBOpvp2gatedt, cherrypi::ABBOzvpmutas, cherrypi::ABBO9PoolSpeedLingMuta, cherrypi::ABBOtvpjoyorush, cherrypi::ABBO2HatchMuta, cherrypi::ABBO3BasePoolLings, cherrypi::ABBOhydracheese, cherrypi::ABBOpve2gate1012, cherrypi::ABBOpve4gate, cherrypi::ABBOpvzffe5gategoon, cherrypi::ABBOt5rax, cherrypi::ABBOtvtz2portwraith, cherrypi::ABBOzvtantimech, cherrypi::ABBO12HatchHydras, cherrypi::ABBO5Pool, cherrypi::ABBOhydras, and cherrypi::ABBOultras.
void cherrypi::ABBOBase::takeNBases | ( | autobuild::BuildState & | st, |
int | n | ||
) |
double cherrypi::ABBOBase::airArmySupply = 0.0 |
double cherrypi::ABBOBase::armySupply = 0.0 |
bool cherrypi::ABBOBase::autoExpand = true |
bool cherrypi::ABBOBase::autoUpgrade = true |
int cherrypi::ABBOBase::bases = 0 |
bool cherrypi::ABBOBase::buildExtraOverlordsIfLosingThem = true |
bool cherrypi::ABBOBase::canExpand = false |
int cherrypi::ABBOBase::currentFrame = 0 |
int cherrypi::ABBOBase::enemyAcademyCount = 0 |
double cherrypi::ABBOBase::enemyAirArmySupply = 0.0 |
double cherrypi::ABBOBase::enemyAntiAirArmySupply = 0.0 |
int cherrypi::ABBOBase::enemyArbiterCount = 0 |
int cherrypi::ABBOBase::enemyArchonCount = 0 |
double cherrypi::ABBOBase::enemyArmySupply = 0.0 |
double cherrypi::ABBOBase::enemyArmySupplyInOurBase = 0.0 |
double cherrypi::ABBOBase::enemyAttackingAirArmySupply = 0.0 |
double cherrypi::ABBOBase::enemyAttackingArmySupply = 0.0 |
double cherrypi::ABBOBase::enemyAttackingGroundArmySupply = 0.0 |
int cherrypi::ABBOBase::enemyAttackingWorkerCount = 0 |
int cherrypi::ABBOBase::enemyBarracksCount = 0 |
Position cherrypi::ABBOBase::enemyBasePos |
int cherrypi::ABBOBase::enemyBattlecruiserCount = 0 |
double cherrypi::ABBOBase::enemyBiologicalArmySupply = 0.0 |
int cherrypi::ABBOBase::enemyBuildingCount = 0 |
int cherrypi::ABBOBase::enemyCloakedUnitCount = 0 |
int cherrypi::ABBOBase::enemyCorsairCount = 0 |
int cherrypi::ABBOBase::enemyCyberneticsCoreCount = 0 |
int cherrypi::ABBOBase::enemyDarkTemplarCount = 0 |
int cherrypi::ABBOBase::enemyDragoonCount = 0 |
int cherrypi::ABBOBase::enemyFactoryCount = 0 |
int cherrypi::ABBOBase::enemyFirebatCount = 0 |
int cherrypi::ABBOBase::enemyForgeCount = 0 |
bool cherrypi::ABBOBase::enemyForgeIsSpinning = false |
int cherrypi::ABBOBase::enemyGasCount = 0 |
int cherrypi::ABBOBase::enemyGasUnits = 0 |
int cherrypi::ABBOBase::enemyGatewayCount = 0 |
int cherrypi::ABBOBase::enemyGoliathCount = 0 |
double cherrypi::ABBOBase::enemyGroundArmySupply = 0.0 |
bool cherrypi::ABBOBase::enemyHasExpanded = false |
int cherrypi::ABBOBase::enemyHighTemplarCount = 0 |
int cherrypi::ABBOBase::enemyHydraliskCount = 0 |
bool cherrypi::ABBOBase::enemyIsRushing = false |
int cherrypi::ABBOBase::enemyLairCount = 0 |
double cherrypi::ABBOBase::enemyLargeArmySupply = 0.0 |
int cherrypi::ABBOBase::enemyMarineCount = 0 |
int cherrypi::ABBOBase::enemyMedicCount = 0 |
int cherrypi::ABBOBase::enemyMissileTurretCount = 0 |
int cherrypi::ABBOBase::enemyMutaliskCount = 0 |
int cherrypi::ABBOBase::enemyObserverCount = 0 |
double cherrypi::ABBOBase::enemyProximity = 0.0 |
int cherrypi::ABBOBase::enemyProxyBarracksCount = 0 |
int cherrypi::ABBOBase::enemyProxyBuildingCount = 0 |
int cherrypi::ABBOBase::enemyProxyCannonCount = 0 |
int cherrypi::ABBOBase::enemyProxyForgeCount = 0 |
int cherrypi::ABBOBase::enemyProxyGatewayCount = 0 |
tc::BW::Race cherrypi::ABBOBase::enemyRace = tc::BW::Race::Unknown |
int cherrypi::ABBOBase::enemyReaverCount = 0 |
int cherrypi::ABBOBase::enemyRefineryCount = 0 |
int cherrypi::ABBOBase::enemyResourceDepots = 0 |
int cherrypi::ABBOBase::enemyScienceVesselCount = 0 |
int cherrypi::ABBOBase::enemyScourgeCount = 0 |
int cherrypi::ABBOBase::enemyScoutCount = 0 |
int cherrypi::ABBOBase::enemyShuttleCount = 0 |
double cherrypi::ABBOBase::enemySmallArmySupply = 0.0 |
int cherrypi::ABBOBase::enemySpireCount = 0 |
int cherrypi::ABBOBase::enemySporeCount = 0 |
int cherrypi::ABBOBase::enemyStargateCount = 0 |
int cherrypi::ABBOBase::enemyStaticDefenceCount = 0 |
int cherrypi::ABBOBase::enemySunkenCount = 0 |
double cherrypi::ABBOBase::enemySupplyInOurBase = 0.0 |
int cherrypi::ABBOBase::enemyTankCount = 0 |
int cherrypi::ABBOBase::enemyTemplarArchivesCount = 0 |
int cherrypi::ABBOBase::enemyValkyrieCount = 0 |
int cherrypi::ABBOBase::enemyVultureCount = 0 |
int cherrypi::ABBOBase::enemyWorkerCount = 0 |
int cherrypi::ABBOBase::enemyWraithCount = 0 |
int cherrypi::ABBOBase::enemyZealotCount = 0 |
int cherrypi::ABBOBase::enemyZerglingCount = 0 |
bool cherrypi::ABBOBase::expandNearest = false |
bool cherrypi::ABBOBase::forceExpand = false |
int cherrypi::ABBOBase::geysers = 0 |
double cherrypi::ABBOBase::groundArmySupply = 0.0 |
bool cherrypi::ABBOBase::hasFoundEnemyBase = false |
Position cherrypi::ABBOBase::homePosition |
std::vector<uint8_t> cherrypi::ABBOBase::inBaseArea |
bool cherrypi::ABBOBase::isLosingAnOverlord = false |
Position cherrypi::ABBOBase::lastFindNaturalDefencePosEnemyPos {-1, -1} |
FrameNum cherrypi::ABBOBase::lastUpdateInBaseArea = 0 |
Position cherrypi::ABBOBase::mainNaturalChoke |
int cherrypi::ABBOBase::mineralFields = 0 |
int cherrypi::ABBOBase::myCompletedHatchCount = 0 |
int cherrypi::ABBOBase::myDefilerCount = 0 |
int cherrypi::ABBOBase::myDroneCount = 0 |
int cherrypi::ABBOBase::myGuardianCount = 0 |
int cherrypi::ABBOBase::myHydraliskCount = 0 |
int cherrypi::ABBOBase::myLarvaCount = 0 |
int cherrypi::ABBOBase::myLurkerCount = 0 |
int cherrypi::ABBOBase::myMutaliskCount = 0 |
int cherrypi::ABBOBase::myScourgeCount = 0 |
int cherrypi::ABBOBase::mySporeCount = 0 |
int cherrypi::ABBOBase::mySunkenCount = 0 |
int cherrypi::ABBOBase::myUltraliskCount = 0 |
int cherrypi::ABBOBase::myZerglingCount = 0 |
Position cherrypi::ABBOBase::naturalDefencePos |
Position cherrypi::ABBOBase::naturalPos |
Position cherrypi::ABBOBase::nextBase |
Position cherrypi::ABBOBase::nextStaticDefencePos |
bool cherrypi::ABBOBase::preferSafeExpansions = true |
bool cherrypi::ABBOBase::shouldExpand = false |
bool cherrypi::ABBOBase::weArePlanningExpansion = false |