Skip to content

Bots avoid grenade-related hazard areas - #2020

Merged
sunzenshen merged 1 commit into
NeotokyoRebuild:masterfrom
sunzenshen:bot-avoid-smoke
Sep 12, 2026
Merged

sunzenshen merged 1 commit into
NeotokyoRebuild:masterfrom
sunzenshen:bot-avoid-smoke

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

Bots avoid hazard areas:

  • areas that are in line of sight of a smoke cloud
  • areas that are in line of sight of a grenade trajectory

Toolchain

  • Windows MSVC VS2022

Comment thread src/game/server/neo/bot/behavior/neo_bot_behavior.cpp

@sunzenshen sunzenshen left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The goal of this PR was to have bots avoid areas that were visible from smoked areas, if they do not have thermal vision. Before this PR, bots tended to disregard smoke and would fall victim to either Support bots or humans that know to spray into the smoke. This PR introduces a time-expiring hazard area marking lookup for smoke and general hazardous areas.

Along with support for smoke, I added hazard area marking for grenades and death locations. The thinking for bot grenade trajectories is that they are so erratic that it's safer to assume that any place along the trajectory towards the target and beyond is a dangerous area. For marking death areas of friendly bots, it's mostly to have bots pause towards running into a fatal funnel if the room is narrow enough to be blocked by the bot death locations.

Comment thread src/game/server/neo/bot/neo_bot_path_cost.cpp
Comment thread src/game/server/neo/bot/neo_bot_path_cost.cpp
@sunzenshen
sunzenshen requested a review from a team July 14, 2026 05:03
@sunzenshen sunzenshen added the Bots Related to bot players label Jul 14, 2026
@sunzenshen

Copy link
Copy Markdown
Contributor Author

Demo example of bots moving out of a room with smoke coverage, into one where there is no exposed smoke:

bot-avoid-smoke-demo.mp4

@sunzenshen sunzenshen left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I forgot that I also incremented OnStuck area avoidance penalties for bot death areas, not just for bots getting stuck so here's another set of adjustments when testing the allowance of bot death areas as candidates for where to escape a hazard.

Comment thread src/game/server/neo/bot/behavior/neo_bot_attack.cpp
Comment thread src/game/server/neo/bot/behavior/neo_bot_attack.cpp
Comment thread src/game/server/neo/bot/behavior/neo_bot_retreat_from_grenade.cpp Outdated
@sunzenshen
sunzenshen removed the request for review from a team July 15, 2026 03:30
@sunzenshen
sunzenshen marked this pull request as draft July 15, 2026 03:30
@sunzenshen
sunzenshen force-pushed the bot-avoid-smoke branch 5 times, most recently from 75814a1 to 0134d13 Compare July 18, 2026 00:29
@sunzenshen sunzenshen changed the title Bots avoid hazard areas Bots avoid grenade related hazard areas Jul 18, 2026
@sunzenshen
sunzenshen marked this pull request as ready for review July 18, 2026 00:34
@sunzenshen
sunzenshen requested a review from a team July 18, 2026 00:34

@sunzenshen sunzenshen left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Finally figured out why bots completely stop when blocked by a hazard area, and implemented partial pathing up to hazard area boundaries.

Opening up this PR for review again.

Here's the script I used to set up observation of bot behavior:

sv_neo_preround_freeze_time 2;

mp_chattime 2; 
cl_neo_grenade_show_path 1; sv_neo_grenade_show_path 1;

sv_neo_bot_grenade_polite_smoke 0;
sv_neo_bot_grenade_polite_frag 0;

nb_debug path;

Comment thread src/game/server/neo/bot/behavior/neo_bot_ctg_escort.cpp Outdated
Comment thread src/game/server/neo/bot/behavior/neo_bot_grenade_dispatch.cpp
Comment thread src/game/server/neo/bot/behavior/neo_bot_grenade_throw_frag.cpp
Comment thread src/game/server/neo/bot/behavior/neo_bot_tactical_monitor.cpp
Comment thread src/game/server/neo/bot/neo_bot_path_compute.cpp
Comment thread src/game/server/neo/bot/neo_bot_path_compute.h
Comment thread src/game/shared/neo/neo_gamerules.cpp
@sunzenshen sunzenshen changed the title Bots avoid grenade related hazard areas Bots avoid grenade-related hazard areas Jul 23, 2026
Comment thread src/game/server/NextBot/NextBotVisionInterface.cpp
Comment thread src/game/server/NextBot/NextBotVisionInterface.cpp
Comment thread src/game/server/neo/bot/behavior/neo_bot_tactical_monitor.cpp
AdamTadeusz
AdamTadeusz previously approved these changes Aug 17, 2026
@sunzenshen

sunzenshen commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

Needed to rebase a merge conflict from #2065

In reviewing the conflicts, I realized that I needed to clean up the repath timer still in the new hazard avoidance class to match the #2065 convention, and also fixed a potential null dereference with a bot's chosen safe area (we hadn't seen it because for the most part bots have been able to find safe areas easily in the maps we tested).

AdamTadeusz
AdamTadeusz previously approved these changes Aug 23, 2026
@sunzenshen

Copy link
Copy Markdown
Contributor Author

Needed to rebase

Bots avoid hazard areas:
- areas that are in line of sight of a smoke cloud
- areas that are in line of sight of a grenade trajectory
Comment thread src/game/server/neo/bot/neo_bot_path_reservation.cpp
Comment thread src/game/server/NextBot/NextBotVisionInterface.cpp
Comment thread src/game/server/neo/bot/neo_bot_path_cost.cpp
Comment thread src/game/server/neo/bot/behavior/neo_bot_tactical_monitor.cpp
@sunzenshen
sunzenshen merged commit ab6128f into NeotokyoRebuild:master Sep 12, 2026
7 checks passed
@sunzenshen

Copy link
Copy Markdown
Contributor Author

Addressed @sunmachine 's code review feedback in #2128

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