Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Capable for RTS

Discussion in 'Navigation' started by Ap0C552, Feb 8, 2015.

  1. Ap0C552

    Ap0C552

    Joined:
    Feb 7, 2015
    Posts:
    43
    Hello,

    I am a beginner at developing using Unity. For my first project I am working on an RTS style game.

    I understand Unity has a build in pathfinding system. Is it adequate for RTS pathfinding. It seems, that with a good deal of units, pathfinding can get much more complicated.

    I hope this question is not too general. But I would just like to get general opinions on the matter from more experienced developers.
     
  2. AgusB

    AgusB

    Joined:
    Jun 20, 2013
    Posts:
    65
    Unity's pathfinding system is not very good in my opinion, and I'm sure they are working in a new version with many of its lacking features, but it will still be enough for a simple RTS.

    In a different note, I wouldn't recommend an RTS as your first project, I'd rather start with a simpler and shorter project.

    Edit: Also if you are interested in a good pathfinding solution I highly recommend: A* http://arongranberg.com/astar/
    There's a free version that's even better that what you can get with unity pro's solution.
     
    Last edited: Feb 9, 2015
  3. Ap0C552

    Ap0C552

    Joined:
    Feb 7, 2015
    Posts:
    43
    I have seen this A* popping up everywhere when I read about pathfinding. What are the benefits of it of Units pathfinding?

    I think at most I would need 40 agents in a scene at once. More like 20 though. So if both perform similar in less demanding situations, I would opt for the one that is more streamlined to develop with.
     
  4. AgusB

    AgusB

    Joined:
    Jun 20, 2013
    Posts:
    65
  5. Ap0C552

    Ap0C552

    Joined:
    Feb 7, 2015
    Posts:
    43
    Thank you for the link. This comparison uses Unity Pro. The navmesh pathfinding system has since been made available on Unity free. Can I assume that I could substitute in unity free for Unity Pro in this comparison sheet? Or are there still certain pathfinding features exclusive to Unity pro?
     
  6. AgusB

    AgusB

    Joined:
    Jun 20, 2013
    Posts:
    65
    Things like navmesh carving (really useful) are still Unity Pro only :(

     
  7. Ap0C552

    Ap0C552

    Joined:
    Feb 7, 2015
    Posts:
    43
    Ok. Just wondering when that would be really useful? Would it not only be useful when your map actually changes shape?

    "Adding movable obstacle for navmesh agents to avoid" is not the same as having navmesh agents avoiding other navmesh agents, is it? Because technically a blod of navmesh agents moving around is a "movable obstacle for navmesh agents to avoid".
     
  8. AgusB

    AgusB

    Joined:
    Jun 20, 2013
    Posts:
    65
    If you have a room with a door and you want an agent to go to the room it will try to go to the room through the door when it is blocking its path, instead of maybe going through the window or something, when you remove the door the agent can now freely go to the room through the new passage where the door was.
    If you have navmesh carving, the door can create a "hole" in the mesh, so the agent won't try to get through the door colliding indefinitely, instead it will find another way to go.

    You see if your map is completely static, no moving obstacles, no disappearing/appearing buildings/obstacles carving isn't needed, but in many cases there are dynamic obstacles especially in RTS.
    Imagine Age of Empires, with carving, it behaves like it normally does now, without carving when you build a house and try to move a villager from one place to another, the path that he will take will go straight through the house, so the villager will collide with the house, never arriving to its destination because for the navmesh, nothing is there.
     
  9. Ap0C552

    Ap0C552

    Joined:
    Feb 7, 2015
    Posts:
    43
    Wow so basically you can not use Unity free for RTS pathing :S. Sad panda....

    EDIT: But wait? Don't agents avoid each other? Couldn't I just place a building down and make it an agent that never sends any movement commands? Then the other agents will avoid it no?
     
  10. llde_chris

    llde_chris

    Joined:
    Aug 13, 2009
    Posts:
    205
    Aren't doors supposed to be handled via Navmesh Links (you just turn them active/inactive depending on door state) and not really via carving (which is a heavier operation).

    Though if it's a multiplayer RTS using traditional lockstep, none of the traditional navigation libraries are usable because of their dependence on floating point.
     
  11. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    I'm seeing A* pop up in this thread as if it is a product. A* is just the most common pathfinding algorithm used. The A* "product" linked is Aron Granberg's pathfinding solution which uses the A* algorithm for pathfinding. Just wanted to make that clear in case it wasn't already.
     
  12. Ap0C552

    Ap0C552

    Joined:
    Feb 7, 2015
    Posts:
    43
    Thanks for not contributing at all. The project is not called "Aron Granberg's pathfinding solution" like you insisted. It is called "A* Pathfinding project". Regardless of if the name is named after an existing algorithm, that is the name.
     
  13. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    Wow. Just wow.

    I never insisted "Aron Granberg's pathfinding solution" was the name of the product. That's simply what it is. I wanted to clarify what exactly A* is because of this post:

    So that you (and future readers) could understand that "seeing this A* popping up everywhere" could likely be in reference to the algorithm, not Aron Granberg's "A* Pathfinding Project".

    It was in case people didn't already realize. I don't know your past or your experience, but I guess in the future I should just sit and expect that everyone in the thread (and everyone in the future looking at this thread trying to figure out RTS pathfinding) knows every fact in the world.

    You're very welcome for my non-contributing post.
     
  14. chanfort

    chanfort

    Joined:
    Dec 15, 2013
    Posts:
    591
    I prefer Unity's Navigation system, as it is quite good and easy solution even for large scale RTS games. I used built-in navigation into my free uRTS asset:
    https://www.assetstore.unity3d.com/en/#!/content/30247
    where I easily get multiple thousands of agents moving along their paths on the map at 40-50 FPS. In free version of Aron's solution I was able to get only few hundreds agents at reasonable FPS.

    Unity 5 personal now brings off-mesh links for free. It also became more precise and more naturally looking navigation than in 4.x cycle. However, it came at the cost that it's a bit heavier for large number of agents than in 4.x :)
     
  15. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    For a single player RTS, Unity Navigation will be perfect. It works well for up to 400 units with reasonably complex maps.
     
  16. Ap0C552

    Ap0C552

    Joined:
    Feb 7, 2015
    Posts:
    43
    Is there some reason it would not be sufficient for multiplayer?