Files

6.4 KiB

Building the navmesh for pfQuest SmartArrow

The navmesh is an optional add-on, pfQuest-SmartArrow-Navmesh, that you build once on your own PC. It turns SmartArrow's walking paths from a good guess into the real thing. It knows every wall, cliff, bridge, cave and building floor in Eastern Kingdoms and Kalimdor, on every level, so the arrow gets the way right the first time instead of learning from bumps.

It's made from the same movement maps classic servers use to move pets and NPCs. Those maps are built from your own game client's files, so the result is yours to use. Don't share the generated add-on.

You need:

  • the World of Warcraft 1.12.1 client you play with
  • Windows 10 or 11, about 5 GB of free space, and about an hour (most of it waiting)
  • Python 3 (tick "Add python.exe to PATH" when installing)

There are three steps: build the server tools, extract the movement maps, and convert them for SmartArrow.

1. Build the server's map tools

Any classic core's tools work, since SmartArrow reads their output whichever one made it. The best-documented route on Windows is MaNGOS Zero. Follow its Windows guide up to and including Compile: https://wiki.realmofespionage.xyz/servers:windows:games:mangos_zero_vanilla_localhost

In short, that means installing Visual Studio 2022 (Desktop development with C++), CMake, Git, OpenSSL and the MariaDB development files, then building with the tools switched on:

git clone --branch master --depth 1 --recurse-submodules https://github.com/mangoszero/server.git "%UserProfile%\Projects\MaNGOS-Zero\src"
cmake -S "%UserProfile%\Projects\MaNGOS-Zero\src" -B "%UserProfile%\Projects\MaNGOS-Zero\build" -G "Visual Studio 17 2022" -DBUILD_TOOLS=1 (plus the MariaDB paths from the guide)
MSBuild "%UserProfile%\Projects\MaNGOS-Zero\build\ALL_BUILD.vcxproj" -property:Configuration=Release

You don't need to set up or run a server. Only the tools in build\src\tools\Extractor_projects\Release are used.

CMaNGOS Classic (-DBUILD_EXTRACTORS=ON, tools map-extractor, vmap-extractor, vmap-assembler, movemap-generator) and VMaNGOS work as well.

2. Extract the movement maps

From the guide's Content Extraction section, run steps A, B and C, in that order, with -i pointing at your WoW folder. The movement maps need the maps and vmaps from the first two steps.

mkdir C:\WowMaps & cd C:\WowMaps
"...\Release\map-extractor.exe" -i "C:\Path\To\World of Warcraft" -o C:\WowMaps -f 0
"...\Release\vmap-extractor.exe" -i "C:\Path\To\World of Warcraft"
"...\Release\mmap-extractor.exe" -i "C:\Path\To\World of Warcraft" --offMeshInput "...\src\src\tools\Extractor_Binaries\offmesh.txt" --bigBaseUnit true --threads %NUMBER_OF_PROCESSORS%

When it's done there's a folder of .mmtile files, normally mmaps (in C:\WowMaps here). That folder is all SmartArrow needs.

3. Convert them for SmartArrow

First, a quick test on a small area, Shadowglen and Aldrassil, to check that everything lines up:

python "C:\Path\To\World of Warcraft\Interface\AddOns\pfQuest-SmartArrow\tools\bake_navmesh.py" C:\WowMaps\mmaps --maps 1 --box=10077,10877,401,1201

It prints what it found. The important line is the axis check: it should say that nearly all walking-network points are on the mesh (90% or more), well ahead of the next best. If it stops with an error instead, send the output to the addon's issue tracker.

Then the whole world (Eastern Kingdoms and Kalimdor). This takes a while, and it prints progress row by row:

python "C:\Path\To\World of Warcraft\Interface\AddOns\pfQuest-SmartArrow\tools\bake_navmesh.py" C:\WowMaps\mmaps

It writes the add-on folder pfQuest-SmartArrow-Navmesh next to SmartArrow in your Interface\AddOns. Use --out to put it somewhere else. At the end it prints the size and how many cells are on more than one level.

4. In the game

Enable pfQuest SmartArrow Navmesh in the AddOns list at character select. SmartArrow loads it by itself while the loading screen is up and says so in chat. /smartarrow mesh shows what it covers.

When it's installed:

  • walking paths are planned on the navmesh: around everything solid, over bridges, up ramps and stairs, into caves through their real entrance
  • roads, your walked trails and hostile camps still count, the same as without it
  • the arrow never aims across a wall corner
  • anything the navmesh can't answer (a search that runs too long, a spot off the mesh) falls back to the usual planner

5. Build the path network (to ship with SmartArrow)

The navmesh itself stays on your PC. What SmartArrow carries is a path network made from it:

  • the walkable ground is cut into 28 yard squares
  • every separate piece of ground in a square (each side of a wall, each level, water apart from land) gets one point, in its most open spot, on the road where there is one
  • two points are joined where the walk between them was checked on the navmesh: straight where that's clear, otherwise round the corner, with the corner kept

That's only coordinates and connections.

python3 bake_rects.py --verify 500

It reads pfQuest-SmartArrow-Navmesh next to SmartArrow and writes data/paths.lua inside SmartArrow. --verify 500 then walks 500 test trips on the navmesh using the arrow's own rules and reports how many arrive, how many get blocked and where, how much longer than a straight line they are, and how many steps go through water.

In the game, a walk is planned once: from the point of the piece of ground you stand on, along the joins, to the point of the piece the goal is on. The arrow then follows that line, aiming 10 yards ahead, and plans again only when the goal changes or you leave the line (more than 15 yards off, or onto another level). Where the network has no data, the older planner is used. /smartarrow debug shows where a path came from; /smartarrow mesh shows whether the network is loaded.

Re-run step 3 if you update SmartArrow and its notes say the navmesh format changed. The movement maps from step 2 can be reused.

Fixing a place where the arrow leads you into a wall

The movement maps are made for creatures, which climb roots and ledges a player cannot. Where the arrow keeps leading you onto one, find the border with probe_rects.py (it shows the rectangles round a spot and the walk the arrow plans from it) and add a box round it to tools/cuts.txt; bake_rects.py leaves out every border whose middle lies in a box, and plans round it.