When bots are focusing an enemy with shield & facing them,
in 2.5x:
they aim & keep shooting! regardless of shield is up/down.
in 2.0.0.864:
they just keep aimming him.
this code was written at the end of CBot::FocusEnemy (2.0.0.864)
Code:
// don't shoot to enemy if enemy with & facing us, we can't hurt it
if (IsEnemyProtectedByShield ())
m_bWantsToFire = false;
it only forbid bots firing at him
Problem:
if other enemies come in bots' sight, they still keep aimming(and shooting) that enemy with shield protected, then stupidly get killed.
I think when bots are focusing an enemy with shield & facing them,
they should engage other enemies(if exists in sight)
or try to complete the mapgoal task
(just image what if a human with shield up running ahead in a new round to catch enemy bots' attention, they just keep aimming and wait to be killed, never to say the mapgoal - bots' stand no chance to win!!
)
in 2.51 src I noticed this in Bot::LookupEnemy
Quote:
// the old enemy is no longer visible or
if (FNullEnt (newEnemy))
{
m_enemyUpdateTime = GetWorldTime () + 0.25;
// some shield stuff
Array <edict_t *> enemies;
// search the world for players...
for (i = 0; i < GetMaxClients (); i++)
{
if (!(g_clients[i].flags & ClientFlag_Used) || !(g_clients[i].flags & ClientFlag_Alive) || (g_clients[i].team == team) || (g_clients[i].ent == GetEntity ()))
continue;
player = g_clients[i].ent;
// let the engine check if this player is potentially visible
if (!ENGINE_CHECK_VISIBILITY (player, pvs))
continue;
// skip glowed players, in free for all mode, we can't hit them
if (player->v.renderfx == kRenderFxGlowShell && g_botVar[Variable_Deathmatch]->GetBool ())
continue;
// do some blind by smoke grenade
if (IsBehindSmokeClouds (player) && m_blindRecognizeTime < GetWorldTime ())
m_blindRecognizeTime = GetWorldTime () + g_randGen.Float (2.0, 3.0);
if (player->v.button & (IN_ATTACK | IN_ATTACK2))
m_blindRecognizeTime = GetWorldTime () - 0.1;
// see if bot can see the player...
if (m_blindRecognizeTime < GetWorldTime () && IsEnemyViewable (player))
{
float distance = (player->v.origin - pev->origin).GetLength ();
if (distance < nearestDistance)
{
enemies.Push (player);
if (IsEnemyProtectedByShield (player))
continue;
nearestDistance = distance;
newEnemy = player;
// aim VIP first on AS maps...
if ((g_mapType & MapType_As) && *(INFOKEY_VALUE (GET_INFOKEYBUFFER (player), "model")) == 'v')
break;
}
}
}
// if we got no enemies with no shield, and got enemies with target them
if (enemies.GetElementNumber () != 0 && !IsValidPlayer (newEnemy))
newEnemy = enemies[0];
}
|
but seems not working...
Bot::
Think
BotAI
SetConditions
LookupEnemy
ChooseAimDirection
FocusEnemy
is LookupEnemy the problem?
and how to correct this??
thx