A* Pathfinding Project v2.5 is released!!

Hi everyone.

This release has been delayed for quite a long time, but now it is finally released for everyone to download!

I have added a lot of things in this update, the thing many have been waiting for is the ability to use your own navmeshes for the pathfinding, I added that, but I didn’t think it was quite enough, therefore I also added three other grid generators:
A list mode so you can define your nodes directly in Unity without the need for a 3d modelling program, and you don’t even need to care about the connections, the script takes care of that automatically.
The second one is the bounds mode, this is quite similar to what my previous pathfinding system used (not the A*), but instead of generating the nodes at runtime this generates a complete navmesh by placing four nodes around each object in the scene and creates connections between them.
The third one is the customisable procedural mode, the script does now have support for external scripts which generate the navmeshes, so now there is no limit to what navmeshes you can use with this system!

Check out the forum release post here.

And you can download the project here.

The system is now better than ever, and I hope it will help people to make even greater games! :D

-Aron

This entry was posted in Unity and tagged . Bookmark the permalink.

7 Responses to A* Pathfinding Project v2.5 is released!!

  1. Steen says:

    Hi, i’m using your A* to control a lot of opponents in my game. however, when i got more than 10 enemies in my grid i really starts to take up a lot of resources. Is there a way to increase performance ? (ive tried all the stuff about @performance in the code but cant see any increased performance).

    I need it to control maybe 100 AI’s but at the same time, they dont have to be that good (can update less etc)

  2. Steen says:

    if it helps the thing that seem to take up alot of power is:

    coroutine AIFollow: __Compilergenerated2.MoveNext()

  3. Admin says:

    Hi Steen

    Are you trying to control 100 AI’s at the same time! Well, then you really need some speedups.
    But, are you going to send a pathfinding call to all those 100 units at the same time, or are you giving them orders at different times?
    First, the AIFollow script uses CharacterControllers, if you are going to use 100 units, I would not use CharacterControllers since they can be quite expensive.
    Instead you can use Transform.Translate and use Raycasting for the height, works almost as good.
    You can also see to it that all “direction.magnitude < something" statement can be replaced by "direction.sqrMagnitude < something*something" which will be much faster (square roots are not the fastest things to compute).

    Are you seeing slowdowns when you send a Pathfinding call or is the performance slowdown the same the whole time?

    Because you posted this question, I tried to make a scene with 100 units and tried to make it run fast, it resulted in the tips above (along with some next version stuff though)
    I have posted it here: http://www.arongranberg.com/unity/a-pathfinding/massive/

  4. Steen says:

    Hello, i resolved my performance issue before you replied and therefore didnt see yuor reply until i came to check up on it now. My project is done, but i thought i would just share the simple fix i did to get alot more performance.

    i am moving 50 AIs and they are constantly updating their target (to follow a player)

    As you mention the CharacterController is expensive. I replace the move function with simply giving the AI’s a rigidbody (i had to do this anyway) and pushing the around with physics (force) in their forward direction. (this ofcourse makes them ignore terrain height, but unity has a terrain height function to return the height of your location if standing on a terrain and i simply translate them up in the Y direction to match the height)

    probably not the best solution, but it solved the problem for me with very little work :)

    Thanks for your work by the way, saved some trouble :)

  5. felipi says:

    sorry to post for this… but just wanted to say HOW AMUZED I AM WITH THIS!!! congratulations, it’s an amazing project. had never worked with AI or pathfind, and the actual game i’m working needs it and i could set everything up in just 2 hours thanks to your project! Totally noob friendly!

    When i grow up, and start selling games i will buy it!

  6. felipi says:

    AH! btw, i’m working in a Tower defense game! And, right now my enemies move in a straight line, but soon i intend to upgrade my tower defense to let players make a maze with their towers, and so, i will need to scan the map everytime a player set up a tower in my grid. Is there any way to scan the map again every time i place a tower? Or the only options to scan the map is on startup or manually? Is there any way to call the function “scanmap” from another script?

    Sorry if it’s somewhere on this site, but i didn’t find it anywhere!

    Thanks!

  7. Admin says:

    Hi Felipi

    You could call AstarPath.active.Scan () every time you change something, however that would be quite slow and might make your game lag.
    Instead you could use an, right now, undocumented function called SetNodes.
    For example you can call.
    AstarPath.active.SetNodes (false,myTower.bounds,true);
    This will set all nodes (if no colliders are there) in that area (myTower.bounds) to unwalkable (false, first parameter) and it will use FullPhysicsCheck (true, last parameter), which means it will check if the area is free from obstacles first instead of just setting the area to unwalkable whatever what. If you use FullPhysicsCheck, make sure that the tower isn’t instantiated yet, otherwise the script will find the tower and think that the area is still unwalkable.
    You can find the full syntax in the AstarPath.cs script (haven’t written a page for it yet).

    PS: Remember that you need to do a repath for all units when you have changed something, they don’t do that automatically.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>