View Single Post
Re: Is it possible for YaPB(Godlike) to defeat zbot(Expert)?
Old
  (#2)
szfzafa
Member
 
Status: Offline
Posts: 24
Join Date: Apr 2010
Location: Nanjing, PRC
Default Re: Is it possible for YaPB(Godlike) to defeat zbot(Expert)? - 12-05-2010

Quote:
Vector Bot::GetAimPosition (void)
{
// the purpose of this function, is to make bot aiming not so ideal. it's mutate m_enemyOrigin enemy vector
// returned from visibility check function.
float hardcodedZ = UsesSniper () ? 15.0f : 17.0f;
float distance = (m_enemy->v.origin - pev->origin).GetLength ();
// get enemy position initially
Vector targetOrigin = m_enemy->v.origin;
// this is cheating, stolen from official csbot
if (yb_hardmode.GetBool ())
hardcodedZ = (UsesSniper () ? 2.32f : UsesPistol () ? 5.9f : (distance < 300 ? 4.68f : 6.98f)) + hardcodedZ;
else
hardcodedZ = hardcodedZ - (0.6f * (100.0f - m_skill)) + engine->RandomFloat (5.0f, 6.0f);
// do not aim at head, at long distance (only if not using sniper weapon)
if ((m_visibility & VISIBILITY_BODY) && !UsesSniper () && !UsesPistol () && ((targetOrigin - pev->origin).GetLength () > (yb_hardmode.GetBool () ? 2400.0f : 1800.0f)))
m_visibility &= ~VISIBILITY_HEAD;
// if target player is a chicken reset z axis
if (*reinterpret_cast <signed short *> (INFOKEY_VALUE (GET_INFOKEYBUFFER (m_enemy), "model")) == (('h' << + 'c'))
hardcodedZ = 0.0f;
// if we only suspect an enemy behind a wall take the worst skill
if ((m_states & STATE_SUSPECTENEMY) && !(m_states & STATE_SEEINGENEMY))
targetOrigin = targetOrigin + Vector (engine->RandomFloat (m_enemy->v.mins.x, m_enemy->v.maxs.x), engine->RandomFloat (m_enemy->v.mins.y, m_enemy->v.maxs.y), engine->RandomFloat (m_enemy->v.mins.z, m_enemy->v.maxs.z));
else
{
// now take in account different parts of enemy body
if (m_visibility & (VISIBILITY_HEAD | VISIBILITY_BODY)) // visible head & body
{
// now check is our skill match to aim at head, else aim at enemy body
if ((engine->RandomInt (1, 100) < g_skillTab[m_skill / 20].headshotFrequency) || UsesPistol ())
targetOrigin = targetOrigin + Vector (0, 0, hardcodedZ);
else
targetOrigin = targetOrigin;
}
else if (m_visibility & VISIBILITY_HEAD) // visible only head
targetOrigin = targetOrigin + Vector (0, 0, hardcodedZ);
else if (m_visibility & VISIBILITY_BODY) // visible only body
targetOrigin = targetOrigin + Vector (0, 0, hardcodedZ);
else if (m_visibility & VISIBILITY_OTHER) // random part of body is visible
targetOrigin = m_enemyOrigin;
else // something goes wrong, use last enemy origin
targetOrigin = m_lastEnemyOrigin;
m_lastEnemyOrigin = targetOrigin;
}
if (yb_hardmode.GetBool ())
{
m_enemyOrigin = (targetOrigin + (m_enemy->v.velocity.SkipZ () * (m_frameInterval * 1.5f)));
// if uses sniper do not predict enemy position
if (UsesSniper ())
m_enemyOrigin = targetOrigin;
}
else
{
float divOffs, betweenDist = (m_enemyOrigin - pev->origin).GetLength ();
if (pev->fov < 40)
divOffs = betweenDist / 2000;
else if (pev->fov < 90)
divOffs = betweenDist / 1000;
else
divOffs = betweenDist / 500;
targetOrigin.x += divOffs * engine->RandomFloat (-g_skillTab[m_skill / 20].aimOffs_X, g_skillTab[m_skill / 20].aimOffs_X);
targetOrigin.y += divOffs * engine->RandomFloat (-g_skillTab[m_skill / 20].aimOffs_Y, g_skillTab[m_skill / 20].aimOffs_Y);
targetOrigin.z += divOffs * engine->RandomFloat (-g_skillTab[m_skill / 20].aimOffs_Z, g_skillTab[m_skill / 20].aimOffs_Z);
// randomize the target position
//m_enemyOrigin = targetOrigin + ((pev->velocity - m_enemy->v.velocity).SkipZ () * m_frameInterval * 1.2f);
}
return m_enemyOrigin;
}
it really sucks...feel strange...*_*
  
Reply With Quote