Skip to content

Conversation

@sunzenshen
Copy link
Contributor

Description

  • Allows server operators to customize bot cloak detection rates.
  • Debug ConVar for watching bots as if they were cloaked all the time.
  • Also separates out the factor of cloak being turned on versus cloak being disrupted.
  • Bot observers are probably more forgiving about cloak disruption when target is firing unsuppressed weapons.

Toolchain

  • Windows MSVC VS2022

@sunzenshen
Copy link
Contributor Author

I added ConVars for detection bonus values and bot difficulty detection thresholds so that anyone else can watch a bot match and tweak detection factors live. That said, how detection events feel seems like a subjective opinion, but I hope that these numbers can start as a reasonable baseline.

My intention with the initially submitted values are based on these intended profiles for the difficulty settings:

  • Expert: Bots have slower reflexes but eventually zero in on you.
  • Hard: Will sometimes miss you in a lapse of attention but otherwise will eventually find you if you linger.
  • Normal: Bots are generally aware of standard ranges and movement, but if you don't aggro them, they sometimes will completely miss you or pass you by.
  • Easy: This about the point that bots are absentminded and really struggle to notice you if you aren't performing loud activities like shooting.

Helpful Testing Commands/Scripting:

Start TDM Mode on Engage

neo_vote_game_mode 0; mp_restartgame 1; 

Enable bots considering everyone as always cloaked, and some example tweaking commands:

sv_neo_bot_cloak_debug_perceive_always_on 1;

sv_neo_bot_cloak_detection_threshold_ratio_easy   0.65;
sv_neo_bot_cloak_detection_threshold_ratio_normal 0.70;
sv_neo_bot_cloak_detection_threshold_ratio_hard   0.75
sv_neo_bot_cloak_detection_threshold_ratio_expert 0.80;

sv_neo_bot_cloak_detection_bonus_scope_range 1;
sv_neo_bot_cloak_detection_bonus_shotgun_range 5;
sv_neo_bot_cloak_detection_bonus_melee_range 50;
sv_neo_bot_cloak_detection_bonus_disruption_effect 30;
sv_neo_bot_cloak_detection_bonus_assault_motion_vision 60;
sv_neo_bot_cloak_detection_bonus_non_support 1;

@sunzenshen sunzenshen requested a review from a team December 15, 2025 06:18
}

// Even if my weapon is unsuppressed, better than nothing
me->EnableCloak(3.0f);
Copy link
Contributor Author

@sunzenshen sunzenshen Dec 15, 2025

Choose a reason for hiding this comment

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

The argument for me->EnableCloak(3.0f); is an parameter to only enable cloak if you have that many seconds left. We could definitely set up different cloak reserve time thresholds for different classes and suppressed/unsuppressed weapons.

RE: https://discord.com/channels/1235346473827434517/1244281729036845200/1449801332528513138

}

if ( me->IsCombatWeapon( myWeapon ) )
if ( myWeapon && me->IsCombatWeapon( myWeapon ) )
Copy link
Contributor Author

@sunzenshen sunzenshen Dec 15, 2025

Choose a reason for hiding this comment

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

To get rid of a warning in proximity to WIP changes.


// If target is not cloaked, it's not obscured.
if (!targetPlayer->GetBotPerceivedCloakState())
if (!targetPlayer->GetInThermOpticCamo() && !sv_neo_bot_cloak_debug_perceive_always_on.GetBool())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ConVar sv_neo_bot_cloak_debug_perceive_always_on is where we can set up a test where we see if bots would notice each other given certain angles/circumstances/etc. You can usually tell without nb_debug if another player was detected, based on bots returning fire or even turning on cloak.


if (targetPlayer->GetBotCloakStateDisrupted())
{
flDetectionBonus += sv_neo_bot_cloak_detection_bonus_disruption_effect.GetFloat();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cloak disruption when firing unsuppressed weapons is now a configurable gradient rather than a full visibility flag.

// thermal vision penalty against cloak
nSneakPenaltyCount += 5;
// Penalize Support as if using thermal vision against cloak
flDetectionBonus += sv_neo_bot_cloak_detection_bonus_non_support.GetFloat();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this value is too high, Supports can look relatively braindead, so don't make this too exaggerated in my opinion.

constexpr float meleeRangeSq = 50.0f * 50.0f;
if (targetDistance < meleeRangeSq) {
nSneakPenaltyCount += 50;
flDetectionBonus += sv_neo_bot_cloak_detection_bonus_melee_range.GetFloat();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Melee range is about the point where not seeing a cloaked player becomes a little incredulous, but tried to set a value where there's some hesitation from the bots at Hard and Expert difficulty.

// Lighting Impact
// NEO JANK: See "FIXMEL4DTOMAINMERGE" for why this doesn't have any effect yet.
// TODO: Lighting is not yet baked into NavAreas with our current tooling
if (sv_neo_bot_cloak_detection_bonus_lighting_enabled.GetBool() && TheNavMesh)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even though CNavArea::ComputeLighting does not compute lighting at a CNavArea, decided to include this in case we ever get around to implementing that, without having to recompile. Default weight could use some follow up thought though.

RE: https://discord.com/channels/1235346473827434517/1244281729036845200/1449808464250536097

@sunzenshen sunzenshen added the Bots Related to bot players label Dec 15, 2025
}

if (GetTeamNumber() == targetPlayer->GetTeamNumber())
if ( NEORules()->IsTeamplay()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In anticipation of DM for bots being fixed:
#1553

@sunzenshen sunzenshen force-pushed the bot-cloak-detection-cloak-disruption branch 2 times, most recently from 0cae1e5 to dab088d Compare December 17, 2025 01:39
Allows server operators to customize bot cloak detection rates.

Debug ConVar for watching bots as if they were cloaked all the time.

Also separates out the factor of cloak being turned on versus cloak being disrupted.

Bot observers are probably more forgiving about cloak disruption when target is firing unsuppressed weapons.
@sunzenshen sunzenshen force-pushed the bot-cloak-detection-cloak-disruption branch from dab088d to e676970 Compare December 22, 2025 02:47
@AdamTadeusz AdamTadeusz requested a review from a team January 1, 2026 13:40
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