TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cherrypi::SquadCombatModule Class Reference

Module which controls ("micromanages") units into and out of combat. More...

#include <squadcombat.h>

Inherits cherrypi::Module.

Public Member Functions

virtual void step (State *s) override
 
void enqueueModel (std::shared_ptr< MicroModel > model, std::string name)
 Adds a MicroModel to the end of the list of models which will be updated and solicited for UPCs. More...
 
std::shared_ptr< MicroModelgetModel (std::string)
 
virtual void onGameEnd (State *state) override
 
virtual void onGameStart (State *state) override
 
- Public Member Functions inherited from cherrypi::Module
virtual ~Module ()=default
 
virtual void setPlayer (BasePlayer *p)
 
void setName (std::string name)
 
std::string name ()
 

Protected Member Functions

bool formNewSquad (std::shared_ptr< UPCTuple > sourceUpc, int sourceUpcId)
 Takes incoming UPCs (usually from the Tactics module) and forms clusters of units that fight collaboratively. More...
 
void updateTask (std::shared_ptr< Task >)
 
virtual BehaviorList makeDeleteBehaviors ()
 Produces new fight Behaviors for an Agent. More...
 
virtual BehaviorList makeFleeBehaviors ()
 Produces new flee Behaviors for an Agent. More...
 
- Protected Member Functions inherited from cherrypi::Module
 Module ()
 

Protected Attributes

Statestate
 
std::unordered_map< Unit const *, Agentagents_
 Micromanagement state of our units. More...
 
std::unordered_map< Unit const *, EnemyStateenemyStates_
 Micromanagement state of enemy units. More...
 
std::unordered_map< std::string, std::shared_ptr< MicroModel > > models_
 Models for SquadCombat to solicit for unit UPCs. More...
 
- Protected Attributes inherited from cherrypi::Module
BasePlayerplayer_
 
std::string name_
 

Additional Inherited Members

- Static Public Member Functions inherited from cherrypi::Module
template<typename T , typename... Args>
static std::shared_ptr< T > make (Args &&...args)
 
static std::shared_ptr< Modulemake (std::string const &typeName)
 
static std::string makeName (std::type_index const &type)
 

Detailed Description

Module which controls ("micromanages") units into and out of combat.

SquadCombat reads diffuse Delete ("Fight") or Flee UPCs from the Blackboard and reposts them as sharp UPCs for commands like Delete or Move.

SquadCombatModule is a thin orchestrator for micromanagement. Most of the micromanagement logic lives in the supporting classes of src/modules/squadcombat/

Member Function Documentation

void cherrypi::SquadCombatModule::enqueueModel ( std::shared_ptr< MicroModel model,
std::string  name 
)

Adds a MicroModel to the end of the list of models which will be updated and solicited for UPCs.

bool cherrypi::SquadCombatModule::formNewSquad ( std::shared_ptr< UPCTuple sourceUpc,
int  sourceUpcId 
)
protected

Takes incoming UPCs (usually from the Tactics module) and forms clusters of units that fight collaboratively.

std::shared_ptr< MicroModel > cherrypi::SquadCombatModule::getModel ( std::string  name)
BehaviorList cherrypi::SquadCombatModule::makeDeleteBehaviors ( )
protectedvirtual

Produces new fight Behaviors for an Agent.

Intended for override by subclasses which insert baseline or ML-powered behaviors.

BehaviorList cherrypi::SquadCombatModule::makeFleeBehaviors ( )
protectedvirtual

Produces new flee Behaviors for an Agent.

Intended for override by subclasses which insert baseline or ML-powered behaviors.

void cherrypi::SquadCombatModule::onGameEnd ( State state)
overridevirtual

Reimplemented from cherrypi::Module.

void cherrypi::SquadCombatModule::onGameStart ( State state)
overridevirtual

Reimplemented from cherrypi::Module.

void cherrypi::SquadCombatModule::step ( State s)
overridevirtual

Reimplemented from cherrypi::Module.

void cherrypi::SquadCombatModule::updateTask ( std::shared_ptr< Task task)
protected

Member Data Documentation

std::unordered_map<Unit const*, Agent> cherrypi::SquadCombatModule::agents_
protected

Micromanagement state of our units.

std::unordered_map<Unit const*, EnemyState> cherrypi::SquadCombatModule::enemyStates_
protected

Micromanagement state of enemy units.

std::unordered_map<std::string, std::shared_ptr<MicroModel> > cherrypi::SquadCombatModule::models_
protected

Models for SquadCombat to solicit for unit UPCs.

State* cherrypi::SquadCombatModule::state
protected

The documentation for this class was generated from the following files: