TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
SquadTask controls a "squad" of units (units which share the same Delete or Flee UPC) More...
#include <squadtask.h>
Inherits cherrypi::MultiProxyTask, and cherrypi::Task.
Public Member Functions | |
const std::unordered_set< Unit * > & | squadUnits () const |
const std::unordered_set< Unit * > & | relevantUnits () const |
SquadTask (int upcId, std::shared_ptr< UPCTuple > upc, std::unordered_set< Unit * > units, std::vector< Unit * > targets, std::unordered_map< Unit const *, EnemyState > *enemyStates, std::unordered_map< Unit const *, Agent > *agents, std::unordered_map< std::string, std::shared_ptr< MicroModel >> *models) | |
SquadTask (int upcId, std::shared_ptr< UPCTuple > upc, std::unordered_set< Unit * > units, int x, int y, std::unordered_map< Unit const *, EnemyState > *enemyStates, std::unordered_map< Unit const *, Agent > *agents, std::unordered_map< std::string, std::shared_ptr< MicroModel >> *models) | |
void | update (State *state) override |
std::vector< Unit * > | getGroupTargets (State *state) const |
std::vector< Unit * > | getGroupThreats (State *state) const |
void | pickTargets (State *state) |
Select which units are valid targets for this Squad. More... | |
void | formation (State *state) |
Calculate a combat formation position for all Agents. More... | |
std::vector< std::shared_ptr< UPCTuple > > | makeUPCs (State *state) |
Get micro decisions for all units. More... | |
bool | isIrrelevantTarget (Unit const *u) const |
Can we ignore this target? More... | |
bool | isImportantTarget (Unit const *u) const |
Should we prioritze this target? More... | |
bool | isRelevantDetector (Unit const *u) const |
Is this unit helping detect allied cloaked fighters? More... | |
bool | isThreat (Unit const *u) const |
Can this unit hurt us? More... | |
virtual const char * | getName () const override |
A name for this task, for debugging purposes. More... | |
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) |
Public Attributes | |
std::vector< Unit * > | targets |
Enemies this Squad should target. More... | |
int | targetX = -1 |
Location this Squad should defend or attack. More... | |
int | targetY = -1 |
bool | targetingLocation |
Whether to consider targets or targetX/targetY. More... | |
bool | hasAirUnits = false |
Does this Squad have any air units? More... | |
bool | hasGroundUnits = false |
Does this Squad have any ground units? More... | |
bool | hasCloakedFighters = false |
Does this Squad have any cloaked units that can kill things? More... | |
double | delProb |
What is the probability – presumably coming from combat simulation via Tactics – that we will win this fight? More... | |
double | fleeProb |
What is the probability that we should flee? More... | |
std::shared_ptr< UPCTuple > | sourceUpc |
What UPC – presumably from Tactics – is directing this squad? More... | |
Position | center_ |
Centroid of the Squad units. More... | |
std::vector< Position > | storms_ |
Known locations of Psionic Storms (so we can dodge them) More... | |
std::unordered_map< Unit const *, EnemyState > * | enemyStates_ |
Stateful information about enemy units. More... | |
std::unordered_map< Unit const *, Agent > * | agents_ |
Stateful information about our units. More... | |
std::unordered_map< std::string, std::shared_ptr< MicroModel > > * | models |
Models to solicit for UPCs. More... | |
std::vector< Unit * > | targets_ |
Enemies this Squad should target. More... | |
std::vector< Unit * > | threats_ |
Threatening enemies this Squad should be aware of. More... | |
std::unordered_set< Unit * > | relevantUnits_ |
All units relevant to this squad. More... | |
Additional Inherited Members | |
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... | |
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 |
SquadTask controls a "squad" of units (units which share the same Delete or Flee UPC)
After doing some group-level coordination, SquadTask delegates individual unit controllers ("Agents") to emit sharp UPCs for translation into game commands (presumably via the UpcToCommand module)
How UPCs are interpreted, loosely:
|
inline |
|
inline |
void cherrypi::SquadTask::formation | ( | State * | state | ) |
Calculate a combat formation position for all Agents.
|
inlineoverridevirtual |
A name for this task, for debugging purposes.
Reimplemented from cherrypi::Task.
bool cherrypi::SquadTask::isImportantTarget | ( | Unit const * | u | ) | const |
Should we prioritze this target?
bool cherrypi::SquadTask::isIrrelevantTarget | ( | Unit const * | u | ) | const |
Can we ignore this target?
bool cherrypi::SquadTask::isRelevantDetector | ( | Unit const * | u | ) | const |
Is this unit helping detect allied cloaked fighters?
bool cherrypi::SquadTask::isThreat | ( | Unit const * | u | ) | const |
Can this unit hurt us?
Get micro decisions for all units.
void cherrypi::SquadTask::pickTargets | ( | State * | state | ) |
Select which units are valid targets for this Squad.
|
inline |
|
inline |
|
overridevirtual |
Reimplemented from cherrypi::Task.
Stateful information about our units.
Position cherrypi::SquadTask::center_ |
Centroid of the Squad units.
double cherrypi::SquadTask::delProb |
What is the probability – presumably coming from combat simulation via Tactics – that we will win this fight?
std::unordered_map<Unit const*, EnemyState>* cherrypi::SquadTask::enemyStates_ |
Stateful information about enemy units.
double cherrypi::SquadTask::fleeProb |
What is the probability that we should flee?
bool cherrypi::SquadTask::hasAirUnits = false |
Does this Squad have any air units?
bool cherrypi::SquadTask::hasCloakedFighters = false |
Does this Squad have any cloaked units that can kill things?
bool cherrypi::SquadTask::hasGroundUnits = false |
Does this Squad have any ground units?
std::unordered_map<std::string, std::shared_ptr<MicroModel> >* cherrypi::SquadTask::models |
Models to solicit for UPCs.
std::unordered_set<Unit*> cherrypi::SquadTask::relevantUnits_ |
All units relevant to this squad.
std::shared_ptr<UPCTuple> cherrypi::SquadTask::sourceUpc |
What UPC – presumably from Tactics – is directing this squad?
std::vector<Position> cherrypi::SquadTask::storms_ |
Known locations of Psionic Storms (so we can dodge them)
bool cherrypi::SquadTask::targetingLocation |
Whether to consider targets or targetX/targetY.
std::vector<Unit*> cherrypi::SquadTask::targets |
Enemies this Squad should target.
std::vector<Unit*> cherrypi::SquadTask::targets_ |
Enemies this Squad should target.
int cherrypi::SquadTask::targetX = -1 |
Location this Squad should defend or attack.
int cherrypi::SquadTask::targetY = -1 |
std::vector<Unit*> cherrypi::SquadTask::threats_ |
Threatening enemies this Squad should be aware of.