Skip to content

Bots throw grenades from cover#1651

Open
sunzenshen wants to merge 7 commits intoNeotokyoRebuild:masterfrom
sunzenshen:bot_attack_with_grenades
Open

Bots throw grenades from cover#1651
sunzenshen wants to merge 7 commits intoNeotokyoRebuild:masterfrom
sunzenshen:bot_attack_with_grenades

Conversation

@sunzenshen
Copy link
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
Contributor Author

Demo with sv_neo_grenade_debug_behavior enabled:

}

bool bEnemySupportInField = false;
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To start the conversation, I wonder if we should check if there are any human non-support players on the bot's team before throwing smoke. Bots don't have too much trouble navigating smoked areas, but I imagine humans could struggle to navigate on maps with fewer routes like bullet.

Copy link
Collaborator

@Rainyan Rainyan Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One fuzzy measure could be calculating a numeric value for how "useful" the smoke would be, based on number of nearby supports, and whether they are friendly/enemy or bot/human, and try to make it such that smokes that may hinder human friendlies are to be avoided, even if they were marginally useful for some bots. And likewise avoid smokes that give advantage to human enemies based on some metric like that.

Copy link
Contributor Author

@sunzenshen sunzenshen Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After watching a friend try the game the other evening, I decided that for the scope of this review, I'd like to make the use of smokes somewhat conservative, avoiding disoriented humans and enemies that could exploit the smoke screen. (As one may guess, the very first thing they did was walk into a smoke cloud and then immediately became lost for the duration. 🥲 )

Then another PR could explore a more sophisticated handling of smokes. For example, maybe we could calculate a path to the smoke target, estimate the movement time needed, and figure out if a player could realistically reach and view the smoke based on their class movement.

Copy link
Collaborator

@Rainyan Rainyan Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've definitely entered the bikeshed, but: it might be interesting to try a kind of VR Chaperone style effect inside smokes, to represent the in-smoke fumbling player having tactile feedback of physically hitting/brushing against the wall (it's basically solving for the same thing IRL):

chaperone

I imagine this might be able to reuse the friendly HUD X-ray shader stuff, but I'm not too familiar with that code.


Then another PR could explore a more sophisticated handling of smokes. For example, maybe we could calculate a path the the smoke target, estimate the movement time needed, and figure out if a player could realistically reach and view the smoke based on their class movement.

Definitely, I think we should implement some kind of code to calculate the full flight path of a grenade ahead of time, and that could be used for stuff like these bot throws, but also for training modes to practice nade throws etc like in CS (the smaller PiP screens show where that nade is going to land):

cs2_grenprev

@sunzenshen sunzenshen force-pushed the bot_attack_with_grenades branch from 3501a89 to d0d9fc1 Compare February 12, 2026 08:26
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.

2 participants