Search Unity

A* Pathfinding Project 3.0 is Released!

Discussion in 'Assets and Asset Store' started by half_voxel, Aug 10, 2011.

  1. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Oh and btw: It's live on the Asset Store now!

    I have not submitted the Free version yet though, only the pro version is there.
     
  2. rocket5tim

    rocket5tim

    Joined:
    May 19, 2009
    Posts:
    242
    @sturestone I sent you a PM with the info and a link to my project.
     
  3. Gaspedal

    Gaspedal

    Joined:
    Mar 29, 2009
    Posts:
    376
    I have bought the Pro version, was hard work to convert the project from 2.95 to 3.0.5 ;)

    But how can I remove the added corrections "Links" ? I can't find a "delete node" button or node list.
    And how can I set walkable Nodes as unwalkable on grids ? With Version 2.95 it was easy.
     
    Last edited: Sep 14, 2011
  4. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    I think I remember someone mentioning the Backspace key will delete nodes. As for setting nodes as walkable/unwalkable in a grid, check out the dynamic obstacle script, it gives an example of how to do it. Then check the docs, as you can either tell it to scan an area and determine if the nodes are walkable/unwalkable or tell it to just set them to either walkable/unwalkable.
     
  5. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Gaspedal

    Backspace works. Manually setting nodes as unwalkable is something I have forgotten to implement I must admit, basically the whole code exists, but I have not given the user the possibility to do it yet (got to fix that for the next version).

    @Meanstreak, thanks, I will take a look at it.
     
  6. ivanzu

    ivanzu

    Joined:
    Nov 25, 2010
    Posts:
    2,065
    I have a problem with your pathfinding i get errors and can they be fixed?:
    Code (csharp):
    1. Assets/AstarPathfindingProject/Editor/GraphEditors/GridGeneratorEditor.cs(251,39): error CS1503: Argument `#4' cannot convert `bool' expression to type `UnityEngine.GUILayoutOption[]'
    2.  
    3. Assets/AstarPathfindingProject/Editor/GraphEditors/GridGeneratorEditor.cs(467,34): error CS0122: `UnityEditor.Tools.current' is inaccessible due to its protection level
     
  7. Enrich86

    Enrich86

    Joined:
    Sep 13, 2011
    Posts:
    1
    Why is there no option for "Collidor Type" to be box collidor?

    All I see is Capsule, Sphere, or Ray. Where is Box? That is so much more common and simple.
     
  8. Tilluss

    Tilluss

    Joined:
    Mar 5, 2010
    Posts:
    34
    I just brought the pro version and noticed a few picky bugs in the UI.

    The bugs are:

    1) When you click on the 'About' section, the version hasn't increased to 3.0.6 even though I have the latest version.
    2) The button to the 'Documentation' web site doesn't work, it links to http://www.arongranberg.com/astar/docs/index.html (needs the index.html removing).

    Next, when I'm using a Grid Graph, I unchecked the 'Show Graphs' box but the un-walkable nodes are still showing, is there another option I'm missing or is this by design?
     
  9. Games-Foundry

    Games-Foundry

    Joined:
    May 19, 2011
    Posts:
    632
    Hi Aron,

    Just a heads up for you. I've just upgraded to the latest version, and was getting the following error on all of my seekers:

    Code (csharp):
    1.  
    2. NullReferenceException: There is no active AstarPath object in the scene
    3.   at AstarPath.GetFromPathPool () [0x00010] in C:\Users\[SNIP]\Documents\New Unity Project\Assets\AstarPathfindingProject\Core\AstarPath.cs:343
    4.  
    5.   at Seeker.GetNewPath (Vector3 start, Vector3 end) [0x00000] in C:\Users\[SNIP]\Documents\New Unity Project\Assets\AstarPathfindingProject\Core\Seeker.cs:258
    6.  
    7.   at Seeker.StartPath (Vector3 start, Vector3 end, .OnPathDelegate callback, Int32 graphMask) [0x00000]
    8.  
    Going back to my last post, I changed the following implementation, and it is now working:

    Code (csharp):
    1.  
    2. public new static AstarPath active {
    3.         get {
    4.             // Fixed implementation
    5.             if (!_activeSet){
    6.                 _active = GameObject.FindObjectOfType (typeof(AstarPath)) as AstarPath;
    7.                 _activeSet = true;
    8.             }
    9.             return _active;
    10.         }
    11.         set {
    12.             _activeSet = value != null;
    13.             _active = value;
    14.         }
    15.     }
    16.  
     
    Last edited: Sep 23, 2011
  10. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Ivanzu Was using an old version of Unity, the project is supported from U3.3 and up

    @Enrich88 That is because the Physics class in Unity does not provide a function to check in a box area, only for rays, spheres and capsules. And I rather not re-implement physics in Unity just to get that working.

    @Tilluss
    1. Are you sure you are using the latest version? I downloaded the latest version (Pro and Free) just to check, and they had both their version numbers set to 3.0.6.
    2. That was fixed in 3.0.6
    3. Thanks for the heads-up will be fixed in 3.0.7
     
  11. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    Question.

    Can this product handle a crowding situation?

    I mean, many units in narrow corridor.

    I investigated the demo project. but couldn't find the way.

    How can I archieve it with this product?
     
  12. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    It is not currently built-in, however if you check my latest blog posts on arongranberg.com you will see that I am coding a system for it which I plan to integrate closely with the project.
    This can be handled right now with separate local avoidance (such as UnitySteer, however I haven't got a UnitySteer + A* Pathfinding Project script included in the project at the moment)
     
  13. Games-Foundry

    Games-Foundry

    Joined:
    May 19, 2011
    Posts:
    632
    Hey Aron.

    Can you briefly explain how Path.startHint and path.endHint work please in helping decide the final path?

    This is my intended use:

    e.g. character wants to get from A to B, which might be a distance of 1000.0f at normal unity scale. I have a "preferred highway" of connections running along a path in the terrain with zero cost. Before I request the path, I find out the nearest "preferred highway" node to the character origin, and the nearest "preferred highway" node to the destination.

    EDIT: I've managed to solve this requirement using the Texture penalties system combined with zero cost connections. The "Generate Reference" button was a real saver! Great work.
     
    Last edited: Sep 29, 2011
  14. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    I bought the product while expecting future.

    But a trouble happens..

    When I try to generate c++ RecastGraph, an long error log appeared and progress bar halted.

    It seems that the file 'recast' is mac executable. but I am using windows.
     
    Last edited: Sep 29, 2011
  15. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    and minor bug.

    Generating c# RecastGraph works.

    After generation, Clicking 'Show Graphs' showed etching areas.

    But, the etching area is too small.

    So I scaled it manually 50x. then it fits well.
     
  16. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    lol.

    I found the factor that affecting size of etching area.

    the bigger RecastGraphs.CellSize is, the smaller size of etching area is.
     
  17. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    feature request.

    considering unit's collision radius when pathfinding or path smoothing.

    It will be good that setting some parameter for Funnel Modifier to consider unit's radius.

    and I need work-around now.

    do you have any idea?



    I tried to set Erosion Radius to 4 when C# recast. (even though radius of my unit is 0.6)

    but generated graph is not so far(4) away from the wall.
     
  18. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Netics

    That doesn't sound too good. Too bad I haven't got Windows to test it on, I though it would work the same on Windows... apparently not...

    The Erosion Radius is measured in Voxels, so it should erode roughly Cell Size * Erosion Radius.

    @Gamesfoundry Great that you managed to solve it. But i can explain about the hints anyway.
    The hintsare not used in the project yet actually, but the idea is that an AI usually has the same node as target and/or start several path calls in a row. So the previous start and end nodes are passed and a quick check is done (for some graph generators) to see if those nodes are still correct, and if so, it uses them instead of querying GetNearest checks, though this is practically no cost at all on Grid Graphs or on Navmesh Graphs when using the Pro version (BBTrees). The only graph type which has some potential to use them is the Navmesh Graph, but I haven't implemented it yet.
    Hints are used for graph linecasts though.
     
  19. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    - 1 -
    I tried to replace the file 'recast' to windows binary from recast 1.4 source.
    no error... but.... no result.
    with more investigation, it was trivial. lol. it was not official file.
    so... what should I try next?

    - 2 -
    I tried Cell Size(0.4) * Erosion Radius(4).
    but in some position, it is still not far away than 0.6 (not even 1.6)
    next try was Cell Size(0.1) * Erosion Radius(12).
    unit with 0.6 radius still collides walls in some case.
    Erosion Radius(16) solves the situation. but it is large value for most case.
    there is a possibility that c# recast have a bug.

    and
    max value of Erosion Radius is just 16.
    if I add really big unit someday, I can't get a good path with small granuality(=small cell size)
    funnel modifier with unit radius is really needed.

    - 3 -
    question.
    it seems that the result path is selected before applying modifiers.
    path cost calculation is before applying modifiers or after?
    funnel modifier changes path length(=cost) drastically in navmesh.
    how is the algorithm solving it?

    - 4 -
    a little suggestion.
    If I clicked AstarPath - Save&Load - ClearCache, it clears cache, but remain 'Cache startup' check box checked.
    so after game started, error message appeared.
    It will be good that clearing checkbox, too.

    how about splitting 'Generate cache - then select scan or not' to two button
    "Generate cache", "Save to cache"
     
    Last edited: Sep 30, 2011
  20. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    code fix for matching etching area exactly.

    RecastGraphEditor.cs
    Code (csharp):
    1.  
    2. public void UpdateDebugMesh (AstarPath astar) {
    3.     CreateDebugMesh ();
    4.     RecastGraph graph = target as RecastGraph;
    5.          //begin modified
    6.     meshRenderer.transform.position = graph.forcedBounds.min;
    7.     meshRenderer.transform.localScale = new Vector3(graph.cellSize * 100, 1, graph.cellSize * 100);
    8.          //end modified
    9.  
    10.  
     
    Last edited: Sep 30, 2011
  21. Hao-Cher-Hong

    Hao-Cher-Hong

    Joined:
    Dec 15, 2010
    Posts:
    127
    Hello,
    I tried the link for serveral weeks,
    and I still cant connect it.
    whys that?
    (Location: Taiwan)
     
  22. jorrit-de-vries

    jorrit-de-vries

    Joined:
    Aug 7, 2009
    Posts:
    71
    Great tool you have created! Very useful, with some tweaking of the generated mesh (the generated mesh didn't return the shortest paths) I got proper navigation for my NPC's within an hour or two.

    I have a question though (I must be missing something probably). I have no debugging turned on on the AStar Path instance - which uses a NavMeshGraph - but Unity's debug log is cluttered with 'Path completed' statements. Since the amount is quite a lot, I have difficulties in finding the log information I generate myself. How can I turn debug logging off?
     
  23. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @rex170

    No idea what's causing that, the site has been up all the time.

    @jorrit5477

    The path completed log messages should go away if you go to Settings-->Debug-->Path Log Mode --> Set to None

    @netics

    Thanks for the suggestions.
    Modifiers are handled in a post-processing stage as with almost all pathfinding implementations. The funnel modifier is a bit tricky since it does change the length of the path quite a lot as you say, for most games it is usually ok, but some calculate the path several times with random nodes set to unwalkable, run the funnel on all of them as checks which one is the shortest one. My system hasn't got support for that out-of-the-box yet.

    Regarding C++ recast, do you think you can try to run the attached file on windows for me, do you get an error or does it say "It Works!" which it does on mac?
     

    Attached Files:

  24. jomeier

    jomeier

    Joined:
    Jun 5, 2010
    Posts:
    45
    Today I bought A* 3.0 through the asset store. I imported all the assets, opened the example project 1, clicked on the "A*" game object and saw this:

    $FontProblem.png

    I can't read the text cause the font color is almost the same as the background color.

    Does anyone also have this problem?

    Thanks and best regards,

    Josef
     
  25. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Hmm... It seems like my detect-if-user-is-using-dark-skin script doesn't work at all times... I'll have to add a manual override then.
    Til then you will have to switch to the light skin. Or you can try switching to light, and then back to dark and restarting Unity.
     
  26. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    I tried the attached file and failed.

    The file is not an windows executable. so it can't be executed.

    The windows executable has the extension '.exe' and 'MZ' in file header.
     
  27. jomeier

    jomeier

    Joined:
    Jun 5, 2010
    Posts:
    45
    Turning on the light skin works. Turning on dark skin and restarting unity doesn't work for me.

    Thanks.
     
  28. jomeier

    jomeier

    Joined:
    Jun 5, 2010
    Posts:
    45
    News from the dark side of your A* addon :)

    The setting of the property "Use dark skin" in the editor panel won't be saved. If I set it to ON the colors change in a manner so I can see the text also while using the dark skin.

    $EditorDarkSkin.png

    If I switch from the A* game object to an other game object and switch back to A* game object after that, the property "Use dark skin" is switched off again and I can't see the text anymore:

    $EditorDarkSkin2.png

    Maybe this helps finding the color bug.

    Greetings,

    Josef
     
  29. jomeier

    jomeier

    Joined:
    Jun 5, 2010
    Posts:
    45
    Hi again,

    I'm searching for a sample about using the list graphs. Can someone give me source or a link?

    @Surestone:
    It would be a good idea to include a demo for each graph type in your package.

    Thanks,

    Josef
     
  30. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Jomeier

    Yeah, I know, previously the dark/light setting was only manual, then in the last version I changed to try to get the Unity setting, which apparently doesn't work at all times, but the toggle happened to be left. For 3.0.7 I have a manual toggle but if a dark skin is detected, then it will ask the user if he/she wants to change to the dark skin.

    You are totally right, I should build some more examples. I will try to get some working for 3.0.7.

    @Netics

    ... Hmm... and I guess it doesn't work if you add a .exe extension...
    Does anyone here know how to compile an either cross platform or windows only c++ application on mac (I'm using monodevelop and sometimes XCode)?
    According to what I have read, gcc should be able to do that, but I just can't figure out how to do it.
     
  31. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    hmmm.

    solution 1.

    install virtual pc / vmware / or similar
    install windows.
    install visual studio express(it's free)

    solution 2.

    see gcc cross-compile document.
    http://www.kegel.com/crosstool/
    http://www.nongnu.org/thug/cross.html

    you may recognize it's not a comfortable work.
    and you can't test the result whether it works or not without windows.

    so solution 1 is recommended.
     
  32. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    Hello,

    I have bought A*Pathfinding (in script info : 3.0.5, in AssetStore info : 3.0.6) from Asset Store.
    Mainly becasue of recast mesh generator i wanna use in PRO payed version.

    But recast C++ dont work and C# version does not have setting that i wanna (character radius).

    There is a bug mentioned before with size of debug navmesh - I uncommented this 2 lines in recastgrapheditor.cs and it works good now :
    Code (csharp):
    1. meshRenderer.transform.position = graph.forcedBoundsCenter-graph.forcedBoundsSize*0.5F;
    2. meshRenderer.transform.localScale = Int3.Precision*Voxelize.CellScale;
    Is there any chance soon we will get proper recast executable for Windows and we can use Recast c++ with character radius setting?
     
    Last edited: Oct 10, 2011
  33. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Hi

    The navmesh size bug is fixed for 3.07

    I have also grabbed an 18 day trial of Parallels, I will try to compile a separate windows version with it so C++ recast will work for windows users.
     
  34. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    I will also try to translate some more C++ to C# so that for example character radius can be used in the C# version.
     
  35. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    Thanks. New updated version will be available from asset store?
     
  36. Sunrift

    Sunrift

    Joined:
    Oct 13, 2011
    Posts:
    18
    Hi,

    I am completely new to Unity, just getting my feet wet.

    Anyway, I am using JavaScript for scripting, and am wondering what I will need to know to put this A* Pathfinding to work using JS.
     
  37. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Reddotgames The updated version will be available from the Asset Store when I release it (perhaps a small delay due to the submission process).

    @Sunrift
    First you will need to enable JS support (if you didn't click Yes on the first-run dialog box, you can change it under Settings-->Editor).
    Then you can use all commands exactly as you would in C# (check the Get Started Tutorial in the docs) with one exception, js does not support optional parameters, so you will need to specify ALL parameters for the functions you call (the default value can be found if you search for the function in the docs).
    That's about it I think.
     
  38. TehWut

    TehWut

    Joined:
    Jun 18, 2011
    Posts:
    1,577
    anyone have an example of this auto navmesh generation? I want to see exactly how it works before buying it, my levels are multi story, with small crawlspaces, and rather complex....well, basically, just a screenshot of how it works or something....
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'm currently about to do AI for my first Unity game, and I need to decide between RainOne and your product. I mainly just need pathfinding / steering / avoidance for vehicles and people. RainOne also has decision tree stuff which is cool. Both the same price....what do you recommend? Is one faster than the other or more lightweight?

    Developing for iOS.

    Also, does your pro version (multithreading) run any faster than the free version on iOS?
     
    Last edited: Oct 15, 2011
  40. TianWolf

    TianWolf

    Joined:
    Aug 20, 2011
    Posts:
    161
    Can this be used in conjunction with a 2d project?
     
  41. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    I got curious about one thing - and sorry if it's an incredibly stupid question - but would A* work for a point-and-click platformer, for vertical stairs, or does it only work on the X-Z plane? Thx!
     
  42. Abe

    Abe

    Joined:
    Feb 14, 2008
    Posts:
    35
    Hi,
    I found that: you can use Handles.DrawLine and Handles.color in function OnDrawGizmos of GridGenerator.cs (remember add using UnityEditor; at head of file) to avoid message "vertexCount > 60000"

    And i recommend to insert "script.showUnwalkableNodes = EditorGUILayout.Toggle ("Show Unwalkable Nodes",script.showUnwalkableNodes);" at line 550 of AstarPathEditor.cs for toggling show/hide unwalkable nodes.
     
  43. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Check out the Trello board I'm trying out. https://trello.com/board/a-pathfinding-project/4e97420ccba8dc00000520f5
    It contains feature requests and things that I'm working on (or well, I just started it so I haven't had time to add much).
    You can vote for new features and comment on them!

    @MaDDoX It would work for a point and click platformer. Vertical stuff can be added using either a list graph, a rotated grid graph (but then it would only work on the ZY axis instead, so that might not help much) or a recast graph, or of couse a navmesh graph.

    @Jerotas
    Seriously, you shouldn't ask me which one I recommend, I'm the one who sells one of them :D
    But my project has got a free version, download it and try it out!
    I haven't tried RainOne myself so I cannot say anything specific, I also haven't got an iPhone license so I don't know about the multithreading either, I'm sure it would run faster on the new iPhone 4S though which has 2 cores.

    @TianWolf
    "2D project" isn't very specific, care to elaborate?

    @TehWut
    See attached images
     

    Attached Files:

  44. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    I got an exception while "save to file".


    IndexOutOfRangeException: Array index is out of range.
    Pathfinding.AstarSerializer.SerializeNodes (Pathfinding.NavGraph graph, .AstarPath active) (at Assets/AstarPathfindingProject/Core/AstarSerialize.cs:309)
    Pathfinding.AstarData.SerializeGraphsPart (Pathfinding.AstarSerializer serializer) (at Assets/AstarPathfindingProject/Core/AstarData.cs:154)
    AstarPathEditor.SerializeGraphs (Pathfinding.AstarSerializer serializer) (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:1623)
    AstarPathEditor.DrawSerializationSettings () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:1178)
    AstarPathEditor.DrawMainArea () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:545)
    AstarPathEditor.OnInspectorGUI () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:296)
    UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/Inspector/InspectorWindow.cs:495)
    UnityEditor.InspectorWindow.OnGUI () (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/Inspector/InspectorWindow.cs:190)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)


    exact code position is
    Code (csharp):
    1.  
    2. int lastValue = graph.nodes[0].penalty;
    3.  
    you have to check whether it is empty or not.
     
  45. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Thanks netics! I will fix that bug.
     
  46. TianWolf

    TianWolf

    Joined:
    Aug 20, 2011
    Posts:
    161
    I'm looking for a solution to having an enemy character stalking the player character. Would this be able to handle that?
     
  47. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    That will work out-of-the-box TianWolf! The "target" GameObject in the example scene could just be swapped with the player character you want to stalk.
     
  48. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Version 3.0.7 Released!

    Lots of new stuff!
     
  49. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    In Asset Store i still see 3.0.6 - I need wait? Im a customer of 3.0.6.
     
  50. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Ah, yeah, forgot about that. I have submitted the 3.0.7 version to the Asset Store, but you will have to wait for a few days or so before they accept it.