Features
- Capable of A* and Dijkstra pathfinding.
- Specify how the pathfinder should navigate your graph. Provide a set of neighbouring nodes that are adjacent to the current node being searched.
Documentation
Graphs
- Compatible with Unity's Tilemaps, including rectangular, hexagonal, and isometric.
- Compatible with many kinds of custom graphs, for example, 3D voxels, city maps, nav meshes (but not Unity's built-in NavMesh).
Customisable
- When the pathfinder finds the goal, you can specify what to collect from the final path of temporary node objects. For example, you could collect a list of edges in the graph network instead of a list of nodes.
- Specify edge weight (cost). For example, mud slows the player/character/agent down.
- Specify the A* heuristic (estimated distance cost from current node to the goal). For example, given a 2D grid of squares, you can make the path have a staircase shape or a big L shape by changing the heuristic.
- Store custom data with each node and/or edge that was searched. For example, in a TBS game like Civilization, given the pathfinder is searching for a path that the selected land unit would take, if the pathfinder reaches this tile (node), then the land unit will board a transport ship.
- Access the set of explored nodes. For example, for a turn-based strategy game like Civilization, you could show all the tiles that the selected unit can reach this turn.
- Opportunities for your own optimisation. Specify the IDictionary collection that stores the nodes that the pathfinder has searched. For example, you can optimise it for a 2D grid of squares by using a quadtree structure.
- Optionally allow the pathfinder to re-explore the previous node that led to the current node.
Multithreading
Multithreading circumvents blocking (synchronous) calls, thus your game's framerate will not drop.
- Tasks
- async/await
- Dispatch callbacks back to the main Unity thread (for calling Unity API methods).
Few Dependencies
- EmpirePathfinding is a C# library.
- The Core module is not coupled to Unity (it can be used in non-Unity C# projects).
- The Core module requires .NET 4.6 and C# 7.3.
Compatibility
- Compatible with Unity 2021.2.7.
- Backwards compatible with Unity 2019.3.10.
Performance
Performance is a secondary focus (the primary focus is flexibility). There are opportunities for you to manually optimise for performance. If necessary, you could manually translate/port the library implementation into a more efficient language like C++, once you have decided on the behaviour your pathfinder needs. If EmpirePathfinding gains enough traction, we will release a C++ module as an alternative to C#, which does not suffer the same downsides as C# (memory allocation, indirection).
Third Party Notices
The EmpirePathfinding package is governed by the Unity Asset Store EULA.
However, some components included in the package have different licenses. See ThirdPartyNotices.txt for more details.
EmiprePathfinding uses MoreLinq under Apache 2.0.
MoreLinq uses code under MIT.