Skip to content

Bots throw grenades from cover#1651

Merged
sunzenshen merged 13 commits intoNeotokyoRebuild:masterfrom
sunzenshen:bot_attack_with_grenades
Feb 28, 2026
Merged

Bots throw grenades from cover#1651
sunzenshen merged 13 commits intoNeotokyoRebuild:masterfrom
sunzenshen:bot_attack_with_grenades

Conversation

@sunzenshen
Copy link
Copy Markdown
Contributor

Description

Bots decide whether they can throw a grenade at a threat after retreating to cover.

Toolchain

  • Windows MSVC VS2022

@sunzenshen sunzenshen requested a review from a team February 7, 2026 08:19
@sunzenshen sunzenshen added the Bots Related to bot players label Feb 7, 2026
@sunzenshen sunzenshen removed the request for review from a team February 7, 2026 18:22
@sunzenshen sunzenshen marked this pull request as draft February 7, 2026 18:22
@sunzenshen sunzenshen force-pushed the bot_attack_with_grenades branch from 07498e9 to ad14b7a Compare February 9, 2026 10:22
@sunzenshen sunzenshen marked this pull request as ready for review February 9, 2026 10:30
@sunzenshen sunzenshen requested a review from a team February 9, 2026 10:30
@sunzenshen
Copy link
Copy Markdown
Contributor Author

Demo with sv_neo_grenade_debug_behavior enabled:

Comment thread src/game/server/neo/bot/behavior/neo_bot_grenade_dispatch.cpp
@sunzenshen sunzenshen force-pushed the bot_attack_with_grenades branch from 3501a89 to d0d9fc1 Compare February 12, 2026 08:26
@Rainyan Rainyan self-requested a review February 15, 2026 14:50
Rainyan

This comment was marked as resolved.

@Rainyan Rainyan requested a review from a team February 19, 2026 21:57
@sunzenshen sunzenshen force-pushed the bot_attack_with_grenades branch from d0d9fc1 to a2c5ce3 Compare February 20, 2026 08:22
@sunzenshen
Copy link
Copy Markdown
Contributor Author

Added some tweaks on top of the code review feedback, where the tweaks can be seen by themselves with:

@sunzenshen sunzenshen requested a review from Rainyan February 20, 2026 08:25
Comment thread src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp
@sunzenshen sunzenshen force-pushed the bot_attack_with_grenades branch from a2c5ce3 to d57931c Compare February 21, 2026 08:07
@sunzenshen
Copy link
Copy Markdown
Contributor Author

Pardon the large set of changes after the initial review. After watching the bots throw grenades in the context of playing rounds of CTG, I decided to chase down some edge cases with throw reliability and frag safety.

@sunzenshen sunzenshen force-pushed the bot_attack_with_grenades branch from d57931c to 66b30a0 Compare February 22, 2026 19:10
Rainyan
Rainyan previously approved these changes Feb 22, 2026
Comment thread src/game/server/neo/bot/behavior/neo_bot_grenade_dispatch.cpp Outdated
Comment thread src/game/server/neo/bot/behavior/neo_bot_grenade_throw.cpp Outdated
Comment thread src/game/server/neo/bot/behavior/neo_bot_grenade_throw.cpp Outdated
@sunzenshen
Copy link
Copy Markdown
Contributor Author

sunzenshen commented Feb 23, 2026

Really sorry for the additional code churn and I should have done this earlier, but I was previously hoping that the grenade retreat logic from tactical monitor would fire soon enough after a grenade was thrown, but after seeing another bot run after their grenade and die, don't think it's triggering fast enough. (To recap, the tactical monitor check is throttled to emulate a human reaction time, but I think we need to immediately trigger a search for throwers since they are both immediately near their own grenade and they are often running in the same direction of their throw.)

So I refactored out the grenade search from tactical monitor and placed it directly in the grenade retreat behavior. I also adapted the grenade retreat behavior to allow triggering without a specific grenade threat, so that we can trigger a grenade retreat immediately after a throw.

@sunzenshen sunzenshen force-pushed the bot_attack_with_grenades branch from ad4b313 to 96d8dba Compare February 27, 2026 10:11
Comment thread src/game/server/neo/bot/behavior/neo_bot_retreat_from_grenade.cpp
@Rainyan Rainyan requested a review from a team February 27, 2026 18:43
@sunzenshen sunzenshen merged commit a399248 into NeotokyoRebuild:master Feb 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bots Related to bot players

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants