DoN's 3D Pathfinding for Flying A.I. [Support Thread]

Ok I added the interface and implemented the "Add Movement Input Custom but I’m still getting the same results. If there is no obstacle between the flying unit and it’s goal, it flies towards the goal and the expected output comes from the event. However, if I move the obstacle between the flying unit and goal, there is no output from the event.

Is the navigation path being generated correctly in all these cases and is Fly To still running on the BT? I don’t think a case like this has been encountered before. Do you have multi-threading enabled by any chance?

Without anything in the logs at this point it’s hard to guess what’s going on. If you’re comfortable with debugging I suggest putting a breakpoint inside BTTask_FlyTo.cpp’s TickTask function. It should be easy to tell exactly what’s going on by doing that.

Another approach is to carefully compare your setup with the sample project’s manager class, its pawns and its behavior trees.

Yes, the path is correct and it’s still running. Multi-threading is not enabled.

I debugged it and it’s completely skipping the switch case in the TickTask function “switch (myMemory->QueryResults.QueryStatus)”

When the obstacle is not there, this switch succeeds correctly. However, when the obstacle is there, it doesn’t even enter the switch statement.

That means the path solution is still being generated and Fly To is waiting for the path to arrive, so I’m surprised that you’re seeing the path being generated at all in the first place.

Best bet then is to directly debug DoNNavigationManager.cpp’s TickScheduledPathfindingTasks function. At this point only that can tell us whether your path was truly generated or if there is some other setup quirk that is preventing the data from being relayed…

Ok I stepped through everything like you said and I am reaching line 2487 “data.QueryStatus = EDonNavigationQueryStatus::Success; // Finally, the task has succeeded!” but there’s still no movement. Where should I look next?

At the bottom of TickScheduledPathfindingTasks you will find CompleteNavigationTask(i);. Inside that the ResultHandler delegate is what notifies the FlyTo task that it can begin routing locomotion to your pawn. If that delegate worked, it should invoke UBTTask_FlyTo::Pathfinding_OnFinish function inside BTTask_FlyTo.cpp.

I’d take a step back and compare your setup with the sample project first though; behavior trees, pawns, manager setup, everything. This kind of low-level issue hasn’t been reported before so might be easier to first run your usecases in the sample project first and then migrate them out to yours.

It seems as if the UBTTask_FlyTo::Pathfinding_OnFinish() is being called after the path is generated.

Major Update & 4.17 release

What’s New:

Full Multi-threading support!

  • Multi-threading code has been rewritten from scratch and is now robust and ready for use. It is now enabled by default.
  • Significant performance boosts - both for your frame rates and for your bot’s reactivity.
  • This means Infinite map size (via Unbound manager) + Large number of A.I is now finally a very viable option!

Major bugfixes to navigation solver

  • Bots no longer get stuck while lying flush with a wall or obstacle (initial overlap usecase)
  • This was an issue reproducible in the sample project and reported by a user. As always, issues reported via the sample project are easiest to reproduce and investigate.
  • Improved nav request scheduling (redundant aborts eliminated and more)

Community Contributions

Thanks to Vladimir Ivanov for:

  • Multiple manager support via actor based manager selection (very common request!)
  • Path recalculation support for Flight Location key
  • EQS tasks that expose the CanNavgate and RandomNavigableLocation functions and fix for FlyTo node usage with SimpleParallel node.

Thanks to Michael Brune for:

  • 4.17 migration code to get me started quickly :slight_smile:
  • Blueprint Nativization friendly code changes (n.b. more changes may be needed in this space, either in the nativizer itself or in code)

[hr][/hr]

Downloads

Check out my new plugin!
A significant amount of effort was needed to get this update out, not just in building the features but in merging four different code bases together and testing some very time-consuming edge cases.

I request that if you found this plugin useful, please also check out my new DoN plugin - Mesh Painting & Gameplay solution for UE4, a very feature-rich plugin catering to many different usecases for both FX and gameplay.
Chances are you may find something you need for your project in there! :smiley:

See the new plugin’s Marketplace Link, Video Trailer and Forum thread for more.

Enjoy this update!

  • Venugopalan Sreedharan

Have you considered adding the ability to make a donation for this plugin, as well? I would love to make a direct contribution for all your work :slight_smile:

^ Hey :slight_smile: No plans atm but I do appreciate the thought @rcdarcey !

Thanks for the update, @VSZ.

I have a question. In my project on the second and further play (PIE) it starts logging warning:

Is it a normal thing? Didn’t test it in packaged project yet.

Should be innocuous, probably a PIE quirk. Appeasing it would be nice, but a nice-to-have for the next engine update maybe.

Can we have option to turn off the debugging in editor? When you have many actors using it, it is not really useful.

Go to the “Debug Params” category on your Fly To node. There will you find several debug flags including “Visualize Optimized Path” / “Visualize Raw Path”, etc.

You are seeing these debug lines because one of those flags is set to true.

Hi don!

Im having a really hard task here, as i get no errors in my logg.
Im trying to use the flyto, but its not working properly
im currently using 4.16 and is bound to that version because i have a big project.

the problem here is that the don event do not trigger.
i have the interface both in the ai controller and the pawn, and i tried both of them, but none of them are triggering.

i have tried all 3 actors:
character actor
pawn actor
default flying pawn actor

i have tried making a new ai controller
i have tried to bind the interface again

There is no errors in the logg what so ever, and the actor see me through perception and sets the location
i print string the location and its an actual location of the actor to follow.

Hi, when you say the event is not triggering are you talking about the “Fly To” node or the “Add Movement Input Custom” node?

As you say the logs are clean, the only option is to debug the BTTask_FlyTo.cpp file and see what is going on in there. As always, compare your setup with the sample project too.

Been amazing pluging, :slight_smile: but noticed one smaller issue that if using “Inclusive” as Blueprint Nativization Method, then project packing fails with error like:
UATHelper: Packaging (Windows (64-bit)): Cook: LogInit: Display: LogBlueprintCodeGen: Error: BP /Game/SaOKStuff/AI/DroneAI/DronePawnBP.DronePawnBP is selected for nativization, but it cannot be nativized because it currently implements an interface class (/Script/DonAINavigation.DonNavigator) that declares one or more pure virtual functions.

Will need to use “Exclusive” unless is it possible to make the interface class compatible with nativization?

Edit: Is it related to this ticket:

“It appears that the virtual function that returns a null pointer is the cause. If you change the function signature so that a null pointer is not returned the project can then be packaged successfully.”

The add to movement input custom doesnt send any ticks, or move the characters. I have implemented the interface!

I downloaded the 4.15 project and compared it, its excatly the same, still doesn’t work which seems weird for me.

Hi,
first: the plugin is awesome and you are awesome for sharing it with community.

I have one question about it.
There is a “Force reschedule query” option in FlyTo behavior tree node. How can i actually use it? How can i call this function in blueprint.
In my project the target location is moving with the player, and the BB key with its vector location is updated every 2 seconds. But it takes more than 4 seconds for the AI to get to target location so the AI is not reacting to the change, because the FlyTo is not finished. I want to force reschedule query every 2 seconds so the target location is up-to-date. Is it possible?

@**Kavaar **

This is actually a very common usecase. The sample project’s “Pursuit Chase Behavior” example demonstrates how to implement exactly what you want so do check that out first.

The force reschedule flag is more relevant for direct API queries rather than behavior trees. For behavior trees, the task needs to be aborted restarted so you’ll need setup your “observer notify” states right and have a service (or some other node) to periodically check for stale locations; see the Pursuit BT for an example of this.

In the latest version of the plugin, a community member added a “Recalculate Path Tolerance” feature. If you turn that flag on and periodically update the flight location vector, it will automatically detect when the target is stale (based on the threshold you have set) and calculate a new path. This is perhaps the ideal way to approach this now.

The “Pursuit Chase Behavior” example hasn’t been updated to use the new approach, so it showcases the old way of doing things; pick whichever works best for you!

**@SaOk -**Nativization hasn’t really been tested for the plugin yet. At some point it should be taken up, so thanks for the pointer!