Skip to content

Commit 2b20828

Browse files
committed
Overhaul lone wolf behaviors based around search
1 parent 2fb986c commit 2b20828

21 files changed

+1368
-728
lines changed

src/game/server/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,10 +1455,16 @@ target_sources_grouped(
14551455
neo/bot/behavior/neo_bot_ctg_lone_wolf.h
14561456
neo/bot/behavior/neo_bot_ctg_lone_wolf_ambush.cpp
14571457
neo/bot/behavior/neo_bot_ctg_lone_wolf_ambush.h
1458+
neo/bot/behavior/neo_bot_ctg_lone_wolf_seek.cpp
1459+
neo/bot/behavior/neo_bot_ctg_lone_wolf_seek.h
14581460
neo/bot/behavior/neo_bot_ctg_seek.cpp
14591461
neo/bot/behavior/neo_bot_ctg_seek.h
14601462
neo/bot/behavior/neo_bot_dead.cpp
14611463
neo/bot/behavior/neo_bot_dead.h
1464+
neo/bot/behavior/neo_bot_detpack_deploy.cpp
1465+
neo/bot/behavior/neo_bot_detpack_deploy.h
1466+
neo/bot/behavior/neo_bot_detpack_trigger.cpp
1467+
neo/bot/behavior/neo_bot_detpack_trigger.h
14621468
neo/bot/behavior/neo_bot_grenade_dispatch.cpp
14631469
neo/bot/behavior/neo_bot_grenade_dispatch.h
14641470
neo/bot/behavior/neo_bot_grenade_throw.cpp

src/game/server/neo/bot/behavior/neo_bot_ctg_capture.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "cbase.h"
22
#include "bot/behavior/neo_bot_ctg_capture.h"
3+
#include "bot/behavior/neo_bot_ctg_lone_wolf_seek.h"
34
#include "bot/behavior/neo_bot_seek_weapon.h"
45
#include "bot/neo_bot_path_compute.h"
6+
#include "neo_detpack.h"
57
#include "weapon_ghost.h"
68

79

@@ -67,6 +69,31 @@ ActionResult<CNEOBot> CNEOBotCtgCapture::Update( CNEOBot *me, float interval )
6769
m_captureAttemptTimer.Start( 3.0f );
6870
}
6971

72+
// Check if there is a detpack that risks exploding if I pick up the ghost
73+
// NEO Jank: It may be more proper to check for line of sight,
74+
// but triggering an entity search at the last moment may involve fewer overall calculations
75+
// with the lampshade explanation as the bot being able to notice the detpack along the path
76+
// even if we didn't check constantly along the same path
77+
CBaseEntity *pEnts[256];
78+
int numEnts = UTIL_EntitiesInSphere( pEnts, 256, me->GetAbsOrigin(), NEO_DETPACK_DAMAGE_RADIUS, 0 );
79+
bool bDetpackNear = false;
80+
for ( int i = 0; i < numEnts; ++i )
81+
{
82+
if ( pEnts[i] && FClassnameIs( pEnts[i], "neo_deployed_detpack" ) )
83+
{
84+
bDetpackNear = true;
85+
break;
86+
}
87+
}
88+
89+
if ( bDetpackNear )
90+
{
91+
// NEO JANK: Putting the bot into seek mode will have it search the map for enemies for the rest of the round
92+
// but for now this could be fine as it may indicate an entrenched enemy
93+
// or a friendly that is setting up an ambush, where either scenario indicates ghost capture is too dangerous
94+
return ChangeTo( new CNEOBotCtgLoneWolfSeek(), "Found detpack: skipping ghost capture to search for enemies" );
95+
}
96+
7097
CBaseCombatWeapon *pPrimary = me->Weapon_GetSlot( 0 );
7198
if ( pPrimary )
7299
{

src/game/server/neo/bot/behavior/neo_bot_ctg_carrier.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "bot/behavior/neo_bot_ctg_carrier.h"
55
#include "bot/behavior/neo_bot_ctg_lone_wolf.h"
66
#include "bot/neo_bot_path_compute.h"
7+
#include "nav_mesh.h"
78
#include "neo_gamerules.h"
89
#include "neo_ghost_cap_point.h"
910
#include "debugoverlay_shared.h"
@@ -368,9 +369,26 @@ ActionResult< CNEOBot > CNEOBotCtgCarrier::Update( CNEOBot *me, float interval )
368369
m_teammates.RemoveAll();
369370
CollectPlayers( me, &m_teammates );
370371

372+
// Check if bot should transition into lone wolf behavior
371373
if ( m_teammates.Count() == 0 )
372374
{
373-
return SuspendFor( new CNEOBotCtgLoneWolf, "I'm the last one!" );
375+
const CKnownEntity *threat = me->GetVisionInterface()->GetPrimaryKnownThreat( true );
376+
if ( threat && threat->GetEntity() && threat->GetEntity()->IsAlive() )
377+
{
378+
CNavArea *destArea = TheNavMesh->GetNearestNavArea( m_closestCapturePoint );
379+
CNavArea *myArea = me->GetLastKnownArea();
380+
381+
if ( !destArea || !myArea || !destArea->IsPotentiallyVisible( myArea ) )
382+
{
383+
return SuspendFor( new CNEOBotCtgLoneWolf, "Last one standing and blocked from capturing!" );
384+
}
385+
}
386+
387+
// Lone wolf will drop the ghost and go into enemy seeking behavior
388+
if ( m_closestCapturePoint == CNEO_Player::VECTOR_INVALID_WAYPOINT )
389+
{
390+
return SuspendFor( new CNEOBotCtgLoneWolf, "Looking for enemy since there is no capture point" );
391+
}
374392
}
375393

376394
UpdateFollowPath( me, m_teammates );

0 commit comments

Comments
 (0)