Research Article

Artificial Intelligence in Video Games: Towards a Unified Framework

Algorithm 4

Tanking capacity estimation. This function could be used to evaluate how fit of a tank a unit or character is.
double  score_tanking(Unit  u, UnitList & grp, UnitList & enemies)
{
 //Set the base score to the current unit hit points
double  score = u->hitpts();
 //Get primary damage type of enemy
DamageType dt = get_primary_dtype(enemies);
 //Get current damage reduction of the unit
double  dr = u->dmgred(dt);
 //Factor in average reduction bonus from ally abilities
dr += dmgred_abilities(u, grp, dt);
//Factor in average amplification bonus from enemy abilities
dr −= dmgamp_abilities(u, enemies, dt);
if  (dr >= 1.0)
  return  numeric_limits<double >::infinity();
 //Estimate effective hit points
score  = 1.0/(1.0 − dr);
return  score;
}