[WIP] Unity's first FlowField based Pathfinding tool

In the Unity asset store there are many pathfinding assets that (as far as I know) all work with A* and control character movement by making them follow a path from node to node. That is why I wanted to create an alternative to these pathfinding systems, one based on Flow Fields.

For those unfamiliair with flow fields, this is a nice tutorial that explains it : Flow Field Pathfinding – Leif Node . In simple terms its a 2D array of vectors that characters can follow to reach their destination.

The biggest strength of flow fields, is that they are reuasable amongst characters, making them ideal for large groups (swarms) of units. They have been used in RTS games such as Supreme Commander 2 and Planetary Annihilation.

Within the next couple of weeks I want to put my tool on the asset store, but before that happens I would really like some feedback of what you guys think of it, what features you would like to see implemented, etc. Any feedback is welcome.

Simple Video Preview:

Features:

  • Tile based pathfinding system that returns flowfields instead of a (node) path.
  • Customize settings to fit your Project.
  • Supports Multi Level terrain (terrain can cross over each other).
  • Cost Drawing, manipulate the cost of nodes (for example: increase cost on a swamp area).
  • Dynamic world: blockades and cost changes get processed and change flowfields to fit accordingly.
  • Easy to setup: works with any 3d model if setup to a few guidelines.

Note: You can adjust how “strictly” characters follow the flow, in the video example characters slightly drift, because they change their direction towards the flow over time. You can set it to an instant change or make them look as if they are running on ice :slight_smile:

2 Likes

The tool also works with Unity Terrain

Interesting, how is the performance over A*, and other node based pathfinding?

At the moment I don’t have good stats for this project, but in the meantime you can check out Dissertation Glenn Korver Final its a paper I wrote of my previous project in which I compare flowfields vs A* vs Jump Point Search, with a “Performance” section.

(video, build, and paper of my old project can be found here:)

Please keep in mind these results are on fairly large maps, whith a lot of “U” shapes, if A* was guided by something like HPA*, the searches would be much much faster, this is just raw A*.

As a general rule, creating flowfields is always slower than creating 1 A* path on small (less than 40x40) and/or pretty empty maps, so if your doing a lot of searches for just 1 or 2 characters, flowfields are not the best option. On big maps where A* is supported by HPA*, A* would still beat flowfields if you do single/small group searches.

Flow fields strength comes from it being so well reusable amongst characters, if you have a group of 50 characters close to eachother going to the same destination, you just need 1 flow field path instead of 50 seperate A* paths, in these scenarios flow fields shine.

I’ll post some time results of this/current project within the next 2 days.

Im very interested in this, because im developing a rts with lots of units on large maps, so this would benefit me a lot.

Some quick performance results.

Bought this asset other day. Currently running Unity 5.5.1f1. Worked alright in the test scene however after putting in our own terrain we ran into a couple of problems. The first was a NullReferenceException for Seeker.cs: 242

desiredFlowValue = pathfinder.seekerManager.FindflowValueFromPosition(transform.position - (Vector3.up * 0.57f), flowFieldPath.flowField, this);

Also while we could successfully create cube objects masked as obstacles to be avoided. When we did the same thing with our building models the flowfield was still trying to lead the agents right through the building meaning they just stood there and didn’t move.

Really keen to continue using this asset just need a bit of help with these problems!