Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Dynamic AI Project[Navigation Released]

Discussion in 'Assets and Asset Store' started by brilliantgames, Oct 13, 2012.

?

Should the Navigation be available as a separate purchase?

  1. No, keep it exclusive to Dynamic AI.

    34 vote(s)
    23.0%
  2. Yes, I am only interested in the Navigation in this project.

    53 vote(s)
    35.8%
  3. Yes, but I also want this to be compatible with Fantasy AI

    61 vote(s)
    41.2%
  1. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Hey. Yeah off grid navigation has problems right now, it will be fixed. As of right now all units use portals if they are there. But I will likely make it a feature that can be enabled/disabled on individual Navigators.
     
  2. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    I've played around some more with it and the grid generation doesn't work that well for me, can you make it so it stays more tightly around blocky shapes or disable the nonwalkable zones?



    It doesn't get any better if I make the cube or capsule size smaller.

    It also needs support for more than 1 ignore layer.

    As of right now I cannot use this in my project...
     
  3. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937

    From what I can tell in your scene, it looks like theres a part of a layer missing. Maybe you have a roof that is not set to non-walkable? Cause I can see gaps in your grid(If there are missing nodes beside another the grid assumes its an 'edge' so the ones beside will be marked as non-walkable so ai dont walk too close/off to edges). But If your level is one solid mesh just increase the amount of layers.


    A few other things to note.. There is no space or obstacle this system wont work on. You just need to find the right balance. The way it works is, you need to have the cube size around the same size as the characters navigating the environment(As well as capsule size). Don't forget to assign non-walkable objects to the non-walkable collision layer.. Make sure there are no random colliders hanging out in your scene.
     
  4. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    Aha, thanks, there where some triggers around those zones and I think because I have "Raycasts hit triggers" on the grid also hit them :)

    I put that layer on ignore and works well! But I have more than 1 layer that needs ignore, so the feature to add more layers on ignore is pretty important.
     
  5. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Yes, I do agree with you there. Have fun!

    PS, I am posting a video tutorial tonight!
     
  6. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    I managed to implement it today in my project and works well but it needs some tweaks:

    -when navigation is called and the navigator is in a non-walkable zone it will start the path from the nearest walkable point from the target, it should start the path from the nearest walkable zone from the navigator or else the navigator can get stuck

    - the pathfinding doesn't like to make long straight paths if there are portals on the grid:


    When will a new version be available?
     
  7. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    The navigator can only get stuck if he ends up in an isolated area. The grid position algorithm will not connect with a non-walkable node. So if the navigator does get stuck, this means that he is in an area that does not have a path to the target(According to the grid).

    Of course the path isnt straight. You have all these portals connected to eachother. May I ask why? The path is not straight because AI sees the connected portals as a shorter route.. Because they are directly connected nodes.

    I do plan to add possibly a list of collision layers to ignore. But for the time being, you can simply assign your colliders you want ignored, to the ignore layer, then change them back after you create the grid. :)

    Edit: As for update. In a perfect world I would like that to happen in 2 or more weeks. But we will see. Another thing to note. There is a new video tutorial. :)
     
    Last edited: Dec 13, 2012
  8. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    Thanks for the reply, I am using the portals for the units that can vault those cover points, the portals connect over the obstacles, works pretty good, I need the option in the navigator to ignore portals for the rest of the units.

    I found the problem why they got stuck, it had to do with the portal nodes connect points.

    Can you add an option so that the portal nodes can have the same value as the normal nodes so that they aren't always prefered over normal nodes or add a option to assign a value to portals? :p
     
  9. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Well I'm not really sure what you mean by same values. Portals simply, directly connect nodes, and have the ability have have one side closed or open. Basically it treats the 2 nodes as if they are connected neighbours.

    It is possible in future updates you will be able to penalize portals though.


    EDIT: Just thought of a solution for you. You could make 2 different grids. One for the AI that need to lunge over the objects, and one for normal navigation around the room.
     
    Last edited: Dec 13, 2012
  10. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    Hmm, I thought that the individual portal nodes have a lower penalization value and that's why they are chosen instead of the straight line.

    With the path in my picture above the navigation doesn't travel trough the whole portals only trough they're starting nodes, the portals are joined only across the objects, that's why it's wierd that the pathfinding includes those nodes in the generated path.

    I thought about making 2 grids, I just didn't want more cpu overhead.
     
  11. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Try to understand that when you connect those portals you're skipping around 5 or so nodes down the grid(Or whatever the distance you have them apart). That means, to the AI, thats 5 nodes closer, so he is going to see that as a quicker route. Make sense?

    Having multiple grids has no affect on CPU. Just memory, and those are very small grids in your case. I have created multiple grids as big as 1200X1200 before. :)
     
    Last edited: Dec 13, 2012
  12. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    Aha, I understand, the thing that bothers me is that the path in the picture doesn't travel trough any connected portals (trough the blue lines) just trough different nodes of non-connected portals(the purple lines).

    My project has dynamic content so I will need to update the grid at runtime, would 2 grids update just as fast as only 1?
     
  13. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    I have integrated it into my random generated levels but the Create Grid function is to slow to be used in-game, freezes the game for about 5 frames, is there any other faster way to update the grid during gameplay? You said the navmesh generation can be updated fast in-game for dynamic generated maps.

    The portals also throw the Array index is out of range error when they get cought out of the grid.
     
  14. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Hey, sorry for the delay I was away for the day yesterday. Portals connect nodes remember, of course the path will travel through nodes. The blue line is only to show that the portals are connected.

    One of the main reasons this is a 'beta' is because dynamic grid generation is not yet complete. How do your randomly generated levels work? Does it generate walk-able space dynamically? Are they multilevel?
     
  15. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    For the random levels I have pre-made level pieces that are joined at run-time, the player walks trough them and only have a single level of height.

    I have the grid follow my player because everything evolves aroud him, update the grid about every 10-20 meters he walks away in a new direction and only need a 100x100 grid since I only use AI's around him.

    Will this be available in the next update?
     
  16. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Yes I hope to implement this feature. Is this a top downshooter? Are there stair cases and different levels along the y axis? Cause if there arent, you can just add the dynamic obstacle script to all your objects that you procedurally build.
     
  17. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    Yeah, I could add the dynamic obstacle script to objects but I would have to make a pretty big grid at start, like 2000x2000, would that run ok?
     
  18. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Unity gets unstable past 1000x1000(Memory allocation). 2000 is a MASSIVE grid..... Thats 2 million nodes... That could almost fill the world of Skyrim, why would you need a grid that big?

    You can make multiple grids though. I tried creating 6 grids that were 800x800 and it was pretty stable. Although load time increased alot.

    You seem to have some very high requirements and expectation for this game of yours. ;)
     
  19. Boji

    Boji

    Joined:
    Jul 10, 2012
    Posts:
    44
    Well I use grid box size of 0.5m, 2000x2000 would be the worst case scenario if they would be completely straight, it would actually be more like 2000x15 but the grid generator only makes square grids, most of the time the levels generated are about 350x350.
     
  20. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    I'm really interested in this AI Navigation. But then I read about it being only for Unity 4. That makes this the first asset I've seen with that clause. I fear it's the beginning of a worrying trend. I suppose I'm going to have to double check that on other assets from now on.

    At first I didn't notice the "Unity 4.0 Required" text on the asset store link and almost would have bought it if I didn't come here first.

    I don't mind buying the Tornado Twins discount one, but I'd rather not because I like having assets I've purchased in one list. It's something I don't mind paying that extra amount for. Which is also why I'd rather not have an asset in the list that I need a Unity 4 install to access.

    I saw your post about it working with Unity 3.5 if you get it "through" Unity 4. So if it doesn't actually require it, can I ask why you have it limited to Unity 4 users only? What would happen if I just went ahead and bought it through my Unity 3.5?

    I'm quite excited to try this, and have the money ready, but this 4.0 thing has stopped me dead in my tracks.
     
  21. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    It was submitted through Unity 4, so the asset store automatically requires Unity 4. That was my mistake, but at the same time, I wanted to create the final bit of the project in Unity 4 to make sure it worked with Unity 4.(I will likely submit the next version through Unity 3.5)

    You need to install Unity 4 to be allowed to download it. Once you have downloaded it, simply copy and paste the scripts into your Unity 3.5 project. The only thing missing will be the demo scenes because they are a "Unity 4" scene.

    Rob.
     
  22. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    That's cool, thanks for the quick reply. I thought it might be just because of the version you submitted it in. I'm fine to wait.

    I like to use Playmaker as much as possible. And it has a lot of actions for utilizing the Unity nav mesh. So, assuming those are standard Unity nav mesh commands, can anything that uses it also use yours? What are the options?
     
  23. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Well everything that you need to get your AI using pathfinding are public. I don't see any problems using Playmaker.
     
  24. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Hey everyone. Just wanted to give a little update here. Been working hard to get this out of beta.

    I have been working on some new features, as well as making it easier to use and fixing bugs.

    If you have any bugs to report please PM me. Thank you.
     
  25. SeanPollman

    SeanPollman

    Joined:
    Jul 10, 2012
    Posts:
    55
    Can dynamic navigation be triggered at runtime? Say for example I use a girded build system and make several 128x128 tiles and have them randomly placed at runtime, can this be triggered to generate the navigation map after the tile generation?
     
  26. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Yes. Though depending on the size you will get lag when the grid is generated. If your ground or walkable areas never change, you can instantly update by having all your instantiated obstacles as Dynamic Obstacles.
     
  27. SeanPollman

    SeanPollman

    Joined:
    Jul 10, 2012
    Posts:
    55
    Awesome, just purchased. Next question, can you have more than 1 grid in a scene and can AI move from one grid to another? Also can you make it so we can adjust the size of the grid so it doesn't have to be square, changing an X and a Y for it would be preferable.
     
  28. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Yes you can have more than one grid. There are no out of the box features for the AI moving between them though. You could make grids overlap eachother and have the AI assigned to the closest one.

    Also, why do you need multiple grids? You can get great stability and performance up to 1000x1000. Which is massive(1 million nodes).
     
  29. Fifth_Moon_Games

    Fifth_Moon_Games

    Joined:
    Dec 10, 2012
    Posts:
    3
    Great asset. Works great. I have a question about the AI part. I know you are trying to get the Navigation out of Beta but I am wondering how the AI part is coming along. I am at the point in my project where I am working on AI and I am wondering if I should go head and make the combat or if I should wait for yours to come out. The video looks like exactly what I want. Just curious on how it is coming along.
     
  30. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    The AI is sorta on hold because of the work to getting the beta out as well as participating in the DX11 competition. But once I get going on it, things should go fast. But yes it is partially developed. but its hard to give a time frame of release.

    Either way it will be pretty affordable(Less than Dynamic Navigation). So maybe you could go ahead and start on your AI. I will be releasing videos and more information as I make progress, so you will have a good idea if it will be better for your game. :)
     
  31. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hello brilliantgames...

    I was using the Unity native pathfinding (NavMeshs and etc), but for my game, it cannot generate more than 1024 tile count. I have a terrain with 2000x2000 in size (Unity units) and I will have more 6 in future, probably... dont know. But with this only terrain, and many structures and trees in place, I cannot use the native pathfinding. Does your solution cover this terrain size and objects numbers? I will only use for NPCs and with easy AI implemented.

    Thanks
     
  32. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    There really isnt any limit on size. The highest I can get my grids are somewhere above 1000x1000(My computer/unity "apparently' has a memory crash), which is a total of one million nodes/points on the grid. But you can set the cube sizes within the grid to whatever you like. You can also create as many grids are you want. As well, the size of the grids has zero affect on performance during gameplay(Because of the way the algorithms work). Someone told me they were able to create a single grid over 2000x2000 and had stable results(Just don't turn on gird debugging and expect good performance ;) ).

    Either way, if one grid can't cover your map, making multiple grids that overlap eachother, will.. :)
     
  33. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Very nice, thank you.
    I will get it soon then.
     
  34. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hey brilliant, one last question: I saw in your first post that you have a Unity terrain with the grids of the Dynamic Navigation... can I make grids for each terrain separated? As I said before, I will have more than 1 terrain in my scene, and so is it possible for me to bake one terrain a time, and maybe have X numbers of nodes/points per terrain, each with their respective structures and objects?

    Thanks again... :)
     
  35. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Yes. Though unless your grids significantly overlap eachother, it will be difficult getting your AI to navigate between them. :)

    Edit: The grids work exactly the same for everything including terrains. You could have 100 terrains, as long as they are in the space of where the grid is created they will all be part of the grid.
     
    Last edited: Jan 10, 2013
  36. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Wonderfull...
    Currently, I have 1 terrain with 2000x2000, there are lots of trees but it will have more, it has around 50+ buildings (with interiors) and others props objects. The scene is a little bit heavy (it is optmized, so at real time it runs good in 35 FPS). The pathfinding needs to be capable to handle this situation, it does not need to be extremelly perfect, but it needs to dodge obstacles and another players with good smooth. Players will use Characters controllers for now, only NPCs will need the grids.

    There will be more 4 to 6 terrains with the same details, heavy heavy scene...

    Do you think we can handle this all? :) lol
     
  37. 3Lighthouses

    3Lighthouses

    Joined:
    Sep 15, 2009
    Posts:
    10
    This looks like a great alternative to Pro, and I would only consider a pro upgrade for the AI.

    I have a concern though -- I have purchased a few things from the Asset Store before and when they relate to scripting, it doesn't matter how robust the software is to me if the documentation isn't easy to work with. Nothing slows down a project as much as poor docs.

    Might it be possible to review your documentation before buying this?

    I also have a question about how I'd use it -- I plan to make a game where the player is adding and removing lots of environmental pieces on the fly, all of which are in some way walkable, or obstacles, or both. The player can create these, so it's not a simple matter of turning on/off different parts of the grid. It would need to reassess available nodes all the time. It also needs to account for overhangs, bridges, etc. I have my fingers crossed that you'll say the portal system can handle it.

    Imagine the player creates a bridge of his own design on an empty floor and a bot can walk under the arch, then around to the bridge entrance and then over the bridge to the other side. Is something like that possible?
     
  38. 3Lighthouses

    3Lighthouses

    Joined:
    Sep 15, 2009
    Posts:
    10
    So almost nothing is pre-baked in this game. The environment is updating its content all the time.
     
  39. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Here is the help page. http://forum.unity3d.com/threads/159725-Dynamic-AI-Project-Help-Page Its fairly straight foreward once you get used to it, as well as understand what all the vars do.

    All this IS possible. But not completely dynamically. Right now the only 100% dynamic part, are Dynamic Obstacles. Anything walkable requires a new grid to be created(With the current version). BUT, depending on the size, you can create a grid during gameplay and only experience minor lag.

    This is the most dynamic pathfinding solution that exists for Unity as far as I know. Things are constantly being improved as well. So I think its safe to say that purchasing it would be a good start. :)
     
  40. 3Lighthouses

    3Lighthouses

    Joined:
    Sep 15, 2009
    Posts:
    10
    Thanks for the quick reply. It DOES look like the most dynamic system available. :D

    So in the bit at the bottom where you say what portals are connect to what other ones, can I do that in real time?

    Could I, for example, do this:
    Start with a navmesh flat floor area, with no objects other than the mesh for the floor itself.
    Instantiate a prefab of a cube with 5 portals as children, one next to each face except the bottom (nobody can walk on, or near there). The portals in the prefab are linked to each other, but nothing else.
    Then instantiate another cube portals some distance away.
    Then re-scan in-game in real-time, connecting the nearest two portals from the two cubes and the original navmesh.
    Bot walks from top of cube 1, to side of cube 1, across the floor, to side of cube 2, to top of cube 2

    I know pictures would have helped there, but hopefully I was clear enough! :)
     
  41. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Hey, I apologize I did not see this post. Yes, Dynamic Navigation shouldnt have any problems. Although with buildings with multiple floors you will have to increase the amount of layers(Which takes more memory). But either way I'm sure it will meet your needs. :)

    Hmm, I'm trying to picture this. If you are scanning the whole thing again during gameplay, why would you need navigation portals?
     
  42. 3Lighthouses

    3Lighthouses

    Joined:
    Sep 15, 2009
    Posts:
    10
    I bought it the other day, but I haven't yet had the opportunity to test it myself -- deadlines, etc. I won't get to it for another week or two, so I'm trying to set up experiments in advance, so that I can answer design questions in the most efficient way. The more I know about what it can handle, the better.

    Then would it be simpler to leave out the portals if the objects the player adds to the world are not moving? In that case they appear and disappear, but they don't move around once they are visible. It would happen every couple of seconds in the game I have in mind, though. Can portals be activated/ deactivated at runtime without requiring a re-scan?

    I assume there is a lag cost to rebuilding a new navmesh during gameplay. Is there a cubic size that's safe enough to do so without affecting framerate? If I know what scale to work with I could limit the boundaries of a level, but let the player mess with the environment within a big box. I would have thought that creating a navmesh during gameplay would slow things down quite a bit, although the built-in Unity Pro one seems to recalculate the navmesh reasonably fast in the editor. I'm really wondering how a mobile device would perform in this way.

    Does it slow down much if you ask it to scan more geometry, or is its performance based solely on the size of the grid you set in the editor? I ask this because I would like to give the player as much freedom as possible, but in doing that, there would inevitably be a situation where a player would try to build something I never accounted for and I'd like to be able to guarantee framerate.
     
  43. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Sorry for the delay on this. The time it takes to build a new grid has nothing to do with geometry. It is the resolution and amounts of layers that affect speed. As far as I know there really isn't any other Navigation solution that builds as fast as this from what I've tested. Portals can be opened or closed dynamically without any affect on performance.
     
  44. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Dynamic Navigation 1.0 is near ready for release! Now is your last chance to report any other bugs or features you would like to see added!
    Very excited for this update. Things are very cleaned up, and "Axis Height" no longer exists! :)
     
  45. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Does this have a cover system or are you planning on adding that?
     
  46. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    That feature will likely come when the first version of the AI is released. This update is meant to really clean everything up and increase ease of use. :)
     
  47. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,084
    Does your system work with JS?
     
  48. yaoklin

    yaoklin

    Joined:
    Jul 16, 2011
    Posts:
    8
    Hi ,
    I have two questions about this package .
    one is how about it's effeciency? can it be used int mobile game development ,such as ios ,android ?

    the other is that
    in the demo ,there is just one character which is finding path ,i just want to be sure ,if there are many characters which are moving to find the target ,can they avoid each other ,not walk cross each other ?
    as in the asset store ,there are some packages about dynamic finding path ,they can avoid static obstacles ,but can't avoid other objects which also are moving.
     
  49. Shintaja

    Shintaja

    Joined:
    Jan 13, 2012
    Posts:
    15
  50. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Sorry about the delay on these responses, I have been a busy bee everyone!


    Its written in C#, but you shouldnt have too much troulbe using Java script with it.


    Yes this package is designed with efficiency in mind. Did you not see the stress test? You can have as many AI's pathfinding as you like, but there is no character avoidance, it is a completely different ball park. Although I do plan to implement character avoidance in the futre, but it may be with Dynamic AI rather than Dynamic Navigation.