BWAPI
|
#include <BayesianUnit.h>
Public Member Functions | |
bool | isFighting () |
void | move (BWAPI::Position p) |
void | switchMode (unit_mode um) |
void | setUnitsGroup (UnitsGroup *ug) |
void | dettachGroup () |
unit_mode | getMode () |
int | getMaxDimension () |
void | newPath () |
void | updatePPath () |
BayesianUnit (BWAPI::Unit *u, const ProbTables *probTables) | |
#define _PROB_GO_NOT_VISIBLE 0.4 | |
virtual | ~BayesianUnit () |
BWAPI::UnitType | getType () |
void | update () |
Should be callable only from a UnitsGroup, maybe enforce it with a pattern (private+friend) | |
virtual void | attack (const BWAPI::Position &p) |
void | attackEnemyUnit (BWAPI::Unit *u) |
virtual void | micro ()=0 |
virtual void | check ()=0 |
virtual int | getAttackDuration ()=0 |
virtual std::set< BWAPI::UnitType > | getSetPrio ()=0 |
Static Public Member Functions | |
static pBayesianUnit | newBayesianUnit (BWAPI::Unit *u) |
Public Attributes | |
int | _fleeingDmg |
Vec | dir |
Vec | obj |
Protected Member Functions | |
void | computeRepulseValues () |
void | computeDamageValues () |
void | straightLine (std::vector< BWAPI::Position > &ppath, const BWAPI::Position &p_start, const BWAPI::Position &p_end, bool quick=true) |
void | updateDirV () |
void | testIfBlocked () |
void | resumeFromBlocked () |
void | updateRangeEnemies () |
void | clearDamages () |
void | updateTargetEnemy () |
void | setTargetEnemy (BWAPI::Unit *u) |
int | computeDmg (BWAPI::Unit *u) |
bool | inRange (BWAPI::Unit *u) |
bool | outRanges (BWAPI::Unit *u) |
bool | outRanges (const std::set< Unit * > &units) |
bool | isOutrangingMe (BWAPI::Unit *u) |
void | drawDirV () |
void | updateObj () |
void | drawObj (int number=0) |
void | updateDir () |
void | drawDir () |
void | clickDir () |
void | clickTarget () |
void | aMoveTarget () |
void | moveClick (BWAPI::Position p) |
void | flee () |
int | fightMove () |
void | drawArrow (Vec &v) |
void | updateAttractors () |
void | drawAttractors () |
void | drawRepulseValues () |
double | computeProb (unsigned int i) |
void | computeProbs () |
void | selectDir (const Vec &criterium) |
virtual int | addRangeGround () |
virtual int | addRangeAir () |
virtual bool | decideToFlee () |
void | simpleFlee () |
bool | dodgeStorm () |
bool | dragScarab () |
bool | dragMine () |
void | drawProbs (std::multimap< double, Vec > &probs, int number=0) |
void | updateTargetingMe () |
Protected Attributes | |
std::vector< Vec > | _dirv |
int | _maxDimension |
int | _minDimension |
int | _lastAttackFrame |
int | _lastMoveFrame |
int | _lastClickFrame |
int | _lastRefreshPathRequest |
double | _maxDiag |
int | _maxWeaponsRange |
BWAPI::Position | _lastRightClick |
BWAPI::Position | _posAtMost13FramesAgo |
BWAPI::Position | _posAtMost23FramesAgo |
bool | _iThinkImBlocked |
int | _lastTotalHP |
std::list< int > | _HPLosts |
int | _sumLostHP |
const int | _refreshPathFramerate |
int | _maxDistWhileRefreshingPath |
int | _maxDistInOneClick |
Position | _inPos |
bool | _fleeing |
bool | _fightMoving |
MapManager * | mapManager |
std::vector< repulse_value > | _repulseValues |
std::vector< damage_value > | _damageValues |
const ProbTables * | _probTables |
UnitsGroup * | _unitsGroup |
std::multimap< double, BWAPI::Unit * > | _rangeEnemies |
std::multimap< double, Vec > | _dirvProb |
unit_mode | _mode |
std::set< Unit * > | _targetingMe |
BayesianUnit::BayesianUnit | ( | BWAPI::Unit * | u, |
const ProbTables * | probTables | ||
) |
#define _PROB_GO_NOT_VISIBLE 0.4
BayesianUnit::~BayesianUnit | ( | ) | [virtual] |
int BayesianUnit::addRangeAir | ( | ) | [protected, virtual] |
int BayesianUnit::addRangeGround | ( | ) | [protected, virtual] |
void BayesianUnit::aMoveTarget | ( | ) | [inline, protected] |
void BayesianUnit::attack | ( | const BWAPI::Position & | p | ) | [virtual] |
Reimplemented from BattleUnit.
void BayesianUnit::attackEnemyUnit | ( | BWAPI::Unit * | u | ) |
virtual void BayesianUnit::check | ( | ) | [pure virtual] |
Implemented in ZealotUnit, HighTemplarUnit, DragoonUnit, MedicUnit, MarineUnit, CorsairUnit, ScoutUnit, ArchonUnit, DarkArchonUnit, ScourgeUnit, CarrierUnit, DarkTemplarUnit, ProbeUnit, ReaverUnit, ArbiterUnit, MutaliskUnit, GroundUnit, ObserverUnit, ShuttleUnit, FlyingUnit, and SpecialUnit.
void BayesianUnit::clearDamages | ( | ) | [protected] |
Reimplemented in ZealotUnit.
void BayesianUnit::clickDir | ( | ) | [inline, protected] |
void BayesianUnit::clickTarget | ( | ) | [inline, protected] |
void BayesianUnit::computeDamageValues | ( | ) | [inline, protected] |
int BayesianUnit::computeDmg | ( | BWAPI::Unit * | u | ) | [protected] |
double BayesianUnit::computeProb | ( | unsigned int | i | ) | [inline, protected] |
Attraction of the obj (== target in INPOS)
Repulsion of the other units incoming towards us
damage map influence
wanted target influence
void BayesianUnit::computeProbs | ( | ) | [inline, protected] |
void BayesianUnit::computeRepulseValues | ( | ) | [inline, protected] |
repulse on actual units positions (against splash damage)
repulse on interpolated units position (against collision)
bool BayesianUnit::decideToFlee | ( | ) | [protected, virtual] |
Reimplemented in DragoonUnit, ZealotUnit, MarineUnit, MedicUnit, CorsairUnit, ScoutUnit, and ArchonUnit.
void BayesianUnit::dettachGroup | ( | ) |
bool BayesianUnit::dodgeStorm | ( | ) | [protected] |
bool BayesianUnit::dragMine | ( | ) | [protected] |
bool BayesianUnit::dragScarab | ( | ) | [protected] |
void BayesianUnit::drawArrow | ( | Vec & | v | ) | [protected] |
void BayesianUnit::drawAttractors | ( | ) | [protected] |
void BayesianUnit::drawDir | ( | ) | [protected] |
void BayesianUnit::drawDirV | ( | ) | [protected] |
void BayesianUnit::drawObj | ( | int | number = 0 | ) | [protected] |
void BayesianUnit::drawProbs | ( | std::multimap< double, Vec > & | probs, |
int | number = 0 |
||
) | [protected] |
void BayesianUnit::drawRepulseValues | ( | ) | [protected] |
int BayesianUnit::fightMove | ( | ) | [protected] |
approach siege tanks or approach our targetEnemy if not in range
Or simply move away from our friends and kite if we can
Reimplemented in ZealotUnit, and MedicUnit.
void BayesianUnit::flee | ( | ) | [protected] |
Reimplemented in ZealotUnit.
virtual int BayesianUnit::getAttackDuration | ( | ) | [pure virtual] |
Implemented in ZealotUnit, DragoonUnit, MedicUnit, MarineUnit, CorsairUnit, ScoutUnit, ArchonUnit, ReaverUnit, DarkArchonUnit, ScourgeUnit, CarrierUnit, DarkTemplarUnit, ProbeUnit, ArbiterUnit, MutaliskUnit, GroundUnit, ObserverUnit, ShuttleUnit, FlyingUnit, and SpecialUnit.
int BayesianUnit::getMaxDimension | ( | ) |
virtual std::set<BWAPI::UnitType> BayesianUnit::getSetPrio | ( | ) | [pure virtual] |
Implemented in ZealotUnit, DragoonUnit, HighTemplarUnit, MedicUnit, MarineUnit, CorsairUnit, ScoutUnit, ArchonUnit, ReaverUnit, DarkArchonUnit, ScourgeUnit, CarrierUnit, DarkTemplarUnit, ProbeUnit, ArbiterUnit, MutaliskUnit, GroundUnit, ObserverUnit, ShuttleUnit, FlyingUnit, and SpecialUnit.
UnitType BayesianUnit::getType | ( | ) |
bool BayesianUnit::inRange | ( | BWAPI::Unit * | u | ) | [protected] |
Reimplemented in ReaverUnit.
bool BayesianUnit::isFighting | ( | ) |
bool BayesianUnit::isOutrangingMe | ( | BWAPI::Unit * | u | ) | [protected] |
virtual void BayesianUnit::micro | ( | ) | [pure virtual] |
Implemented in ZealotUnit, HighTemplarUnit, DragoonUnit, MedicUnit, MarineUnit, CorsairUnit, ScoutUnit, ArchonUnit, DarkArchonUnit, ScourgeUnit, CarrierUnit, DarkTemplarUnit, ProbeUnit, ReaverUnit, ArbiterUnit, MutaliskUnit, GroundUnit, ObserverUnit, ShuttleUnit, FlyingUnit, and SpecialUnit.
void BayesianUnit::move | ( | BWAPI::Position | p | ) |
void BayesianUnit::moveClick | ( | BWAPI::Position | p | ) | [inline, protected] |
pBayesianUnit BayesianUnit::newBayesianUnit | ( | BWAPI::Unit * | u | ) | [static] |
void BayesianUnit::newPath | ( | ) |
bool BayesianUnit::outRanges | ( | BWAPI::Unit * | u | ) | [protected] |
bool BayesianUnit::outRanges | ( | const std::set< Unit * > & | units | ) | [protected] |
void BayesianUnit::resumeFromBlocked | ( | ) | [inline, protected] |
void BayesianUnit::selectDir | ( | const Vec & | criterium | ) | [inline, protected] |
void BayesianUnit::setTargetEnemy | ( | BWAPI::Unit * | u | ) | [inline, protected] |
<=> _unitsGroup->unitDamages.left[u] += computeDmg(u);
void BayesianUnit::setUnitsGroup | ( | UnitsGroup * | ug | ) |
void BayesianUnit::simpleFlee | ( | ) | [protected] |
Don't flee only a single enemy that we don't outrange
void BayesianUnit::straightLine | ( | std::vector< BWAPI::Position > & | ppath, |
const BWAPI::Position & | p_start, | ||
const BWAPI::Position & | p_end, | ||
bool | quick = true |
||
) | [protected] |
void BayesianUnit::switchMode | ( | unit_mode | um | ) |
void BayesianUnit::testIfBlocked | ( | ) | [inline, protected] |
void BayesianUnit::update | ( | ) | [virtual] |
Should be callable only from a UnitsGroup, maybe enforce it with a pattern (private+friend)
check() for all inherited classes
Switch to fight if we're not fighting already nor scouting and there are enemies (and we can attack)
Implements BattleUnit.
void BayesianUnit::updateAttractors | ( | ) | [inline, protected] |
void BayesianUnit::updateDir | ( | ) | [protected] |
void BayesianUnit::updateDirV | ( | ) | [inline, protected] |
void BayesianUnit::updateObj | ( | ) | [protected] |
fleeing gradient influence
target influence
void BayesianUnit::updatePPath | ( | ) |
Do not pathfind for a small distance (1 build tile diagonal)
Request a path from the MapManager (without spamming it)
remove path points we passed
void BayesianUnit::updateRangeEnemies | ( | ) | [protected] |
void BayesianUnit::updateTargetEnemy | ( | ) | [protected] |
take one in our priority set and in focus fire order
take one in our priority set
take the best in focus fire order, not especially out of range
Choose a priority target in the ones in range in focus fire order
Focus fire in range
Take a new one
In range or almost and in the priority set
In range and not in the priority set
Not in range and the first one, priority to the priority set
Anywhere and not particularly in the priority set OR not defense building
Take the default target of the UnitGroup
No target in rangeEnemies nor as a default target, follow the old one // should never happen
WTF??? // should never happen
Reimplemented in ZealotUnit.
void BayesianUnit::updateTargetingMe | ( | ) | [protected] |
std::vector<damage_value> BayesianUnit::_damageValues [protected] |
std::vector<Vec> BayesianUnit::_dirv [protected] |
std::multimap<double, Vec> BayesianUnit::_dirvProb [protected] |
bool BayesianUnit::_fightMoving [protected] |
bool BayesianUnit::_fleeing [protected] |
std::list<int> BayesianUnit::_HPLosts [protected] |
Position BayesianUnit::_inPos [protected] |
bool BayesianUnit::_iThinkImBlocked [protected] |
int BayesianUnit::_lastAttackFrame [protected] |
int BayesianUnit::_lastClickFrame [protected] |
int BayesianUnit::_lastMoveFrame [protected] |
int BayesianUnit::_lastRefreshPathRequest [protected] |
BWAPI::Position BayesianUnit::_lastRightClick [protected] |
int BayesianUnit::_lastTotalHP [protected] |
double BayesianUnit::_maxDiag [protected] |
int BayesianUnit::_maxDimension [protected] |
int BayesianUnit::_maxDistInOneClick [protected] |
int BayesianUnit::_maxDistWhileRefreshingPath [protected] |
int BayesianUnit::_maxWeaponsRange [protected] |
int BayesianUnit::_minDimension [protected] |
unit_mode BayesianUnit::_mode [protected] |
BWAPI::Position BayesianUnit::_posAtMost13FramesAgo [protected] |
BWAPI::Position BayesianUnit::_posAtMost23FramesAgo [protected] |
const ProbTables* BayesianUnit::_probTables [protected] |
std::multimap<double, BWAPI::Unit*> BayesianUnit::_rangeEnemies [protected] |
const int BayesianUnit::_refreshPathFramerate [protected] |
std::vector<repulse_value> BayesianUnit::_repulseValues [protected] |
int BayesianUnit::_sumLostHP [protected] |
std::set<Unit*> BayesianUnit::_targetingMe [protected] |
UnitsGroup* BayesianUnit::_unitsGroup [protected] |
MapManager* BayesianUnit::mapManager [protected] |