|
5 | 5 | #include "neo_bot_locomotion.h" |
6 | 6 | #include "nav_mesh.h" |
7 | 7 | #include "neo_bot_path_reservation.h" |
| 8 | +#include "weapon_neobasecombatweapon.h" |
8 | 9 |
|
9 | 10 | extern ConVar neo_bot_path_reservation_enable; |
10 | 11 |
|
11 | 12 | ConVar neo_bot_path_around_friendly_cooldown("neo_bot_path_around_friendly_cooldown", "2.0", FCVAR_CHEAT, |
12 | 13 | "How often to check for friendly path dispersion", false, 0, false, 60); |
13 | 14 |
|
14 | | -ConVar neo_bot_path_penalty_jump_multiplier("neo_bot_path_penalty_jump_multiplier", "100.0", FCVAR_CHEAT, |
| 15 | +ConVar neo_bot_path_penalty_jump_multiplier("neo_bot_path_penalty_jump_multiplier", "1000.0", FCVAR_CHEAT, |
15 | 16 | "Maximum penalty multiplier for jump height changes in pathfinding", false, 0.01f, false, 1000.0f); |
16 | 17 |
|
17 | 18 | ConVar neo_bot_path_penalty_ladder_multiplier("neo_bot_path_penalty_ladder_multiplier", "3.0", FCVAR_CHEAT, |
18 | 19 | "Penalty multiplier for ladder traversal in pathfinding", true, 0.1f, true, 100.0f); |
19 | 20 |
|
| 21 | +ConVar neo_bot_path_penalty_exposure_base("neo_bot_path_penalty_exposure_base", "5.0", FCVAR_CHEAT, |
| 22 | + "General additional penalty per visible area for bots to avoid exposed areas", true, 0.0f, false, 0.0f); |
| 23 | + |
| 24 | +ConVar neo_bot_path_penalty_exposure_pistol("neo_bot_path_penalty_exposure_pistol", "10.0", FCVAR_CHEAT, |
| 25 | + "Additional penalty per visible area for bots wielding pistol caliber weapons", true, 0.0f, false, 0.0f); |
| 26 | + |
| 27 | +ConVar neo_bot_path_penalty_exposure_shotgun("neo_bot_path_penalty_exposure_shotgun", "20.0", FCVAR_CHEAT, |
| 28 | + "Additional penalty per visible area for shotgun-wielding bots", true, 0.0f, false, 0.0f); |
| 29 | + |
| 30 | +ConVar neo_bot_path_penalty_exposure_inverse_base_battle_rifle("neo_bot_path_penalty_exposure_inverse_base_battle_rifle", "500.0", FCVAR_CHEAT, |
| 31 | + "Base penalty for calculating inverse traversal penalty for semi-auto battle rifles", true, 1.0f, false, 0.0f); |
| 32 | + |
| 33 | +ConVar neo_bot_path_penalty_exposure_inverse_base_scoped("neo_bot_path_penalty_exposure_inverse_base_scoped", "1000.0", FCVAR_CHEAT, |
| 34 | + "Base penalty for calculating inverse traversal penalty for scoped weapons", true, 1.0f, false, 0.0f); |
| 35 | + |
20 | 36 | //------------------------------------------------------------------------------------------------- |
21 | 37 | CNEOBotPathCost::CNEOBotPathCost(CNEOBot* me, RouteType routeType) |
22 | 38 | { |
@@ -126,6 +142,50 @@ float CNEOBotPathCost::operator()(CNavArea* baseArea, CNavArea* fromArea, const |
126 | 142 | cost += CNEOBotPathReservations()->GetPredictedFriendlyPathCount(area->GetID(), m_me->GetTeamNumber()) * neo_bot_path_reservation_penalty.GetFloat(); |
127 | 143 | cost += CNEOBotPathReservations()->GetAreaAvoidPenalty(area->GetID()); |
128 | 144 |
|
| 145 | + // Weapon range penalties |
| 146 | + CNEOBaseCombatWeapon* myWeapon = ToNEOWeapon(m_me->GetActiveWeapon()); |
| 147 | + const int nWeaponBits = myWeapon->GetNeoWepBits(); |
| 148 | + if (myWeapon && (nWeaponBits & NEO_WEP_FIREARM)) |
| 149 | + { |
| 150 | + constexpr int nShotgunBits = NEO_WEP_AA13 | NEO_WEP_SUPA7; |
| 151 | + constexpr int nBattleRifleBits = NEO_WEP_M41 | NEO_WEP_M41_S; |
| 152 | + constexpr int nPistolCaliberBits = NEO_WEP_MILSO | NEO_WEP_TACHI | NEO_WEP_KYLA |
| 153 | + | NEO_WEP_MPN | NEO_WEP_MPN_S | NEO_WEP_JITTE | NEO_WEP_JITTE_S | NEO_WEP_SRM | NEO_WEP_SRM_S; |
| 154 | + |
| 155 | + const int visibleAreaCount = area->GetPotentiallyVisibleAreaCount(); |
| 156 | + |
| 157 | + if (nWeaponBits & nPistolCaliberBits) |
| 158 | + { |
| 159 | + // Weapons that don't have max first shot accuracy |
| 160 | + const float exposurePenalty = neo_bot_path_penalty_exposure_pistol.GetFloat(); |
| 161 | + dist += visibleAreaCount * exposurePenalty; |
| 162 | + } |
| 163 | + else if (nWeaponBits & nShotgunBits) |
| 164 | + { |
| 165 | + // Weapons that have spread that can't hit long range targets |
| 166 | + const float exposurePenalty = neo_bot_path_penalty_exposure_shotgun.GetFloat(); |
| 167 | + dist += visibleAreaCount * exposurePenalty; |
| 168 | + } |
| 169 | + else if (nWeaponBits & nBattleRifleBits) |
| 170 | + { |
| 171 | + // Weapons that benefit from medium sightlines that can see many NavAreas |
| 172 | + const float baseline_penalty = neo_bot_path_penalty_exposure_inverse_base_battle_rifle.GetFloat(); |
| 173 | + dist += baseline_penalty / visibleAreaCount; |
| 174 | + } |
| 175 | + else if (nWeaponBits & NEO_WEP_SCOPEDWEAPON) |
| 176 | + { |
| 177 | + // Weapons that benefit from long sightlines that can see many NavAreas |
| 178 | + const float baseline_penalty = neo_bot_path_penalty_exposure_inverse_base_scoped.GetFloat(); |
| 179 | + dist += baseline_penalty / visibleAreaCount; |
| 180 | + } |
| 181 | + else |
| 182 | + { |
| 183 | + // Generally avoiding exposed areas when traversing a wide open area |
| 184 | + const float exposurePenalty = neo_bot_path_penalty_exposure_base.GetFloat(); |
| 185 | + dist += visibleAreaCount * exposurePenalty; |
| 186 | + } |
| 187 | + } |
| 188 | + |
129 | 189 | if (m_routeType == SAFEST_ROUTE) |
130 | 190 | { |
131 | 191 | // NEO Jank Cheat: Incorporate enemy bot paths so that we don't run directly into their line of fire |
|
0 commit comments