• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Pathing Wizard v1.3.2

Overview

The Pathing Wizard is a tool that facilitates the creation of the pathing map, allowing the user to easily control which parts of the map can be accessed by players.

Pathing Wizard uses a flood-fill algorithm to determine which parts of the map are accessible and which parts are connected. You have the option to use seed points. If you do, only sections of the map that can be reached from at least one of the seed points are considered accessible. Imagine water being flooded into the map from the seed points you define. Unwalkable terrain sections act as walls, preventing the water from reaching areas that are separated from the areas you flood, even if they are themselves walkable.

If you don't use seed points, the algorithm will simply check whether a point on the terrain is walkable to determine whether it is accessible, while still storing information about which sections of the map are connected.

You then have various options to modify inaccessible sections of the map. You can disable pathability (to disallow units from blinking there, for example) and create pathing blockers around those areas to improve AI pathfinding (with just walkability disabled, units often have a hard time finding the correct path). You no longer have to spam pathing blockers yourself, reducing map size and editor save/load time.

The pathing map is created during the loading screen and takes roughly 1 second on a semi-large map.

Units are intentionally ignored, as this system is supposed to only concern itself with the map terrain.

Features
  • Disable pathing on inaccessible sections of the map. This prevents players from teleporting into forbidden areas.
  • Automatically disable pathing on certain terrain types.
  • Paint pathing with rects.
  • Automatically create pathing blockers around the borders of inaccessible areas to improve unit pathfinding.
  • Update the pathing map whenever a destructable is destroyed.
  • Check for spots where players can leave the intended map areas by visualizing the pathing map.
  • Functions:
    • IsPointAccessible
    • GetClosestAccessiblePoint
    • ArePointsConnected
    • GetSectionSize

Installation

Copy the PathingWizard script file from the test map as well as the Walkability Check Item. Make sure the fourCC code ("I000" etc.) of the item matches the TEST_ITEM_TYPE you set in the config.

Credits

Showcase Map Credits: Ultimate Terraining Map
Contents

PathingWizard (Binary)

PathingWizard v1.3.2 (Map)

Reviews
Wrda
Why is CreateVisualizers function checking if VISUALIZE_MAP is true when it is already being checked before this function is called? local function IsPathable(i, j) if explicitlyUnpathable[i][j] then return false elseif...
Very nice! Next up is astar with a binary heap :p
Nah, while doing pathfinding is somewhere on my to-do list, I made this just in preparation of another, unrelated system I'm working on, which I'll publish soon.

When I get to the pathfinding, I don't think A* is the best fit. The pathing map in my map will be static, so I want an algorithm that can make use of cached calculations. I'm thinking creating nodes at each convex corner of unwalkable sections of the map, then precomputing a visibility graph between them. For the pathfinding, you find the nodes visible at the start and destination points, then traverse nodes from there to find the shortest path.
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,993
Why is CreateVisualizers function checking if VISUALIZE_MAP is true when it is already being checked before this function is called?

Lua:
local function IsPathable(i, j)
        if explicitlyUnpathable[i][j] then
            return false
        elseif explicitlyPathable[i][j] then
            return true
        end
        local x, y = worldMinX + (i - 0.5)*64, worldMinY + (j - 0.5)*64
        SetItemPosition(testItem, x, y)
        local itemX, itemY = GetItemX(testItem), GetItemY(testItem)
        return x - itemX <= 1 and x - itemX >= -1 and y - itemY <= 1 and y - itemY >= -1
    end
Must hide all items first before setting the testItem position, and later unhide. Currently if there are preplaced items, it screws up.

Lua:
GetSectionMap()                                                         Returns the interal section map.
Typo :D
The ability to have 32x32 pathing would be nice.

Great for maps that rely on spawning units randomly on the, but relocate them to reachable areas. I'll approve in good faith that you fix that issue above.

Approved
 
Why is CreateVisualizers function checking if VISUALIZE_MAP is true when it is already being checked before this function is called?

Lua:
local function IsPathable(i, j)
        if explicitlyUnpathable[i][j] then
            return false
        elseif explicitlyPathable[i][j] then
            return true
        end
        local x, y = worldMinX + (i - 0.5)*64, worldMinY + (j - 0.5)*64
        SetItemPosition(testItem, x, y)
        local itemX, itemY = GetItemX(testItem), GetItemY(testItem)
        return x - itemX <= 1 and x - itemX >= -1 and y - itemY <= 1 and y - itemY >= -1
    end
Must hide all items first before setting the testItem position, and later unhide. Currently if there are preplaced items, it screws up.
Fixed.

Lua:
GetSectionMap()                                                         Returns the interal section map.
Typo :D
🦅

The ability to have 32x32 pathing would be nice.
At 64x64 spaced pathing checks, it seems to work just fine, even for units with 0 collision radius, so I don't really see the benefit for that. I would also need to rewrite the entire logic for the pathing blocker placement.

Great for maps that rely on spawning units randomly on the, but relocate them to reachable areas.
Not what I had in mind, but I'll take it! :plol:

Thank you! 👍
 
Level 8
Joined
Sep 16, 2016
Messages
226
Insane, just tinkered with the system and its mindboggling how good it is at doing its job. So far I only have one seed, how many "seeds" would there have to be to see a noticeable difference in performance?
 
Insane, just tinkered with the system and its mindboggling how good it is at doing its job. So far I only have one seed, how many "seeds" would there have to be to see a noticeable difference in performance?
Glad to hear!

I'm assuming you're refering to the comment I wrote somewhere in the documentation that says that multiple seed points decrease performance. This is meant to imply that you shouldn't use multiple seed points for a single connected area. Users might mistakenly assume that this increases the speed because now the "water is flooding in" from multiple points. If you have a thousand separated areas with one seed point each, the time to process them will be exactly equal to that of one area with the combined size.
 
Level 8
Joined
Sep 16, 2016
Messages
226
Glad to hear!

I'm assuming you're refering to the comment I wrote somewhere in the documentation that says that multiple seed points decrease performance. This is meant to imply that you shouldn't use multiple seed points for a single connected area. Users might mistakenly assume that this increases the speed because now the "water is flooding in" from multiple points. If you have a thousand separated areas with one seed point each, the time to process them will be exactly equal to that of one area with the combined size.
Oooh, thank you for the clarification. :)
 
Top