International Journal of Computer Games Technology / 2015 / Article / Alg 3

Research Article

Artificial Intelligence in Video Games: Towards a Unified Framework

Algorithm 3

Primary tank designation. This function could be used to determine which unit or character should engage the enemy.
void  set_tank(UnitList & grp)
{
 //Get a list of the enemies the group is fighting
UnitList enemies = get_nearby_threats(grp);
Unit  toughest = NULL;
double  score = 0;
 //For each unit in the group, estimate its toughness against the enemy
UnitList::iterator u;
for  (u = grp.begin(); u != grp.end(); ++u)
 {
  double  cs = score_tanking(u, grp, enemies);
  if  (cs > score)
  {
   toughest =  u;
   score = cs;
  }
 }
 //Assign the role of tank to the toughest unit in the group
if  (score > 0)
  set_role(toughest, Role::tank);
}

We are committed to sharing findings related to COVID-19 as quickly as possible. We will be providing unlimited waivers of publication charges for accepted research articles as well as case reports and case series related to COVID-19. Review articles are excluded from this waiver policy. Sign up here as a reviewer to help fast-track new submissions.