Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/game/server/neo/bot/behavior/neo_bot_behavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ ConVar neo_bot_fire_weapon_allowed( "neo_bot_fire_weapon_allowed", "1", FCVAR_CH

ConVar neo_bot_allow_retreat( "neo_bot_allow_retreat", "1", FCVAR_CHEAT, "If zero, bots will not attempt to retreat if they are are in a bad situation." );

ConVar neo_bot_recon_superjump_min_dist( "neo_bot_recon_superjump_min_dist", "1000", FCVAR_NONE,
ConVar neo_bot_recon_superjump_min_dist( "neo_bot_recon_superjump_min_dist", "4096", FCVAR_NONE,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrived at this number testing around with a bunch of recon bots in the first Jinrai spawn of Ballistrade:

bot_class 0;
sv_neo_preround_freeze_time 2; mp_chattime 2;
sv_neo_bot_cmdr_enable 1;
sv_neo_bot_cmdr_debug_pause_uncommanded 1;
neo_ctg_round_timelimit 99;
neo_bot_recon_superjump_min_accuracy 0.96;
neo_bot_recon_superjump_min_dist 4096;

Pretty much just doubled the values until the choice to superjump felt a bit less wasteful while still being responsive, but open to other suggestions.

"Minimum straight-line path distance required for a Recon bot to super jump while moving", true, 0, false, 0 );

ConVar neo_bot_recon_superjump_min_accuracy( "neo_bot_recon_superjump_min_accuracy", "0.95", FCVAR_NONE,
ConVar neo_bot_recon_superjump_min_accuracy( "neo_bot_recon_superjump_min_accuracy", "0.96", FCVAR_NONE,
"Minimum directional alignment with path required for a Recon bot to super jump while moving", true, 0.1f, false, 1.0f );

//---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -370,30 +370,30 @@ Vector CNEOBotMainAction::SelectTargetPoint( const INextBot *meBot, const CBaseC
//-----------------------------------------------------------------------------------------
void CNEOBotMainAction::ReconConsiderSuperJump( CNEOBot *me )
{
CNEO_Player *pNeoMe = ToNEOPlayer(me);
if ( !pNeoMe || pNeoMe->GetClass() != NEO_CLASS_RECON )
if ( me->GetClass() != NEO_CLASS_RECON )
{
return;
}

// Check that bot isn't only moving sideways which wastes aux power
// Also determines a direction to jump towards
// NEO Jank: We don't check sprint here because bots don't anticipate using sprint in a smart manner
if ( ( pNeoMe->m_nButtons & ( IN_FORWARD | IN_BACK ) ) == 0 )
const int nForwardBack = me->m_nButtons & ( IN_FORWARD | IN_BACK );
if ( nForwardBack == 0 || nForwardBack == ( IN_FORWARD | IN_BACK ) )
{
// Remove this check if we add sideways super jump in the future
return;
}

if (!pNeoMe->IsAllowedToSuperJump())
if (!me->IsAllowedToSuperJump())
{
return;
}

bool bImmediateDanger = gpGlobals->curtime - pNeoMe->GetLastDamageTime() <= 2.0f;
bool bImmediateDanger = gpGlobals->curtime - me->GetLastDamageTime() <= 2.0f;

if (!bImmediateDanger
&& (pNeoMe->m_nButtons & IN_FORWARD)
&& (me->m_nButtons & IN_FORWARD)
&& (neo_bot_recon_superjump_min_dist.GetFloat() > 1))
{
if (!m_reconSuperJumpPathCheckTimer.IsElapsed())
Expand Down Expand Up @@ -421,7 +421,7 @@ void CNEOBotMainAction::ReconConsiderSuperJump( CNEOBot *me )

// Get the bot's facing direction
Vector vecFacing;
pNeoMe->EyeVectors( &vecFacing );
me->EyeVectors( &vecFacing );
vecFacing.z = 0.0f;
vecFacing.NormalizeInPlace();

Expand Down Expand Up @@ -455,7 +455,7 @@ void CNEOBotMainAction::ReconConsiderSuperJump( CNEOBot *me )
}

// Sanity check that each waypoint is relatively aligned with our jump direction
Vector vecToWaypoint = seg->pos - pNeoMe->GetAbsOrigin();
Vector vecToWaypoint = seg->pos - me->GetAbsOrigin();
vecToWaypoint.z = 0.0f;

float flDist = vecToWaypoint.NormalizeInPlace();
Expand All @@ -470,7 +470,7 @@ void CNEOBotMainAction::ReconConsiderSuperJump( CNEOBot *me )
bCanJump = true;
break;
}
else if (flDist < 0)
else if ( !IsFinite( flDist ) || flDist < 0 )
{
return; // Just in case of a bad value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ ActionResult< CNEOBot > CNEOBotTacticalMonitor::Update( CNEOBot *me, float inter
MonitorArmedStickyBombs( me );
#endif

CNEO_Player* pBotPlayer = ToNEOPlayer( me->GetEntity() );
if ( pBotPlayer && !(pBotPlayer->m_nButtons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_USE)) )
if ( !(me->m_nButtons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_USE)) )
{
AvoidBumpingFriends( me );
}
Expand Down
3 changes: 1 addition & 2 deletions src/game/server/neo/bot/neo_bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,8 +1620,7 @@ void CNEOBot::ReloadIfLowClip(bool bForceReload)
}
else if (myWeapon->Clip1() > 0)
{
auto* pPlayer = ToNEOPlayer(this);
if ( pPlayer->GetTimeSinceWeaponFired() < 3.0f)
if (GetTimeSinceWeaponFired() < 3.0f)
{
return; // still in the middle of a fight
}
Expand Down
Loading