Search Unity

A* Pathfinding 2.9 Is Released (Unity 3 Compatible)

Discussion in 'Assets and Asset Store' started by half_voxel, Nov 16, 2010.

  1. cupsster

    cupsster

    Joined:
    Apr 14, 2009
    Posts:
    363

    Try to set up grid to grid transfer same cost as normal pathing.. Usually defaults are that that it costs more.
    Don't know if custom made links are judged same as generated..
     
    Last edited: May 4, 2011
  2. Darknuke

    Darknuke

    Joined:
    Jan 31, 2011
    Posts:
    223
    So my pathing isn't working correctly. The units are trying to track through walls in order to get to their location. I attached a picture to show you an example (the monster at the top is trying to path through that wall when it is clearly labeled an obstacle).

    Why are they doing this? There is clearly a path to that point, they just need to go around the obstacle. They just refuse to for some reason.

    I'm not exactly sure what kind of information you are looking for to help me debug this, so let me know what you need.

    EDIT: I've pretty much messed with all of the variables in AIFollow and Seeker and have found no solution to this. I'd really appreciate some help from sturestone or someone with some knowledge on this =)
     

    Attached Files:

    Last edited: May 6, 2011
  3. Darknuke

    Darknuke

    Joined:
    Jan 31, 2011
    Posts:
    223
    Just to note: I fixed the issue above via emails with aron... new problem tho

    I'm getting serious framerate issues with A*. If I do a 1k x 1k grid with .4 nodes and quadtree processor (i need .4 to deal with some of the smaller holes I have in my maps), I get around 10 ms of time in the profiler for AIFollow.Patrol(). When I drop it to 256 x 256, i get around 231 FPS in the stats window (tho 30 FPS in my own personal FPS updater, which is weird) and a Time in the profiler of 1.22 ms. That is perfectly acceptable, but the A* square to make the grid isn't big enough.

    So my question is, how do I procedurally generate grids? I see that it is possible and there's the brief description saying to use "CreateGrid()" but I have no idea how to call that function. Is there any documentation on how to procedurally generate grids or can someone give me a brief tutorial on what to do? I'm fairly familiar with the rest of the A* functions, so a push in the right direction might be all I need.

    Thanks!
     
  4. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Darknukes question was answered by mail


    Got a video to share. I just made a quick video showing the A* Pathfinding Project 3.0. It shows three different graph types (Recast, Grid and Navmesh) and also some path modifiers like funnel and plain smoothing. I also make use of the cached start feature I implemented today which decreases loading times to almost nothing (7.8 ms for the recast graph).

     
  5. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    very nice work, looking forward to it Aron :)
     
  6. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Damn you are fast ;)
     
  7. cupsster

    cupsster

    Joined:
    Apr 14, 2009
    Posts:
    363
    wow, nice new features.. :)
     
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    As always,
    Ultra awesome work Aron!
    Keep the greatness. :)
     
  9. Games-Foundry

    Games-Foundry

    Joined:
    May 19, 2011
    Posts:
    632
    Boy I am looking forward to this one. Will there be the option to export the NavMesh so I can edit it in 3dsMax and then reimport?

    I'm using the previous production version but having problems with collisions. My "Character Controller" rigidbody NPC's aren't colliding. They come within range, but something prevents the collision event from actually happening. Anyone witnessed this before?

    Great work!
     
  10. ognjenm

    ognjenm

    Joined:
    May 3, 2011
    Posts:
    97
    ok i made a sample mesh a* path , now how can i make this capsules to walk randomly on it? tnx

    $path.JPG
     
  11. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Gamesfoundry

    Yes that will be possible.
    Sounds more like a problem with the physics, not with the pathfinding.

    @ognjenm

    First, read the Get Started tutorial if you haven't done that (on the A* page on my website).
    Then, that navmesh doesn't really look very good for pathfinding, you should use a grid for less weird paths.
    To make them randomly walk around, do a loop through all your capsules (Seekers) and call StartPath with random target points every n seconds.
     
  12. ognjenm

    ognjenm

    Joined:
    May 3, 2011
    Posts:
    97
    i made it thankss :)) it work great :)
     
  13. Fires

    Fires

    Joined:
    May 30, 2011
    Posts:
    5
    Any ideas on how to implement this to a procedurally generated grid? Is it even possible?
     
  14. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Fires

    Sorry, but implement what as a procedurally generated grid?
     
  15. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    (bookmarked)
     
  16. Murcho

    Murcho

    Joined:
    Mar 2, 2009
    Posts:
    309
    @Darknuke / @sturestone - I'm having similar issues to Darknuke's issues with paths being generated that cause an actor to go straight through obstacles. Could either of you share your solution or PM me to talk about it out of the thread?

    I'm using 2.95 under Unity 3.3.
     
    Last edited: Jun 8, 2011
  17. hxx2010

    hxx2010

    Joined:
    Aug 31, 2009
    Posts:
    155
    There was an error path
     

    Attached Files:

  18. siflandolly

    siflandolly

    Joined:
    May 17, 2011
    Posts:
    141
    One question: In order to make links between 2 grids do they need to have the same Node Size? It seems that when they don't my links are red which I assume means there's a problem.
     
  19. siflandolly

    siflandolly

    Joined:
    May 17, 2011
    Posts:
    141
    Nevermind. I figured it out now.
     
  20. Games-Foundry

    Games-Foundry

    Joined:
    May 19, 2011
    Posts:
    632
    Managed to fix the collision issues as part of my learning curve. Looking forward to the next release. Keep up the great work.
     
  21. tet2brick

    tet2brick

    Joined:
    Jun 24, 2009
    Posts:
    77
    Hi,

    First of all, very nice work ;)

    I've run into a problem, I've made a script to select multiple units and send them along a path.
    I'm trying to use the SetNodes function to block the last node of each unit just after the path is calculated, so the next path to be calculated will not take this node into account and they don't finish on the same node at the end.

    To do that I move a collider with an obstacle layer to this last node and activate the SetNodes function to recalculate the nodes around it.

    But it don't seem to work, the debug log display : "Changing the Grid..." but the grid is not changed.

    And it's funny because the start position is (right now only for test purposes) inside the grid, and when the grid is calculated at launch, the nodes around it are correctly calculated as un-walkable.

    Can you help me?

    Thanks a lot :)
     
  22. Lemonwood

    Lemonwood

    Joined:
    May 22, 2011
    Posts:
    13
    Hi

    I trying downloading and opening the A* Pathfinding 2.95 (12269) project and try to open it, and I got alot of errors

    I using Unity 3.3, I wondering if there something I miss or that this doesn't work with Unity 3.3 :/

    Thanks in Advance

    Brandon
     
  23. siflandolly

    siflandolly

    Joined:
    May 17, 2011
    Posts:
    141

    I have 3.3 also and it worked. What sort of errors?
     
  24. Lemonwood

    Lemonwood

    Joined:
    May 22, 2011
    Posts:
    13
  25. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Lemonwood, it seems like you have got another class in your project named Connection, try placing that inside a namespace or renaming it.

    @tet2brick what is the syntax you are using for the SetNodes function?
     
  26. tet2brick

    tet2brick

    Joined:
    Jun 24, 2009
    Posts:
    77
    Hi,

    I use this :

    Code (csharp):
    1. AstarPath.active.SetNodes (false,ColliderPathEndPoint.collider.bounds,true);
    Where ColliderPathEndPoint is a simple collider that I move to the last point of the path when it's calculated.

    Thank you :)
     
  27. Lemonwood

    Lemonwood

    Joined:
    May 22, 2011
    Posts:
    13
    Hey guys, I making an Ant game, And I want the one going to the food and coming back to take a different path or even a slight detour, through I don't know how quite to do this, Any suggestion on complete that task

    Update: Nevermind, it seems like it be already be doing it :/ somehow...
     
    Last edited: Jun 21, 2011
  28. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Tet2brick make sure the obstacle lies in a layer which is included in the walkability check layer mask. And make sure the obstacle is moved BEFORE you call SetNodes (but I guess that's quite obvious).
     
  29. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Hi everyone.

    Version 3.0 release date is nearing. So I thought I should share some news:

    New features I have implemented since the last video.
    Path pooling (reduces memory allocations)
    Max slope and max climb settings for grid graph
    More stable graph updates
    Smaller file sizes for saved graphs.
    Generally more stable
    Optimized search modes for multiple start points to one end point
    Better documentation! Using Doxygen, I'm building docs for every single function and variable.​

    I will release the system as a Free version and one Pro version. The Free version will have most of the features, but the Pro one will have some additional advanced features such as Recast graph generation and optimized pathfinding modes, I have not decided exactly what it will contain or the price. Both version will be distributed on the Unity Asset Store!
    And the free version will also be available on my website.

    Here's a new video for you:
    A stress test of the system with 600 agents pathfinding back and forth across a plane while obstacles spawn randomly. The AI's are quite crappy, but they are using raycasting simplification (even with thick raycasts!).
     
  30. Lemonwood

    Lemonwood

    Joined:
    May 22, 2011
    Posts:
    13
    That the best Feature ever
     
  31. BloodFist

    BloodFist

    Joined:
    Mar 10, 2011
    Posts:
    22
    can this be used for a city game for cars, pedestrians not walking on roads etc...?
     
  32. Lemonwood

    Lemonwood

    Joined:
    May 22, 2011
    Posts:
    13
    Any possible way, that I can make my player, take a different path, and perhaps not always that Fastest???

    or even, So the same Unit doesn't take the same path to get there

    EDIT**
    I think there might be a way to increase the Penalty to the nodes,but it's doesn't seem to be working


    If you divide the Sidewalk and Road with Different layers, This would work
     
    Last edited: Jul 7, 2011
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    You can add node weights and check them all once the Pathfinder returns the list of walkable nodes (to your goal) and discard those you like and those you dont like based on the node weights.
    Don't remember exactly the class that you need to change but yeah it should be doable.

    PS: You also need to set some public properties on the nodes, so you can set their weight on the A* pathfinder editor.
     
  34. Lemonwood

    Lemonwood

    Joined:
    May 22, 2011
    Posts:
    13

    I try to use cache paths to get the last path

    But had no effect, I don't know, perhaps I'm looking in the wrong places
     
    Last edited: Jul 7, 2011
  35. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi sturestone.
    Nice work!

    For those of us who licensed the 2.x version, do we get a free upgrade or discount to the 3.0 pro?

    Thank you.
     
  36. tet2brick

    tet2brick

    Joined:
    Jun 24, 2009
    Posts:
    77
    Yes and yes, It's done like that and it's not working.

    But oddly, if I set the end point of another path on a area near enough for the collider to overlap to its old location, it seem that the difference betwen the two areas are set "not walkable"

    edit : And if I call setNodes from elsewhere in the update function (when I press the "e" key) and move manually the collider, it work, I really don't understand where the problem is... :/

    Here is my code, maybe I miss something obvious :

    Code (csharp):
    1. if (Input.GetKeyUp(KeyCode.Mouse1))
    2.     {
    3.         //right click, move the pointer to the position
    4.         if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition),  hit, 1000))
    5.         {      
    6.            
    7.             if(hit.transform.gameObject.layer==9)
    8.             {
    9.                 target.position=hit.point;
    10.                 target.position.y=0;
    11.                 targetPos=target.position;
    12.                    
    13.                
    14.                 //move the selected units to the position of the pointer.
    15.                 for(i=0;i<listSelected.length;i++)
    16.                 {                  
    17.                     if(i>0)
    18.                     {
    19.                        
    20.                             //move the collider to the last point of the path              
    21.                         var endPoint=listSelected[i-1].GetComponent(pathTest).getLastPathPoint();
    22.                        
    23.                         ColliderPathEndPoint.transform.position=Vector3(endPoint.x,ColliderPathEndPoint.transform.position.y,endPoint.z);
    24.                         AstarPath.active.SetNodes (false,ColliderPathEndPoint.collider.bounds,true);
    25.                        
    26.                     }
    27.                     listSelected[i].GetComponent(pathTest).calculPath(targetPos);
    28.                    
    29.                    
    30.                 }
    31.             }
    32.         }
    33.        
    34.    
    35.     }
     
    Last edited: Jul 15, 2011
  37. asnane

    asnane

    Joined:
    Nov 23, 2010
    Posts:
    8
    it is great package. i'am using it at my advanture game.
     
  38. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    very useful.
     
  39. Lemonwood

    Lemonwood

    Joined:
    May 22, 2011
    Posts:
    13
    Hey, Did anyone have the problem of it not working when I build the project, seems like all the Gameobject that use that aren't working
     
  40. Lemonwood

    Lemonwood

    Joined:
    May 22, 2011
    Posts:
    13
    I also try to build his tutorials and they don't seem to work, So am I forgetting something ?
     
  41. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @Lemonwood, take a look at the player log, maybe that has some information on what went wrong.

    @Elias_t, You will get 3.0 Pro, for free.

    @Sorry tet2brick, I cannot think of anything.

    But I've got good news for all of you, I have submitted 3.0 Pro to the Asset Store, hopefully they will accept it.
     
  42. Lemonwood

    Lemonwood

    Joined:
    May 22, 2011
    Posts:
    13
    Oh joy, better better Path finding :D
     
  43. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Arong,
    I'll only ask one thing, the price for the pro edition? :D
     
  44. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Ah, yes. That will be the same as a commercial license has costed, $100 (even though now Unity will take 30% of it...).
     
  45. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    The Free version is now released!
    Check out the new thread!
     
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Where is the new thread? Can't find it out. :D

    EDIT: Spotted! I was looking on the Asset-Store forum section. :D
     
    Last edited: Aug 11, 2011
  47. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    Anyone else not seeing the Grid which is created (still on 2.9 for now) in the scene view? I cannot get it to appear, I assume this is an issue with 3.4.1 ?

    Not seeing the navmesh or the navmesh bounds!?
     
    Last edited: Sep 22, 2011
  48. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    @KrankyBoyGames

    Have you made sure that Gizmos are turned on. Unity 3.4 (I think) added the ability to turn off Gizmos in the scene view, it can be controlled with a toggle right above the Game and Scene view windows.
     
  49. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Oh, and please don't post in this old thread anymore, if you have questions it would be better if you posted them on my website or in the new thread.
     
  50. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    OK last post then =) Yes I made sure those were on. Likely some new obscure bug.