From 604361e7b8c2cf54859d5be2d2b5f7b8a6508231 Mon Sep 17 00:00:00 2001 From: Fitz <146554352+fitzforge@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:51:14 +0100 Subject: [PATCH 1/9] nav city gate: trip ends the match couldn't anchor go on their NPC's floor; reported walks from everyone; #2889 - A trip end at a Forever NPC the old match had no spawn height for now sits on that NPC's floor (the heights came with the Forever TDB), like a landing on its flight master's. - The reported set takes any person's walk through a reported place (outside the capitals nothing is built from recordings); the walker's own breadcrumbs stay out of the walked surfaces. - New reported case: #2889, Riverglades, from Gelinda Coppergleam into the Cinderscale hollow. --- tests/nav-city.test.js | 21 +++++++++++-------- tools/lib/nav/city/gate.js | 35 ++++++++++++++++++-------------- tools/lib/nav/city/reported.json | 3 ++- tools/lib/nav/city/world.js | 16 ++++++++------- 4 files changed, 44 insertions(+), 31 deletions(-) diff --git a/tests/nav-city.test.js b/tests/nav-city.test.js index f7b12c17df..52a2bf1945 100644 --- a/tests/nav-city.test.js +++ b/tests/nav-city.test.js @@ -74,13 +74,18 @@ test('trail tiles: negative heights, many levels and long cell gaps round-trip t sample.forEach(([, , z, w], n) => assert.deepEqual(got[n], [z, w], `entry ${n}`)); }); -test("the city gate starts a landing on the flight master's floor, not the ground under the tower", () => { - const { landOnTower } = require('../tools/lib/nav/city/gate'); - const g = { colIndex: () => 0, colNodes: () => [0, 1, 2], nz: [39.5, 61.4, 95] }; +test("the city gate's ends: a landing on the flight master's floor, an NPC the match had no height for on the NPC's", () => { + const { anchorEnds } = require('../tools/lib/nav/city/gate'); + const g = { colIndex: () => 0, colNodes: () => [0, 1, 2, 3], nz: [39.5, 61.4, 95, -85.1] }; const taxi = [{ c: 1, wx: 1677.5, wy: -4315.7, npc: 3310 }]; - const npcZ = (npc) => (npc === 3310 ? 61.7 : null); - const trip = { c: 1, A: { kind: 'land', wx: 1677.5, wy: -4315.7, z: 39.5, node: 0 } }; - assert.deepEqual(landOnTower(g, trip, taxi, npcZ).A, { ...trip.A, z: 61.4, node: 1, landed: 39.5 }); - assert.equal(landOnTower(g, { ...trip, A: { ...trip.A, kind: 'vendor' } }, taxi, npcZ).A.z, 39.5); - assert.equal(landOnTower(g, { ...trip, A: { ...trip.A, wx: 1900 } }, taxi, npcZ).A.z, 39.5, 'no flight master within 40 yd'); + const npcZ = (npc) => ({ 3310: 61.7, 270038: -85.1 })[npc] ?? null; + const B = { kind: 'vendor', wx: 1690, wy: -4400, z: 39.5, node: 0, npc: 3322, anchored: true }; + const trip = { c: 1, A: { kind: 'land', wx: 1677.5, wy: -4315.7, z: 39.5, node: 0 }, B }; + const moved = anchorEnds(g, trip, taxi, npcZ); + assert.deepEqual(moved.A, { ...trip.A, z: 61.4, node: 1, was: 39.5 }); + assert.equal(moved.B, B, 'an anchored end stays'); + assert.equal(anchorEnds(g, { ...trip, A: { ...trip.A, wx: 1900 } }, taxi, npcZ).A.z, 39.5, 'no flight master within 40 yd'); + const lab = { ...B, npc: 270038, anchored: false }; + assert.deepEqual(anchorEnds(g, { ...trip, B: lab }, taxi, npcZ).B, { ...lab, z: -85.1, node: 3, was: 39.5 }); + assert.equal(anchorEnds(g, { ...trip, B: { ...lab, npc: 1 } }, taxi, npcZ).B.z, 39.5, 'no height known'); }); diff --git a/tools/lib/nav/city/gate.js b/tools/lib/nav/city/gate.js index 68ccb78039..9d58564f0e 100644 --- a/tools/lib/nav/city/gate.js +++ b/tools/lib/nav/city/gate.js @@ -75,18 +75,23 @@ function landZ(taxi, npcZ, c, wx, wy) { return best ? npcZ(best.n.npc, best.n.wx, best.n.wy) : null; } -// A trip that starts at a landing starts where the flight sets players down, on the flight master's floor: the -// recording has only the taxi node's spot, and the matcher may put it on the ground under the tower (Orgrimmar's, -// Thunder Bluff's), where players then drop to. The start moves to the grid level nearest the flight master's height -// (within 8 yd) at that spot. -function landOnTower(g, t, taxi, npcZ) { - if (t.A.kind !== 'land') return t; - const z = landZ(taxi, npcZ, t.c, t.A.wx, t.A.wy); - const ci = z === null ? -1 : g.colIndex(t.A.wx, t.A.wy); - if (ci < 0) return t; - let node = -1; - for (const v of g.colNodes(ci)) if (Math.abs(g.nz[v] - z) <= 8 && (node < 0 || Math.abs(g.nz[v] - z) < Math.abs(g.nz[node] - z))) node = v; - return node < 0 || node === t.A.node ? t : { ...t, A: { ...t.A, z: g.nz[node], node, landed: t.A.z } }; +// A trip's ends on the floor the game puts them on, where the matcher could only guess: a landing on its flight +// master's floor (the recording has only the taxi node's spot, and the matcher may put it on the ground under the +// tower, Orgrimmar's and Thunder Bluff's, where players then drop to), and an NPC's end the match had no spawn height +// for (Forever's own NPCs, whose heights came with the Forever TDB) on that NPC's. Each moves to the grid level +// nearest that height (within 8 yd) at its spot; `was` keeps the matched height. +function anchorEnds(g, t, taxi, npcZ) { + const fix = (e) => { + const z = e.kind === 'land' ? landZ(taxi, npcZ, t.c, e.wx, e.wy) : !e.anchored && e.npc ? npcZ(e.npc, e.wx, e.wy) : null; + const ci = z === null ? -1 : g.colIndex(e.wx, e.wy); + if (ci < 0) return e; + let node = -1; + for (const v of g.colNodes(ci)) if (Math.abs(g.nz[v] - z) <= 8 && (node < 0 || Math.abs(g.nz[v] - z) < Math.abs(g.nz[node] - z))) node = v; + return node < 0 || node === e.node ? e : { ...e, z: g.nz[node], node, was: e.z }; + }; + const A = fix(t.A); + const B = fix(t.B); + return A === t.A && B === t.B ? t : { ...t, A, B }; } // Line scoring on the judge's grid. @@ -407,7 +412,7 @@ async function gate({ priv, nav, ground = null, spf = null, grid, frames, spawnz const t0 = Date.now(); const area = loadArea(priv, map, grid, frames); const npcZc = spawnHeight(spawnz, city.c); - const trips = area.trips.map((t) => landOnTower(area.g, { ...t, c: city.c, side: city.side }, taxi, npcZc)); + const trips = area.trips.map((t) => anchorEnds(area.g, { ...t, c: city.c, side: city.side }, taxi, npcZc)); const res = await runArms({ trips, arms, dirs: { nav: gn.dir, ground, spf }, spawnz, policy, taxi }); const rows = scoreRows(area, trips, res, protosFor(area, arms)); const summary = summarize(rows, map, frames, npcs); @@ -433,7 +438,7 @@ async function gateWorld({ priv, nav, ground = null, spf = null, grid, frames, s const zOf = (c) => npcZc.get(c) || npcZc.set(c, spawnHeight(spawnz, c)).get(c); const trips = all.map((t) => { const s = { ...t, side: t.fac === 'Alliance' || t.fac === 'Horde' ? t.fac : null }; - return s.A.kind === 'land' ? landOnTower(new AreaGraph(s.box, { grid }), s, taxi, zOf(s.c)) : s; + return s.A.kind === 'land' || s.A.npc || s.B.npc ? anchorEnds(new AreaGraph(s.box, { grid }), s, taxi, zOf(s.c)) : s; }); const byI = new Map(trips.map((t) => [t.i, t])); const gn = gateNav(path.resolve(nav), priv); @@ -583,4 +588,4 @@ function markdown(report, cmp = null) { return lines.join('\n'); } -module.exports = { gate, gateWorld, remeasure, compareReports, markdown, judge, tautPts, desire, landOnTower, COUNTED }; +module.exports = { gate, gateWorld, remeasure, compareReports, markdown, judge, tautPts, desire, anchorEnds, COUNTED }; diff --git a/tools/lib/nav/city/reported.json b/tools/lib/nav/city/reported.json index 21e06aca51..814c1268c8 100644 --- a/tools/lib/nav/city/reported.json +++ b/tools/lib/nav/city/reported.json @@ -12,6 +12,7 @@ {"id": "stormrage-barrow-dens", "issue": "#2027", "title": "Moonglade: the Stormrage Barrow Dens (#1919, #2005)", "zone": 1450, "c": 1, "at": [7337, -2639.3], "r": 90}, {"id": "banethil-barrow-den", "issue": "#2027", "title": "Teldrassil: Ban'ethil Barrow Den (#1341)", "zone": 1438, "c": 1, "at": [9772.6, 1553.9], "r": 70}, {"id": "grizzled-den", "issue": "#2027", "title": "Dun Morogh: Grizzled Den, the wendigo cave under Shimmer Ridge (#2679)", "zone": 1426, "c": 0, "at": [-5502.3, -231.9], "r": 110}, - {"id": "freewind-bridges", "issue": "#2027", "title": "Thousand Needles: Freewind Post's rope bridges between the mesas (#1936)", "zone": 1441, "c": 1, "at": [-5430, -2440], "r": 90} + {"id": "freewind-bridges", "issue": "#2027", "title": "Thousand Needles: Freewind Post's rope bridges between the mesas (#1936)", "zone": 1441, "c": 1, "at": [-5430, -2440], "r": 90}, + {"id": "cinderscale-hollow", "issue": "#2889", "title": "Riverglades: from Gelinda Coppergleam into the Cinderscale hollow (137 yd, planned 1:50 round the mountain)", "zone": 2548, "c": 0, "at": [-8768.8, -3351.5], "r": 70} ] } diff --git a/tools/lib/nav/city/world.js b/tools/lib/nav/city/world.js index db7bdd62ee..982f2723ff 100644 --- a/tools/lib/nav/city/world.js +++ b/tools/lib/nav/city/world.js @@ -185,7 +185,8 @@ function matchWorld({ priv, grid, frames, spawnz, set = 'world', log = () => {} for (const trips of byZone.values()) { const maps = trips[0].maps || [trips[0].zone]; const zone = trips[0].zone; - const sessions = areaSessions(priv, maps).filter((s) => !isTest(s.who)); + // the walked surfaces come from the training people (the reported set: everyone but the walker) + const sessions = areaSessions(priv, maps).filter((s) => set === 'reported' || !isTest(s.who)); const c = frames[String(zone)].c; const npcZ = spawnHeight(spawnz, c); // the training people's pieces, once per area @@ -207,12 +208,12 @@ function matchWorld({ priv, grid, frames, spawnz, set = 'world', log = () => {} continue; } const { full } = m.expand(seg, whole, st, null, 0, true); - // density: up to DENSITY_PEOPLE training people's breadcrumbs near the trip + // density: up to DENSITY_PEOPLE training people's breadcrumbs near the trip (never the trip's own person's) const near = nearTrip(seg); const people = new Map(); const seen = new Set(); for (const { who, seg: s2 } of pieces) { - if (seen.size >= DENSITY_PEOPLE && !seen.has(who)) continue; + if (who === t.who || (seen.size >= DENSITY_PEOPLE && !seen.has(who))) continue; let run = []; const runs = []; for (const x of s2) { @@ -310,8 +311,8 @@ function sampleBoundary({ priv, frames, spawnz, per = 25, seed = 1, log = () => return out; } -// tools/lib/nav/city/reported.json's cases (players' reports): each case's zone's held-out walks between stops (20-1500 -// yd apart) that pass within r yd of its place (with end: finish there), up to `per` a case, round-robin over people +// tools/lib/nav/city/reported.json's cases (players' reports): each case's zone's walks between stops (20-1500 yd +// apart) that pass within r yd of its place (with end: finish there), up to `per` a case, round-robin over people // -> /reported/candidates.json (stratum 'reported', case: its id). function sampleReported({ priv, frames, spawnz, per = 12, seed = 1, log = () => {} }) { const rand = rng(seed); @@ -320,8 +321,9 @@ function sampleReported({ priv, frames, spawnz, per = 12, seed = 1, log = () => for (const k of cases) { const npcZ = spawnHeight(spawnz, k.c); const byWho = new Map(); + // every person: the places are rare (few walk a mine), and outside the capitals nothing is built from + // recordings, so no walk needs holding out; the match leaves the walker's own breadcrumbs out of the density for (const s of readSessions(path.join(priv, `${k.zone}.jsonl`))) { - if (!isTest(s.who)) continue; for (const seg of segmentsOf(s, k.zone, frames, npcZ, blankCut(), { stops: STOPS })) { for (const { piece, B, straight } of stopWalks(seg, 20, MAX_STRAIGHT)) { const hit = k.end ? Math.hypot(B.wx - k.at[0], B.wy - k.at[1]) <= k.r : nearTrip(piece)(k.at[0], k.at[1]) <= k.r; @@ -334,7 +336,7 @@ function sampleReported({ priv, frames, spawnz, per = 12, seed = 1, log = () => const got = roundRobin([...byWho.values()], per, rand); out.trips.push(...got); out.cases[k.id] = { issue: k.issue, people: byWho.size, trips: got.length }; - log(`reported sample ${k.id} (${k.issue}): ${byWho.size} held-out people walked it; ${got.length} trips`); + log(`reported sample ${k.id} (${k.issue}): ${byWho.size} people walked it; ${got.length} trips`); } out.trips.forEach((t, i) => (t.i = i)); const dir = path.join(priv, 'reported'); From ac344d53bde3459d20bfad37f439fde94248ed7a Mon Sep 17 00:00:00 2001 From: Fitz <146554352+fitzforge@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:07:19 +0100 Subject: [PATCH 2/9] nav city gate: an end moves only onto a level players walk - A trip end goes to its NPC's or flight master's floor only where 3+ training people walk that level. --- tools/lib/nav/city/gate.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/lib/nav/city/gate.js b/tools/lib/nav/city/gate.js index 9d58564f0e..9280dc6db1 100644 --- a/tools/lib/nav/city/gate.js +++ b/tools/lib/nav/city/gate.js @@ -79,14 +79,15 @@ function landZ(taxi, npcZ, c, wx, wy) { // master's floor (the recording has only the taxi node's spot, and the matcher may put it on the ground under the // tower, Orgrimmar's and Thunder Bluff's, where players then drop to), and an NPC's end the match had no spawn height // for (Forever's own NPCs, whose heights came with the Forever TDB) on that NPC's. Each moves to the grid level -// nearest that height (within 8 yd) at its spot; `was` keeps the matched height. -function anchorEnds(g, t, taxi, npcZ) { +// nearest that height (within 8 yd) at its spot that players walk (walked(node): 3+ training people), else stays; +// `was` keeps the matched height. +function anchorEnds(g, t, taxi, npcZ, walked = () => true) { const fix = (e) => { const z = e.kind === 'land' ? landZ(taxi, npcZ, t.c, e.wx, e.wy) : !e.anchored && e.npc ? npcZ(e.npc, e.wx, e.wy) : null; const ci = z === null ? -1 : g.colIndex(e.wx, e.wy); if (ci < 0) return e; let node = -1; - for (const v of g.colNodes(ci)) if (Math.abs(g.nz[v] - z) <= 8 && (node < 0 || Math.abs(g.nz[v] - z) < Math.abs(g.nz[node] - z))) node = v; + for (const v of g.colNodes(ci)) if (Math.abs(g.nz[v] - z) <= 8 && walked(v) && (node < 0 || Math.abs(g.nz[v] - z) < Math.abs(g.nz[node] - z))) node = v; return node < 0 || node === e.node ? e : { ...e, z: g.nz[node], node, was: e.z }; }; const A = fix(t.A); @@ -412,7 +413,7 @@ async function gate({ priv, nav, ground = null, spf = null, grid, frames, spawnz const t0 = Date.now(); const area = loadArea(priv, map, grid, frames); const npcZc = spawnHeight(spawnz, city.c); - const trips = area.trips.map((t) => anchorEnds(area.g, { ...t, c: city.c, side: city.side }, taxi, npcZc)); + const trips = area.trips.map((t) => anchorEnds(area.g, { ...t, c: city.c, side: city.side }, taxi, npcZc, (v) => area.train[v] >= 3)); const res = await runArms({ trips, arms, dirs: { nav: gn.dir, ground, spf }, spawnz, policy, taxi }); const rows = scoreRows(area, trips, res, protosFor(area, arms)); const summary = summarize(rows, map, frames, npcs); @@ -438,7 +439,9 @@ async function gateWorld({ priv, nav, ground = null, spf = null, grid, frames, s const zOf = (c) => npcZc.get(c) || npcZc.set(c, spawnHeight(spawnz, c)).get(c); const trips = all.map((t) => { const s = { ...t, side: t.fac === 'Alliance' || t.fac === 'Horde' ? t.fac : null }; - return s.A.kind === 'land' || s.A.npc || s.B.npc ? anchorEnds(new AreaGraph(s.box, { grid }), s, taxi, zOf(s.c)) : s; + if (!(s.A.kind === 'land' || s.A.npc || s.B.npc)) return s; + const walked = new Set(s.density.filter(([, n]) => n >= 3).map(([v]) => v)); + return anchorEnds(new AreaGraph(s.box, { grid }), s, taxi, zOf(s.c), (v) => walked.has(v)); }); const byI = new Map(trips.map((t) => [t.i, t])); const gn = gateNav(path.resolve(nav), priv); From 1dfa1d1aa8a9864e59b92f3affc2c9e5e26e7838 Mon Sep 17 00:00:00 2001 From: Fitz <146554352+fitzforge@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:25:10 +0100 Subject: [PATCH 3/9] nav city: usage lists the world steps, --set, --spf and --spawnz --- tools/commands/nav.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/commands/nav.js b/tools/commands/nav.js index e7096f56a8..179cb39e32 100644 --- a/tools/commands/nav.js +++ b/tools/commands/nav.js @@ -30,7 +30,8 @@ const usage = `usage: node tools/polestar.js nav build [--continents 0,1] [--for node tools/polestar.js nav city match --private [--maps ...] [--grid ] node tools/polestar.js nav city freeze --private [--maps ...] [--max 200] [--force] node tools/polestar.js nav city trails --private [--maps ...] [--train] [--out ] [--lua addon/Polestar_Nav/Trails/Trails.lua] - node tools/polestar.js nav city gate --private [--nav ] [--ground ] [--maps ...] [--arms GAME,WALK,E0,E2,P3] [--policy legacy|a2] [--remeasure ] [--baseline ] [--out ] [--md ] [--grid ] + node tools/polestar.js nav city gate --private [--nav ] [--ground ] [--spf ] [--maps ...] [--arms GAME,WALK,E0,E2,G1,SPF,P3,P4,P5] [--policy legacy|a2] [--spawnz ] [--remeasure ] [--baseline ] [--out ] [--md ] [--grid ] + node tools/polestar.js nav city world-sample|world-match|world-gate --private [--set world|boundary|reported] [--maps world|...] [--per N] [--seed N] [--strata ...] (world-gate: as gate) build the navigation grid of every continent map-frames.json names (or --continents): client geometry per ADT tile through the CASC cache @@ -93,6 +94,10 @@ city the capitals' walks against players' recordings (tools/lib/nav/city). harness) and prints the failures per city and arm (GAME: the player's floor known; WALK: unknown, the addon's fallbacks); with --baseline exit 1 when a counted arm gets worse in any capital. + world-sample/-match/-gate: the same over every other zone (--set + world: stratified held-out walks), across the capitals' entrances + (boundary) and through the places of open walking-map issues + (reported: tools/lib/nav/city/reported.json). Retired for Forge (docs/forge/nav.md): pack (forge nav pack), check (forge nav check), layers (forge nav layers roads|hubs).`; From 94b6f46aa0f14512c8c264bb66995606415f20d1 Mon Sep 17 00:00:00 2001 From: Fitz <146554352+fitzforge@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:29:09 +0100 Subject: [PATCH 4/9] nav city gate: --policy a2 asks a failed WALK again from any floor near its start height, then with none - Mirrors CityFloor's Walk.lua (#2911): from.floors = [z] with reach 10, then no start height. --- tools/lib/nav/city/gate.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/lib/nav/city/gate.js b/tools/lib/nav/city/gate.js index 9280dc6db1..b86b6b6cc9 100644 --- a/tools/lib/nav/city/gate.js +++ b/tools/lib/nav/city/gate.js @@ -398,6 +398,22 @@ async function runArms({ trips, arms, dirs, spawnz, policy, taxi = [] }) { const second = navRun(dir, again.map((k) => route(trips[k], `${arm}|${trips[k].i}|retry`, A(trips[k], startOf(trips[k], arm)), B(trips[k], null)))); again.forEach((k, j) => (first[k] = { ...second[j], retried: true })); } + // a2 (CityFloor's Walk.lua): a WALK whose guessed start height can't reach the goal is asked again starting on + // any surface within 10 yd of that height (from.floors), then with no start height + if (arm === 'WALK' && policy === 'a2') { + for (const step of ['floors', 'none']) { + const again = []; + first.forEach((r, k) => { + const sz = startOf(trips[k], arm); + if (!r.ok && sz !== null && sz !== undefined) again.push(k); + }); + const ask = (t) => route(t, `${arm}|${t.i}|${step}`, A(t, null), B(t, goalOf(t, arm)), step === 'floors' ? { reach: 10, floors: [startOf(t, arm)] } : { reach: 10 }); + const second = navRun(dir, again.map((k) => ask(trips[k]))); + again.forEach((k, j) => { + if (second[j].ok || step === 'none') first[k] = { ...second[j], retried: step }; + }); + } + } res[arm] = first; } return res; From a3629863f074bdb277572cff09544a8de3dbc7e7 Mon Sep 17 00:00:00 2001 From: Fitz <146554352+fitzforge@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:35:49 +0100 Subject: [PATCH 5/9] nav eval acceptance: the Mound of Dirt ledge (#2214), the Cinderscale hollow (#2889) and Booty Bay's docks to Seahorn (#2215) - #2214 and #2889 fail on today's maps (640 yd round the valley; the hollow's walk ends 31 yd short of the Draconia); #2215's walk passes: that bug is the floor lost on the climb, which the city gate's walk without a known floor covers. --- tools/lib/nav/city/gate.js | 23 +++++++++++++++++++++-- tools/lib/nav/eval/acceptance.json | 5 ++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tools/lib/nav/city/gate.js b/tools/lib/nav/city/gate.js index b86b6b6cc9..82724bdd1f 100644 --- a/tools/lib/nav/city/gate.js +++ b/tools/lib/nav/city/gate.js @@ -517,8 +517,26 @@ function scoreRows(area, trips, res, protos = {}) { x.fail = failOf(x, tt); return x; }; + // an end anchorEnds moved (a landing onto its tower, an NPC onto its floor) joins the recorded route by the graph's + // own walk between the two (players drop off the tower; a walk can't): the real route is that plus the recorded one + const realPath = (t) => { + let p = t.path; + const join = (from, to) => { + area.g.search([[from, 0]], [to], { bound: 600 }); + return area.g.pathTo(to); + }; + if (t.A.was !== undefined && t.A.node !== p[0]) { + const pre = join(t.A.node, p[0]); + if (pre) p = pre.concat(p.slice(1)); + } + if (t.B.was !== undefined && t.B.node !== p[p.length - 1]) { + const post = join(p[p.length - 1], t.B.node); + if (post) p = p.slice(0, -1).concat(post); + } + return p; + }; return trips.map((t, k) => { - const real = measure(tautPts(area.g, t.path)); + const real = measure(tautPts(area.g, realPath(t))); const tt = { ...t, real: real.yards }; const row = { i: t.i, A: t.A, B: t.B, straight: t.straight, real: real.yards, arms: {} }; for (const [arm, rs] of Object.entries(res)) row.arms[arm] = score(rs[k], tt); @@ -555,7 +573,8 @@ function remeasure(report, { priv, grid, frames, npcs = {}, protos: extraArms = for (const [map, m] of Object.entries(report.maps)) { const area = loadArea(priv, Number(map), grid, frames); const byI = new Map(area.trips.map((t) => [t.i, t])); - const trips = m.rows.map((r) => byI.get(r.i)); + // the stored rows keep the ends the gate anchored (anchorEnds) + const trips = m.rows.map((r) => ({ ...byI.get(r.i), A: r.A, B: r.B })); const res = {}; for (const arm of Object.keys(m.rows[0].arms)) if (!PROTO[arm]) res[arm] = m.rows.map((r) => r.arms[arm]); const protos = protosFor(area, [...new Set([...Object.keys(m.rows[0].arms), ...extraArms])]); diff --git a/tools/lib/nav/eval/acceptance.json b/tools/lib/nav/eval/acceptance.json index 06eee871f4..26a508db52 100644 --- a/tools/lib/nav/eval/acceptance.json +++ b/tools/lib/nav/eval/acceptance.json @@ -77,6 +77,9 @@ {"id":"tb-spirit-rise-pools","kind":"floor","issue":null,"tags":["underworld"],"outcome":"From the top of Spirit Rise down into the Pools of Vision to Miles Welsh (z 97.9), 40 yd under the rise: on his floor, not the rise top above him.","map":1,"from":[-996.9,278.5,138.1],"to":[-956.2,252.4,97.9],"profile":"Horde","expect":[{"type":"ok"},{"type":"end","leg":30,"dz":3},{"type":"metric","metric":"yards","op":"<=","value":390}]}, {"id":"tb-elevator-bottom-elder-rise","kind":"floor","issue":null,"tags":["chokepoint"],"outcome":"Bloodhoof Village up a Mesa Elevator and across to Elder Rise, ending on Hamuul's floor (z 159.1).","map":1,"from":[-2378.767,-399.137,-3.866],"to":[-1048.7,-304,159.1],"profile":"Horde","expect":[{"type":"ok"},{"type":"end","leg":40,"dz":4},{"type":"metric","metric":"yards","op":"<=","value":2460}]}, {"id":"stormwind-city-harbor","kind":"reported","issue":null,"reporter":"Fitz (screenshot, 2026-10-21)","tags":[],"outcome":"Fitz, 2026-10-21 (screenshot): from the player in Stormwind City through the city down to the harbour docks (the dock 9 yd from the Stormwind Harbor boat stop, TaxiPathNode -8654.5,1344.4), never out of the city north over the mountains (streets <= 101 yd high, the mountains to 268).","from":{"uiMap":1453,"x":55.9,"y":56.9},"to":[-8649.5,1337.4,6],"profile":"Alliance","expect":[{"type":"ok"},{"type":"height","max":130},{"type":"metric","metric":"yards","op":"<=","value":1090}]}, - {"id":"stormwind-city-harbor-under","kind":"reported","issue":null,"reporter":"Fitz (screenshot, 2026-10-21)","tags":["underworld"],"outcome":"The same walk from the surface under the player (z 59: the terrain buried under the Trade District; from it today's router draws the screenshot's detour, so it is probably the surface the in-game floor took): it should still go through the city, not north over the mountains and round the coast.","map":0,"from":[-8654.925,751.655,59],"to":[-8649.5,1337.4,6],"profile":"Alliance","expect":[{"type":"ok"},{"type":"height","max":130},{"type":"metric","metric":"yards","op":"<=","value":1090}]} + {"id":"stormwind-city-harbor-under","kind":"reported","issue":null,"reporter":"Fitz (screenshot, 2026-10-21)","tags":["underworld"],"outcome":"The same walk from the surface under the player (z 59: the terrain buried under the Trade District; from it today's router draws the screenshot's detour, so it is probably the surface the in-game floor took): it should still go through the city, not north over the mountains and round the coast.","map":0,"from":[-8654.925,751.655,59],"to":[-8649.5,1337.4,6],"profile":"Alliance","expect":[{"type":"ok"},{"type":"height","max":130},{"type":"metric","metric":"yards","op":"<=","value":1090}]}, + {"id":"stonetalon-camp-mound-of-dirt","kind":"reported","issue":"#2214","tags":["oneway"],"outcome":"From the camp's Pocket Litter (object 424005) north through the camp and down the steep slope to the Mound of Dirt on the ledge (z 205, the grid: 141 yd with an 18 yd drop), never down into the valley below it (z under 195) and back up (today about 640 yd for a 100 yd trip).","from":{"uiMap":1442,"x":40.75,"y":52.57,"f":"e"},"to":{"uiMap":1442,"x":39.62,"y":49.87,"z":204.9},"profile":"Horde","expect":[{"type":"ok"},{"type":"end","leg":30,"dz":5},{"type":"height","min":195},{"type":"metric","metric":"yards","op":"<=","value":190}]}, + {"id":"riverglades-gelinda-cubic-draconia","kind":"reported","issue":"#2889","tags":["underworld"],"outcome":"From Gelinda Coppergleam (the report's Where line, z 170) in at the hollow's mouth beside her and through the Cinderscale hollow to the Cubic Draconia at its back, on the hollow's floor (z 190; the grid: 336 yd), not round the mountain (the report: 1:50 for 137 yd straight).","from":{"uiMap":2548,"x":30.25,"y":69.08,"z":170},"to":{"uiMap":2548,"x":30,"y":73.3,"z":190.3},"profile":"Alliance","expect":[{"type":"ok"},{"type":"end","leg":30,"dz":5},{"type":"metric","metric":"yards","op":"<=","value":440}]}, + {"id":"bootybay-docks-seahorn","kind":"reported","issue":"#2215","tags":[],"outcome":"The reporter's way: from First Mate Crazz on the docks (the chain's previous turn-in) up Booty Bay's stairs to Fleet Master Seahorn on his floor (z 28.8; the grid: 197 yd), not the inn floor 14 yd under him nor out through the pass.","map":0,"from":[-14411.1,428,9],"to":[-14444.8,486.8,28.8],"profile":"Horde","expect":[{"type":"ok"},{"type":"end","leg":30,"dz":5},{"type":"metric","metric":"yards","op":"<=","value":260}]} ] } From 48489acf9d0784d97f0e88f85b889572c5b2dd62 Mon Sep 17 00:00:00 2001 From: Fitz <146554352+fitzforge@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:37:40 +0100 Subject: [PATCH 6/9] nav city gate: reports keep the walks to 0.01 yd so --remeasure scores them as the run did - At 0.1 yd, 8 Darnassus walks within 0.5 yd of the 10 yd unwalked-floor threshold flipped on --remeasure. --- tools/lib/nav/city/gate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lib/nav/city/gate.js b/tools/lib/nav/city/gate.js index 82724bdd1f..b60ba1ef07 100644 --- a/tools/lib/nav/city/gate.js +++ b/tools/lib/nav/city/gate.js @@ -510,7 +510,8 @@ async function gateWorld({ priv, nav, ground = null, spf = null, grid, frames, s // judge's own desire paths). function scoreRows(area, trips, res, protos = {}) { const { measure } = judge(area); - const keep = (pts) => pts.map((p) => p.map((v) => (v === null ? null : +v.toFixed(1)))); + // 0.01 yd: --remeasure re-scores these, and the judge's 10 yd thresholds sit close to some walks + const keep = (pts) => pts.map((p) => p.map((v) => (v === null ? null : +v.toFixed(2)))); const score = (r, tt) => { if (!r.ok) return { ok: false, reason: r.reason, fail: 'no walk' }; const x = { ok: true, ...measure(r.pts), routerYards: r.yards === undefined ? null : r.yards, retried: !!r.retried, startZ: r.pts[0][2], endZ: r.pts[r.pts.length - 1][2], pts: keep(r.pts) }; From 3f681739e40f4c648c6d6ccf981cdbbf3d2bcb5a Mon Sep 17 00:00:00 2001 From: Fitz <146554352+fitzforge@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:46:22 +0100 Subject: [PATCH 7/9] nav city gate: a walk asked without an end's height is judged by its nearest point's height - Legacy's retry drops the goal height, so its last point had none and 'end off the floor' never fired (CityFloor: Garion Wendell's chamber, Stormwind 59 and 111). --- tools/lib/nav/city/gate.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/lib/nav/city/gate.js b/tools/lib/nav/city/gate.js index b60ba1ef07..4d1c42b97b 100644 --- a/tools/lib/nav/city/gate.js +++ b/tools/lib/nav/city/gate.js @@ -512,9 +512,14 @@ function scoreRows(area, trips, res, protos = {}) { const { measure } = judge(area); // 0.01 yd: --remeasure re-scores these, and the judge's 10 yd thresholds sit close to some walks const keep = (pts) => pts.map((p) => p.map((v) => (v === null ? null : +v.toFixed(2)))); + // an end asked without a height has none on its own point: the walk's height there is its nearest point's that has one + const zAt = (pts, from, step) => { + for (let i = from; i >= 0 && i < pts.length; i += step) if (pts[i][2] !== null && pts[i][2] !== undefined) return pts[i][2]; + return null; + }; const score = (r, tt) => { if (!r.ok) return { ok: false, reason: r.reason, fail: 'no walk' }; - const x = { ok: true, ...measure(r.pts), routerYards: r.yards === undefined ? null : r.yards, retried: !!r.retried, startZ: r.pts[0][2], endZ: r.pts[r.pts.length - 1][2], pts: keep(r.pts) }; + const x = { ok: true, ...measure(r.pts), routerYards: r.yards === undefined ? null : r.yards, retried: !!r.retried, startZ: zAt(r.pts, 0, 1), endZ: zAt(r.pts, r.pts.length - 1, -1), pts: keep(r.pts) }; x.fail = failOf(x, tt); return x; }; From 72c38e2233d79d2bfdb49872ecc2ecd9162dd901 Mon Sep 17 00:00:00 2001 From: Fitz <146554352+fitzforge@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:47:09 +0100 Subject: [PATCH 8/9] nav city gate: an NPC end's height is its nearest spawn within 15 yd, as the game's Lookup.SpawnZ - The matcher keeps its 12 yd. --- tools/lib/nav/city/gate.js | 9 +++++---- tools/lib/nav/city/match.js | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/lib/nav/city/gate.js b/tools/lib/nav/city/gate.js index 4d1c42b97b..3e4afcec15 100644 --- a/tools/lib/nav/city/gate.js +++ b/tools/lib/nav/city/gate.js @@ -28,6 +28,7 @@ const run = require('../eval/run'); const STEP = 2; // yd: line samples const DZ = 6; // yd: a line point lies on a surface within this height (the two maps' heights differ up to ~5 yd) const Z_OFF = 30; // yd, Nav/Walk.lua: a path ending this far off the goal's height missed its floor +const SPAWN_R = 15; // yd, Lookup.SpawnZ: an NPC goal's height is its nearest spawn's this close const COUNTED = ['GAME', 'WALK']; // The folder the gate runs: nav, with its Trails/Trails.lua replaced by /Trails-train.lua when that exists (the @@ -340,14 +341,14 @@ async function runArms({ trips, arms, dirs, spawnz, policy, taxi = [] }) { const B = (t, z) => [t.B.wx, t.B.wy, z === undefined ? null : z]; const npcZs = new Map(); const npcZ = (t, e) => { - if (!npcZs.has(t.c)) npcZs.set(t.c, spawnHeight(spawnz, t.c)); + if (!npcZs.has(t.c)) npcZs.set(t.c, spawnHeight(spawnz, t.c, SPAWN_R)); return npcZs.get(t.c)(e.npc, e.wx, e.wy); }; // what Walk.lua knows of a stop's height: the NPC just talked to (spawn height), or at a landing its flight // master's (TaxiNodes' height stands in for it in game) const hint = (t, e) => { if (e.kind !== 'land') return npcZ(t, e); - if (!npcZs.has(t.c)) npcZs.set(t.c, spawnHeight(spawnz, t.c)); + if (!npcZs.has(t.c)) npcZs.set(t.c, spawnHeight(spawnz, t.c, SPAWN_R)); return landZ(taxi, npcZs.get(t.c), t.c, e.wx, e.wy); }; // WALK (CityFloor's rules): the start from the trail floor within 4 yd near the stop's height hint, else the hint, @@ -428,7 +429,7 @@ async function gate({ priv, nav, ground = null, spf = null, grid, frames, spawnz const city = CITIES[map]; const t0 = Date.now(); const area = loadArea(priv, map, grid, frames); - const npcZc = spawnHeight(spawnz, city.c); + const npcZc = spawnHeight(spawnz, city.c, SPAWN_R); const trips = area.trips.map((t) => anchorEnds(area.g, { ...t, c: city.c, side: city.side }, taxi, npcZc, (v) => area.train[v] >= 3)); const res = await runArms({ trips, arms, dirs: { nav: gn.dir, ground, spf }, spawnz, policy, taxi }); const rows = scoreRows(area, trips, res, protosFor(area, arms)); @@ -452,7 +453,7 @@ async function gateWorld({ priv, nav, ground = null, spf = null, grid, frames, s const all = readWorldTrips(priv, set).filter((t) => !strata || strata.includes(t.stratum)); const keep = new Set(all.map((t) => t.i)); const npcZc = new Map(); - const zOf = (c) => npcZc.get(c) || npcZc.set(c, spawnHeight(spawnz, c)).get(c); + const zOf = (c) => npcZc.get(c) || npcZc.set(c, spawnHeight(spawnz, c, SPAWN_R)).get(c); const trips = all.map((t) => { const s = { ...t, side: t.fac === 'Alliance' || t.fac === 'Horde' ? t.fac : null }; if (!(s.A.kind === 'land' || s.A.npc || s.B.npc)) return s; diff --git a/tools/lib/nav/city/match.js b/tools/lib/nav/city/match.js index c29403b14e..dccddf8702 100644 --- a/tools/lib/nav/city/match.js +++ b/tools/lib/nav/city/match.js @@ -40,13 +40,13 @@ const JUMP_COST = 20; const OFF_ANCHORED = 15; const BEAM = 150; -// The NPC's spawn height nearest (within 12 yd) to a world point on continent c, or null. -function spawnHeight(spawnz, c) { +// The NPC's spawn height nearest (within R yd) to a world point on continent c, or null. +function spawnHeight(spawnz, c, R = 12) { return (npc, wx, wy) => { const s = npc && spawnz[String(npc)]; if (!s) return null; let best = null; - let bd = 12; + let bd = R; for (const [sc, x, y, z] of s) { if (sc !== c) continue; const d = Math.hypot(x - wx, y - wy); From 794b15709f1b8f03492c907b5ebef42a229d1a11 Mon Sep 17 00:00:00 2001 From: Fitz <146554352+fitzforge@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:47:35 +0100 Subject: [PATCH 9/9] nav city gate: WALK's start hint follows NpcFloor (spawns within 30 yd, none when they span 10+ yd of height) --- tools/lib/nav/city/gate.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/lib/nav/city/gate.js b/tools/lib/nav/city/gate.js index 3e4afcec15..edee21b53f 100644 --- a/tools/lib/nav/city/gate.js +++ b/tools/lib/nav/city/gate.js @@ -344,10 +344,26 @@ async function runArms({ trips, arms, dirs, spawnz, policy, taxi = [] }) { if (!npcZs.has(t.c)) npcZs.set(t.c, spawnHeight(spawnz, t.c, SPAWN_R)); return npcZs.get(t.c)(e.npc, e.wx, e.wy); }; - // what Walk.lua knows of a stop's height: the NPC just talked to (spawn height), or at a landing its flight + // what Walk.lua knows of a stop's height (CityFloor's NpcFloor): the NPC just talked to, from its spawns within 30 + // yd of the player, the nearest one's height unless they span more than 10 yd of height; or at a landing its flight // master's (TaxiNodes' height stands in for it in game) + const npcFloor = (t, e) => { + const s = e.npc && spawnz[String(e.npc)]; + if (!s) return null; + let best = null; + let lo = Infinity; + let hi = -Infinity; + for (const [sc, x, y, z] of s) { + const d = sc === t.c ? Math.hypot(x - e.wx, y - e.wy) : Infinity; + if (d > 30) continue; + lo = Math.min(lo, z); + hi = Math.max(hi, z); + if (!best || d < best.d) best = { d, z }; + } + return best && hi - lo <= 10 ? best.z : null; + }; const hint = (t, e) => { - if (e.kind !== 'land') return npcZ(t, e); + if (e.kind !== 'land') return npcFloor(t, e); if (!npcZs.has(t.c)) npcZs.set(t.c, spawnHeight(spawnz, t.c, SPAWN_R)); return landZ(taxi, npcZs.get(t.c), t.c, e.wx, e.wy); };