Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

A* Pathfinder based on Waypoints

Discussion in 'Made With Unity' started by Catsoft-Studios, Mar 3, 2011.

  1. Catsoft-Studios

    Catsoft-Studios

    Joined:
    Jan 15, 2011
    Posts:
    702
    Greetings to everyone!

    Even we had released the pathfinder system some weeks ago, we have recently updated the project.

    What does this system do?
    Using a very simple and friendly interface, you can tell your game characters to move to a certain position. Then the character will try to reach that position avoiding all obstacles by following the shortest path.

    Yeah, but, how it works?
    We designed this system so it would be very easy and fast to setup.
    First of all you need to drag and drop waypoints around the map and press the Generate Connections button.
    That was the "most complicated" part.

    Let's say you want an enemy to reach the player. By using this pathfinder system you just need to write the following sentence:

    Code (csharp):
    1.  
    2. var nextPosition = GetComponent(Pathfinder).GetPath(player);
    3. // for iOS and Android:
    4. var pathfinder = GetComponent(Pathfinder);
    5. var nextPosition = pathfinder.GetPath(player);
    6.  
    What this does is to return a map position that the enemy has to move to in order to reach the player. There will be no obstacles between this position and the enemy. Once the enemy has reached this position it will automatically update the nextPosition value to a new position. To understand this better, take a look at the youtube videos at the end of this post.

    What are those "waypoints" and how to set them?
    You can think about waypoints as 360º turn-around security cameras. Those "cameras" can be used by the enemy to know where the player is hiding.
    It is really easy to set them up. Just drag and drop waypoint prefabs around the map and press the Generate Connections button. Take a look at the last video to have a more clear idea of how this is done.

    Can I use it with my iOS or Android projects?
    Yes, you can. But be aware that mobile devices are not desktop computers, so do not try to place 20 enemies following a target in a very complex map with lots of obstacles. The frame rate would be too low!

    And what does this package come with?
    By getting this package you will receive an full reference guide and well explained documentation. It also comes with 2 demo scenes. One with a flat floor and the other one with a small ramp where an enemy tries to catch you. It also contains some extra scripts like an improved orbit camera and a simple enemy AI script to show how to move the enemy.

    And are there some advanced extra features?
    Of course! It is all explained in the documentation manual. You can tell an enemy to ignore certain objects by using layers. You can also connect and disconnect waypoints in real time (what if you blow up a bridge?)

    We are working hard to add more features to the system.

    Where can I get it?
    Take a look at the gameprefabs.com webpage: http://www.gameprefabs.com/products/show/192



    Simple live Demo:
    http://www.gameprefabs.com/products/preview/192


    Video demonstration of 17 followers following the player:



    Waypoints connection setup:



    If you have any questions or suggestions, just write them down and I'll answer as soon as possible
     
    Last edited: Mar 4, 2011
  2. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    Hi, at the moment I'm looking for a sollid Pathfinding framework. Most (commercial and free) frameworks doesn't include a steering system where an enemy avoids colliding with an other enemy. They simply bounce of each other. This also occurs in your video's. My question is (before I purchase the framework) if this framework supports any obstacle avoidance or is it simply another Pathfinding system.

    Regards,
     
  3. cemC

    cemC

    Joined:
    Dec 23, 2010
    Posts:
    214
    can you give an download link ?


    i see the link. i like your jobs.But there is a link which includes a* system. you can customize your own path.
     
    Last edited: Mar 3, 2011
  4. Catsoft-Studios

    Catsoft-Studios

    Joined:
    Jan 15, 2011
    Posts:
    702
    This system treats the other followers or enemies like obstacles. If an enemy is blocking the line of sight of the follower, he will search for another path in order to reach the player. On the other hand, if there is no other path, the enemy will simply move straight ahead to the player.

    It's all about the amount of waypoints that you drop onto the scene. If there are not enough (and so the follower cannot reach the player), you should add more.

    Actually we are currently working on a pathfinder system for RTS games, where there are a lot of characters moving around that the system has to take care of their paths.

    By the way, the Certain Logic team made a great job with their system, but don't be confused. Our package is completely different. His system makes the characters move from one point to another one without taking care of the obstacles. It has no A* Pathfinder.

    The "magic" of our package is that you don't need to specify a path. Just tell the characters where they should go and they will handle everything else (avoiding obstacles, finding the shortest route, etc...).

    Haven't you played a game before where the enemies got stuck behind a wall trying to reach you? That won't happen anymore with our system ;-)
     
  5. cemC

    cemC

    Joined:
    Dec 23, 2010
    Posts:
    214
    umm i made a game(RTS)Tower Defence by using aron pathfinding. And it was also my graduation project. However there is a one disadvantages of aron pathfinding sys which does not detect the obstacles dynamically. This package detects the obstacles dynamically? (if i change the position of obstacle in scene,can enemy or robot sense the obstacles position? Then can it change the path?) I looked up many a* package (i havent't tried yours yet.) There is no obstacles sense in a* pathfinding dynamically.

    I think it seems the FPS demo waypoint system(robots mocement and patrolling) in Unity3D. (Example projects).

    I wish you realese the demo version of the pathfinder systems.
     
    Last edited: Mar 4, 2011
  6. Catsoft-Studios

    Catsoft-Studios

    Joined:
    Jan 15, 2011
    Posts:
    702
    Actually, you can play a demo version of the pathfinder system. Take a look at this link: http://www.gameprefabs.com/products/preview/192

    We have recently added new features: Now it is possible to dynamically change the available paths by connecting/disconnecting and instantiating/destroying waypoints. And the good news are that there is no need to do it manually. The package comes with a method called SetConnections(); which recalculates all the waypoints connections in real time.
     
  7. Adrenaline-Crew

    Adrenaline-Crew

    Joined:
    Dec 14, 2010
    Posts:
    400
    Anything for cars?
     
  8. Catsoft-Studios

    Catsoft-Studios

    Joined:
    Jan 15, 2011
    Posts:
    702
    We didn't thought about making it for cars. Let me write it in the To-Do list
     
  9. cemC

    cemC

    Joined:
    Dec 23, 2010
    Posts:
    214
    it looks great work.i still think waypoint systems come from the Unity FPS demo :) Or modifiying it :) Am i right ?
     
  10. Catsoft-Studios

    Catsoft-Studios

    Joined:
    Jan 15, 2011
    Posts:
    702
    I have no idea of which FPS are you talking about. The army-demo that comes with Unity 3? I haven't tested it. But does it come with a pathfinder system? I swear I had no idea.

    The idea of making this pathfinder was because we had a job where we had to control 100 soldiers trying to reach some sort of control-points in a discreet-map (made of tiles). We found very interesting ways of doing it, so we wanted to proof ourselfs that we were able to do it in a continuos-space like in Unity3D. That's where it comes from.

    We still had to do a lot of research to make a good pathfinder system that could run on iOS and Android. But above all: It had to be very easy to use.

    EDIT: Oh, maybe you wanted to mean the FPS where the map of the video comes from? As you see, I am a programmer, and I have very poor 3D design skills. In the description of the first youtube video in the first post you can read that I took the map from a project I found in the Unity webpage. I also explain that if there is some copyright issue of using the map, I will remove it immediately.
     
    Last edited: Mar 4, 2011
  11. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    Can you please show a demo with multiple enemies following the player where the enemies stay some distance from each other (without bumping into eachother)? In the videos you can clearly see the clustering/cluttering of the enemies. It would be nice to have a Pathfinding Framework that makes this possible.
     
    Last edited: Mar 4, 2011
  12. NomadMellock

    NomadMellock

    Joined:
    Sep 28, 2010
    Posts:
    5
    I've just purchased this and found that if i duplicate the enemy and move to a adjacent side of the demo scene, I can get the duplicate to get stuck. If i only have one enemy then the everything works well.

    This is the demo to show where i placed the objects
    the large red dot it where i hide, if you run the demo you will see the left enemy gets a little confused.

    $patherror1.png

    Please can you advise
     
    Last edited: May 13, 2011
  13. doubitchou

    doubitchou

    Joined:
    Jul 14, 2012
    Posts:
    6
    I'm not so sure about it, looking at : Navmesh Opensource / Assets / CertainLogic Opensource / Pathfinding / Scripts / Core : to see Astar implementation with open closed nodes traditional way. What do you mean then ?

    I'd like to: but while Certain Logic team allow me to understand their code: how to see yours please ?