Bots can attack toward an optional coordinate#2000
Conversation
sunzenshen
left a comment
There was a problem hiding this comment.
The impetus for this PR was that I wanted to have bots take advantage of the cover seeking routines while being commanded by a player, while also following the player's waypoint. Before, using the existing Attack behavior locked bots into combat until the enemy was destroyed or the bots lost track of them, which essentially took the bots out of control of the commanding player.
Also, while #1805 was a start at proving out the cover seeking search, there were some cases where bots chose paths that avoided the enemy and did not engage with the objective. I was also trying to keep within the conventions of hl2mp_bot_attack.cpp in that PR, by inserting the path searching logic unobtrusively when the bot was behind existing cover. For this PR I have essentially did an full rewrite of the attack behavior based on the set of bot features built up to this point.
To help diagnose and observe the cover selecting choices, there is a new ConVar sv_neo_bot_attack_debug_cover, where when enabled, shows lines emitting from each bot, where:
- Red: shows where the bot thinks the enemy is
- Green: shows the optional position that the bot wants to get closer to
- Yellow: shows the cover area that the bot picked to advance towards their goal or enemy
Generally if there is only a Red line, the bot is in direct chase mode. If there are no lines and the bot is attacking the enemy, the bot is likely in CNEOBotRetreatToCover and is trying to find the nearest cover without regard to a goal direction.
| if ( CNEO_Player *pCommander = me->m_hCommandingPlayer.Get() ) | ||
| { | ||
| const Vector& vWaypointPingLocation = pCommander->m_vLastPingByStar.Get(me->GetStar()); | ||
| return SuspendFor( new CNEOBotAttack(vWaypointPingLocation), "Engaging enemy en route to waypoint" ); |
There was a problem hiding this comment.
By adding an optional vector position parameter to CNEOBotAttack, we can direct bots to search for cover in the direction of the vector position. For example, in this case we are directing the bots to attack the enemy while advancing between cover spots that are directionally closer to their commanding player's ping waypoint.
One known design tradeoff is that bots will not immediate change their direction of movement if the player places another ping when the bots are in the Attack behavior. My thinking is that this is okay, as bots should terminate the attack behavior earlier when they both have the optional goal waypoint while not seeing the enemy when moving between cover. I think it's fine not to interrupt the bots in the middle of their current plan, as it's more important that they don't change their minds indecisively and get destroyed when executing a cover plan.
| if ( grenadeArea ) | ||
| { | ||
| if ( area->IsPotentiallyVisible( grenadeArea ) ) | ||
| if ( grenadeArea->IsPotentiallyVisible( area ) ) |
There was a problem hiding this comment.
For this PR I took some time to review whether the directionality of observation made since for every call for IsPotentiallyVisible and IsCompletelyVisible.
| // Support has difficulty seeing cloak in thermal vision | ||
| ConVar sv_neo_bot_cloak_detection_bonus_non_support("sv_neo_bot_cloak_detection_bonus_non_support", "1", FCVAR_NONE, | ||
| ConVar sv_neo_bot_cloak_detection_bonus_non_support("sv_neo_bot_cloak_detection_bonus_non_support", "5", FCVAR_NONE, | ||
| "Bot cloak detection bonus for non-support classes", true, 0, true, 100); |
There was a problem hiding this comment.
The more aggressive bot attacking behavior showed some quirks of having the bots not detect cloaked enemies, especially if the two teams rush each other's positions (at the original values, the two teams either stared at each other at point blank range, or swapped positions). I decided to slightly bump the detection changes, though perhaps we might want to boost them even more.
|
Demo: https://streamable.com/t032e5 Script used to set up the faster round reset timers: |
Description
Allows inputting an optional vector position into the bot Attack behavior which then serves as a goal direction to look for cover towards while engaging the enemy.
Toolchain
Linked Issues