Skip to main content
GameDev.net gamedev.net
🔒 Locked

Properly Mixing NavMesh Pathfing with Steering Behaviors

Started by Ender1618 Oct 22, 2015 at 5:19 PM 1 replies 9.6k views
Original Post
Ender1618
Ender1618

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

Burnt_Fyr
Burnt_Fyr

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.

IADaveMark
IADaveMark

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<

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.