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

Pathfinding + avoidance for RTS / MOBA / Tower defense / Diablo - like

Discussion in 'Assets and Asset Store' started by Paradoks, Nov 19, 2013.

  1. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    ---------- EDIT 06 / 02 / 14 -----



    ---------- EDIT -----




    ---------- EDIT -----

    Hi, here is the latest video showing Paradoks Astar + local avoidance with an character manager.



    ---------- EDIT -----
    Hi here is a video showing the local avoidance:

    - Soldier 3D model
    - Blocks Map, the entire scene is made out of square blocks that pixel snaps
    - Atlas texture, all the Blocks share the same texture and material.
    - 3D arrow that can be found here:
    https://www.assetstore.unity3d.com/#/content/13377

    all the assets should be sold when done

    ---------- EDIT -----
    Hi here is a video showing the local avoidance:
    I made the character and the grass texture too , tell me if you are interested in.



    ---------- EDIT -----


    Hi here is a video showing the avoidance queuing behavior:

    first video:
    http://www.youtube.com/watch?feature=player_detailpage&v=klwiblgEC_Y

    Hi all,

    I am making a pathfinding tool wich use pathfinding and light avoidance.
    I used to use pathfinding solution from very talented people, but found out that when i had to modify their script the code was too big and complicated.
    So i begun to make my own with in mind :
    Simplicity and Inexpensivness.
    So the project is for now only 3 Scripts:

    - Astar script
    - Map script
    - Seeker script
    all are around 400 lines of code.

    Here is the video of the first version:
    The quality setting are all on fastest.
    the code profiler is the one from Duckets :
    http://robotduck.wordpress.com/2011/08/05/code-optimization-in-unity-part-2/
    My computer is an old Q6600 - ATI HD 5700 - with 2 gigs of RAM.



    The 100 clients are totally autonomous, and dont know about each other.
    The fps count is usually 30/40 fps greater than in the video certainly because of the video recording software.
    You can see little spikes when i change the target location, its because the pathfinding is launched at the same time for the 100 clients otherwise there is never any lags.
    I made that the clients can overlap a little so they not get stucks, but this can be tweaked in the inspector.
    Sometimes you can see that clients pass trough a wall, its because the map/obstacle need a little optimisations:
    The clients cant avoid concave walls made of two walls because of raycasts it just follow the the first wall and continue.

    For the movement i am using a simple :
    transform.position += transform.forward * moveSpeed * Time.deltaTime;
    And it use a simple Collider.

    I plane the sell the tool in the asset store when finished.

    Paradoks
     
    Last edited: Jun 2, 2014
  2. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Little Update on the first thread showing:

    - Soldier 3D model
    - Blocks Map, the entire scene is made out of square blocks that pixel snaps
    - Atlas texture, all the Blocks share the same texture and material.
    - 3D arrow that can be found here:
    https://www.assetstore.unity3d.com/#/content/13377

    Tell me what you think about.
     
  3. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    729
    Looking good, keep going!
     
  4. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    699
    This is awesome. How did you make it? Is there a particular technique that you used?
     
  5. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    @Cookimage: thx ! i continue but its hard work, soon a new video

    @jRocket: thx, if you mean by "technique" the pathfinding, i use a simple Astar algorithm.
     
  6. Gnimmel

    Gnimmel

    Joined:
    Apr 21, 2010
    Posts:
    358
    Just have to say the avoidance looks great. Does it work on a navmesh or a tile system as your game seems to be a 2D map layout?
     
  7. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Hi all, in the first post edit, you will find the latest video wich includes:

    Astar + local avoidance + character manager that that does the enemy finding etc.
    the FPS is fairly high, around 100fps with 64 clients.
    You can see lags sometime, it is due to the instantation not the astar.

    As is said to Gnimmel: I still dont know if i will be able to finish the tool and if so, if i will have enough time to make my game AND give support for the tool, as i realised that its a lot of work.

    If i could i would move the thread to an other topic, but nothing is definitive.

    Paradoks
     
  8. 3

    3

    Joined:
    Sep 16, 2012
    Posts:
    387
    This is awesome, just wondering if you have a webplayer avalable for it?
     
  9. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Guys, sorry for not answering earlier.

    @ Gnimmel: the tool is pure 2D grid, the Y is handeled by the character controller.

    @ 3 : i am trying to get a webplayer as soon as possible, the tool is becoming more a unit/player system than a "simple" pathfinding system.
    but you will see that soon !

    For now here is a new video, brown vs blue team, the towers are spawning units every X seconds.
    the spawned units aim is the opposite team tower but when an enemy comes close the unit attacks it.
     
  10. GCatz

    GCatz

    Joined:
    Jul 31, 2012
    Posts:
    282
    Whats the fps of 500-600 units?
     
  11. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    @GCat, i dont really know as my computer would probably burn with that amount.
    my max test for now is 100 and i was around 80 fps if i remember well. but my computer is very old
    Q6600 ( 2007!) + ATI HD 5700 + 2GO ram.
    on a recent computer fps count the could easily be 240fps for 100 units i think.
    + with 500 maybe you dont need a very good precision too, you could get a few cycles too.
     
  12. oliver-jones

    oliver-jones

    Joined:
    Nov 8, 2010
    Posts:
    25
    Hey Paradoks, great work! Looks fantastic. What do you hope to do with this once you've finished? Are you going to release it as a plugin or something? If so, I would be very much interested!

    Thanks.
    Ollie
     
  13. camtronius

    camtronius

    Joined:
    Apr 22, 2014
    Posts:
    7
    Wow this looks really good. Has anyone else here tried local avoidance code on their own? Im using aron's a* pathfinding and trying to write my own avoidance code right now, but its being quite troublesome. Anyone know of a solution? I may end up writing my own pathfinding code that incorperates occupied spaces of a grid, or try modifying aron's code. thanks,
     
  14. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    Hoping this becomes something available whether for free or purchase. Now that A* pathfinding no longer supports local avoidance, we need a new solution!
     
  15. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Hi all,

    @ oliver-jones @ rxmarccall
    As is said, i would really like to release it but found that the support would probally kill my game dev activity, so i still really know if i will be able to release it. but i promess i will try!

    @ camtronius
    I had similar problems in fact, as i begun with the a* but was unable to make a local avoidance to work, so i made mine from scratch.

    BTW I am trying to get a demo running soon!
     
  16. oliver-jones

    oliver-jones

    Joined:
    Nov 8, 2010
    Posts:
    25
    I'm in the same boat as you. I'm currently messing around with aron's A* pathfinding too, and I need to now include some kind of local avoidance. Although I've never built my own before, so I don't really know where to start.

    Hence why I'm asking around the community :)
     
  17. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Hi all,

    In the first post you will find the latest video.
    I added "light-evasion" so the clients are not stuck ( too much) anymore when they are chasing an enemy.

    You can also see that i added a game environement to test the tool in real game situation.
    the additional draw calls are heavily impacting the performance, now with around 60-70 DC and 30-40 clients going to the opposit base i got around 100-120 fps in "maximize on play mode".

    I tried to be as close to DOTA as i could, improvement will come anyway.

    if you are interested in some assets present in the video dont forget to check my asset store page please:
    https://www.assetstore.unity3d.com/en/#!/publisher/5206

    if you see something that is not yet on the store just let me know i will put it in asap.
     
  18. mboog12

    mboog12

    Joined:
    Oct 4, 2011
    Posts:
    91
    Thumbs up for an awesome display of pathfinding + avoidance!
    Count me in for purchasing the asset. Also, I can be an early backer to this kind of work, to support the developer to finish it.