From d9140429a61ff6ee04bbdb5b1c3a4b0d953fe50d Mon Sep 17 00:00:00 2001 From: Alan Shen Date: Sat, 12 Sep 2026 00:30:47 -0600 Subject: [PATCH] Bots follow commander into smoke and smoke hazard optimization --- src/game/server/neo/bot/neo_bot_path_cost.cpp | 3 ++- src/game/server/neo/bot/neo_bot_path_cost.h | 1 + src/game/server/neo/bot/neo_bot_path_reservation.cpp | 8 ++++++++ src/game/server/neo/bot/neo_bot_path_reservation.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/game/server/neo/bot/neo_bot_path_cost.cpp b/src/game/server/neo/bot/neo_bot_path_cost.cpp index 81199a0dee..b198ff5299 100644 --- a/src/game/server/neo/bot/neo_bot_path_cost.cpp +++ b/src/game/server/neo/bot/neo_bot_path_cost.cpp @@ -41,6 +41,7 @@ CNEOBotPathCost::CNEOBotPathCost(CNEOBot* me, RouteType routeType) m_maxJumpHeight = me->GetLocomotionInterface()->GetMaxJumpHeight(); m_maxDropHeight = me->GetLocomotionInterface()->GetDeathDropHeight(); m_bIgnoreReservations = !neo_bot_path_reservation_enable.GetBool(); + m_bIgnoreHazards = (me->m_hCommandingPlayer.Get() != nullptr); } //------------------------------------------------------------------------------------------------- @@ -61,7 +62,7 @@ float CNEOBotPathCost::operator()(CNavArea* baseArea, CNavArea* fromArea, const return -1.0f; } - if ( CNEOBotPathReservations()->IsAreaHazardous(area->GetID(), m_me) ) + if ( !m_bIgnoreHazards && CNEOBotPathReservations()->IsAreaHazardous(area->GetID(), m_me) ) { if ( m_routeType == DEFAULT_ROUTE ) { diff --git a/src/game/server/neo/bot/neo_bot_path_cost.h b/src/game/server/neo/bot/neo_bot_path_cost.h index 55ce34b43e..bfaff2d278 100644 --- a/src/game/server/neo/bot/neo_bot_path_cost.h +++ b/src/game/server/neo/bot/neo_bot_path_cost.h @@ -26,6 +26,7 @@ class CNEOBotPathCost : public IPathCost bool m_bIgnoreReservations; private: + bool m_bIgnoreHazards; CNEOBot* m_me; RouteType m_routeType; float m_stepHeight; diff --git a/src/game/server/neo/bot/neo_bot_path_reservation.cpp b/src/game/server/neo/bot/neo_bot_path_reservation.cpp index 65d08ecb34..a5c6b0704c 100644 --- a/src/game/server/neo/bot/neo_bot_path_reservation.cpp +++ b/src/game/server/neo/bot/neo_bot_path_reservation.cpp @@ -393,6 +393,7 @@ void CNEOBotPathReservationSystem::AddDeadlyHazard(int navAreaID, float expireTi HazardInfo blank; blank.hazardExpireTime = expireTime; blank.smokeExpireTime = 0.0f; + blank.smokePropagateTime = 0.0f; index = m_HazardAreas[teamID].Insert(navAreaID, blank); } else @@ -466,6 +467,7 @@ void CNEOBotPathReservationSystem::AddSmokeHazard(int navAreaID, float expireTim HazardInfo blank; blank.hazardExpireTime = 0.0f; blank.smokeExpireTime = expireTime; + blank.smokePropagateTime = 0.0f; index = m_HazardAreas[teamID].Insert(navAreaID, blank); } else @@ -475,6 +477,10 @@ void CNEOBotPathReservationSystem::AddSmokeHazard(int navAreaID, float expireTim // May also work for resetting an area to be non-hazardous early existing.smokeExpireTime = expireTime; + if (propagatePVS && (existing.smokePropagateTime == expireTime)) + { + return; + } } if (propagatePVS) @@ -482,6 +488,8 @@ void CNEOBotPathReservationSystem::AddSmokeHazard(int navAreaID, float expireTim CNavArea *area = TheNavMesh->GetNavAreaByID(navAreaID); if (area) { + m_HazardAreas[teamID][index].smokePropagateTime = expireTime; + CNEOFunctorPropagatePVSSmokeHazard propagate(expireTime, teamID); // CompletelyVisible: fewer areas to iterate through and definitely exposed // vs PotentiallyVisible: for narrow corridors, some areas would count even if only a sliver was exposed diff --git a/src/game/server/neo/bot/neo_bot_path_reservation.h b/src/game/server/neo/bot/neo_bot_path_reservation.h index 932642d1aa..de261b778b 100644 --- a/src/game/server/neo/bot/neo_bot_path_reservation.h +++ b/src/game/server/neo/bot/neo_bot_path_reservation.h @@ -17,6 +17,7 @@ struct HazardInfo { float smokeExpireTime; // when the smoke hazard risk expires float hazardExpireTime; // when a general deadly hazard risk expires + float smokePropagateTime; // expiry this area has already propagated to its visible set }; struct BotReservedAreas_t