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

Research Article

Artificial Intelligence in Video Games: Towards a Unified Framework

Algorithm 16

Vision update in the Graven sensory memory module.
void  CptSensoryMemory::UpdateVision()
{
 //for each bot in the world test to see if it is visible to the owner of this class
const  std::list<CptMvAgent2D> & bots = m_pOwner->GetWorld()->GetAllBots();
std::list<CptMvAgent2D>::const_iterator curBot;
for  (curBot = bots.begin(); curBot != bots.end(); ++curBot)
{
  //make sure the bot being examined is not this bot
if  (m_pOwner->GetAgent() !=  curBot)
{
   //make sure it is part of the memory map
MakeNewRecordIfNotAlreadyPresent(curBot);
   //get a reference to this bot’s data
CptMemoryRecord & info = m_MemoryMapcurBot;
   //test if there is LOS between bots
if  (m_pOwner->GetWorld()->isLOSOkay(m_pOwner->GetAgent()->Pos(), (curBot)->Pos()))
{
info.bShootable =  true;
    //test if the bot is within FOV
    if  (isSecondInFOVOfFirst(m_pOwner->GetAgent()->Pos(),
m_pOwner->GetAgent()->Facing(),
(curBot)->Pos(),  m_pOwner->GetAgent()->FieldOfView()))
{
info.fTimeLastSensed = Clock->GetCurrentTime();
info.vLastSensedPosition = (curBot)->Pos();
info.fTimeLastVisible = Clock->GetCurrentTime();
if  (info.bWithinFOV ==  false )
{
info.bWithinFOV =  true;
info.fTimeBecameVisible = info.fTimeLastSensed;
}
}
    else
{
info.bWithinFOV =  false ;
}
}
   else
{
info.bShootable =  false ;
info.bWithinFOV =  false ;
}
}
 }//next bot
}

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.