Skip to content

Lone bots deploy detpack ambush at ghost - #1795

Merged
sunzenshen merged 4 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-deploy-detpack
Aug 18, 2026
Merged

Lone bots deploy detpack ambush at ghost#1795
sunzenshen merged 4 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-deploy-detpack

Conversation

@sunzenshen

Copy link
Copy Markdown
Contributor

Description

Consolidated bot ambush logic into its own behavior class and added the ability for bots to plant detpacks in such scenarios.

Toolchain

  • Windows MSVC VS2022

Comment thread src/game/server/neo/neo_player.cpp Outdated
Comment thread src/game/server/neo/neo_player.cpp Outdated
Comment thread src/game/shared/neo/weapons/weapon_detpack.cpp Outdated
@sunzenshen

sunzenshen commented Mar 7, 2026

Copy link
Copy Markdown
Contributor Author

The easiest way to test the behavior for me was honestly to give all players GiveDet in neo_player.cpp, and to set up a game with 2 players. You can either watch the two bots try to plant the det on the ghost, or you can use noclip and nb_debug behavior to bait the other player into various behaviors, such as by making loud sounds nearby.

@sunzenshen
sunzenshen requested a review from a team March 7, 2026 20:12
@sunzenshen sunzenshen added the Bots Related to bot players label Mar 7, 2026

@AdamTadeusz AdamTadeusz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

generally fine, could probably drop the ghost handle and get the ghost position from neorules

Comment thread src/game/server/neo/bot/behavior/neo_bot_ctg_lone_wolf.cpp Outdated
AdamTadeusz
AdamTadeusz previously approved these changes Mar 18, 2026
@sunzenshen
sunzenshen marked this pull request as draft March 19, 2026 07:43
@sunzenshen

Copy link
Copy Markdown
Contributor Author

In verifying a code review pass, I realized that there was a defect with the case where bots do not have a detpack and are waiting, which I didn't notice because it was boring to watch the wait behavior. I think I need to take this behavior to the drawing board and test out some potential restructuring of the behavior.

@sunzenshen

sunzenshen commented Mar 23, 2026

Copy link
Copy Markdown
Contributor Author

In verifying a code review pass, I realized that there was a defect with the case where bots do not have a detpack and are waiting, which I didn't notice because it was boring to watch the wait behavior. I think I need to take this behavior to the drawing board and test out some potential restructuring of the behavior.

Related to what I mentioned, part of the issue with testing was that it was extremely boring to watch 2 bots wait each other out and then get destroyed when one decided to break the stalemate by picking up the ghost. Before there was a bug with the bots constantly dropping their weapon when they didn't have the detpack that wasn't noticed because it was too boring to watch that scenario.

In this update, I ended up implementing a rudimentary exploration behavior where bots keep track of what NavAreas they have seen and try to search for enemies. The hope is that this behavior is more interesting to watch than seeing a bot inevitably fail to cap the ghost. The tradeoff is that bots now will never attempt to capture the ghost if the are a sole survivor, so that we don't have to review a lot of ghost capture decision making code in this PR.

The general logic flow is something like this:

  • First walk to the ghost to get visual contact of its area
  • If bot has a detpack try planting it
  • Just before a bot starts arming the detpack or dropping their weapon to pick up the ghost, do a last minute entity search for any existing deployed detpacks. Go into search mode if there is a trap to try to find the planter. (In reality, the planter will hear the footsteps and blow the detpack, but maybe this is a good discussion point for how loud footsteps should be because I eyeballed the audible range.)
  • If a bot finished deploying a detpack or just arrived near the ghost, wait in ambush
  • Wait in ambush until the enemy arrives, or a timer has expired and it's a 1v1 situation
  • Search for the enemy around unexplored areas of the map

The flow is intentionally relatively one directional so that it's easier to understand and also avoids some circular transitions that happened with earlier iterations of this code.

Helpful testing script:

bot_class 0;
sv_neo_preround_freeze_time 2;
mp_chattime 2; 
nb_debug behavior;
sv_neo_grenade_show_path 1;
host_timescale 3;

Then observe bot fights in cases of 1v1, 2v2, 1v2.

@sunzenshen
sunzenshen marked this pull request as ready for review March 23, 2026 12:10
@sunzenshen
sunzenshen requested review from a team and AdamTadeusz March 23, 2026 12:22
@sunzenshen
sunzenshen force-pushed the bot-deploy-detpack branch from 4451c5d to 0fb069c Compare April 3, 2026 04:56
AdamTadeusz
AdamTadeusz previously approved these changes Apr 3, 2026
@sunzenshen

Copy link
Copy Markdown
Contributor Author

Fixed merge conflict by accepting all new incoming files in CMakelists.txt

@sunzenshen
sunzenshen force-pushed the bot-deploy-detpack branch from 77744f8 to 5b94e3c Compare June 18, 2026 06:06
Comment thread src/game/server/neo/bot/behavior/neo_bot_ctg_lone_wolf_seek.cpp
@sunzenshen
sunzenshen force-pushed the bot-deploy-detpack branch from 5b94e3c to b68a6da Compare June 27, 2026 05:11
@sunzenshen

sunzenshen commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

I decided to pare down the scope of the changes to just the bot exploration behavior around the ghost, into this PR: #2001

The idea is to review that enemy search behavior first, without having to worry about the detpack deploying and sound detection behavior. If PR #2001 gets merged in, then I'll rebase and clean up this PR to review the detpack logic.

One can see what was excised from PR #1795 by looking at this commit: 88169cc

@sunzenshen
sunzenshen removed the request for review from a team July 14, 2026 05:11
@sunzenshen
sunzenshen force-pushed the bot-deploy-detpack branch 2 times, most recently from f38efae to 28419ef Compare July 16, 2026 04:06
@sunzenshen
sunzenshen requested a review from a team July 16, 2026 04:07
@sunzenshen
sunzenshen marked this pull request as ready for review July 16, 2026 04:07
@sunzenshen

Copy link
Copy Markdown
Contributor Author

I pared down the scope of this review by removing a number of the sound detection changes that this PR previously had, to focus on just the detpack deployment and trigger behavior.

To test, one can force the bots all be Recon class as well as reducing the inter-round timers with the following script:

bot_class 0;
sv_neo_preround_freeze_time 2;
mp_chattime 2; 

and setting the number of bots to 2. One can also drop in as a player and make some large noises around an enemy detpack, if the detpack avoidance behavior in the deploying behavior causes the bots not to reach inside the blast radius.

AdamTadeusz
AdamTadeusz previously approved these changes Aug 14, 2026

@AdamTadeusz AdamTadeusz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some weird behavior when there's no valid ambush position, but generally great

Comment thread src/game/server/neo/bot/behavior/neo_bot_ctg_lone_wolf.cpp
AdamTadeusz
AdamTadeusz previously approved these changes Aug 14, 2026

@AdamTadeusz AdamTadeusz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I notice that bots re-path very frequently when going to an ambush position, which often causes them to run back and forth in front of the ghost, is this intentional?

Comment thread src/game/server/neo/bot/behavior/neo_bot_ctg_lone_wolf.cpp Outdated
@Rainyan
Rainyan requested a review from a team August 14, 2026 18:29
Only follow short recompute pattern with paths that are short and without additional path requirements
@AdamTadeusz
AdamTadeusz requested a review from a team August 17, 2026 10:14
Comment thread src/game/server/neo/bot/behavior/neo_bot_tactical_monitor.cpp
Comment thread src/game/server/neo/bot/behavior/neo_bot_tactical_monitor.cpp
@sunzenshen
sunzenshen merged commit 8bfa98b into NeotokyoRebuild:master Aug 18, 2026
7 checks passed
@sunzenshen
sunzenshen deleted the bot-deploy-detpack branch September 6, 2026 21:59
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