.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   YaPB (http://forums.bots-united.com/forumdisplay.php?f=55)
-   -   shield issues... (http://forums.bots-united.com/showthread.php?t=7606)

szfzafa 15-05-2010 09:03

shield issues...
 
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!!:cursing:)

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??
:helpsmilie:thx

szfzafa 15-05-2010 09:19

Re: shield issues...
 
2.51 src(last modified by ProRaiL)
http://forums.bots-united.com/showpo...2&postcount=82

szfzafa 15-05-2010 10:43

Re: shield issues...
 
i wrote this at the end of FocusEnemy
Quote:

// don't shoot to enemy if enemy with shield & facing us, we can't hurt it
if (IsEnemyProtectedByShield (m_enemy))
{
m_wantsToFire = false;
m_enemy = NULL;
}
i works...partly, through sometimes...

i tested this with a zbot as a teammate(bot_zombie 1) following me, and i'm using shield facing a YaPB enemy. When the YaPB caught sight of my teammate zbot it would usually kill him. But there are times when the YaPB just aim the zbot without shooting, the moment i ran away/turned off shield, the YaPB killed zbot just then, i showed up before that, and YaPB keep shooting at me!
--it seems the YaPB's m_wantsToFire property was applied to wrong enemies!
lol


All times are GMT +2. The time now is 01:06.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.