Disable AI update throttler that blocked all strategy execution

The AdaptiveAIUpdateThrottler was preventing UpdateStrategies() from
ever being reached, leaving bots idle with active but never-executed
strategies. Also swapped quest/loot priority so quest (MOVEMENT=45)
runs below loot (FOLLOW=50) only when loot is gated by IsActive.

Added temporary STRAT-SELECT diagnostic logging to trace which
strategy wins priority selection each tick.
This commit is contained in:
luis
2026-03-17 20:31:29 -03:00
parent cedc8bba80
commit 4127c8485a
+14 -15
View File
@@ -686,20 +686,11 @@ void BotAI::UpdateAI(uint32 diff)
if (_currentBudgetTier == AIBudgetTier::MINIMAL)
goto throttled_update_complete;
// ========================================================================
// ST-1: ADAPTIVE AI UPDATE THROTTLING - CPU optimization for far bots
// ========================================================================
// Check if this update should be processed based on:
// - Proximity to human players (near = full rate, far = reduced)
// - Combat state (in combat = full rate always)
// - Bot activity level (idle = minimal updates)
// This optimization can reduce CPU usage by 10-15% for bots far from players
if (_aiUpdateThrottler && !_aiUpdateThrottler->ShouldUpdate(diff))
{
// Throttled - skip this update cycle
// Note: Essential systems (death recovery, stall detection) already ran above
goto throttled_update_complete;
}
// ST-1: ADAPTIVE AI UPDATE THROTTLING - DISABLED
// The throttler was preventing ALL strategy execution (UpdateStrategies never reached).
// Bots need strategies to run to quest, grind, and move. Re-enable throttling only
// after verifying it doesn't block essential AI phases.
// TODO: Re-enable with proper bypass for strategy execution phase
// ========================================================================
// BATTLEGROUND AI CONTEXT - Priority handler for BG situations
@@ -1063,6 +1054,13 @@ void BotAI::UpdateStrategies(uint32 diff)
selectedStrategy = _priorityManager->SelectActiveBehavior(activeStrategies);
}
// DIAGNOSTIC: Log strategy selection result every call (temporary)
TC_LOG_INFO("module.playerbot",
"STRAT-SELECT: Bot {} activeCount={} selected={}",
_bot->GetName(),
activeStrategies.size(),
selectedStrategy ? selectedStrategy->GetName() : "NONE");
// ========================================================================
// PHASE 4: Execute the selected strategy
// ========================================================================
@@ -1365,7 +1363,7 @@ void BotAI::UpdateSoloBehaviors(uint32 diff)
float distance = std::sqrt(_bot->GetExactDistSq(snapshot.position)); // Calculate once from squared distance
if (!snapshot.isDead &&
snapshot.isHostile &&
(snapshot.isHostile || snapshot.isAttackable) &&
distance <= 60.0f)
{
// Target is valid based on snapshot data
@@ -1814,6 +1812,7 @@ void BotAI::AddStrategy(std::unique_ptr<Strategy> strategy)
{
// Loot strategy gets FOLLOW priority (50) - HIGHER than quest
// Ensures bots loot corpses immediately after combat before wandering
// IsActive() gates this to only activate when lootable corpses exist
priority = BehaviorPriority::FOLLOW;
}
else if (name == "rest")