Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions docs/BOT-CVARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,22 @@ Console variables that control bot AI, navigation, chat, and fill rules. Set the

| Name | Origin | Default | Valid values | Description |
|------|--------|---------|--------------|-------------|
| `bot_aasoptimize` | Vanilla | `0` | 0 or 1 | When `1`, allows the bot navigation library to optimize the maps AAS data when it is built or loaded. |
| `bot_challenge` | Vanilla | `0` | 0 or 1 | Harder bots on **legacy** aim: steadier tracking and snap-to-target when locked on. No effect on `bot_enhanced_aim` (enhanced harness ignores this cvar). |
| `bot_aasoptimize` | Vanilla | `0` | 0 or 1 | When `1`, allows the bot navigation library to optimize the map's AAS data when it is built or loaded. |
| `bot_challenge` | Vanilla | `0` | 0 or 1 | Harder bots on **legacy** aim: steadier tracking and snap-to-target when locked on. No effect when `bot_enhanced` is on (enhanced harness ignores this cvar). |
| `bot_developer` | Vanilla | `0` | 0 or 1 | Extra bot-library debug output. Requires `sv_cheats 1`. |
| `bot_debugAim` | Devotion | `0` | 0 or 1 | Publishes bot aim on `ps.grapplePoint`, `STAT_EXTFLAGS` (`EXTFL_BOT_AIM_DEBUG`), and `ent->s.origin2` for `cg_debugBotAim`. Works with or without enhanced aim. Requires `sv_cheats 1`. |
| `bot_enable` | Vanilla | `0` | 0 or 1 | Master switch: bots only load and play when `1`. Usually set in `server.cfg` (provided by the engine, not the game module). |
| `bot_enhanced` | Devotion | `0` | 0 or 1 | Master switch for Devotion bot AI upgrades (aim harness, smart weapons, tactics). When `0`, sub-cvars have no effect. Saved to config. |
| `bot_enhanced_aim` | Devotion | `0` | 0 or 1 | Smoother, more human-like bot aiming when `1` and `bot_enhanced` is `1` (`0` = classic snap aim). Independent of `bot_challenge`. Saved to config. |
| `bot_enhanced_tactics` | Devotion | `0` | 0 or 1 | Extra combat decisions when `1` and `bot_enhanced` is `1`: gauntlet rush/flee, react to third-party damage, finish wounded targets, prefer nearer threats. Saved to config. |
| `bot_enhanced_items` | Devotion | `1` | 0 or 1 | Visible mega/red/yellow armor pickup with committed goals when `1` and `bot_enhanced` is `1`. Saved to config. |
| `bot_enhanced_items_debug` | Devotion | `0` | 0 or 1 | Server console lines when bots commit to or abandon major item pickups. |
| `bot_enhanced_movement` | Devotion | `0` | 0 or 1 | Human-like movement behaviors when `1` and `bot_enhanced` is `1`: active rocket-jump maneuver prep/fire and walk-off ledge fall-damage avoidance. Saved to config. |
| `bot_enhanced_weapons` | Devotion | `0` | 0 or 1 | Smarter weapon picks by range and ammo when `1` and `bot_enhanced` is `1` (e.g. rail/MG at distance, rocket mid-range, shotgun up close). Saved to config. |
| `bot_fastchat` | Vanilla | `0` | 0 or 1 | When `1`, bots are more likely to use chat lines (skips some random “stay quiet” rolls). |
| `bot_enhanced` | Devotion | `0` | 0 or 1 | Master switch for all Devotion bot AI upgrades: aim harness, smart weapons, tactics, items, item timing (per gametype), movement (RJ + walkoff), position, opponent (1v1), nav guard, combat intent. When `0`, behavior matches vanilla. Saved to config. |
| `bot_enhanced_debug` | Devotion | `0` | 0 or 1 | Server-side debug logging for enhanced subsystems (item commits, nav guard, opponent inference, etc.). Requires `bot_enhanced 1`. |
| `bot_fastchat` | Vanilla | `0` | 0 or 1 | When `1`, bots are more likely to use chat lines (skips some random "stay quiet" rolls). |
| `bot_forceclustering` | Vanilla | `0` | 0 or 1 | Forces the navigation system to rebuild area clusters for the current map (slow; map load / AAS build). |
| `bot_forcereachability` | Vanilla | `0` | 0 or 1 | Forces reachability between areas to be recalculated (slow; map load / AAS build). |
| `bot_forcewrite` | Vanilla | `0` | 0 or 1 | Forces the navigation `.aas` file to be written to disk when the map is processed. |
| `bot_grapple` | Vanilla | `0` | 0 or 1 | When `1`, bots may use the off-hand grapple for movement where the mod supports it. |
| `bot_interbreedbots` | Vanilla | `10` | integer ≥ 1 | Number of bots spawned when a bot interbreeding run starts. |
| `bot_interbreedbots` | Vanilla | `10` | integer ≥ 1 | Number of bots spawned when a bot "interbreeding" run starts. |
| `bot_interbreedchar` | Vanilla | `` | bot name string | Bot character file to use for interbreeding; setting this starts a tournament-style breeding session. Cleared after spawn. |
| `bot_interbreedcycle` | Vanilla | `20` | integer ≥ 1 | How many matches to run before the best bots AI is saved and a new generation is spawned. |
| `bot_interbreedwrite` | Vanilla | `` | filename string | If set, writes the winning bots goal logic to this file at the end of a breeding cycle, then clears. |
| `bot_interbreedcycle` | Vanilla | `20` | integer ≥ 1 | How many matches to run before the best bot's AI is saved and a new generation is spawned. |
| `bot_interbreedwrite` | Vanilla | `` | filename string | If set, writes the winning bot's goal logic to this file at the end of a breeding cycle, then clears. |
| `bot_memorydump` | Vanilla | `0` | 0 or 1 | One-shot: dumps bot-library memory stats, then resets to `0`. Requires `sv_cheats 1`. |
| `bot_minplayers` | Vanilla | `0` | integer ≥ 0 | Target player count per team (or FFA slot fill): server adds or removes bots about every 10 seconds to match. `0` = off. Shown in server info. |
| `bot_nochat` | Vanilla | `0` | integer ≥ 0 | `0` = normal chat; `1` = no bot taunts/greetings; `2` or higher also blocks team orders/voice and bots talking in global chat. |
Expand All @@ -36,32 +31,38 @@ Console variables that control bot AI, navigation, chat, and fill rules. Set the
| `bot_report` | Vanilla | `0` | 0 or 1 | Updates internal bot status info shown in server config strings. Requires `sv_cheats 1`. |
| `bot_rocketjump` | Vanilla | `1` | 0 or 1 | When `1`, bots may rocket-jump for vertical movement; `0` disables it. |
| `bot_saveroutingcache` | Vanilla | `0` | 0 or 1 | One-shot: saves the routing cache for the current map, then resets to `0`. Requires `sv_cheats 1`. |
| `bot_testclusters` | Vanilla | `0` | 0 or 1 | Debug: print AAS area/cluster under the bots view. Requires `sv_cheats 1`. |
| `bot_testichat` | Vanilla | `0` | 0 or 1 | Test mode: new bots fire their enter game chat line immediately. |
| `bot_testclusters` | Vanilla | `0` | 0 or 1 | Debug: print AAS area/cluster under the bot's view. Requires `sv_cheats 1`. |
| `bot_testichat` | Vanilla | `0` | 0 or 1 | Test mode: new bots fire their "enter game" chat line immediately. |
| `bot_testrchat` | Vanilla | `0` | 0 or 1 | Test mode: triggers random chat handling in the bot library. |
| `bot_testsolid` | Vanilla | `0` | 0 or 1 | Debug: report whether the bots view point is in solid AAS. Requires `sv_cheats 1`. |
| `bot_testsolid` | Vanilla | `0` | 0 or 1 | Debug: report whether the bot's view point is in solid AAS. Requires `sv_cheats 1`. |
| `bot_thinktime` | Vanilla | `100` | integer (ms), max 200 | Milliseconds between bot AI updates; lower = more reactive bots, higher = less CPU. Capped at 200. |
| `bot_visualizejumppads` | Vanilla | `0` | 0 or 1 | Debug: draw jump-pad reachability in the navigation mesh. |
| `bot_wigglefactor` | Vanilla | `0.0` | 0.0–1.0 | How often bots change strafe direction in combat; higher = more side-to-side movement. |

## Deprecated enhanced-bot cvars

These names are **not registered** by the game module anymore. On first load, if a new `bot_enhanced_*` cvar is still at its default and the old name is set in `server.cfg`, the value is copied once and `bot_enhanced` is turned on when needed. A one-line message is printed to the server console when any deprecated name is detected.
These names are **not registered** by the game module anymore. On first load, if any deprecated name is set in `server.cfg`, `bot_enhanced` is turned on and a one-line console notice is printed. Use `bot_enhanced` (and optionally `bot_enhanced_debug`) instead.

| Deprecated | Replaced by |
|------------|-------------|
| `bot_humanizeaim` | `bot_enhanced` + `bot_enhanced_aim` |
| `bot_smartWeaponChoice` | `bot_enhanced` + `bot_enhanced_weapons` |
| `bot_tacticalAI` | `bot_enhanced` + `bot_enhanced_tactics` |
| `bot_humanizeaim` | `bot_enhanced` |
| `bot_smartWeaponChoice` | `bot_enhanced` |
| `bot_tacticalAI` | `bot_enhanced` |
| `bot_enhanced_aim` | `bot_enhanced` |
| `bot_enhanced_weapons` | `bot_enhanced` |
| `bot_enhanced_tactics` | `bot_enhanced` |
| `bot_enhanced_items` | `bot_enhanced` |
| `bot_enhanced_items_debug` | `bot_enhanced_debug` |
| `bot_enhanced_items_timing` | `bot_enhanced` (timing active in FFA/Duel/TDM) |
| `bot_enhanced_movement` | `bot_enhanced` |
| `bot_enhanced_position` | `bot_enhanced` |
| `bot_enhanced_opponent` | `bot_enhanced` (opponent logic in 1v1 context) |

Example (equivalent to the old `set bot_humanizeaim 1`):
Example:

```text
set bot_enhanced 1
set bot_enhanced_aim 1
set bot_enhanced_items 1
set bot_enhanced_debug 0
```

Sub-cvars alone (`bot_enhanced_aim 1` without `bot_enhanced 1`) have no effect unless the master is enabled or legacy migration runs at init.

For architecture, extension points, and the **Phase 8 parity test checklist**, see [BOT-ENHANCED-ARCHITECTURE.md](BOT-ENHANCED-ARCHITECTURE.md).
For architecture, extension points, and the **parity test checklist**, see [BOT-ENHANCED-ARCHITECTURE.md](BOT-ENHANCED-ARCHITECTURE.md).
29 changes: 13 additions & 16 deletions docs/BOT-ENHANCED-ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,32 @@ flowchart TB
think -.->|sets ideal_viewangles aimh_hold_fire| input
```

**North-facing include for hooks:** `ai_bot_enhanced.h` (`BotEnhanced_*Active`, `BotEnhanced_OnThinkStart`, register/reset).
**North-facing include for hooks:** `ai_bot_enhanced.h` (`BotEnhanced_IsActive`, `BotEnhanced_DebugActive`, `BotEnhanced_OnThinkStart`, register/reset).

---

## Cvar matrix

| Active when | Cvar | Notes |
|-------------|------|--------|
| Master | `bot_enhanced` | Default `0`. Sub-cvars ignored if off. |
| Aim harness | `bot_enhanced` + `bot_enhanced_aim` | Facade: `BotEnhanced_AimActive()` (`bot_challenge` ignored) |
| Smart weapons | `bot_enhanced` + `bot_enhanced_weapons` | Facade: `BotEnhanced_WeaponsActive()` |
| Tactical AI | `bot_enhanced` + `bot_enhanced_tactics` | Facade: `BotEnhanced_TacticsActive()` |
| Movement | `bot_enhanced` + `bot_enhanced_movement` | Facade: `BotEnhanced_MovementActive()`. Gates: enhanced RJ maneuver prep/fire; walk-off ledge fall-damage avoidance. Enhanced RJ also requires `bot_enhanced_aim` (view bypass). |
| Debug (cheat) | `bot_debugAim` | Independent of master; client `cg_debugBotAim` |
| Cvar | Role |
|------|------|
| `bot_enhanced` | Master gate (default `0`). When `1`, all enhanced features are on: aim harness, weapons, tactics, items, item timing (FFA/Duel/TDM), movement (RJ + walkoff), position, opponent (1v1), nav guard, combat intent. |
| `bot_enhanced_debug` | Server-side debug logging for enhanced subsystems (item commits, nav guard, opponent inference). Requires `bot_enhanced 1`. |
| `bot_debugAim` | Client cheat debug (independent); see BOT-CVARS.md |

Legacy `bot_humanizeaim` / `bot_smartWeaponChoice` / `bot_tacticalAI` are migrated once at init if new cvars are still default (see BOT-CVARS.md).
Deprecated `bot_enhanced_*` sub-cvars and legacy `bot_humanizeaim` / `bot_smartWeaponChoice` / `bot_tacticalAI` are read once at init for migration (see BOT-CVARS.md).

---

## File ownership

| File | Role |
|------|------|
| `ai_bot_enhanced.c/h` | Master cvar, facade gates, `OnThinkStart`, register/reset orchestration, goal-stack overflow guards (`BotEnhanced_PushGoalSafe`, `BotEnhanced_ReserveGoalStackRoom`, `BotEnhanced_SanitizeGoalStack`) |
| `ai_bot_items.c/h` | Visible pickup commits, botlib item chooser wrappers (uses enhanced goal-stack API) |
| `ai_bot_combat.c/h` | `bot_combat_intent_t` on `bot_state_t`; stance/move/fire policy (defaults = legacy) |
| `ai_bot_events.c/h` | Ingress queue (`evt_*`); `BotEvents_Drain` → tactics scan/process |
| `ai_bot_move_harness.c/h` | Botlib movement-view bypass (`bot_enhanced_aim`); `bot_enhanced_movement` cvar + `BotEnhanced_MovementActive()` gate; enhanced RJ maneuver prep/fire (requires both aim + movement); walk-off ledge fall-damage avoidance; `BotMove_EffectiveTfl`; hooks think/input |
| `ai_bot_move_util.c/h` | Shared horiz walk, approach speed, view actuation, goal anchors for maneuvers |
| `ai_bot_enhanced.c/h` | Master cvar, `BotEnhanced_IsActive` / `BotEnhanced_DebugActive`, `OnThinkStart`, register/reset orchestration, goal-stack guards |
| `ai_bot_items.c/h` | Visible pickup commits, item timing (merged), botlib item chooser wrappers |
| `ai_bot_combat.c/h` | `bot_combat_intent_t`; stance/move/fire policy |
| `ai_bot_events.h` | Ingress API (`BotEvents_Push`); implementation in `ai_bot_tactics.c` |
| `ai_bot_move_harness.c/h` | Movement-view bypass, RJ maneuver, walk-off avoidance, `BotMove_BuildTravelFlags` / `BotMove_EffectiveTfl`, move util helpers |
| `ai_bot_move_util.h` | Shared geometry/view helper declarations (implemented in harness) |
| `ai_aim_harness.c/h` | Humanized view motor; monotonic menu skill 0–5 accuracy ladder; suppressive fire (wide cone, all skills); rail/RL/SG shot urgency (reload+grace without firing widens track/trace tolerances); rail lead-and-wait + trace/urgency fire |
| `ai_weapon_select.c/h` | Range/ammo weapon picker + roam selection; voluntary close combat (25%: SG > plasma > gauntlet) |
| `ai_bot_tactics.c/h` | Gauntlet flee, hurt-by-other, closer threat (skill + distance-scaled swap chance), finish wounded |
Expand Down
13 changes: 9 additions & 4 deletions ratoa_gamecode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1794,13 +1794,15 @@ Q3GOBJ_ = \
$(B)/baseq3/game/ai_dmq3.o \
$(B)/baseq3/game/ai_bot_enhanced.o \
$(B)/baseq3/game/ai_bot_combat.o \
$(B)/baseq3/game/ai_bot_events.o \
$(B)/baseq3/game/ai_bot_move_util.o \
$(B)/baseq3/game/ai_bot_move_harness.o \
$(B)/baseq3/game/ai_aim_harness.o \
$(B)/baseq3/game/ai_weapon_select.o \
$(B)/baseq3/game/ai_bot_tactics.o \
$(B)/baseq3/game/ai_bot_items.o \
$(B)/baseq3/game/ai_bot_position.o \
$(B)/baseq3/game/ai_bot_opponent.o \
$(B)/baseq3/game/ai_bot_nav_guard.o \
$(B)/baseq3/game/ai_bot_dmnet.o \
$(B)/baseq3/game/ai_main.o \
$(B)/baseq3/game/ai_team.o \
$(B)/baseq3/game/ai_vcmd.o \
Expand Down Expand Up @@ -1863,12 +1865,15 @@ MPGOBJ_ = \
$(B)/missionpack/game/ai_dmq3.o \
$(B)/missionpack/game/ai_bot_enhanced.o \
$(B)/missionpack/game/ai_bot_combat.o \
$(B)/missionpack/game/ai_bot_events.o \
$(B)/missionpack/game/ai_bot_move_util.o \
$(B)/missionpack/game/ai_bot_move_harness.o \
$(B)/missionpack/game/ai_aim_harness.o \
$(B)/missionpack/game/ai_weapon_select.o \
$(B)/missionpack/game/ai_bot_tactics.o \
$(B)/missionpack/game/ai_bot_items.o \
$(B)/missionpack/game/ai_bot_position.o \
$(B)/missionpack/game/ai_bot_opponent.o \
$(B)/missionpack/game/ai_bot_nav_guard.o \
$(B)/missionpack/game/ai_bot_dmnet.o \
$(B)/missionpack/game/ai_main.o \
$(B)/missionpack/game/ai_team.o \
$(B)/missionpack/game/ai_vcmd.o \
Expand Down
4 changes: 3 additions & 1 deletion ratoa_gamecode/code/cgame/cg_unlagged.c
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,9 @@ void CG_DrawBotAimFollowFirstPerson( void ) {
}

cent = &cg_entities[cg.snap->ps.clientNum];
CG_BotAimDebugEye( cent, bodyStart, CG_BOTAIMDBG_BODY_HEIGHT );
/* Chest height — eye origin hides rails under the follow crosshair. */
VectorCopy(cg.snap->ps.origin, bodyStart);
bodyStart[2] += cg.snap->ps.viewheight * CG_BOTAIMDBG_BODY_HEIGHT;

VectorCopy( cg.snap->ps.grapplePoint, aimPoint );
if (VectorLengthSquared( aimPoint ) < 64.0f ) {
Expand Down
Loading