Announcement

Collapse
No announcement yet.

DoN's 3D-Pathfinding / Flying-AI system (with full source!)

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

    Your distance theory is starting to resonate with me too. Does pathfinding always succeed within the distance threshold which you just established?

    Now the PriorityQueue uses a uint32 for priority value (distance based). Try upping that to uint64 inside 1) DonNavigationCommon.h Line 26 and 2) ADonNavigationManager::ExpandFrontierTowardsTarget Line 1825

    For smaller priority values you can also try changing Line 1824 to use Dist instead of DistSquared and you'll also need to change Line 1814 from SegmentDist = VoxelSizeSquared to SegmentDist = VoxelSize for consistency.

    All in all, I suspect the PriorityQueue's calculation of voxel priority inside ExpandFrontierTowardsTarget. An error in priority calculation explains why the best neighbors never get a chance to run and we keep choosing the wrong neighbors by assigning higher priority (lower numeric value) to them.

    If the uint64 or SquareRoot tricks don't work, then try this experiment. Change the line above into float SegmentDist = VoxelSizeSquared * TestMultiplier;. For the experiment vary TestMultiplier from a range of values starting from 0.7, 0.8, 0.9 and upwards (mostly shouldn't be necessary).

    And you're welcome. Adopting this plugin has always been slightly challenging so identifying and fixing issues like these will better serve the intent behind releasing this plugin to the community in the first place.

    Steam Early Access: Drunk On Nectar - The Nature Simulator

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

    Comment


      Originally posted by VSZ View Post
      Your distance theory is starting to resonate with me too. Does pathfinding always succeed within the distance threshold which you just established?
      Yeah, it seems right around 64,000uu is where the pathing starts failing. I added some additional debug display to output distance between origin and destination:

      https://drive.google.com/open?id=0B9...UdYVTB6bklRRjA

      Originally posted by VSZ View Post
      Now the PriorityQueue uses a uint32 for priority value (distance based). Try upping that to uint64 inside 1) DonNavigationCommon.h Line 26 and 2) ADonNavigationManager::ExpandFrontierTowardsTarget Line 1825
      YEEEEAAAAAHHHHH, BUDDY! Looks like this did the trick.

      Originally posted by VSZ View Post
      For smaller priority values you can also try changing Line 1824 to use Dist instead of DistSquared and you'll also need to change Line 1814 from SegmentDist = VoxelSizeSquared to SegmentDist = VoxelSize for consistency.
      Which do you think is the better method?

      Thanks so much for working through this with me. The AI units are pathing like champions now!
      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


        [MENTION=43607]rcdarcey[/MENTION] Great to hear!

        I'd use the second method because when I profiled Dist v/s DistSquared (a long time ago admittedly) there was only a minor performance gain from the latter. On the other hand I've never profiled a uint64 PriorityQueue and that thing holds a huge amount of data in some queries so I can't say what performance impact that will have. Btw there may be room for increasing the VoxelSize even further (for better performance) on your large map. That's assuming you have no tiny obstacles in your airways.

        --

        Summary of important fixes not yet released:

        1) Ignore all collision bodies belonging to the navigating pawn for pathfinding.

        2) Fix for infinite loop/hanging in certain hard-to-reproduce (for me at least) scenarios

        3) Allow users to customize the "TweakMagnidutes" for their project. This variable is used to offset bots from their origin for pathfinding purposes whenever they're "stuck" on a wall, floor, etc or if an actor being chased (eg: player) is hiding flush with a wall. Also need to change default value for this to something more apt for normal-scale UE4 maps.

        4) Long distance query fix (ref posts #136, #137)

        I do not know when I'll release these as I'm busy with my own project work but if anyone really needs them, just read the previous 5-10 posts and you'll know what to do!
        Last edited by VSZ; 08-02-2016, 03:19 AM. Reason: Added 4th fix to list

        Steam Early Access: Drunk On Nectar - The Nature Simulator

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

        Comment


          Originally posted by VSZ View Post
          I'd use the second method because when I profiled Dist v/s DistSquared (a long time ago admittedly) there was only a minor performance gain from the latter. On the other hand I've never profiled a uint64 PriorityQueue and that thing holds a huge amount of data in some queries so I can't say what performance impact that will have. Btw there may be room for increasing the VoxelSize even further (for better performance) on your large map. That's assuming you have no tiny obstacles in your airways.
          Awesome. Will go with the second method then and I'll look into increasing the voxel sizes, as well. I'll have a much easier time fine tuning these values now that all these bugs are fixed
          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


            Hey there, I was looking forward to use your plugin but I'm having a bit of trouble getting it to work.

            Searching this thread and the internet I found out that blueprint projects would get a few errors with C++ plugins, after making a C++ project to import your plugin I then found another barrier to the usage of your plugin, build.cs is not built for MacOS, and we can't seem to build the file due to apparent C++ errors. If you have the time, I can send you the errors found.

            Comment


              How to hide the path lines

              How to hide the path lines
              Click image for larger version

Name:	722GZG4]H$7[Q0D)A$3Q7NK.png
Views:	1
Size:	237.1 KB
ID:	1114342

              Comment


                Very good, I have put the plug in my project, very good, but I have a problem, the project is always packed failed, but I can not find what reason, I use the 4.12 version of the engine ,Thank you.

                Comment


                  [MENTION=517159]Giraya[/MENTION] [MENTION=404029]woshihong[/MENTION] - Totally missed your posts, sorry. I rely on the forum email notification system to check this thread and sometimes it just doesn't send a mail when a new post arrives.

                  --
                  [MENTION=517159]Giraya[/MENTION] - The compiler on Linux/Mac is stricter than Windows. You'll need to open DonAINavigation.Build.cs and add bEnableShadowVariableWarnings = false; inside the DonAINavigation module constructor to fix build errors. I've tested the plugin on Linux before and it worked after making this change.

                  --
                  [MENTION=404029]woshihong[/MENTION] - Open the behavior tree named "FlightBehavior", click on the node "Fly To" and under "Query Params" turn off the options to Visualize Raw/Optimzied path.

                  --
                  [MENTION=94612]wuyukang[/MENTION] - I found no issues packaging the 4.12 project when I tried it now and no one else has reported it either so we'll need to see your packaging Output Logs/Cook logs to know what's going on. The output log will tell you where the Cook log is located as well.

                  Most likely a setup issue on your end. Common packaging issues include:
                  #1 Folder path being too long (just try packaging to a top-level folder like D:\test for example)
                  #2 Project name starting with a number as opposed to a letter. Eg: A project named 3DNavTest will not package while Nav3DTest will.
                  #3 Lack of disk space, etc...

                  Steam Early Access: Drunk On Nectar - The Nature Simulator

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

                  Comment


                    [MENTION=14603]VSZ[/MENTION]

                    Hi,
                    I'm trying to build your plugin on Mac and its giving me this error:
                    "Plugins/DonAINavigation 2/Source/DonAINavigation/Classes/DonNavigationManager.h:295:20: error: assigning field to itself [-Werror,-Wself-assign-field]"

                    Comment


                      [MENTION=14603]VSZ[/MENTION]
                      Please look at my log files it
                      https://www.dropbox.com/s/q7fwhou0euqakhk/Log.txt?dl=0

                      Comment


                        Originally posted by YagoTxr View Post
                        [MENTION=14603]VSZ[/MENTION]
                        Hi,
                        I'm trying to build your plugin on Mac and its giving me this error:
                        "Plugins/DonAINavigation 2/Source/DonAINavigation/Classes/DonNavigationManager.h:295:20: error: assigning field to itself [-Werror,-Wself-assign-field]"
                        Did you edit Build.cs by setting bEnableShadowVariableWarnings = false; like I explained above? That error only comes when you haven't fixed that setting.

                        Originally posted by wuyukang View Post
                        [MENTION=14603]VSZ[/MENTION]
                        Please look at my log files it
                        https://www.dropbox.com/s/q7fwhou0euqakhk/Log.txt?dl=0
                        The error appears to be this line:
                        Code:
                        UE4Editor-Cmd: Ensure condition failed: ObservedKeyNames.Num() > 0 [File:D:\Build\++UE4+Release-4.12+Compile\Sync\Engine\Source\Runtime\AIModule\Private\BehaviorTree\Decorators\BTDecorator_BlueprintBase.cpp] [Line: 66]
                        I found an Answerhub post with a similar issue but no one else has reported this issue with the 4.12 build and I'm not seeing it either.

                        What is the name of the zip file from which you loaded the sample project?

                        Steam Early Access: Drunk On Nectar - The Nature Simulator

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

                        Comment


                          [MENTION=14603]VSZ[/MENTION]
                          Yes, i add bEnableShadowVariableWarnings = false; in the DonAINavigation.Build.cs constructor and still giving me this error

                          Comment


                            Originally posted by YagoTxr View Post
                            [MENTION=14603]VSZ[/MENTION]
                            Yes, i add bEnableShadowVariableWarnings = false; in the DonAINavigation.Build.cs constructor and still giving me this error
                            Ok, that worked on Linux, I don't have a Mac so I've never tested there.

                            Edit:
                            So the error is coming from an initializer list in DonNavigationManager.h:295:20.

                            Looks like the Mac compiler doesn't like the underscore I'm using to differentiate the local variable and member (_DrawDebugVolumes v/s DrawDebugVolumes). If the bEnableShadowVariableWarnings flag is not working on Mac then the only option is to manually make all initializer list variable names unique.

                            For example, you'll have to change the initializer list code from this:

                            Code:
                            FDoNNavigationDebugParams(bool _DrawDebugVolumes, bool _VisualizeRawPath, bool _VisualizeOptimizedPath, bool _VisualizeInRealTime, float _LineThickness)
                            	{
                            		DrawDebugVolumes = _DrawDebugVolumes;
                            		VisualizeRawPath = _VisualizeRawPath;
                            		VisualizeOptimizedPath = _VisualizeOptimizedPath;
                            		VisualizeInRealTime = _VisualizeInRealTime;
                            		LineThickness = _LineThickness;
                            	}
                            to something like
                            Code:
                            FDoNNavigationDebugParams(bool local_DrawDebugVolumes, bool local_VisualizeRawPath, bool local_VisualizeOptimizedPath, bool local_VisualizeInRealTime, float local_LineThickness)
                            	{
                            		DrawDebugVolumes = local_DrawDebugVolumes;
                            		VisualizeRawPath = local_VisualizeRawPath;
                            		VisualizeOptimizedPath =local _VisualizeOptimizedPath;
                            		VisualizeInRealTime = local_VisualizeInRealTime;
                            		LineThickness = local_LineThickness;
                            	}
                            You will need to make similar changes in all initializer lists in that file and any other places where this issue comes up. Again, I haven't tested the plugin on Mac ever so you might run into more compilation issues along these lines.
                            Last edited by VSZ; 09-08-2016, 08:44 AM.

                            Steam Early Access: Drunk On Nectar - The Nature Simulator

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

                            Comment


                              [MENTION=14603]VSZ[/MENTION]
                              Thanks for the help, I manage to build it making some changes

                              In DonNavigationManager.h:295 there was a self assigning
                              Code:
                              DrawDebugVolumes = DrawDebugVolumes;
                              I just add a '_' in the second one and worked

                              Comment


                                [MENTION=508875]YagoTxr[/MENTION] - Great to hear That's fixed in a local build of mine, one of the many changes I just haven't had time to push out yet along with some of the recently discovered items mentioned in this post.

                                Steam Early Access: Drunk On Nectar - The Nature Simulator

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

                                Comment

                                Working...
                                X