🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Properly Mixing NavMesh Pathfing with Steering Behaviors

Started by
1 comment, last by IADaveMark 8 years, 9 months ago

So I am working in Unity (5.x) Pro and have my AI agents moving about via calls to Unity's built in path finding and movement system (NavMesh base).

I also, in the past did alot of work with Reynold style steering behaviors, and had alot of nice (uselfull) emergent behaviors come about. But when I used them there was a low density of static obstacles, so a true global path finding solution was unnessisary.

But for this new Unity project, my maps have a high density of obstacles (also some areas of low density, e.g. large courtyards, etc), and a global path finder is quite nessisary (some places can be maze like).

So what I want to do is somehow properly mix NavMesh based path planning with Steering Behaviors (Evade, Chase, Formations, etc.). It is not quite clear to me how that would work.

The NavMesh does give me all walk-able areas, which I can query with ray casts. I also can compute paths from any location on the navmesh to any other location on the navmesh, without having to traverse them (Ive used that to know if even a path exists), but this is an expensive operation and can not be perform too often (like once an update frame, would not work). The number of AI agents I am dealing with right now is anywhere from 1 to 32.

I was just wondering if others have tried to mix these two movement systems, and how they went about it?

Thanks,

-Ryan

Advertisement

In "Programming Game AI by Exampke" by Buckland (Great book) pathfinding is just another steering behavior. if pathfollow behavior is enabled, the behavior checks if the current waypoint is within a certain radius, and if it is, it sets currentwaypoint to the next waypoint in the path. It then returns a vector to the current waypoint.

Yeah, basically, you treat your next waypoint as an attractor that is "pulling" you and all the other objects you are trying to steer around as "pushing" you. Since you are guaranteed by the pathfinder and navmesh that you can reach the next waypoint directly (i.e. moving across a poly face), steering towards that waypoint should work fine. That way, you get a nice blend of "I'm trying to get over there but this crap is in my way."

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

This topic is closed to new replies.

Advertisement