Skip to content

Add weak weapon concept: bots with only Glock avoid combat#79

Merged
jkivilin merged 1 commit intomasterfrom
weak-weapon-concept
Mar 3, 2026
Merged

Add weak weapon concept: bots with only Glock avoid combat#79
jkivilin merged 1 commit intomasterfrom
weak-weapon-concept

Conversation

@jkivilin
Copy link
Member

@jkivilin jkivilin commented Mar 2, 2026

Summary

  • Add BotIsWeakWeapon() / BotHasOnlyWeakWeapons() helpers identifying the Glock as the only weak weapon
  • Add b_only_has_weak_weapons state flag computed per-frame in BotThinkHandleEnemy
  • Bots with only a Glock now prefer seeking better weapons over engaging enemies
  • Bots still fight back in self-defense when recently attacked, but disengage faster (1s window vs 3s for normal weapons)
  • BotCombatDisengageTime() helper returns the appropriate timeout based on weapon state
  • Skip and abort sound tracking when only weak weapons available

Test plan

  • test_bot_weapons: BotIsWeakWeapon (6 tests) + BotHasOnlyWeakWeapons (7 tests)
  • test_bot: BotThink weak weapon no-seek, fights-back, disengages-after-1s, and strong-weapon-seeks (4 tests)
  • test_bot_navigate: track sound stops with weak weapons, find waypoint goal skips sound tracking (2 tests)
  • Full test suite: make test with cross-compiler

@jkivilin jkivilin force-pushed the fix-last-time-attacked-bug branch from cda8b9a to a8d2b39 Compare March 2, 2026 16:16
@jkivilin jkivilin force-pushed the weak-weapon-concept branch 2 times, most recently from aaf4444 to 65b9ca2 Compare March 2, 2026 16:31
@jkivilin jkivilin changed the base branch from fix-last-time-attacked-bug to master March 2, 2026 16:33
@jkivilin jkivilin force-pushed the weak-weapon-concept branch from 65b9ca2 to aed89e2 Compare March 2, 2026 16:33
Bots carrying only weak weapons (currently just the Glock) will:
- Not actively seek out enemies
- Not track enemy sounds for navigation
- Not pursue sound-based waypoint goals
- Only fight back briefly (1s) after being attacked, then disengage
  (normal weapons retain the 3s combat window)

The weak weapon state is re-evaluated each frame based on the bot's
current inventory and ammo, so picking up a better weapon immediately
restores normal combat behavior.
@jkivilin jkivilin force-pushed the weak-weapon-concept branch from aed89e2 to 387bb32 Compare March 3, 2026 16:52
@jkivilin jkivilin merged commit d379028 into master Mar 3, 2026
5 checks passed
@jkivilin jkivilin deleted the weak-weapon-concept branch March 3, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant