Skip to content

CTF Frogbots - #452

Draft
dsvensson wants to merge 11 commits into
QW-Group:masterfrom
qw-ctf:ctfbots
Draft

dsvensson wants to merge 11 commits into
QW-Group:masterfrom
qw-ctf:ctfbots

Conversation

@dsvensson

Copy link
Copy Markdown
Collaborator

Draft. A rebased, conflict-resolved, and restructured take on #365 (CTF Frogbots by @SpookyScaryDev), adding CTF support to the KTX frogbots.

The original branch was ~18 months behind master. This rebases it onto current master, fixes the build (strict-prototypes, c89/QVM), works through the review comments, and splits the single large "Added CTF bots" commit into focused commits that each build on their own.

Commits

  1. Added NULL check for look_marker in BestEnemy_apply — guards, and now warns on, a NULL sight marker (a symptom of a .bot file whose marker numbering is out of sync with the map).
  2. Add CTF flag/rune teamplay messaging — server-side teamplay reporting of carried flags/runes (works for humans; not bot-specific).
  3. Add bot support for shooting buttons and doors — generic LOOK_BUTTON/FIRE_BUTTON behaviour (usable in DM, not just CTF).
  4. Add /botcmd gomarker command — generic admin debug command (send all bots to the marker you're looking at).
  5. botcmd fill: round up to the next full team size — generic fill fix: top players+bots up to the next multiple of 8, capped at maxclients.
  6. Added CTF bots — the core CTF behaviour: attack/midfield/defend roles, flag/rune/defend-marker goals, per-team discharge-at-start markers, flag-carrier logic, CTF names, .bot loading from sv_loadbotfiles_dir. (@SpookyScaryDev)
  7. Add bot grappling hook support — frogbot grappling-hook routing & movement.

Still to do before un-drafting

  • Regenerate the CTF .bot files for the new marker numbering (the team spawns are now markers) and playtest.
  • The tossflag/tossrune/basesafe/basenotsafe/goingflag messages have a counterpart TP_Msg_* side in ezQuake.

Co-authored with @SpookyScaryDev (original author of #365).

🤖 Generated with Claude Code

@dsvensson
dsvensson force-pushed the ctfbots branch 8 times, most recently from b21f6ad to a668f35 Compare June 25, 2026 18:57
dsvensson and others added 11 commits July 3, 2026 00:22
The route calculation used the bare literals 100000 and 1000000
interchangeably to mark a link or route that can't be taken. Introduce
TRAVEL_UNREACHABLE and use it for every such sentinel so the intent is
explicit and the value is defined in one place (next to PATH_SCORE_NULL).

No behaviour change beyond unifying the two 100000 sites onto the same
1000000 value the reachability checks (< 1000000) already test against.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Server-side teamplay messaging for CTF, usable by human players (not
bot-specific):

- Report the flag and the rune(s) a player is carrying in status/took/
  need/area/point messages (CTFItemText), with team-coloured FLAG and
  abbreviated rune names.
- New messages: tossflag, tossrune, basesafe, basenotsafe, goingflag.
- TeamplayEventItemTaken now records picked-up runes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: SpookyScaryDev <thomaslcave@gmail.com>
Generic frogbot functionality (usable in DM, not CTF-specific) for making
bots shoot buttons and shootable doors:

- LOOK_BUTTON path flag marks a path from a regular marker to a button;
  bots don't travel it, it only tells them where to look to shoot.
- MARKER_LOOK_BUTTON is set automatically on a marker that has such a
  path, and makes closed-door paths from it passable.
- FIRE_BUTTON path state is raised when a bot should shoot the linked
  button/door, suppressing normal enemy fire and picking a hitscan
  weapon to press it.

Added to the .bot format as path flag 'l'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: SpookyScaryDev <thomaslcave@gmail.com>
Admin-only debugging command that sends every bot to the marker the
caller is looking at (reuses the existing fixed_goal mechanism). Generic
bot tooling, unrelated to CTF.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: SpookyScaryDev <thomaslcave@gmail.com>
Instead of adding up to 8 bots toward maxclients, fill the player count
(humans + bots) up to the next multiple of 8, capped at maxclients: 3
players -> 8, a repeat -> 16, and a server already at a full team size
jumps straight to the next one. Run repeatedly to keep filling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: SpookyScaryDev <thomaslcave@gmail.com>
Mirror sv_loadentfiles_dir (used for .ent files): when sv_loadbotfiles_dir
is set, look for a map's .bot file under that subdirectory before falling
back to the default location, and write generated .bot files there too.

This lets alternative entity sets keep their waypoints in a dedicated
directory instead of colliding with the stock per-map files, and is useful
for any such set, not just CTF.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Markers added at runtime by the server (MARKER_DYNAMICALLY_ADDED) are not
part of the saved .bot file, so a /botcmd addpath that links to one would
produce a path that can't be persisted. Reject it with a message instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Frogbots can now play Capture the Flag.

- Three roles, assigned round-robin as bots are added: attackers go for
  the enemy flag, midfielders contest mid/quad, defenders hold near base
  (FB_CTF_ROLE_*); each role weights the relevant goals differently.
- Goals for flags and runes: capture/return the flag and grab runes in
  priority order res > str > hst > rgn (goal_flag, goal_flag_enemy,
  goal_rune), plus manually-placed defend points (goal_defend_marker,
  MARKER_FLAG1_DEFEND / MARKER_FLAG2_DEFEND).
- Bots prioritise an enemy carrying their flag; a flag carrier won't
  chase enemies and surrenders its flag/rune to a nearby human teammate
  (SurrenderCTFItemsLogic).
- Bots leave a goal to a teammate already going for it, except powerups
  and flags (GoalLeaveForTeammate).
- CTF-only bot names, longer goal lookahead, and per-map bot files loaded
  from the sv_loadbotfiles_dir subdirectory.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per-team "discharge at start" markers (MARKER_DISCHARGE_AT_START_RED /
MARKER_DISCHARGE_AT_START_BLUE, 'd'/'D' in .bot files): on its first life
a bot of the matching team runs to the marker, grabs the LG and
discharges it. Driven entirely by the marker flag (e.g. red on e2m2).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: SpookyScaryDev <thomaslcave@gmail.com>
Lets frogbots use the grappling hook for routing and movement: hook
travel-time in the marker routing graph (hook_time / *_hook fields), a
HOOK path flag ('h' in .bot files), the hook_routes parameter threaded
through the route lookups, and the bot hook movement/aim/weapon logic
(BotCanHook, BotPerformHook, SetHookAngles). Gated by k_ctf_hook.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: SpookyScaryDev <thomaslcave@gmail.com>
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.

2 participants