• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Pathing Wizard

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. If you don't, the algorithm will simply check whether a point on the terrain is pathable to determine whether it is accessible, while still storing information about which sections of the map are connected.

You 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. 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 library from the test map as well as the Walkability Check Item.

Credits

Showcase Map Credits: Ultimate Terraining Map
Contents

PathingAssistant v1.2 (Map)

PathingWizard (Binary)

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 26
Joined
Nov 18, 2012
Messages
1,924
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! 👍
 
Top