Repository navigation
feat: runtime route generation from spawn data, plus approach/facing/stuck fixes - #828
Merged
Merged
Conversation
A class profile has had to name a hand-recorded waypoint file, so a route
went stale the moment the character outlevelled the zone it was drawn for.
Profiles were rewritten every couple of levels for that reason alone.
PathSettings.Generate replaces the filename with a query over the running
client's NPC spawn data - zone or subzone, a mob expression in creature
scope, and a mode. The route is built at runtime from where the selected
mobs actually stand:
SpawnPolygon cell occupancy mask at AreaGrid resolution, dilated and
cluster-pruned - concave for free, so an L-shaped valley
does not route through the abbey in the middle
RouteGenerator Wander re-samples anchors every lap so the bot never
retraces a line; Loop builds one 2-opt tour over density
peaks as a drop-in for a recorded file
NavmeshConnectivity keeps the route on one walkable component, so a stop
across a lake is discarded rather than swum to
RouteSeed splitmix64 rather than HashCode.Combine, which is seeded
per process and so reproduced a route only within one
session
CreatureRequirementFactory gives the mob filter its own expression scope -
the subject is a candidate creature row, not the player, so Level means the
creature's and PlayerLevel means yours.
See docs/generated-routes-design.md.
Tries a Generate query against the running client and draws the result on the Leaflet map before it is committed to a profile - spawn spread, chosen stops and the walked line. Iterating on a mob filter otherwise meant editing json and restarting the bot to see what it produced.
Builds every Generate path in a class profile from Json/ plus the baked navmesh, with the player stubbed - no client, no login. Renders each over the game's own minimap tiles so "does this cross the river" is answerable while iterating on a mob filter. --profile every generated path in a class json, in profile order --seed fixed by default so two runs are comparable; "random" to vary --output where to write; --svg is kept as a warned alias --format svg (default), png or webp All three formats share RouteLayout - the zoom search and the world-to-pixel flip are the fiddly part, and a second copy in the raster path would drift into two pictures of the same route that disagree. Reports spacing, vertical spread and a spawn/route hash per path, so a change that was meant to be a refactor can be shown not to move the route.
A profile had to paste its whole Paths array inline, so the same starting zone was duplicated into every class that levels there. PathsFilenames names group files under Json/path/, each a bare PathSettings array, appended after any inline Paths in listed order - order matters, it sets each route goal cost through FollowRouteGoal.COST_OFFSET. Ships the eight starting zones as groups, keyed on Race so a profile can list all of them and the character matches the one it belongs in. Every mob name was checked against creatures.json and the map spawn tables rather than typed from memory, which is how Tauren ended up on Red Cloud Mesa: Camp Narache is the village and holds one spawn, the mesa around it holds 216. ResolvePathGroups is public and callable without Initialise, because tooling that reads Paths off a deserialized profile would otherwise see only the inline entries and silently render nothing.
Nine profiles replacing the per-level ladder, each pulling in all eight starting-zone groups so the same file serves every race of that class. Level spanning is done with "Spell:SPELL_x" id arrays - do I know it - not with WhenUsable. WhenUsable only reads the usable bit of the slot a key maps to; it cannot tell the slot holds a different spell. A Blood Elf paladin has Arcane Torrent on slot 5, which is always usable, so a WhenUsable-only gate fired, cast the racial, never satisfied "!Blessing of Might" and retried forever. Ids rather than names because names drift: Blessing of Protection became Hand of Protection, and Seal of the Crusader was dropped outright - a name gate silently never matches where the id chain still does. Every chain was read out of Json/dbc/wrath/spells.json; that table repeats player spell names on mob abilities, so the noise clusters were filtered rather than taken wholesale. Known limit: this cannot save an ability known at level 1 from a wrong binding. Those carry a Cooldown so a mis-bound bar degrades to a slow retry instead of a hard loop, but the bars still have to match.
Interact-with-target is not a nudge. One press starts a continuous run that the client finishes on its own, keeping the player facing the target the whole way. The bot treated it as a nudge and re-pressed every time the key cooldown cleared - roughly 2.5 times a second for the entire chase. Each press restarts the run, and one landing in the final yards restarts a run toward a mob the player is already standing on, so a warrior or rogue walks through and past it. Ranged classes never noticed; their goal exits 20 yards out. ApproachThrottle presses only when a press changes something: when nothing is carrying the player forward, and on a keepalive whose rate depends on whether the target moved. Movement is read from the player facing, which the interact run keeps pointed at the target - a mob that circles drifts the bearing and earns a prompt re-aim, one standing still gets the slow rate. Measured over a 9 minute run: minimum gap 412ms, median 1037ms, nothing under 200ms, against a flat ~400ms before. Also here, in the same goals: - The closer-target probe blocked the loop while it waited for the addon to publish the swapped target. It is a state machine now, arming a deadline and picking it up on a later tick. - That probe traded targets on every goal re-entry, so two mobs at similar distance swapped places forever and the bot closed on both and pulled neither. A gain margin plus a short-lived memory of the mob just walked away from settles it. - PullTargetGoal keeps its Approach cooldown as a method-level rate limiter. It also gates the stuck detector below it, which jumps on every call, and PressJump honours no cooldown of its own. Relates to #827 - the warrior half, where the bot ends up on top of the mob.
Reported in #827: in combat, on top of the mob, never turning to face it, dead. The attached warlock log shows the recovery firing and failing. Unable to react to ERR_BADATTACKFACING - Fast turn with Interact -422.4484ms React to ERR_BADATTACKFACING - Fast turn with Interact 358.9413ms Unable to react to ERR_BADATTACKFACING - Fast turn with Interact -565.7295ms Same code, three outcomes, and the negatives are AfterEquals timing out. Two faults compounded: The settle window was SpellQueueTimeMs, capped at 400ms by the CVar, while one sample costs updateCount addon frames. At ~100ms a frame the first sample eats the whole budget, so the loop exits before it can compare and the method can only return negative. Success or failure was decided by frame latency, not by anything the player did. Budget is taken from what a sample actually costs now. On failure it then inferred success from "the direction changed" - which is true precisely while a turn is unfinished, so it set turnedWithInteract and skipped the 180 degree fallback in the one state that needs it. A timeout now falls through to the fallback. Confirmed by CombatGoal logging "Turning too fast!" straight after each facing error: the character was mid-spin, not stuck.
45 seconds of Spacebar at ~70ms in one session - the character pogo-jumping in place, which reads from outside as a stuck key. The branch below UNSTUCK_AFTER_MS presses jump on every call and logs nothing. It never escalated because a spline advances its lookahead each tick and re-seeds SetTargetLocation with it, which Resets attemptTime, so UnstuckMs restarts before it can reach the threshold. The ladder sat at attempt 0 forever and the jump fired every frame. Exactly the failure the comment in Navigation already predicted. Gated on the Jump key cooldown, so it cannot fire at frame rate whoever resets the clock. Next session: 71 presses, minimum gap 768ms, median 7.1s.
Four goals pressed jump on every tick while Drowning, with no cooldown, and CombatGoal returned straight after - so a drowning fight was 14 seconds of Spacebar at frame rate and no abilities at all. Tapping is also the wrong action: holding is what makes a swimming character ascend, so the spam was both loud and ineffective. PressJumpAscend holds the key once via PressFixed, which posts the key-up after waiting on the token handle - cancellation shortens the hold, it never skips the release.
A hunter runs out of ammo and has to restock, but which ammo depends on whether the ranged slot holds a bow, a crossbow or a gun - and nothing in the expression language could see that. An ammo vendor entry had to hardcode one item id and was wrong for half the weapons. RangedWeapon:<subclass> reads the equipped ranged item and compares its ItemWeaponSubclass. Bow, Gun, Crossbow, Thrown, Wand and the rest; an unknown name throws at profile load rather than never matching. README updated - the requirement language is user-facing API.
RefillRouteToNextWaypoint skips pathfinding for a hop about as long as the route own point spacing - sound for a recorded route of hundreds of points a few yards apart. A generated route is anchors, not a traced path. Eight of them across a subzone give an average spacing around 60 yards, so a 100 yard leg counted as trivial and the bot walked it blind through whatever stood in the way. SparseWaypoints pins the threshold to OutDoorMinDistance instead, and the caller supplying such a route sets it. Also surfaces StuckDetector.IsUnreachable so a destination that has resisted every unstuck attempt can be abandoned rather than retried forever.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runtime route generation, and the combat fixes found while testing it
Two things in one pack. The headline feature is routes built at runtime from spawn data
instead of hand-recorded waypoint files. The rest are movement and combat fixes that
surfaced while grinding on those routes — several of them are their own bug, so they are
separate commits.
The problem the feature solves
A class profile had to name a recorded waypoint file. That file went stale the moment the
character outlevelled the zone it was drawn for, so profiles were rewritten every couple of
levels — usually just because the trainer had new spells and the old route no longer
matched where the character should be.
PathSettings.Generatereplaces the filename with a query:The route is built from where those mobs actually stand, in the running client's own spawn
data.
Wanderre-samples anchors every lap, so movement no longer traces the same line —which also makes it look far less mechanical.
Combined with
PathsFilenames, one profile now covers levels 1–10 for every race of aclass: eight starting-zone groups, each keyed on
Race, and the character matches the oneit belongs in.
Full design writeup:
docs/generated-routes-design.md.Commits
feat(Path)RouteGenerator·SpawnPolygon·RouteSeed·NavmeshConnectivity·RouteGenSettingsfeat(Frontend)RouteGeneratorPage.razorfeat(CoreTests)routegenharness — render a whole profile with no game runningTest_RouteGen·CoreTests/CLAUDE.mdfeat(ClassConfig)PathsFilenamesgroups + the eight starting zonesPathSettings·Json/path/feat(Json)Json/class/feat(Navigation)SparseWaypointsso generated legs get pathfoundNavigationfix(Approach)ApproachThrottle·ApproachTargetGoal·PullTargetGoalfix(Combat)ERR_BADATTACKFACINGinstead of giving upReactCastErrorfix(StuckDetector)StuckDetectorfix(Input)ConfigurableInputfeat(Requirement)RangedWeapon:— tells arrows from bulletsRequirementFactory·READMENew starting-zone PathSettings groups
Eight group files under
Json/path/, each a barePathSettingsarray pulled in by namerather than pasted into every profile that levels there:
1-8_Human_Northshire.json1-8_Draenei_AmmenVale.json1-8_NightElf_Teldrassil.json1-8_DwarfGnome_Coldridge.json1-8_OrcTroll_ValleyOfTrials.json1-8_Undead_Deathknell.json1-8_Tauren_RedCloudMesa.json1-8_BloodElf_SunstriderIsle.jsonEach has three tiers —
Level < 3,< 5,< 8— with the mob filter narrowing as thecharacter grows, and every entry keyed on
Race. A profile lists all eight and thecharacter simply never matches the seven it does not belong in, so one file serves every
race of a class.
Mob names were checked against
creatures.jsonand the map spawn tables rather than typedfrom memory. That caught real errors:
Wretched Zombiehas zero spawns on its map,Burning Blade Neophyteis level 9-10,Bristleback Thornweaveris level 18-19. It alsocaught Camp Narache, the obvious choice for Tauren, holding exactly one spawn — the
camp is the village, the mobs are on Red Cloud Mesa around it, which holds 216. That
one would have looked fine in a log and been useless in game.
Name:is a substring match, which matters more than it looks:Name:Mottled Boaralsocatches Dire (6-7) and Elder (8-9), and
Name:Bristlebackcatches Thornweaver at 18.The level guards on those entries are load-bearing, not decoration.
New 1-10 class profiles
Nine profiles, one per class, replacing the per-level ladder — this is what removes the
rewrite-every-two-levels problem:
Warrior·Warlock·Mage·Priest·Rogue·Hunter·Paladin·Shaman·DruidDeath Knight is out of scope; it starts at 55.
Each amalgamates the existing low-level profiles for that class and gates every ability
trained after level 1 on a
Spell:SPELL_*id array, so an untrained spell is skipped andthe same file works at level 1 and level 10. Each carries a header comment listing the key
bindings it expects.
Building them surfaced two things worth calling out:
Paladin_10.jsonbuilds its whole rotation on Seal of the Crusader, whichis not trained until 22. Copied as-is, a level 1 paladin would have had no seal at
all. Rebuilt around Seal of Righteousness.
SPELL_RANK_PAINand on low mana.Shielding keyed to mana and gated on an unrelated spell looks like a copy-paste slip;
changed to the shield spell and low health. Flag it if that was deliberate.
Hunter additionally restocks ammunition, which needed the new
RangedWeapon:requirement —a bow and a crossbow eat arrows, a gun eats bullets, and nothing in the expression language
could previously tell them apart. There is a money gate on the vendor trip so the bot does
not walk to a merchant it cannot pay.
Relates to #827
Two independent faults, both reproduced from the reporter's own log.
The warlock half is the real bug in that report.
ReactCastErrorwas firing andfailing:
Same code, three outcomes. The settle window was
SpellQueueTimeMs— capped at 400 ms bythe CVar — while one sample costs 4 addon frames. At ~100 ms a frame the first sample eats
the whole budget, so the method can only ever time out. Success was decided by frame
latency, not by anything the player did. On failure it then inferred success from "the
direction changed", which is true precisely while a turn is unfinished, and so skipped the
180° fallback in the one state that needs it.
CombatGoalloggingTurning too fast!straight after each error confirms it: mid-spin, not stuck.
The warrior half — on top of the mob, in combat, never turning — is the approach
overshoot, fixed separately.
Worth being explicit for the reporter: the addon version in that issue is the template
default, so it is not evidence of anything, and "lag" was their inference rather than an
observation. The mechanism turned out to be addon frame latency against a fixed sample
budget, which is why it felt like lag.
Measured
Same 9-minute grind, before and after:
122 kills, no
Too long time, no blacklist losses.Verification
HeadlessServer --loadonly, which exercises the realClassConfiguration.Initialise— requirement expressions compiled,Usable:/CanRun:resolved to named KeyActions (that one throws, so it would be a startup crash), and
PathsFilenamesgroups read off disk.tier resolves with real spawns, from 39 up to 293.
Json/dbc/wrath/spells.json, not from memory. That tablerepeats player spell names on mob abilities, so the noise clusters were filtered rather
than taken wholesale.
Known limits, deliberately not fixed here
Spell:gating fixes anything trainedafter level 1, but nothing can stop a wrongly-bound key for an ability known at level 1
— the bot presses the key and casts whatever is actually there. Those entries carry a
Cooldownso it degrades to a slow retry instead of a hard loop.ActionBarSlotValidatoralready detects the mismatch and only logs it; turning that into a gate is a separate
change.
Food/Drinkon=and-. A hunter session shows 42 ×Cast failed due CurrentActionNotDetectedand no successful eat. README already warns that main-bar slots11/12 are keyboard-layout dependent. The profiles inherit the existing convention;
rebinding them is a follow-up.
NO PLAN - nothing runnable, 19× in one session — in combat with no target, rightafter a loot and ClearTarget. Recovers on its own. Possibly a remaining hole from
d96e1121.loot succeeded. Cosmetic in the log, but the early return skips
CheckForCanGather, so askinnable corpse can be missed.
Generated paths
🤖 Generated with Claude Code