TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
The primary way for modules to publish their activity. More...
#include <task.h>
Inherited by cherrypi::ControllerTask, cherrypi::MasterHarassTask, cherrypi::MultiProxyTask, cherrypi::ProxyTask, cherrypi::SharedControllerTask, cherrypi::SquadTask, and cherrypi::TacticsTask.
Public Member Functions | |
Task (UpcId upcId, std::unordered_set< Unit * > units={}) | |
virtual | ~Task () |
virtual void | update (State *) |
virtual void | cancel (State *) |
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 std::unordered_set< Unit * > const & | proxiedUnits () const |
A set of units occupied performing this task. More... | |
virtual const char * | getName () const |
A name for this task, for debugging purposes. More... | |
Protected Member Functions | |
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... | |
The primary way for modules to publish their activity.
A task describes a particular activity of a module, likely spanning multiple frames in the game. Tasks are meant for publishing module activity to the blackboard. A typical use case would be that a given Module B acts on a UPCTuple from Module A on the blackboard (i.e. it consumes it) and spawns a corresponding task and possible further UPCTuples for lower-level Module objects. Tasks are publicly available on the blackboard, which allows Module A to track the execution of the UPCTuple that it spawned previously.
Modules are encouraged to sub-class Task and add custom, task-specific data. This way, module state is stored on the blackboard instead of in the modules themselves.
|
inlinevirtual |
|
virtual |
Reimplemented in cherrypi::SharedControllerTask, cherrypi::ControllerTask, cherrypi::MultiProxyTask, cherrypi::ProxyTask, and cherrypi::TacticsTask.
|
inline |
|
inlinevirtual |
A name for this task, for debugging purposes.
Reimplemented in cherrypi::ControllerTask, cherrypi::HarassTask, cherrypi::SquadTask, cherrypi::BuildingHarassTask, cherrypi::MasterHarassTask, and cherrypi::TacticsTask.
|
inlinevirtual |
A set of units occupied performing this task.
If this is a ProxyTask, this will reflect the units of the targeted task.
Reimplemented in cherrypi::MultiProxyTask, and cherrypi::ProxyTask.
|
protectedvirtual |
Remove units that have been assigned to another task and units that have died.
void cherrypi::Task::removeUnit | ( | Unit * | unit | ) |
|
inline |
|
inline |
|
inline |
A set of units occupied performing this task.
|
inlineprotected |
|
inline |
UPC id in Blackboard that caused this Task to be spawned.
|
inlinevirtual |