Posted on Apr 3, 2011

Pathfinding 102-ish

Following my last post on my debut with pathfinding (well yesterday’s post), I continued my reading to achieve a smoother path. Well for starter, using the triangle’s center for the path’s point is really not a good choice because of the way meshes are built: in a zig-zag-ish way to form quad I believe, or not. I was already storing the connecting edge between triangles so I thought it was a good try to build the path following the center point of those edges.

Navigation mesh

Path built with center-edges

Not bad at all and certainly better than with center-triangle. So what about smoothing the line a bit? I read about Catmull-Rom formula to create in-between point to form a sort-of-curve-path, but I saw a friend on IM so I through it would be a good idea to have an external take. My friend, who shall-not-be-named is working on a major triple-A game at Ubisoft, told me that the process of smoothing the path was cheaper to do in the path-follow behavior, less secure but cheaper. Well duh! Why did I not thought of that first!

In the next week-or-so, I’ll be reading about flocking behavior to add on top of the pathfinding. My ultimate goal is to generate a nice crowd of primitives that follows a path.

Latest Tweets