I am having a hard time finding any official documentation on UE4 navigation and AI movement/steering in general. Have I missed it, or is there really no documentation on this topic? If so, are there any recommended 3rd party docs out there?
Hey Haimat! not sure how in depth you are looking but we have the NavMesh content example and also the Behavior Tree Quick Start Guide . These have the concepts I would believe to get you started with AI navigation and movement. There are also a number of youtube videos from community members that are out there . . . Maybe look this Basic AI Navigation from Tesla and AI Behavior Tree & NavMesh from Peter Newton. The videos are a bit older so the UI may differ slight so keep that in mind BUT hopefully the concepts will still help.
Thanks for the feedback, Brandon. I have seen those sections in the official docs, but they feel a bit short in comparison to most other parts of the superb UE4 documentation. I would be interested in a few more (technical) details, for example how path finding works internally (A*, hierarchical?) and things like that.
Also in particular I am interested to know how one can and should work with multiple nav meshes. For example, how does one dynamically define different costs for different areas in a map, is that described somewhere in detail?
Gotcha! Let me see if I can get one of our Dev’s to chime in and hopefully they can at least answer your immediate questions
But what I will do is make a request to get NavMesh and AI docs updated with more info.
Going back to the questions, bare with me and let me find someone to jump in and provide some incite.
That is super aweseome, thank you very much Brandon!
Right. Where to start
I’ll start by answering the specific questions you’ve asked.
Under the hood we’re using Recast (google it, there’s lots of info on it online) and it’s using regular A*. We’ve approached the idea of implementing hierarchical pathfinding on top of that, but we didn’t get satisfying results in dynamic worlds such as Fortnite’s. It’s kinda there, but we don’t market it as a full-blown feature until we get time to get back to it and make it bullet-proof.
Most navigation queries allow you to specify NavigationData instance you want to use for the query. NavigationData in regular, out-of-the-box use cases are just RecastNavMesh instances.
To annotate navmesh with “areas” you need to use “navigation modifiers”. Those are actors that implement INavRelevantInterface. The easiest and ready-to-use modifier is NavModifierVolume - just put it on the map and pick navigation area class to use. Now to change the cost dynamically that’s a bit more work - you either need to dynamically change the cost associated with selected nav area type, or configure navigation query filter (FNavigationQueryFilter) to use virtual calls while calculating traversal cost during A* search (expensive, but as flexible as it gets).
Not yet, sorry. AI Documentation is behind a bit
Hope it helps somewhat, and feel free to ask follow up questions!
Thank you very much for your reply.
I do have some follow-up questions indeed
Ohh yes I know Recast, at least I have had a talk on that at the last GameAI conference in Vienna. Besides, personally I have had some good experience with Jump Point Search (in open areas), and I would like to implement it in UE4. Now, do I need to pull off a whole new path finding solution from scratch in that case, or can I implement JPS with some kind of interface and plug that class into the built-in path finding framework within the engine, so that it would be used automatically instead of A*?
So if I understand you correctly, then I can use multiple nav meshes, but can only specify one certain mesh at one navigation query, right? If that is the case, is there any way to navigate from A to B if A lives in nav mesh 1 and B lives in nav mesh 2? So, can I navigate from one mesh to another mesh?
Thanks, I will have a look at that.
The documentation is great already for many parts, it just lacks details in some sections, like AI. Are there any plans and ETA for when this will be addressed?
Also, I have another related question: Does UE4 provide any built-in solutions for steering behaviours (e.g. avoid, flee, follow, etc.), or do I need to implement that on my own from scratch? In the latter case, do you have any recommendations where it would be best to plug such a custom solution in?
All you need to do is to create a class derived from [FONT=Courier New]ANavigationData and point to it in [FONT=Courier New]NavigationSystem.SupportedAgents
There’s currently no way of doing that, but that’s going to be added as part of “navmesh on moving platforms” support.
Plans: yes, ETA: no idea. I’d love it to be ASAP! We are aware of this being an issue and as far as I know the docs team has AI docs in focus.
We supply two implementations actually. One is a simple RVO which you enable by setting [FONT=Courier New]CharacterMovementComponent.bUseRVOAvoidance (note that it doesn’t care about navmesh) and the other is our wrapper for Detour Crowds, which you use by making your AI use [FONT=Courier New]UCrowdFollowingComponent as path following component (the easiest way is to derive your AI controller from [FONT=Courier New]ADetourCrowdAIController, or just use it).