Skip to content
Merged
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
2 changes: 0 additions & 2 deletions src/game/server/neo/bot/behavior/neo_bot_attack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ EventDesiredResult< CNEOBot > CNEOBotAttack::OnStuck( CNEOBot *me )
{
m_path.Invalidate();
m_attackCoverArea = nullptr;
CNEOBotPathReservations()->IncrementAreaAvoidPenalty(me->GetLastKnownArea()->GetID(), neo_bot_path_reservation_onstuck_penalty.GetFloat());
return TryContinue();
}

Expand All @@ -423,7 +422,6 @@ EventDesiredResult< CNEOBot > CNEOBotAttack::OnMoveToFailure( CNEOBot *me, const
{
m_path.Invalidate();
m_attackCoverArea = nullptr;
CNEOBotPathReservations()->IncrementAreaAvoidPenalty(me->GetLastKnownArea()->GetID(), neo_bot_path_reservation_onstuck_penalty.GetFloat());
Comment thread
sunzenshen marked this conversation as resolved.
return TryContinue();
}

Expand Down
32 changes: 0 additions & 32 deletions src/game/server/neo/bot/behavior/neo_bot_behavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,38 +271,6 @@ EventDesiredResult< CNEOBot > CNEOBotMainAction::OnStuck( CNEOBot *me )
me->PressRightButton();
}

// NEO Jank: For the current match, all bots share where they get stuck
// The reasoning is that bots on either team will get stuck in their respective half of the map
// so the overall fairness may balance out for both teams sharing common sticking points.
if ( const CNavArea *navArea = me->GetLastKnownArea() )
{
CNEOBotPathReservations()->IncrementAreaAvoidPenalty( navArea->GetID(), neo_bot_path_reservation_onstuck_penalty.GetFloat() );
}
else
Comment thread
sunzenshen marked this conversation as resolved.
{
// Fallback if GetLastKnownArea is null, try finding nearest nav area
CNavArea *nearestArea = TheNavMesh->GetNearestNavArea( me->GetAbsOrigin() );
if ( nearestArea )
{
CNEOBotPathReservations()->IncrementAreaAvoidPenalty( nearestArea->GetID(), neo_bot_path_reservation_onstuck_penalty.GetFloat() );
}
}

// Also penalize the immediate next nav area bot was trying to get to
if ( const PathFollower *path = me->GetCurrentPath() )
{
if ( const Path::Segment *currentGoal = path->GetCurrentGoal() )
{
if ( const Path::Segment *nextSegment = path->NextSegment( currentGoal ) )
{
if ( nextSegment->area )
{
CNEOBotPathReservations()->IncrementAreaAvoidPenalty( nextSegment->area->GetID(), neo_bot_path_reservation_onstuck_penalty.GetFloat() );
}
}
}
}

Comment thread
sunzenshen marked this conversation as resolved.
return TryContinue();
}

Expand Down
27 changes: 27 additions & 0 deletions src/game/server/neo/bot/neo_bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "team_train_watcher.h"
#include "neo_bot.h"
#include "neo_bot_manager.h"
#include "neo_bot_path_reservation.h"
#include "neo_bot_vision.h"
#include "trigger_area_capture.h"
#include "GameEventListener.h"
Expand Down Expand Up @@ -2846,6 +2847,32 @@ CNEOBotIntention::~CNEOBotIntention()
delete m_behavior;
}

static void CNEOBotApplyOnStuckAreaPenalty( CNEOBot *me )
{
// NEO Jank: For the current match, all bots share where they get stuck.
// The reasoning is that bots on either team will get stuck in their respective half of the map
// so the overall fairness may balance out for both teams sharing common sticking points.
if ( const CNavArea *navArea = me->GetLastKnownArea() )
{
CNEOBotPathReservations()->IncrementAreaAvoidPenalty( navArea->GetID(), neo_bot_path_reservation_onstuck_penalty.GetFloat() );
}
}

void CNEOBotIntention::OnStuck()
{
CNEOBotApplyOnStuckAreaPenalty( static_cast<CNEOBot *>( GetBot() ) );
INextBotEventResponder::OnStuck();
}

void CNEOBotIntention::OnMoveToFailure( const Path *path, MoveToFailureType reason )
{
if ( reason == FAIL_STUCK )
{
CNEOBotApplyOnStuckAreaPenalty( static_cast<CNEOBot *>( GetBot() ) );
}
INextBotEventResponder::OnMoveToFailure( path, reason );
}

void CNEOBotIntention::Reset()
{
delete m_behavior;
Expand Down
3 changes: 3 additions & 0 deletions src/game/server/neo/bot/neo_bot.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class CNEOBotIntention : public IIntention, public CNEOBotContextualQueryInterfa
INextBotEventResponder *FirstContainedResponder() const override;
INextBotEventResponder *NextContainedResponder(INextBotEventResponder *current) const override;

void OnStuck() override;
void OnMoveToFailure( const Path *path, MoveToFailureType reason ) override;

QueryResultType ShouldWalk(const CNEOBot *me, const QueryResultType qShouldAimQuery) const final;
QueryResultType ShouldAim(const CNEOBot *me, const bool bWepHasClip) const final;

Expand Down