Skip to content

Bots apply nav pathing penalties based on weapon limits#1805

Open
sunzenshen wants to merge 5 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-shotgunners-prefer-enclosed-spaces
Open

Bots apply nav pathing penalties based on weapon limits#1805
sunzenshen wants to merge 5 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-shotgunners-prefer-enclosed-spaces

Conversation

@sunzenshen

Copy link
Copy Markdown
Contributor

Description

Bots consider relative level of exposure of a NavArea when deciding paths through the NavMesh

  • Bots with shotguns shy away from NavAreas that have many visibility connections
  • Bots with pistol caliber weapons slightly avoid areas but to a lesser degree
  • Bots with scoped/semi-auto weapons favor exposed NavAreas with long sightlines
  • Generally, a minor penalty is applied for NavArea exposure for bots to avoid wide open exposed NavAreas, unless they have a scoped/battle rifle

Toolchain

  • Windows MSVC VS2022

@sunzenshen sunzenshen requested a review from a team March 9, 2026 03:54
@sunzenshen

sunzenshen commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

Gallery of interesting paths now that bots are incentivized to avoid the most wide open areas when traversing the map:

Screenshot 2026-03-08 212054

Bots now generally hug walls as those NavAreas have fewer visibility connections along that edge:

Screenshot 2026-03-08 204006

A bot with a Supa takes the slightly long way around to take advantage of the closed off visibility area:

Screenshot 2026-03-08 205854

The cars, particularly the bus and truck, provide defilade protection when advancing:

Screenshot 2026-03-08 212642 Screenshot 2026-03-08 212750 Screenshot 2026-03-08 214102

The nudge away from exposed NavAreas encourages bots to use the defiladed ponds as cover.

Screenshot 2026-03-08 214130

The NavArea valleys under the rocks also have a reduced visibilty penalty for traversal and are now relatively less costly for bots as path choices:

Screenshot 2026-03-08 214228

An NSF Recon bot with a ZRL advancing to the garden (bottom center) moves to a NavArea that has many visibility connections due to exposure to both the garden and the pathway:

Screenshot 2026-03-08 214750

A bot with a semi-auto battle rifle uses a path that has wide open views:

Screenshot 2026-03-08 214844

"How often to check for friendly path dispersion", false, 0, false, 60);

ConVar neo_bot_path_penalty_jump_multiplier("neo_bot_path_penalty_jump_multiplier", "100.0", FCVAR_CHEAT,
ConVar neo_bot_path_penalty_jump_multiplier("neo_bot_path_penalty_jump_multiplier", "1000.0", FCVAR_CHEAT,

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.

Now that NavArea pathing costs are slightly elevated, need to bump up the penalty for jump paths to match the relatively increased baseline penalty costs.

"Path selection penalty added to a nav area each time a bot dies moving through that area.", true, 0, false, 0);

ConVar neo_bot_path_reservation_onstuck_penalty("neo_bot_path_reservation_onstuck_penalty", "10000", FCVAR_NONE,
ConVar neo_bot_path_reservation_onstuck_penalty("neo_bot_path_reservation_onstuck_penalty", "1000", FCVAR_NONE,

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.

When working on ladder climbing, I noticed that the previous penalty cost was so heavy that bots would fail to climb a challenging ladder a couple times and then never touch that ladder again for the rest of the match. So I figured toning down this penalty was warranted.

@sunzenshen sunzenshen added the Bots Related to bot players label Mar 9, 2026
@sunzenshen sunzenshen force-pushed the bot-shotgunners-prefer-enclosed-spaces branch from 0b2be5c to f6b8450 Compare March 13, 2026 03:32
@sunzenshen sunzenshen force-pushed the bot-shotgunners-prefer-enclosed-spaces branch from f6b8450 to 9d80dd3 Compare March 21, 2026 01:39
@sunzenshen sunzenshen force-pushed the bot-shotgunners-prefer-enclosed-spaces branch from 9d80dd3 to 3e11e84 Compare April 3, 2026 04:58
AdamTadeusz
AdamTadeusz previously approved these changes Apr 4, 2026
@sunzenshen sunzenshen requested a review from a team April 4, 2026 17:05
@sunzenshen sunzenshen force-pushed the bot-shotgunners-prefer-enclosed-spaces branch from 3e11e84 to dcc9d1d Compare April 4, 2026 17:08
@sunzenshen sunzenshen force-pushed the bot-shotgunners-prefer-enclosed-spaces branch from dcc9d1d to 25114e3 Compare May 28, 2026 01:28
@Rainyan Rainyan requested review from Rainyan and removed request for a team June 5, 2026 09:55
- Bots with shotguns shy away from NavAreas that have many visibility connections
- Bots with pistol caliber weapons slightly avoid areas but to a lesser degree
- Bots with scoped/semi-auto weapons favor exposed NavAreas with long sightlines
- Generally, a minor penalty is applied for NavArea exposure for bots to avoid wide open exposed NavAreas
@sunzenshen sunzenshen force-pushed the bot-shotgunners-prefer-enclosed-spaces branch from 25114e3 to eca69c6 Compare June 6, 2026 04:30
Comment thread src/game/server/neo/bot/neo_bot_path_cost.cpp Outdated
Comment thread src/game/server/neo/bot/neo_bot_path_cost.cpp Outdated
Comment thread src/game/server/neo/bot/neo_bot_path_cost.cpp Outdated
Comment thread src/game/shared/neo/weapons/weapon_neobasecombatweapon.h Outdated
@Rainyan

Rainyan commented Jun 6, 2026

Copy link
Copy Markdown
Member

@sunzenshen What was the console command to display those orange paths as shown in the screenshots above?

@sunzenshen

Copy link
Copy Markdown
Contributor Author

@sunzenshen What was the console command to display those orange paths as shown in the screenshots above?

nb_debug path

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

Changing the CNEOBotPathCost penalty from distance to cost for weapons enhanced the bot tendency to hide behind cover, which results in bunching up, so I further increased the path reservation penalties to encourage taking alternate paths or to dividing up a room.

This is the script I paste into the console for observation:

(Divided up into forcing TDM mode, speeding up the round resets, showing grenade paths, showing pathing, and speeding up the rounds 2x.)

sv_neo_gamemode_enforcement 3; sv_neo_gamemode_single 0; neo_vote_game_mode 0; mp_restartgame 1;

sv_neo_bot_grenade_debug_behavior 1; mp_chattime 2; sv_neo_preround_freeze_time 2; cl_neo_grenade_show_path 1; sv_neo_grenade_show_path 1;
sv_neo_pvs_cull_roaming_observer 0;

nb_debug_path;
host_timescale 2;

{
CNEOBotPathCompute( me, m_path, pGhostCarrier->GetAbsOrigin(), DEFAULT_ROUTE );
// FASTEST_ROUTE: don't waste chase time looking for cover
CNEOBotPathCompute( me, m_path, pGhostCarrier->GetAbsOrigin(), FASTEST_ROUTE );

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.

With DEFAULT_ROUTE on this PR, bots don't chase ghost carriers fast enough as they sneak behind cover which wastes pursuit time. I decided that it's better to risk bunching up while taking the FASTEST_ROUTE, and then let the dispatch to the Attack behavior above to use DEFAULT_ROUTE when actually attacking enemies. So pursuers beeline as fast as possible to the ghoster until they contact the enemy, and then split up along different paths at that point.

ConVar neo_bot_path_penalty_jump_multiplier("neo_bot_path_penalty_jump_multiplier", "100.0", FCVAR_CHEAT,
"Maximum penalty multiplier for jump height changes in pathfinding", false, 0.01f, false, 1000.0f);
ConVar neo_bot_path_penalty_jump_multiplier("neo_bot_path_penalty_jump_multiplier", "100000.0", FCVAR_CHEAT,
"Maximum penalty multiplier for jump height changes in pathfinding", true, 0.01f, false, 0.0f);

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.

Further increasing the jump penalty as I increased the path reservation penalty below.

{
// Weapons that don't have max first shot accuracy
const float exposurePenalty = neo_bot_path_penalty_exposure_pistol.GetFloat();
cost += visibleAreaCount * exposurePenalty;

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.

Changing the penalty addition to cost enhanced the effect of bots bunching up together behind cover, so I tweaked the other penalties to encourage bots to spread out if they are in the same room.

ConVar neo_bot_path_reservation_penalty("neo_bot_path_reservation_penalty", "100", FCVAR_NONE,
"Pathing cost penalty for a reserved area.", true, 0, true, 1000000);
ConVar neo_bot_path_reservation_penalty("neo_bot_path_reservation_penalty", "10000", FCVAR_NONE,
"Pathing cost penalty for a reserved area.", true, 0, false, 0);

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.

Encourage bots to spread out in a room if they are traversing the same room as other bot teammates. Otherwise bots bunch up together to take the same covered path.

@Rainyan Rainyan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, cool to see the bots taking more nuanced routes!

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