Vectorfield Pathfinding
An interactive blog post on VFP, a novel pathfinding algorithm for steering many agents toward one goal, written as live p5.js visualisations you can play with as you read.
Overview
One field instead of a thousand paths
Back in 2016, while building a clone of Tanks!, I ran into my first pathfinding challenge. I needed a way for multiple enemy tanks to chase the player around while dodging walls. After digging into the topic, I came across goal-based vector pathfinding (or simply Vector Field Pathfinding — VFP). It did exactly what I needed, but in a way that felt more visual & intuitive than A* or Dijkstra. I liked it so much that I even made a video about it in 2020 just to share how cool and practical this approach really is.
The video ended up doing very well for a niche subject! It sparked a lot of great discussions in the comments: people sharing alternative approaches, asking smart questions, or diving deeper into the method. But looking back, my younger self definitely made a few mistakes. There were some unverified claims, oversimplified explanations, and a lot I just didn’t know back then. More than six years later, I finally decided to revisit this topic, something I’d been wanting to do for a long time, especially as the comments kept rolling in over the years.
This is what this post is about: A Deep dive into Vector Field Pathfinding. How it works, the many ways you can build and tweak it to fit different needs and where it fits in the spectrum of pathfinding algorithms.