Search Unity

[Released] BFGames: Simply A* Pathfinding! NOW FREE

Discussion in 'Assets and Asset Store' started by BFGames, Dec 28, 2012.

  1. PJRM

    PJRM

    Joined:
    Mar 4, 2013
    Posts:
    303
    Hi BFGames.
    I'm starting to pre-looking for Pathfinding...

    Are you thinking about World Space pathfinding? (Space-Shoot game)
    Also I'm building a tank game and it is time to me start thinking on pathfinding for my enemies, but my world is spherical!

    Best regards,
    PJRM
     
  2. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Space pathfindng is something i thought about. But at the moment my focus is on Simplay A* PRO and my new companys game Gunjitsu. So if i add it it will be atleast 9-12 months away.

    Pathfinding for spherical worlds is very, very game specfic and not a feature i will add sorry.
     
  3. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    1.4 is up!
     
  4. kdimas

    kdimas

    Joined:
    Sep 13, 2013
    Posts:
    10
    Hi, got excited the moment I found this asset :)

    Does it support Windows Phone 8? Do you have a working trial (demo games, maybe) that I can try in Windows Phone 8 device?

    Thanks.
     
  5. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Works on all platforms.

    I do not have a demo for Windows Phone 8 sorry.
     
  6. oysterCAKE

    oysterCAKE

    Joined:
    Dec 3, 2012
    Posts:
    149
    Hey, I'm getting a pretty big problem currently.
    No problems at all with the system in generall - everything works perfect. Except on instantiated prefabs. If I call FindPath on a clone object, then the Path list only contains the start and end nodes. Where would I start looking to fix this?

    Cheers,
    Alex
     
  7. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    I will look into it this weekend!

    Sounds kind of wierd really, as it is the pathfinder object that handles it all. Anyways ill try and see if i can fix it tonight, else i will do it tommorow.
     
    Last edited: Nov 1, 2013
  8. oysterCAKE

    oysterCAKE

    Joined:
    Dec 3, 2012
    Posts:
    149
    Cheers, appreciate the fast response.
     
  9. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    A bit busy today will have to wait for tomorrow night.
     
  10. oysterCAKE

    oysterCAKE

    Joined:
    Dec 3, 2012
    Posts:
    149
    No rush on that, away for the weekend currrently.
     
  11. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    Just bought this wonderful pack,now getting a hang of it.
    I was wondering if this smooth path with a bezier curve or something else and check if each step is walkable has been implemented into the current version.This will provide an excellent ideal state for AI's.If not can you please point me in the right direction how i can implement this type of behaviour.

    Cheers
     
  12. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    853
    Does the grid-based system work with multiple floors as well? The example image only shows the waypoint-based one.

    [edit] Ah, that's coming with the Pro version as far as I understand?
     
    Last edited: Nov 5, 2013
  13. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Not it does not contain a bezier smoothing system. And if i add it, it will be on the new pro version.
    How you want to use a system including beziers is really up to you so cannot guide you really, only say learn how beziers curves is created (it is not that hard) and then tailor it your game.
     
  14. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Yes it will be a pro version feature only. The pro package is on hold at the moment though as i work on our Gunjitsu kickstarter project.
     
  15. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    853
    Will it be pro as in "pro features" or "requires Unity Pro"?
     
  16. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Pro features. It will all run in Unity free.
     
  17. fairtree

    fairtree

    Joined:
    Jun 11, 2012
    Posts:
    84
    Hi,

    Is there a function allowing to know the nodes around a position or around an other node?
     
  18. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    public bool IsTheClosestNodeWalkable(Vector3 pos);

    This method will tell you if a position is at an walkable node or not. So lets say you stand at (0, 0, 0) and want to check if the node left for you is available. Then you just call Pathfinder.Instance.IsTheClosestNodeWalkable(transform.position + (Vector3.left * Pathfinder.Instance.TileSize));

    You can see that i use tile-size to get the "middle" of the node to the left of me. You can use this Technic to look at all 8 neighbors.

    Anyways more than you asked for a method that returns a list of available points around a node. So that will come in the next update.
     
  19. fairtree

    fairtree

    Joined:
    Jun 11, 2012
    Posts:
    84
    Thanks,

    Indeed I wanted to know if the node is walkable or not, so this function is perfect for me.

    Regards,
     
  20. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Good to know that it is useful for you!
     
  21. oysterCAKE

    oysterCAKE

    Joined:
    Dec 3, 2012
    Posts:
    149
    Hey, did you have any luck with the problems on instantiated characters?
     
  22. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Hey!

    I tested it in my grid based scene, but do not seem to have any problem with it - see video below:



    So if you can pm the code you use then i can look over it.
     
  23. oysterCAKE

    oysterCAKE

    Joined:
    Dec 3, 2012
    Posts:
    149
    I set it to replace the (clone) with a random string and that seems to have fixed it... odd. No chance atm, but will test in depth when I get one. To help me plot our roadmaps etc, what sort of release date are we looking at for the pro-version/layers?

    Cheers
     
  24. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Sadly i am pretty far from the pro version. As i wrote in the WIP thread for it, then i am too busy with a kickstarter project and some freelance work, to have any time for the it at the moment.
     
  25. Artheus

    Artheus

    Joined:
    Aug 29, 2013
    Posts:
    9
    Is there a way to create uni-directional pathways using pathfinder2D?

    Thanks.
     
  26. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    You mean, that you do not want to move diagonal? There should be a check box for that on the pathfinder script, if i remember right.
    I am not home at the moment but will check as soon as i am.
     
  27. Artheus

    Artheus

    Joined:
    Aug 29, 2013
    Posts:
    9
    No, I mean just pathways that can only move one way ie a unit can move from node A to node B but not the other way around. I'm just trying to figure out a way for units to move around without moving into an already occupied node.
     
  28. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Sorry there is not function to do that at the moment. You need to hack the code a bit if you want something like that. ;)
     
  29. BigDill

    BigDill

    Joined:
    Jan 1, 2013
    Posts:
    31
    Hi there,

    I am interested in buying you simplyA* and was wondering if it supports a grid over a sphere? I have game objects that can align to the surface of the sphere and I just need an AI solution that will allow the game objects to find a path around the whole sphere (pole to pole) which might have some non passable features like walls or mountains. I have looked at loads of pathing solutions and non of them can do a 3d object such as a sphere. Some have come back to me and said I can stich grids together but this beyond my programming skills. Can your product help me?

    I have had some success with waypoints but not grids.

    Thanks

    Dan
     
  30. Chaosgod_Esper

    Chaosgod_Esper

    Joined:
    Oct 25, 2012
    Posts:
    295
    wouldn't it be the easiest to use waypoints?

    simple readout all vertex positions of the sphere at runtime, and generate a waypoint-node at this position. then simple move it a bit away from the sphere, so it hovers above its surface.
     
    Last edited: Nov 25, 2013
  31. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Sorry but Simply A*'s grid can not be created for spheres no. But Chaosgod's idea is pretty good, so maybe play around with that.
     
  32. BigDill

    BigDill

    Joined:
    Jan 1, 2013
    Posts:
    31
    Yes this makes good sense. My sphere will have well over 10000 verts how many waypoints does your solution support before impacting fps? And can multiple games objects share the same waypoint graph at run time? I am assuming that this is probably quite basic data structure math and your product will scale well.

    Thanks for coming back so quickly and thanks to Chaosgod for the idea.
     
  33. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Well my waypoint system is not build for this situation at all. It is made for smaller levels where you place and connect them by hand, so you need to write your own system from scratch i guess. (But just to answer the question, then my system supports a lot more than 10000 waypoints ;) )
     
  34. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Hey guys, just tested unity new 2D system!

    Sadly i wont work with my 2D pathfinding as long as you use the new 2D colliders. You can hack it to work if you use the normal colliders.

    Waiting for Unity to update my description in the asset store!
     
  35. ZINI-NGR

    ZINI-NGR

    Joined:
    Jan 28, 2013
    Posts:
    20
    Hi, I purchased yesterday and I played this. I like this :)
    Some Questions. What means Highest Point, Lowest Point and Move Diagonal in Pathfinder? they are not explained in Totorial Documentation ;)
    And I want to realize procedural map generation in Simply A* , How could I do that? I need some example or explain. help me~
     
  36. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Hey ZINI, first of then i will update the entire documentation next week because of the 4.3 release and 2D changes.
    But let me explain you the rest.

    1. Highest point Lowest point: is the highest and lowest possible Y value an world object will ever be at in your level. The reason for setting this is that the raycasts detects the world better the "shorter" they are for some reason.

    2. Move Diagonal: Should really be self explanatory. But ill give it a go. When you are placed on a node in a grid, it will have 8 neighbors. So you can move up, down, right left OR you can move diagonal which means you move to one of the "corners" in the surrounding neighbors.

    3. Procedural maps: The map is created in the Start() method. So if you are creating your own procedural generated map, then do it in the Awake() method, such that it got something to react upon. It is important that your start and end positions is big enough to "fit the map" so if you for example creates a procedural map that can be between -300 to 300 in both x and z, then you should set your start and end positions accordingly. Pretty sure this is explained in the documentation though.
     
  37. ZINI-NGR

    ZINI-NGR

    Joined:
    Jan 28, 2013
    Posts:
    20
    Thank you and appreciate the fast response.
    I voted 5 star. ;)
     
  38. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Thank you! :)
     
  39. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    1. Works with all sort of 2d setups, but not with the new 2d colliders sadly. Only works with the old colliders which it was build for.
    2. There is a script that does most of it for you.
     
  40. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,162
    do you plan to make it work with 2d colliders?
     
  41. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Would love to, but just dont have the time over the next couple of months. So busy with other projects!
     
  42. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    I agree that it is needed. But i need to completely change my system, so will take time. Time i do not have not as i am working full time on Gunjitsu + doing my Master Degree at the same time.
     
  43. Chaosgod_Esper

    Chaosgod_Esper

    Joined:
    Oct 25, 2012
    Posts:
    295
    some warnings i got with the latest version:
    I´m using Unity 4.2.2 Pro
     
  44. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Thanks. I will look into it tomorrow.
     
  45. -JohnMore-

    -JohnMore-

    Joined:
    Jun 16, 2013
    Posts:
    64
    Hello,
    I have one question about Simply A*, maybe you could help me.

    TLDR; I need to move freely within a grid, with acceptable performance for mobile.

    I have to start prototyping in a few days and I'm looking for a consistent path-finding solution. As far as I have read, your grid solution allows me to get a path from current position to a destination point. This is great for my enemies AI, they can move freely using the grid to any place in the map, chase the player or idle, and so on.

    But what about the player? In my case, the player moves using a controller so he can move in any direction and that cannot be the center of a grid cell. While this behavior is acceptable for an enemy, the player should be able to move to the border between 2 cells, or to the corner of one of them. I need the player to check every frame if the direction he is moving in is inside the grid.

    You added a function called "IsTheClosestNodeWalkable". This function can work if I move in the direction of another cell, but what if there is no more cells? If I am standing at the center of the last cell of a path, IsTheClosestNodeWalkable in the direction I'm moving will return false, but there is still CellWidth/2 space for me to move. Also, I worry about memory and performance impact from calling this function each update.

    Any ideas?

    Regards
     
    Last edited: Dec 17, 2013
  46. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    "IsTheClosestNodeWalkable" will always return the node you are with-in also if you are close to an edge.
    It is a one to one look-up so it is not heavy, and it takes no memory as it is only a look up.

    If you want to add the exact end position to your player it is pretty easy. Just save the position you are asking for in
    a variable, like Vector3 nextPosition. Then when the path returns, check to see if nextPosition is a walkable. if it is
    then add it to the Path list.
     
  47. -JohnMore-

    -JohnMore-

    Joined:
    Jun 16, 2013
    Posts:
    64
    Thanks for the quick answer!

    I have bought the plugin and tested the function, it is working really fast so thank you.

    I still have a problem. I am not using the FindPath for the player, only for enemies. The player just calculates the next position and then checks if the position is walkable. The function returns true but I need to get the Y position for that point in the grid.

    This is the code I'm using, don't mind the multiple IsTheClosestNodeWalkable checks, it's to allow the player to move in one axis when the other is not walkable.

    Code (csharp):
    1.     void movePlayer()
    2.     {
    3.         nextPosition = myTransform.position + direction;
    4.  
    5.         if(!Pathfinder.Instance.IsTheClosestNodeWalkable(nextPosition)){
    6.             Vector3 directionAltA = direction;
    7.             directionAltA.x = 0f;
    8.  
    9.             nextPosition = myTransform.position + directionAltA;
    10.             if(!Pathfinder.Instance.IsTheClosestNodeWalkable(nextPosition)){
    11.                 direction.z = 0f;
    12.                 nextPosition = myTransform.position + direction;
    13.                 if(!Pathfinder.Instance.IsTheClosestNodeWalkable(nextPosition)){
    14.                     nextPosition = myTransform.position;
    15.                 }
    16.             }
    17.         }
    18.  
    19.         myTransform.position = nextPosition;
    20.     }
    What i need to do is just before the last line, get the height Y in the grid at position nextPosition.X, nextPosition.Z.

    Other way I can do it is using FindPath using the nextPosition but I worry that performance will suffer if I do that, as I move the player every frame.
     
  48. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Well you can hack it a bit.

    Go into Pathfinder.cs, line 346.
    Find the method: private Node FindClosestNode(Vector3 pos)

    Make that method public. Now you can call it from outside of the script.
    It will return a node. Node.yCoord is what you need.
     
  49. -JohnMore-

    -JohnMore-

    Joined:
    Jun 16, 2013
    Posts:
    64
    Thank you! It's working like a charm, just what I needed. Now the enemies can fully use pathfind while the player is free to move but still restricted to the grid. And the only thing I have to do is make a terrain and throw some colliders to make non-walkable zones and it all just works.

    You made me really happy, thanks again :)
     
  50. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Glad i could help. And glad that Simply A* is working for your project :)