Announcement

Collapse
No announcement yet.

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

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #76
    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.


    Watch DoN's Grasshoppers | DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

    Comment


    • #77
      Been amazing pluging, 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:
      https://answers.unrealengine.com/que...interface.html
      "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."
      Last edited by SaOk; 10-08-2017, 04:25 PM.

      Comment


      • #78
        Originally posted by VSZ View Post
        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.

        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.

        Comment


        • #79
          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?

          Comment


          • #80
            @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!


            Watch DoN's Grasshoppers | DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

            Comment


            • #81
              Does the 4.15 version in the Unreal store have the new multi-threading and optimization updates?
              Free Demo at: http://spacecadets.shop/demominigames/

              Comment


              • #82
                Originally posted by MikeRPG View Post
                Does the 4.15 version in the Unreal store have the new multi-threading and optimization updates?
                Only 4.17 has those.

                In general, you can always use the MaxPathSolverIterationsPerTick and related variables to restrict the CPU usage (whether single-threaded or multi) to a fixed amount based on your project's needs.


                Watch DoN's Grasshoppers | DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

                Comment


                • #83
                  Thank you for the answer. I will check it out.

                  Comment


                  • #84
                    Hi! I want to thank you as well for sharing this with the community. This is incredibly useful and I think you've made an outstandingly designed and engineered solution.

                    I've run across one issue so far in playing with it that I figured I should pass along:
                    In certain circumstances, ADonNavigationManager::GetVoxelCollisionProfileFromMesh() can access bad memory - not yet entirely sure what circumstances cause this, but I believe it may have to do with a flying pawn exiting the flight bounds volume while debug drawing is on for the FlyToTarget node.

                    Here's what I've got so far:
                    Code:
                    Exception thrown: read access violation.
                    **PreferredCache** was 0x5F0. occurred
                    Occurs here:
                    Code:
                    // Does the collision cache have an entry for this mesh?    
                    if (!bDisableCacheUsage && !bReloadCollisionCache && PreferredCache.Contains(MeshId))
                    {
                        bResultIsValid = true;
                    
                        return *PreferredCache.Find(MeshId);
                    }
                    The relevant bit of the callstack:
                    Code:
                    >    UE4Editor-DonAINavigation.dll!ADonNavigationManager::GetVoxelCollisionProfileFromMesh(const FDonMeshIdentifier & MeshId, bool & bResultIsValid, TMap<FDonMeshIdentifier,FDonVoxelCollisionProfile,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FDonMeshIdentifier,FDonVoxelCollisionProfile,0> > & PreferredCache, bool bIgnoreMeshOriginOccupancy, bool bDisableCacheUsage, FName CustomCacheIdentifier, bool bReloadCollisionCache, bool bUseCheapBoundsCollision, float BoundsScaleFactor, bool DrawDebug) Line 573    C++
                         UE4Editor-DonAINavigation.dll!ADonNavigationManager::Debug_DrawVoxelCollisionProfile(UPrimitiveComponent * MeshOrPrimitive, bool bDrawPersistent, float Duration) Line 1281    C++
                         UE4Editor-DonAINavigation.dll!UBTTask_FlyTo::TickPathNavigation(UBehaviorTreeComponent & OwnerComp, FBT_FlyToTarget * MyMemory, float DeltaSeconds) Line 290    C++
                         UE4Editor-DonAINavigation.dll!UBTTask_FlyTo::TickTask(UBehaviorTreeComponent & OwnerComp, unsigned char * NodeMemory, float DeltaSeconds) Line 279    C++
                         UE4Editor-AIModule.dll!UBTTaskNode::WrappedTickTask(UBehaviorTreeComponent & OwnerComp, unsigned char * NodeMemory, float DeltaSeconds) Line 50    C++
                         UE4Editor-AIModule.dll!UBehaviorTreeComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) Line 1102    C++
                         [Inline Frame] UE4Editor-Engine.dll!FActorComponentTickFunction::ExecuteTick::__l2::<lambda_a8128609955b5bb0ccb5da311e0c1d1a>::operator()(float) Line 792    C++
                    Local variable contents at the time of the exception:
                    Code:
                    +        this    0x0000000000000000 <NULL>    ADonNavigationManager *
                            bDisableCacheUsage    false    bool
                            bIgnoreMeshOriginOccupancy    false    bool
                            BoundsScaleFactor    1.00000000    float
                            bReloadCollisionCache    false    bool
                            bResultIsValid    true (102)    bool &
                            bUseCheapBoundsCollision    false    bool
                    +        collisionData    {RelativeVoxelOccupancy=Invalid WorldVoxelsOccupied=Invalid }    FDonVoxelCollisionProfile
                    +        CustomCacheIdentifier    0x00000208225664d0 "None"    FName
                            DrawDebug    false    bool
                    +        MeshId    {Mesh=0x000002087a5d3580 (Name=0x0000020822990328 "CollisionCylinder") CustomCacheIdentifier=0x00000208225664d0 "None" ...}    const FDonMeshIdentifier &
                    +        PreferredCache    {...}    TMap<FDonMeshIdentifier,FDonVoxelCollisionProfile,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FDonMeshIdentifier,FDonVoxelCollisionProfile,0> > &
                    Hope this is useful to you!
                    Thanks again for sharing this with us!

                    Comment


                    • #85
                      I'm running into one other issue, and I'm not sure yet what's causing it:

                      I've set up a simple test map and have a flying pawn pursuing the player. It works fine as long as I'm using a DonNavigationManager object, but if I try replacing it with a DonNavigationManagerUnbound, the pawn runs its AI, and breakpoints set in UBTTask_FlyTo::TickPathNavigation() do get hit, but the pawn never moves. If I pull out the unbound manager and put the bounded manager back, it runs again. I migrated DemoMap into the project and verified that the Unbound manager does work, so I'm guessing there's something I've set up in my pawn or my decision tree that's making the unbound manager unhappy but not impeding the bounded manager.

                      Any thoughts on where I should be looking for the culprit?

                      Thanks so much!

                      Edit: It appears that the behavior tree was calling FlyTo before a valid destination point had been found. Adding some logic to the behavior tree to keep it from attempting to fly to the target before the target had been identified seems to have helped. (The VisionCheck BTService works fairly similarly to what Asher Einhorn describes in his tutorial here: https://youtu.be/Gsfnf25WAig )

                      Edit2: Confirmed - the problem was entirely my own. The two fixes were to add the logic described above and to offset the flight destination to a point that didn't penetrate the target character's collision. Unbound manager now seems to be working well, even on a very large test map.
                      Attached Files
                      Last edited by KevODoom; 11-14-2017, 01:47 PM.

                      Comment


                      • #86
                        Originally posted by KevODoom View Post
                        Edit2: Confirmed - the problem was entirely my own. The two fixes were to add the logic described above and to offset the flight destination to a point that didn't penetrate the target character's collision. Unbound manager now seems to be working well, even on a very large test map.
                        Glad to hear it's solved! For the other issue, the "Preferred Cache" code was added in 4.17 for the multi-threading update. Sounds like there are some edge-cases relating to Debug visualization that haven't been taken into account yet. As we're dealing with a direct reference to to simple value types I'm surprised that crash is even possible. If I manage to reproduce it I'll take a closer look.

                        Also thanks for the kind words, appreciate it



                        Watch DoN's Grasshoppers | DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

                        Comment


                        • #87
                          v1.9 Released (4.18)

                          The latest version of the plugin tested for 4.18 is here:
                          Download Link.

                          A major bugfix for "Dynamic collision updates" in single-threaded mode comes with this version. Most users should be unaffected as multi-threading is used by default and dynamic collision updates aren't used/required for most projects/usecases.

                          Marketplace version should be available soon-ish too!


                          Watch DoN's Grasshoppers | DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

                          Comment


                          • #88
                            Hello,

                            First of all Thanks for creating such a lovely free flying AI plug-in. I have a question regarding using the AI with the Character class.

                            I need to do root motions for the project I am working on, so I have to use the character class for the AI movement. I downloaded and checked out the examples you had, and it seemed like it's using a pawn class by default to run the AI. When I tried changing that to Character Class, it is causing problems in the AI behavior. I've listed the problems below and wondering if you have any insights on:

                            1) I have to set the character to flying mode in order to get it working. However it doesn't use flying speed to move around. Instead, it uses Max Acceleration and Breaking factor to start and stop.

                            2) When the character moves, it weirdly accelerates and then decelerates when it reaches the end point.

                            Here are my settings for the character class:




                            Here is my heirarchy setup:



                            I've already included the DON navigator and flying Pawn interface in my class settings.

                            I am using the normal Fly To Node to move the object around in different places. It would be great if you can give me your insights into solving the problem.

                            Cheers,
                            Parth

                            Comment


                            • #89
                              Hello,
                              This is great and I've got it working awesome, except for one thing; the Flying AI works perfectly whenever I run any map with the FlyingAI in it from the editor by loading it and running it....but when i call a different map load from within a pawn or a trigger, when the new map loads my flying pawns just fly off into the distance, even though they have found their waypoints and locations. it's very strange because individually each map works perfectly, but when i string them together this weird behavior happens. Im using the unbound navmanager. any suggestions?
                              thank you!
                              - khazum
                              Last edited by khazum; 02-15-2018, 08:51 PM.

                              Comment

                              Working...
                              X