Sitelet https://github.com/mod-playerbots/mod-playerbots/pull/2893
Skip to content

(feat) WSG Tactics - #2893

Draft
Jellypowered wants to merge 2 commits into
mod-playerbots:test-stagingfrom
Jellypowered:test-staging
Draft

Jellypowered wants to merge 2 commits into
mod-playerbots:test-stagingfrom
Jellypowered:test-staging

Conversation

@Jellypowered

Copy link
Copy Markdown
Contributor

Pull Request Description

WSG bots had a habit of wandering around while a flag needed returning, leaving our carrier without help, or chasing the wrong target. Both flags out could turn into a long standoff with bots sitting in midfield.

This adds an opt-in WSG tactics mode, including WSG through the Random BG queue. Bots use the actual flag state to decide who should return, escort, defend, or push. They protect a friendly carrier, pursue the enemy carrier using the position shown on the BG map, and only attack that carrier when they can actually detect them. When both flags are held, available non-carrier, non-escort bots help return ours instead of waiting around.

The team presets use bot-only assignments:

  • Balanced: 3 defenders and 3 attackers, with the rest available as needed.
  • Offensive: 2 defenders, prioritizing the strongest bots, and 5 attackers.
  • Defensive: 5 defenders and 2 attackers, prioritizing the strongest attackers used to cap flag.

Strength is ranked by level, then average equipped item level, with GUIDs breaking ties. Defense slots are filled first, capped by the number of eligible living, non-carrier bots; attack slots use the remaining bots. Real players do not fill or reduce bot quotas. A human carrying the flag still gets bot support. Escorts use flexible bots first, then attackers, without taking defender slots. Defenders stay near the home flag unless responding to its loss, and other eligible bots push for the enemy flag when it is available.

Movement now chooses the best eligible corridor deterministically and retains it while movement is waiting. Completing a corridor is handled separately from a stall so bots can move on without repeatedly switching or backtracking. Bots spread across the starting positions before the gates open. Graveyard cliff checks prevent joining upper routes from below, while the explicit jump-down handling remains responsible for those descents.

There are also WSG-specific improvements to healing teammates and rejecting dead or ghost targets. Ordinary enemy-player targeting is limited by the core's configured MonsterSight; actual flag carriers are exempt from that distance cap (because flag carriers are visible on the map), but still require normal detection and valid combat targeting.

The option is AiPlayerbot.WsgTactics.Enabled = 0 by default. Other battlegrounds and feature-off behavior keep their existing tactics.

Feature Evaluation

  • Describe the minimum logic required to achieve the intended behavior.
  • Describe the processing cost when this logic executes across many bots.

The mode reads WSG flag state and assigns jobs from the current bot roster. Assignments and strength rankings are cached for two seconds. Flag and support checks use cached values where appropriate; route selection is bounded by the existing waypoint pool and happens when a route is needed, not at every waypoint. The extra work only runs with the option enabled in WSG.

The profiler comparison is mixed: average full tick went from 32.68 ms to 35.53 ms (+2.85 ms), while AI time per full tick went from 5.71 ms to 5.25 ms (-0.465 ms) and instrumented work per tick went from 3.63 ms to 3.05 ms (-0.576 ms). I've seen several runs with a similar pattern. I would call the measured AI impact minimal, but I don't want to present the overall tick increase as an improvement. More testing is welcome.

How to Test the Changes

(NOTE: most will be noticable by observing map/battlefield with eyes)

  1. Set AiPlayerbot.WsgTactics.Enabled = 1 and restart the worldserver. Run WSG with bots on both teams, preferably with a human on one team. Repeat through the Random BG queue when it selects WSG.
  2. Test all three team presets. With enough eligible bots, check for 3/2/5 defenders near home and the corresponding attack assignments. Repeat with nine bots and one human, smaller rosters, deaths and respawns. A human defending or escorting should not reduce the bot quotas. Check that the offensive defenders and defensive attackers prioritize level, then equipment strength.
  3. Pick up each flag in turn, including as a human. Check that a friendly carrier gets escorts without borrowing defenders, our missing flag gets returners, and dropped flags change the objective. When their flag is available, eligible bots outside defense, return and escort should push for it.
  4. When both teams hold a flag. The carrier should wait to capture with support while available non-carrier, non-escort bots go after the enemy carrier. Check both factions and make sure bots do not attack an unseen carrier just because the BG map shows its position.
  5. Watch trips through tunnels, midfield and route junctions in both directions, particularly near alliance gy buff (1318.79, 1533.00, 315.43). Check for repeated stopping, route switching or backtracking. At the Horde graveyard lower approach near (1045.86, 1356.21, 327.57), bots should not try to climb the cliff. Check both graveyards, normal tunnel/ramp access and valid jump-down movement.
  6. Check ordinary opponents moving beyond MonsterSight and confirm bots stop targeting them. Flag carriers retain their existing detection rules rather than this ordinary-player distance cap. Kill and release an enemy player during a fight and check that bots drop dead or ghost targets. Check that healers help injured BG teammates outside their party.
  7. Set the option back to 0 and confirm WSG uses the previous behavior. Check another battleground for regressions. Compare profiler runs under similar server load if possible.

I've built and tested this on test-staging. After addressing route switching and defender coverage, the latest live results are much better than playing with tactics disabled. I'd like more feedback, especially on both-faction routes and role coverage, but it's ready for outside eyes.

Impact Assessment

  • Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots?
      • No, not at all
      • Minimal impact (explain below)
      • Moderate impact (explain below)

Only enabled WSG bots run the extra logic. The team scan is cached and limited to the BG roster, and the profiler runs so far show minimal AI cost. The full-tick result in the attached comparison was higher, so I would still like to keep an eye on it during testing.

  • Does this change modify default bot behavior?
      • No (if not enabled, no change)
      • Yes (explain why)

Yes and no? The new WSG tactics are disabled by default. Enabling them changes WSG behavior, including WSG reached through Random BG.

  • Does this change add new decision branches or increase maintenance complexity?
      • No
      • Yes (explain below)

It adds WSG-specific roles, flag checks, support targeting, and route handling. That is more code to maintain, but it stays behind the config option rather than replacing the tactics for everyone.

AI Assistance

Was AI assistance used while working on this change?

    • No
    • Yes (explain below)

I used AI to assist with investigating the existing code, implementation, and static checks. I've built and tested the changes on my server, against the most current test-staging, and i'm ready for it to be picked apart!

Code Provenance / Attribution

Was any code in this PR copied or adapted from a sister / upstream project (e.g. CMaNGOS playerbots,
MaNGOS, another module)?

    • No, all code in this PR is original
    • Yes (name the project and the original author(s) below)

No code was copied from another project. This works within the module's existing battleground code.

Final Checklist

    • Changes are understood and tested for server stability and performance impact.
    • Any new bot dialogue lines are translated. (No new bot dialogue.)
    • New source files use the GPLv2 header.
    • Documentation updated if needed (config comment added).
    • New and modified files do not introduce new compiler warnings.

Notes for Reviewers

I looked at the other open BG PRs, especially #2857 and #2855. #2857 fixes bugs in the old WSG objective path. This PR takes a separate path when the option is on, so I think both are worth keeping: #2857 helps default WSG, and this changes opt-in WSG. #2855 fixes enemy-player attacker and PvP checks shared across battlegrounds. It should help combat here too, but it edits some of the same target-selection code. When they come together, please keep both its BG fixes and this PR's opt-in WSG checks for dead and ghost targets, ordinary-player MonsterSight limits, and flag-carrier exceptions.

If other PR's get merged in first, I will gladly push changes that address merge conflicts/integrate functionality.

The final note: This will produce varied wins/losses. It's meant to increase difficulty, improve cohesion, make it less like a free for all, and give you a sense of challenge. It's a BIG DANG PR. Lots of files touched, headers included so it's gonna take a bit to compile. I hope you all enjoy! I'm submitting this as a draft, so we can get some real feedback/reviews before officially making it a proper PR.

@Jellypowered

Jellypowered commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author

With the latest commit 6965e49, AiPlayerbot.WsgTactics.Enabled = 1 is no longer needed/present. It's enabled by default.

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