Skip to content

Bots avoid neo_npc_targetsystem via nav PVS - #2179

Merged
sunzenshen merged 6 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-avoid-npc-turret-pvs-0927
Oct 17, 2026
Merged

sunzenshen merged 6 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-avoid-npc-turret-pvs-0927

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

In casual mode ntre_rogue_ctg runs a scripted tank (neo_npc_targetsystem) on a loop round the roads. Bots had no notion of it and walked into its line of fire: in 8 test matches its turret took 15 % of the kills.

On ntre_rogue_ctg with the NPC tank (neo_npc_targetsystem), bots avoid the tank by querying the hazard avoidance system. The tank updates that hazard with areas approximating its line of sight.

Navmesh PRs that rely on this

None. NeotokyoRebuild/neoAssets#158 (ntre_rogue_ctg) beats master with the tank and without it on bot code that does not have this PR, so it does not wait on it. This PR addresses what the mesh cannot: bots walking into the tank's line of fire.

Testing

Local bot matches on this branch plus harness logging, with a test-only switch between upstream behavior and this PR. ntre_rogue_ctg, 12 bots, default damage, ghost pinned at each of the 5 spawns x 10: 100 matches, 50 an arm, all ended cleanly with 0 asserts.

per round / match upstream this PR
deaths to the tank, a round 2.13 1.34
rounds ending in a ghost capture 17 % 41 %
"no path" move failures, a match 1.3 13.9
stuck events, a match 2.6 8.2
kills, a match 17.5 15.8

Known side effect: most of the new "no path" failures come from bots chasing the enemy ghost carrier (ctgEnemy) while the carrier stands where the tank can see. The hazard takes those areas out of pathing, so the chaser cannot build a path to its target. That probably explains part of the capture rise as well: carriers are harder to chase down, not only safer from the tank.

Walking while cloaked (review fix, 2026-10-16)

The tank ignores a cloaked player only below 180 u/s, but a Recon's base speed is 200, so a cloaked retreat still drew fire. Bots now release run and hold sneak while cloaked during the retreat (walk speed: Recon 150, Assault 120). Measured against this PR before the fix: ntre_rogue_ctg, Release build, 12 bots, ghost pinned at each of the 5 spawns x 32 with the rank tier rotated, 160 matches an arm, all ended cleanly.

per round before the fix with the fix
deaths to the tank 1.21 [1.02, 1.39] 0.92 [0.76, 1.07]
run-over deaths 0.062 0.050
rounds ending in a ghost capture 34 % 33 %

Deaths to the tank fall by 0.29 a round [-0.53, -0.04], at every rank tier. While retreating cloaked, Recon is at or above 180 u/s on 3 % of ticks (was 66 %) and Assault on 1 % (was 39 %); the tank killed 2 of 139 such bots (was 33 of 183).

Cloaking in the tank's sight and hurrying past it (2026-10-16)

Rebased onto current master. Three commits on top:

  • The cloak mark now spreads to every area the tank can see, not only its own area and its target's, so a bot retreating out of its sight cloaks.
  • A hurrying bot in the tank's sight cloaks and keeps going instead of retreating; a cloaked Assault holds off sprinting (base speed 160 is under the 180 u/s motion-vision limit).
  • The turret's sight is its own mark, apart from deadly marks: bots that are not hurrying still avoid it, and the tank's own area (run over) stays deadly. A hurrying bot crosses the sight at the cost of Let hurrying bots path through smoke hazards #2260's neo_bot_path_penalty_hurry_hazard_multiplier (default 20) only when no detour exists. This branch is built on top of Let hurrying bots path through smoke hazards #2260 and adds no path-cost code of its own.

ntre_rogue_ctg, Release build: 5 matches, one per ghost spawn, all ended cleanly with 0 asserts. 80 matches an arm against the rebased previous head (12 bots, rank tier rotated):

per round previous head this head
deaths to the tank 1.01 [0.76, 1.27] 0.81 [0.61, 1.02]
run-over deaths 0.050 0.025
rounds ending in a ghost capture 21 % 19 %

After rebuilding on #2260 (7485aec6c): 1 match on ntre_rogue_ctg with the multiplier set to 25, ended cleanly with 0 asserts. Rebased onto master after #2260 merged (1ab1e19ef, no change to this PR's files): 1 match on ntre_rogue_ctg, Release, ended cleanly with 0 asserts.

  • Linux GCC (dedicated server, debug build)

Toolchain

  • Linux GCC Distro Native (Linux Mint 22.3, GCC 13.3.0)

Linked Issues

sunzenshen added a commit to sunzenshen/neo that referenced this pull request Oct 1, 2026
@sunzenshen
sunzenshen force-pushed the bot-avoid-npc-turret-pvs-0927 branch from c79a868 to 4b30e7c Compare October 3, 2026 17:51
@sunzenshen
sunzenshen force-pushed the bot-avoid-npc-turret-pvs-0927 branch from 4b30e7c to f317bf4 Compare October 12, 2026 03:55
@sunzenshen
sunzenshen marked this pull request as ready for review October 13, 2026 01:18
@sunzenshen
sunzenshen requested a review from sunmachine October 13, 2026 01:18
@sunzenshen sunzenshen added the Bots Related to bot players label Oct 13, 2026
@sunzenshen
sunzenshen force-pushed the bot-avoid-npc-turret-pvs-0927 branch from f317bf4 to 5237977 Compare October 15, 2026 04:09
Comment thread src/game/server/neo/neo_npc_targetsystem.cpp Outdated
Comment thread src/game/server/neo/neo_npc_targetsystem.cpp
Comment thread src/game/server/neo/neo_npc_targetsystem.cpp
@sunzenshen
sunzenshen force-pushed the bot-avoid-npc-turret-pvs-0927 branch 2 times, most recently from fddcc44 to 7485aec Compare October 17, 2026 05:25
@sunmachine
sunmachine self-requested a review October 17, 2026 05:45
sunmachine
sunmachine previously approved these changes Oct 17, 2026

@sunmachine sunmachine 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.

This is looking good so long as we merge it in after #2260

The tank's motion vision ignores a cloaked player only under 180 u/s.
A Recon walks at 200 and a sprinting bot is faster still, so cloak
alone spent charge without hiding the bot. Release run and hold sneak
once the cloak is on, as CNEOBotCommandFollow does, which keeps every
class under the threshold (walk speed 150 or less).
Mark the tank's own area once per team: a targeted team gets the
visible-area hazard, which already includes the deadly marking, and
other teams get the deadly marking alone. Replace a one-shot lambda
left from an earlier functor with a plain if/else, and fix the header
comment, which described adjacent-area marking that was never done.
No behavior change.
The turret mark that tells bots to cloak was set only on the tank's
own area and its target's, while the tank's deadly mark spread to
every area it can see. A bot elsewhere in its sight retreated without
cloaking. The mark now spreads to the same visible areas; teams the
tank does not target still get only the run-over mark on its own
area, which gives no reason to cloak.
A bot in a hurry for the objective skips the hazard retreat, so it
never reached the retreat's cloak near the tank. In the tank's line
of fire it now cloaks and keeps going; a cloaked Assault holds off
sprinting to stay under the 180 u/s the tank's motion vision ignores,
while a Recon keeps its pace and Support or the carrier cannot cloak.
A bot chasing on DEFAULT_ROUTE treated every area the tank can see as
impassable, so a hurrying interceptor stalled when no detour existed.
The turret mark is no longer also written as a deadly mark, so the
hurry penalty for hazards that are not deadly (NeotokyoRebuild#2260) now covers it:
in a hurry a bot crosses the tank's sight at a large path cost and
still detours when a detour exists. Grenades and the tank's own area
(run over) stay deadly, and every other hazard check counts the
turret mark as before.
@sunzenshen
sunzenshen dismissed sunmachine’s stale review October 17, 2026 05:55

The merge-base changed after approval.

@sunzenshen
sunzenshen force-pushed the bot-avoid-npc-turret-pvs-0927 branch from 7485aec to 1ab1e19 Compare October 17, 2026 05:55
@sunzenshen
sunzenshen requested a review from sunmachine October 17, 2026 05:56

@sunmachine sunmachine 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.

Still good. Still approved. Thanks for merge/rebase.

@sunzenshen
sunzenshen merged commit 0156ed6 into NeotokyoRebuild:master Oct 17, 2026
9 of 10 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.

2 participants