TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
The Tactics module decides where on the map to allocate combat units. More...
#include <tactics.h>
Inherits cherrypi::Module.
Inherited by cherrypi::TacticsAlwaysFightModule.
Public Member Functions | |
virtual void | step (State *s) override |
virtual void | onGameEnd (State *s) override |
Public Member Functions inherited from cherrypi::Module | |
virtual | ~Module ()=default |
virtual void | setPlayer (BasePlayer *p) |
void | setName (std::string name) |
std::string | name () |
virtual void | onGameStart (State *s) |
Protected Member Functions | |
UpcId | findSourceUpc (State *s) |
virtual void | process (State *state, int srcUpcId) |
void | formGroups (State *state, TacticsState &tstate, std::vector< Unit * > &leftoverWorkers, std::unordered_set< Unit * > &wasInAGroup) |
Create groups based on distance rules, useful for the scouting/worker/search and destroy functionality. More... | |
void | distributeLeftoverWorkers (std::unordered_set< Unit * > &unitSet, std::vector< Unit * > &leftoverWorkers, std::unordered_set< Unit * > &wasInAGroup) |
Return unused workers, doesn't rely on group creation, just on existance of leftoverWorkers which specifies the workers and wasInAGroup which specifies which will automatically be reassigned based on attachement to a previously existing task. More... | |
void | processNonFightFleeGroup (State *state, TacticsState &tstate, TacticsGroup &g, std::vector< Unit * > &leftoverWorkers, std::unordered_set< Unit * > &wasInAGroup) |
Takes the scouting & search and destroy groups created in formGroups and issues the commands, also returns leftoverWorkers. More... | |
void | moveUnit (State *state, UpcId srcUpcId, Unit *u, Position target) |
Creates a move upc for unit with given target. More... | |
std::pair< double, double > | distributeFightFlee (State *state, TacticsState &tstate, TacticsGroup &g, std::vector< Unit * > &fightUnits, std::vector< Unit * > &fleeUnits) |
Uses combat sim + rules to put each unit into a fight or flee vector. More... | |
void | processOrders (State *state, TacticsGroup &g, int srcUpcId, double deleteScore, double moveScore, std::vector< Unit * > &fightUnits, std::vector< Unit * > &fleeUnits, std::vector< Unit * > &leftoverWorkers, std::unordered_set< Unit * > &wasInAGroup) |
Takes a group and the fight/flee assignments and issues commands. More... | |
virtual bool | alwaysFight () |
Protected Member Functions inherited from cherrypi::Module | |
Module () | |
Protected Attributes | |
FrameNum | lastProcess_ = 0 |
std::vector< uint8_t > | inBaseArea_ |
FrameNum | lastUpdateInBaseArea_ = 0 |
std::vector< uint16_t > | fleeScore_ |
FrameNum | lastUpdateFleeScore_ = 0 |
std::unordered_map< Unit *, std::pair< int, Position > > | searchAndDestroyTarget_ |
std::unordered_map< Unit *, std::pair< int, Position > > | scoutTarget_ |
std::ranlux24 | rngEngine_ {42} |
std::unordered_map< Unit *, int > | lastTargetInRange_ |
std::unordered_map< Unit *, int > | lastMove_ |
Protected Attributes inherited from cherrypi::Module | |
BasePlayer * | player_ |
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< Module > | make (std::string const &typeName) |
static std::string | makeName (std::type_index const &type) |
The Tactics module decides where on the map to allocate combat units.
Finally, outputs a UPC for each group of units indicating where they should go or what they should fight.
|
inlineprotectedvirtual |
|
protected |
Uses combat sim + rules to put each unit into a fight or flee vector.
|
protected |
Return unused workers, doesn't rely on group creation, just on existance of leftoverWorkers which specifies the workers and wasInAGroup which specifies which will automatically be reassigned based on attachement to a previously existing task.
|
protected |
Create groups based on distance rules, useful for the scouting/worker/search and destroy functionality.
|
protected |
Creates a move upc for unit with given target.
|
overridevirtual |
Reimplemented from cherrypi::Module.
|
protectedvirtual |
|
protected |
Takes the scouting & search and destroy groups created in formGroups and issues the commands, also returns leftoverWorkers.
|
protected |
Takes a group and the fight/flee assignments and issues commands.
|
overridevirtual |
Reimplemented from cherrypi::Module.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |