Announcement

Collapse
No announcement yet.

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

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

    #46
    Originally posted by sotroll View Post
    Would someone be able to build and upload the plugin for mac? I'm having some problems trying to do that.
    Have you tried compiling from the latest version on Github? (4.16 version). It has some fixes for platform specific includes that may help.

    I've been using Linux as a target platform for the plugin for a while now although I've never tested on Mac. I'm on a slightly older version of the plugin myself though so if you can post the compilation errors you're seeing someone may be able to suggest a quick fix or workaround.

    --

    If someone already has a Mac build handy do feel free to post it here

    Steam Early Access: Drunk On Nectar - The Nature Simulator

    UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

    Comment


      #47
      I was having trouble building the source but I can comment on building the plugin once I get that working. Another thing I would love to ask you in the meantime is your thoughts on using this for 2D. I only ask because I got to the point in your tutorial video https://youtu.be/6Tr_K551zvI?t=1060 where the schedule dynamic collision update takes in a mesh as an argument whereas in many 2D games this would be a sprite. I suppose the 2D game could have meshes used for dynamic collision objects though. Do you have any other thoughts or advice on using this for 2D? Other than obvious things like set the number of voxels in the Y direction to 1. By the way thank you for releasing such a great looking plugin, I cannot wait to try it!

      Comment


        #48
        [MENTION=3807]sotroll[/MENTION] - You should be fine. That function takes in a Primitive Component (even though its called Mesh) so assuming you're using something like the Paper Sprite Component (which is a primitive component) everything should just work in theory. In practice though, this flow hasn't been tested before, so there's that. If you really need dynamic collision handling for your usecases, another option is to use the Infinite/Unbound Manager and thus free yourself completely from manual handling of dynamic collision. The Unbound mode is fully automatic/uncached so it picks up all dynamic changes instantly. This does make it much slower though.

        Other than that, expect to spend some time on initial setup / tweaking the world grid and voxel sizes, etc. There's a sweet spot for every project and it can take some experimentation to find the right one for yours.

        Steam Early Access: Drunk On Nectar - The Nature Simulator

        UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

        Comment


          #49
          [MENTION=108847]jvukovich[/MENTION] - Looks like you're reusing the sample behavior tree of the demo project. The demo project has been setup in such a way that it picks goals from pawns via the "Goal Actor" public variable (which is set on a pawn from the map via world outliner). Additionally, each pawn implements a simple interface called "Demo Pawn Interface" which allows the behavior tree task to extract the goal from any arbitrary pawn. Now, if you're testing with the sample BT and not doing either of these, then the "Invalid Goal" message which you're seeing appears.

          Of course you will eventually want to switch out the sample "Pick Goal" / "Pick Bot" tasks with your BT task/logic/implementation which sets the FlightLocationKey blackboard to a suitable vector depending on the specific gameplay tasks your A.I. is trying to achieve.

          Edit:- I notice you're already setting the BB keys directly. In that case you should not be using the Pick Bot ("Refresh Pursuit Goal") node in your behavior tree at all. That node will attempt to override the goal with its own logic which is not desirable in your case.
          OH! I get it now, thank you so much! I am new to behavior trees, but now that you have explained it, it makes perfect sense. Thanks so much for this awesome plugin & helping out the community.

          Comment


            #50
            4.16 Marketplace version released!

            https://www.unrealengine.com/marketp...ding-flying-ai

            Changelog:-
            1) Platform specific #include fixes
            2) Linux compilation warnings cleaned up

            Originally posted by jvukovich View Post
            Thanks so much for this awesome plugin & helping out the community.
            Thank you

            Steam Early Access: Drunk On Nectar - The Nature Simulator

            UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

            Comment


              #51
              I tried installing this is 4.15.1 today (BP only) and from the launcher it looks like the install was completed fine, but unlike any other plugin, I can't find the nodes when searching for them. The only thing I can find is one icon in engine assets folder for the plugin.

              Can anyone help?

              Comment


                #52
                Originally posted by Skifree View Post
                I tried installing this is 4.15.1 today (BP only) and from the launcher it looks like the install was completed fine, but unlike any other plugin, I can't find the nodes when searching for them. The only thing I can find is one icon in engine assets folder for the plugin.

                Can anyone help?
                If you go to the plugin manager in the editor does DonAINavigation show up under "AI Navigation"? (Edit/Plugins) If so, is it enabled?

                On a side note, it sounds like you've installed it into the engine folder, you could try installing it to just your project and see if that works instead. (in YourProjectName/Plugins/DonAINavigation/)
                Happy Coding!

                Comment


                  #53
                  How is it that I can stop the movement caused by the "Fly To" Task?

                  Comment


                    #54
                    Originally posted by Dirtsleeper View Post
                    How is it that I can stop the movement caused by the "Fly To" Task?
                    Abort the current "Fly To" task in the behavior tree. If you're unfamiliar w/ how to do that, I suggest running through some tutorials I think I ran through this one:

                    https://www.youtube.com/watch?v=h0Kb42oCoYg
                    Check out my ★★★★★ UE4 plugin if you want to go fast!
                    • Feedback Event Factory: Perfect for managing sounds, particle systems, force feedback, camera shakes, time dilation, animations & more...all within a single Blueprint!

                    Comment


                      #55
                      Got a little treat to share for any of you working w/ large levels & large AI counts. Enables/Disables AI processes, as needed. This saved me about 4.6ms:

                      Code:
                      void APFAIController::UpdateAIProcessCulling()
                      {
                          if (PFCPawn.IsValid())
                          {
                              APFGameState* PFGS = Cast<APFGameState>(GetWorld()->GetGameState());
                      
                              // Check nearest enemy distance (not just player locations cause AI fight other AI)
                              TArray<APFCharacter*> enemyList;
                              PFGS->GetEnemyPawns(this, enemyList);
                              float closestDistSq = BIG_NUMBER;
                              for (int i = 0; i < enemyList.Num(); ++i)
                              {
                                  const float distSq = (PFCPawn->GetActorLocation() - enemyList[i]->GetActorLocation()).SizeSquared();
                                  if (distSq < closestDistSq)
                                  {
                                      closestDistSq = distSq;
                                  }
                              }
                      
                              const bool bWantsKillProcesses = !PFCPawn->WasRecentlyRendered() && closestDistSq > FMath::Square(processCullingDistance);
                              if (IsActorTickEnabled() == bWantsKillProcesses)
                              {
                                  // Enable/Disable movement component
                                  UPFCharacterMovementComponent* PFCMC = PFCPawn->GetPFCharacterMovement();
                                  if (PFCMC->MovementMode != EMovementMode::MOVE_None)
                                  {
                                      PFCMC->SetActive(!bWantsKillProcesses);
                                      PFCMC->SetComponentTickEnabled(!bWantsKillProcesses);
                                  }
                      
                                  // Enable/Disable sight/sound/damage senses
                                  GetAIPerceptionComponent()->SetActive(!bWantsKillProcesses);
                                  GetAIPerceptionComponent()->SetComponentTickEnabled(!bWantsKillProcesses);
                      
                                  SetBehaviorTreePaused(bWantsKillProcesses);
                      
                                  // For good measure, kill weapon tick, too...
                                  AWeapon* equippedWeapon = PFCPawn->Inventory->GetEquippedWeapon();
                                  if (equippedWeapon != nullptr)
                                  {
                                      equippedWeapon->SetActorTickEnabled(!bWantsKillProcesses);
                                  }
                      
                                  // Controller & pawn should both get their ticks updated
                                  SetActorTickEnabled(!bWantsKillProcesses);
                                  PFCPawn->SetActorTickEnabled(!bWantsKillProcesses);
                              }
                          }
                      }
                      Last edited by Ryan Darcey; 08-15-2017, 09:37 PM.
                      Check out my ★★★★★ UE4 plugin if you want to go fast!
                      • Feedback Event Factory: Perfect for managing sounds, particle systems, force feedback, camera shakes, time dilation, animations & more...all within a single Blueprint!

                      Comment


                        #56
                        I cannot figure out why the unit is not moving, it generates the path but doesn't move. The Fly To task is definitely being called and the target location is correct. There are also no messages in the output log.

                        Click image for larger version

Name:	Untitled.png
Views:	2
Size:	433.2 KB
ID:	1132499
                        Last edited by Dirtsleeper; 08-16-2017, 11:38 AM.

                        Comment


                          #57
                          Originally posted by rcdarcey View Post
                          Got a little treat to share for any of you working w/ large levels & large AI counts. Enables/Disables AI processes, as needed. This saved me about 4.6ms:
                          Interesting! Curious to know whether packaged builds (shipping) also benefit to the same degree, often seen major gains in the debug/dev builds that translate a bit differently to the optimized binaries. Anyway, I've long been planning a move away from BTs for my A.I. and I think stats like these just add to that impetus. There's a lot going on in there!

                          --

                          Originally posted by Dirtsleeper View Post
                          I cannot figure out why the unit is not moving, it generates the path but doesn't move. The Fly To task is definitely being called and the target location is correct. There are also no messages in the output log.
                          Hey, the plugin routes all locomotion to your pawn for you to determine how it should move.

                          This is handled inside the "Add Movement Input" function. For the default character/pawn classes Unreal already provides a basic implementation for this function so most pawns will automatically move.

                          To debug this I would check what is happening when the Fly To node calls your pawn's Add Movement Input. If it's a BP only project you can also implement the "DoN Navigator" interface and the "Add Movement Input Custom" function to intercept the call (either for your testing purposes, or to provide your own locomotion logic).

                          HTH!

                          Steam Early Access: Drunk On Nectar - The Nature Simulator

                          UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

                          Comment


                            #58
                            Originally posted by VSZ View Post
                            Interesting! Curious to know whether packaged builds (shipping) also benefit to the same degree, often seen major gains in the debug/dev builds that translate a bit differently to the optimized binaries. Anyway, I've long been planning a move away from BTs for my A.I. and I think stats like these just add to that impetus. There's a lot going on in there!
                            I compared on a "Test" build w/ cooked content. I'll try out a packaged shipping build and get back to you
                            Check out my ★★★★★ UE4 plugin if you want to go fast!
                            • Feedback Event Factory: Perfect for managing sounds, particle systems, force feedback, camera shakes, time dilation, animations & more...all within a single Blueprint!

                            Comment


                              #59
                              Originally posted by VSZ View Post
                              Hey, the plugin routes all locomotion to your pawn for you to determine how it should move.

                              This is handled inside the "Add Movement Input" function. For the default character/pawn classes Unreal already provides a basic implementation for this function so most pawns will automatically move.

                              To debug this I would check what is happening when the Fly To node calls your pawn's Add Movement Input. If it's a BP only project you can also implement the "DoN Navigator" interface and the "Add Movement Input Custom" function to intercept the call (either for your testing purposes, or to provide your own locomotion logic).

                              HTH!
                              Sorry, I should have explained better. The flying AI works perfectly fine if it doesn't have to move past the obstacle but if it does have to move near it, like in the image, it doesn't move at all.

                              Comment


                                #60
                                Originally posted by Dirtsleeper View Post
                                Sorry, I should have explained better. The flying AI works perfectly fine if it doesn't have to move past the obstacle but if it does have to move near it, like in the image, it doesn't move at all.
                                I would still recommend the same debug strategy: You need to see what is happening inside your pawn's Add Movement Input code and why it is not responding to movement requests for this case.

                                Going by your description that a) the path is generated successfully and b) The Fly To node is busy/active in the behavior tree. If both of these conditions are indeed satisfied, the plugin's work pretty much ends there and it is up to the pawn to do the rest. That's why you need to check what your pawn's Add Movement Input is doing.

                                Now if the path was not generated, then there are other factors to consider like insufficient clearance area above the floor for either your pawn or for its goal (which can be solved by nudging the height of the goal/etc). However that's likely to happen only for large bots and if something like that did happen, the logs would have definitely told you why pathfinding did not occur. In your case the logs are clean, so the issue is likely elsewhere.

                                Steam Early Access: Drunk On Nectar - The Nature Simulator

                                UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

                                Comment

                                Working...
                                X