I finally finished with the implementation of HPA*.

The pathfinder can be parameterized on cluster size, cluster-local path quality, coarse path quality and minimum distance between entrances to name a few. Below are a few examples. HPA* is ideal for use for many unit pathfinding queries, which I intend to have in AoT.

Clusters and entrances. Background is the movecost heatmap (blue: low move cost, red: high movecost)

Clusters, entrances and connections

Showing image /sigil-of-kings-website/assets/2017/01/output_overworld_navpathhpavis_true_true.webp

Low quality path using HPA* (cost: 70.464)

Showing image /sigil-of-kings-website/assets/2017/01/output_overworld_navpath_q0_70-464.webp

High quality path using HPA* (cost: 25.349)

Showing image /sigil-of-kings-website/assets/2017/01/output_overworld_navpath_q9_25-3496.webp

High quality path using regular A* (cost: 23.765)

Showing image /sigil-of-kings-website/assets/2017/01/output_overworld_navpath_q10_23-7657.webp

 

Dynamic path

The pathfinder works also with dynamic weights: when parts of the weights are updated, we only recalculate the cluster-local paths in the clusters that the weights are in, ie. minimizing A* calculations.

Here's a busy visualization of a dynamic path:

Showing image /sigil-of-kings-website/assets/2017/01/output_visibility_unitpath_unit_dwarves_vis_normal4.gif

The movecost map is visualized again as a heatmap. Green is the "unknown movecost", and is the so-far invisible area. The map is split in 8x8 clusters. All entrances and connected paths are visualized with magenta. The fat white line is the evolving path calculation. It is clear that "highways" are formed naturally when we explore the movecost map, as several paths coalesce