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

[RELEASED]Node AI - Pathfinding and AI for procedurally generated games and more!

Discussion in 'Assets and Asset Store' started by cmart, Mar 25, 2015.

  1. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121

    Hi everyone, I am very excited to announce the release of my new AI and path finding asset: Node AI! What is node AI and who is it for? Node AI is in my (totally biased) opinion the BEST AI and path finding solution available on the asset store for procedurally generated games. As a matter of fact, the path finding is as accurate as navmesh solutions if nodes are set up properly!

    Asset Store Link:


    With Node AI, you can do many things. Not only can you have complex levels, players can hide behind cover to avoid line of site, AI has adjustable reaction time, and much more.

    If you are making a game with procedurally generated levels, or if you just want to write your AI once and have it work in any situation, Node AI is for you!

    If you have any questions about Node AI, feel free to ask! Thank you for checking out my asset, I hope you like it!

    Store Blurb:

    Unity 5 Ready!

    Works with free and pro versions of Unity!

    Demos and guide at bottom of description


    Node AI is advanced Path finding without the need for a navmesh or baking of any kind!

    A.I.s can follow routes and track players through complex levels with perfect accuracy!

    Built with procedurally generated games in mind, but powerful enough for any situation, node AI is the pathfinding solution you have been waiting for. Why spend time converting code back and forth when you could simplify your A.I. and use a solution that will be flexible in any situation!

    Easy to use! No need to write any code. AI Agents have tons of easy to understand options available right in the inspector! And if you want to code, the scripts are packed with comments and written in a way to be as easily understandable as possible.

    Features:

    -AI agents can wander, follow waypoints/patrol, guard/stand ground or chase a target.

    -AI features dynamic reaction time, complete with on screen indicator. Perfect for stealth games!


    -AI agents can alert other agents to chase player!

    -AI features a sophisticated routine for finding players. If an agent can't see a player directly, it can follow a players trail, or investigate the players last known location.

    -Agents can take damage, and attack player!

    -includes bonus animation script with a basic setup for Mecanim compatible models!

    -Setting up nodes couldn't be simpler. simply drag them into your scene, arrange them in a way that suites your level, and that's it. Node AI takes care of the rest!

    -Nodes can be stored in prefabs allowing for ultra flexible and dynamic scenes!

    -Easy to use visualization tools!

    -Highly optimized performance!

    -Easy integration with UFPS! Detailed setup instructions included.


    The best way to see what Node AI is capable of is to test it out yourself! Check out these demos:


    Complex maze pathfinding (included in package):

    https://dl.dropboxusercontent.com/s/j7ippa9x1g7gawp/nodeDemo.html

    Playable Demo 1 (included in package):

    https://dl.dropboxusercontent.com/s/zvmn8vkfm84r075/wanderDemo.html

    Playable demo 2 (included in package):

    https://dl.dropboxusercontent.com/s/2kzhmjy388ehqzg/miscDemo.html

    Procedurally generated level demo featuring level generation by Dungen (sold separately! This scene is NOT included with Node A.I.!):
    https://dl.dropboxusercontent.com/s/ahhmt8770c04fm9/proceduralDemo.html

    Have more questions? Check out the 27 page PDF guide:

    https://www.dropbox.com/s/rya58svnq50cb6v/nodeAIGuide.pdf?dl=0

    Video tutorials coming soon!


    Thanks again for checking out Node AI!
     
    Last edited: Jan 15, 2017
    EliasMasche likes this.
  2. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,288
    Hi,

    Can this do A* like pathfinding ? Does it support heigh and dynamic obstacle handling ?

    Also do i have to add nodes manually based on the areas in the game ? Is that automated in any way ? If not automated, how does it work in a procedurally created / changing environment that has not go any nodes setup?

    I have also noticed that cliking sometimes make the hero go the opposite way of the clicked area and then start moving correctly. Can this be avoided ?

    Thanks
     
    Last edited: Mar 25, 2015
  3. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    I am not super familiar with A*, but Node AI does support height and should support dynamic obstacles.

    For height, if your paths are indoor/have walls everything works perfectly. You can adjust how steep an incline your agent can climb.

    Here is an example from a personal project that I use Node AI with:


    If you have open paths with no walls, you might need to setup invisible walls/colliders depending on the scene. I will make a demo soon, and will prioritize a slicker implementation with the next update. But short answer, yes Height is totally supported.

    Dynamic/moving obstacles should be fine in most cases, but to be honest I haven't done many tests with moving obstacles, so thanks for the question! Do you have a specific situation in mind? If dynamic obstacles are a big part of your project you might want to hold off until I do some tests... maybe if a moving object parked on a node it could be a issue... I will do some tests and build a demo. Dynamic obstacles will be a major priority for the next update as well :)


    You have to set up nodes manually. So for instance, most procedural level generation tools use tile rooms, so you would just set up the nodes in the tile prefab, like this:


    If you were to procedurally place obstacles in those tiles, you would need to make sure you placed nodes around the obstacle so a path could still be created. I will create an example soon.

    You could write a script to place nodes in your scene, and then build the node graph again. That is a bit more complex, but it is doable. I don't know that I will ever support this out of the box because it is very dependent on the scene/situation, but I will look into building a simple example to show how it could be done.

    Yes! The reason this happens is because I wanted to minimize the amount of nodes used in the scene for loading/performance reasons on the web. The reason this is happening is because when you change the agents destination the agent looks for the closest node with the shortest path to the target, and if you are using a sparse node graph sometimes that node might be behind the agent, or off to the side.

    For Enemy agents, it usually makes sense to use a sparser node graph because the odd time this happens really doesn't affect much, and the agent will always find his path.

    But for a player character using node AI pathfinding, that could look a little weird. So the solution is to simply use more nodes. if you used a node graph like this:

    That should fix the issue. But it could also increase load times, so it kind of depends on your scene and what you need.


    Thanks for the great questions! I will definitely follow up this post with some more examples very soon.
     
  4. Limyc

    Limyc

    Joined:
    Jan 27, 2013
    Posts:
    29
    How can you promote this asset as "the BEST AI and path finding solution available on the asset store for procedurally generated games" when your asset requires manual setup? The assumption that most proc gen games use prefab rooms is a bit naive, and makes your claims misleading to those that don't use tile-based techniques.
     
    Zaddo67 likes this.
  5. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Fair enough! but when I said "best" I prefaced it with "in my (totally biased) opinion" :)

    I will work on making a demo that spawns nodes and doesn't use rooms/tiles. It is completely doable, but definitely not the focus of 1.0.

    One thing I should mention, is that you don't even really need to use nodes if you have a really open type of level. If you had an arena style level, or open terrain with trees, rocks, and other simple obstacles nodes wouldn't be necessary. I describe this a bit in the manual. In the near future I'll have videos and more demos to showcase all of this stuff.

    Check out this demo:

    https://dl.dropboxusercontent.com/s/zvmn8vkfm84r075/wanderDemo.html

    This demo doesn't use any nodes at all, all you would need to do is drop the agents in. No manual setup whatsoever for the pathfinding, but as you can see the level layout is simpler then some of the other demos.


    Thanks for your feedback, I appreciate it!
     
    Last edited: Mar 25, 2015
  6. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,288
    Thanks for clarifying
     
  7. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Last edited: Mar 26, 2015
  8. Greenwar

    Greenwar

    Joined:
    Oct 11, 2014
    Posts:
    54
    Would this work with 2D?
     
  9. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Is this just for shooters or is melee available as well?

    Also can it be setup with like people working in a village or zombies eating brains and when they see or hear you they start to chase you?
     
  10. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    3D only for now.
     
  11. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    You can easily setup Node AI to do shooter or melee style attacks. There are settings called "stop distance low" and "stop distance high" and for a shooter you would set them to something like 4 and 8, and the agent would stop 4-8 units away from the player to attack.

    For melee, you would set both of these to 0.5 or 1 (or whatever suites your game) so the agent only attacks when up close.

    Yes absolutely! For people working in a village you could set up wayPoints for them to patrol, and Node AI lets you define how long Agents wait at wayPoints. So you could have a Villager at a work table for 10 seconds, then move to a storage bin for 5 seconds, or whatever you want really :)

    For the Zombies, you could set them to guard mode (guard mode just means they are standing still in one place until they see/hear the player) and have a brain eating animation playing.

    Node AI has adjustable reaction time, so you could set up how smart/how good of vision your zombies have. They could see the player and chase right away, or it could take a second or two to allow the player to hide. Its up to you!

    To make the zombie "hear" the player is pretty simple. You just need to send a "wakeUp" message to the zombies you want to start chasing the player. This involves a bit of code, but Its pretty easy and if you need help I'd be more then happy to show you how.

    One other cool thing is that if a zombie is chasing your player, it can alert other zombies to start chasing the player as well.

    Hope that answers your questions! If you have more, feel free to ask. Thanks for checking out Node AI!
     
  12. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi, I wanted to let everyone know I just finished a couple of tutorial videos. These cover the very basic things Node AI can do. In the near future I'll post more videos covering more advanced topics. If anyone has anything they would like me to cover please let me know!

    Here is a link to the playlist:
    https://www.youtube.com/playlist?list=PLGrMvTMQkr2Po-bbX916t3EjMeAcK4Ghk

    And here is the first video:


    Thanks
     
  13. Zapgun

    Zapgun

    Joined:
    Jun 3, 2011
    Posts:
    50
    Hi Curtis,

    The package looks interesting. You haven't made any mention of performance (beyond saying its 'highly optimized'), do you have any concrete numbers or comparisons and how would this fair for mobile use?

    -- Z
     
  14. Julian-S

    Julian-S

    Joined:
    May 31, 2013
    Posts:
    73
    Hello,

    In my game I have a ship constantly moving on water meaning its x, y, z position and rotation are always in flux.

    I would like to have the ai crew be able to move about the ship while it's moving.

    I am wondering if your pathfinding solution is able to accomplish this? I assume it means modifying path finding at runtime in a reasonable way but any waypoint pathfinders that I have looked at so far don't seem to be capable of that.

    Any help would be much appreciated, thanks!
     
  15. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi Zapgun,

    I just ran a couple of tests on my LG G3 phone. I basically ported over this demo:

    https://dl.dropboxusercontent.com/s/zvmn8vkfm84r075/wanderDemo.html

    I zoomed the camera all the way out so you can see the entire level, and removed the player character. With 20 high poly animated characters on screen at once, I was getting around 20 fps. When I removed the animated models and replaced them with simple markers, I was getting 50+ fps, often 60.

    If anyone is interested I could create a more polished mobile demo and upload the .apk.

    Thanks for checking out Node AI, and if you have any specific questions or tests you would like me to run I'd be happy to do it.
     
  16. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121

    Hmm that is a interesting question. So let me see if I get the gist of your question, basically you want to know if AI agents can move around on an object that is moving around? My tentative answer is yes, if the AI agents are children of the moving object.

    So if your crew (and waypoints and nodes) were children of the ship, they should be able to move around it just fine.

    But before you buy Node AI, if you could show me an example scene or give me more details I could be more certain.

    I ran a basic test where I had my AI agents as children of a level, and I could move the level, rotate it, and everything works just fine. Of course if you rotate the level/ship and are using gravity the agents will fall if you tip them upside down and things like that, but other then that, I think it should work :)

    Thanks for the great question!
     
  17. Julian-S

    Julian-S

    Joined:
    May 31, 2013
    Posts:
    73
    Hey, thanks for the reply!

    Yes, my crew members are children of the ship, and I am not using gravity either so that should make it easier.

    Just to clarify, my ship sails around the ocean and the crew members need to move about the ship.

    Would the fact that the waypoints/nodes are moving around have any more of an effect on performance?
     
  18. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi, sorry for the late reply, I must have missed the alert.

    I imagine it could have a small effect on performance if you had a ton of waypoints/nodes moving around, but I think it would be pretty minimal. I have had a couple of scenes with moving wayPoints, but it is usually one or two at most, and noticed no performance hit at all.

    Not sure how I would test this, but I don't think that moving wayPoints and nodes would be much of an issue performance wise.
     
  19. Julian-S

    Julian-S

    Joined:
    May 31, 2013
    Posts:
    73
    No worries. Excellent, I will give it a try over the next while and I will let you know how it works!
     
  20. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi everyone, I just wanted to leave a quick update about Node AI. Version 1.1 is coming soon, and it is a HUGE update. Across the board tweaks and improvements, some of the major being:

    -Greatly improved load time for scenes with lots of nodes

    -advanced wayPoint options. You can use traditional patrol style time based wayPoints, or event based wayPoints with the ability to dynamically assign target wayPoints based on outside scripts. Here's a super simplified example "if Hp < 5 targetWayPoint = healingPool"

    -More modular scripts. For instance, if you don't need advanced obstacle avoidance, you can easily disable it to save on performance.

    -Step/stair climbing support and general revamp for multi-height levels.

    -More demo scenes and tutorial videos

    If you have any questions about Node AI please don't hesitate to contact me. I have been getting great feedback so far, and it helps me decide what to prioritize in future updates, so the more feedback and questions the better :)

    Thanks for checking out Node AI!

    edit: if you are having long load times and don't want to wait for the update, send me a message and I can send it you right away.
     
    Last edited: Apr 24, 2015
  21. TH_Unity

    TH_Unity

    Joined:
    Jul 9, 2013
    Posts:
    11
    I am working on a procedural generated dungeon game as well. We have meele third person combat. I do not want the player to be controlled by any nodes, but the enemies.
    Is there a way to just retrieve a path that contains the node information or any other kind of path infos to move to the player? I want to handle the AI itself on my own, since there are some states and tweaks that are specific to the game I am working on.
    Is this possbile?
     
  22. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi there,

    Yes, enemies can use the nodes to find the player. You could do the AI yourself, and just use the node scripts to find locations. There is a script called "playerNode" and there is a public function called "FindClosestNode". So if you had that attached to your player, any enemy could call that to find the closest node to the player. You could probably then go into the main aiMovment script, take a look at the way it handles nodes and copy out the stuff you want to use.

    It would involve some work and scripting on your end, but I don't see why you couldn't extract just the node stuff and use it in your own custom AI system. If you know your way around C# it would probably be pretty simple to do.

    Haven't thought of that, thanks for the great question :)
     
  23. TH_Unity

    TH_Unity

    Joined:
    Jul 9, 2013
    Posts:
    11
    Thanks for the reply.

    We've tried out Unitys NavMesh System and the A* Pathfinding Project and both could not satisfy the needs of our game. They could not provide a solid solution to both of the features: dynamic and procedural Pathgeneration (failed with unitys navmesh, due to baking) and clamping the entities to specific ground or graph.

    The last one is very important. So the entities should first not push each other off from cliffs and second recgonize if they move over an edge and prevent that. How did you handle this in the example scene and how would you solve this problem. The entites should move on a parcour like this without falling to the ground or pushing each other off the edge:


    Best regards,
    T_Schm
     
  24. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi T_Schm,


    One thing to keep in mind with Node AI is that you have to manually place nodes on your prefabs. There is a no-node option, but the path finding isn't nearly as good (but suitable for top down shooters and simple arcadey type games).

    Node AI is designed for tile based procedurally generated games, so for instance in your picture if those cubes were all prefabs, and they had nodes as children, you could place them together randomly at run time (with something like dungen, available on the asset store) and the nodes would find each other and work.

    So you can turn this:


    into this:

    https://dl.dropboxusercontent.com/s/ahhmt8770c04fm9/proceduralDemo.html

    And of course node AI works with non procedurally generated games as well :)

    You could do this fairly simply, at least with nodes. What you would need to do is basically set up a new node tag, and use separate nodes with different tags and assign the proper layer/tag settings for the agents. This isn't an out of the box feature though and would require a bit of unity/scripting experience (if you are familiar with tags/layers and finding objects in scripts with certain tags/layers you should be ok.) to take full advantage of.

    I use invisible colliders and tag/layer settings. As a matter of fact, in the soon to be released Node AI update I am going to include a scene that shows more advanced pathfinding techniques, avoiding edges and holes, multi height stages, etc.

    Another big part of the update is a new node wander mode. Right now when a agent wanders, it literally just wanders around aimlessly. With the new node wander mode, the agent will wander from node to node which is much more useful. You still get the randomness, but there is some purpose to where the agent moves. The old school wander mode (which doesn't require nodes) will still be available as well.

    I will be done with the update within a week or two, and I will post the new demo scene as soon as it is ready.

    Hope that answers some of your questions. If you have any more feel free to ask. Thanks again for checking out node AI!
     
  25. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    How fast is generation at runtime, provided your prefabs _don't_ have nodes in them? Also does it support dynamic obstacles (recalculating mesh as needed)?

    For my game I'll be using custom level editor (written in Unity, though, but not as Editor script as this will also be used for modding) and levels will be loaded one object at the time. Level designers will also be able to change level's layout at runtime (think Quake's/Build/Doom "triggers"/moving sectors) and I want AI to react accordingly.
     
  26. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Just additional question: Is it possible to "retard" AI a bit? You know, make it choose wrong path on purpose sometimes, then back away to the correct one. It'd make AIs behave more human-like, especially when said AI (say, companion) is story-wise supposed to be in that specific place for the first time. Or if enemies are supposed to be unfamiliar with terrain.
     
  27. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hey darkhog,

    Sorry for the late reply, I am not getting notifications from this thread sent to my e-mail for some reason : /

    How fast is generation at runtime, provided your prefabs _don't_ have nodes in them?

    I think you are asking if Node AI generates nodes at runtime? Unfortunately it doesn't at this time, you must store nodes in prefabs.

    Also does it support dynamic obstacles (recalculating mesh as needed)?

    Sort of... out of the box, with nodes not so much, without nodes no problem... but you could easily refresh the node list after a new obstacle is introduced. Would require a bit of code on your part, but this is something you can do with Node AI.

    make it choose wrong path on purpose sometimes, then back away to the correct one


    Actually this would be pretty simple: don't use Nodes :) but keep in mind even when you don't use Nodes agents are quite accurate depending on how complex your level is. If you have a simple level, even without nodes you might have a 100% accurate enemy, but the more complex the level the more likely a AI agent is to make mistakes if it is not using nodes.

    Hope that answers some questions, and sorry about the late reply.
     
  28. Bionicle_fanatic

    Bionicle_fanatic

    Joined:
    Jun 8, 2013
    Posts:
    368
    Hi there, I'm creating a game that procedurally generates an island out of a Terrain object. The game will have inhabitants who need to navigate the terrain, and as Unity can't bake or update navmeshes at runtime, I need to look for an alternate solution. The description of Node AI seems to fit the bill, however I have a few queries:

    There might be roughly fifty AI-using game objects at a time in the script. Will this cause a noticeable drop in framerate?

    Using the node system is out of the question, as I would have to instantiate thousands of them to lay out a cohesive map of the terrain. Would the AI, without nodes, be able to navigate across the island, through trees, around giant boulders, etc?

    The villagers will have huts, and will need to be able to enter them through a door. I know that this is highly unlikely without the node map, but would it work with one or two nodes placed strategically either side of the door?

    The villagers and animals have a complex behavioural system which will be the "brain" behind the Node AI movement. I know it won't be as simple as Unity's NavMesh.destination, but would it be possible to call functions of the Node AI code via my "brain" script without getting messy with cross-referencing?

    I think that's all for now. Look forward to hearing from you [:)]
     
  29. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi Bionicle_fanatic, thanks for checking out Node AI!

    There might be roughly fifty AI-using game objects at a time in the script. Will this cause a noticeable drop in framerate?


    If you are building for pc/mac, that should be fine. On mobile devices that would probably be pushing it (see my message earlier in this thread for info on an android build).

    Using the node system is out of the question, as I would have to instantiate thousands of them to lay out a cohesive map of the terrain. Would the AI, without nodes, be able to navigate across the island, through trees, around giant boulders, etc?

    Yep, if you have an open terrain and simple obstacles (try to avoid corners and "u" shaped obstacles) node AI works fine without nodes. Agent's might be a bit "dumber" without nodes, as the agents have to do a bit more "guessing" to find their targets.

    This demo uses no nodes at all, so you can get an idea of what kind of obstacles are easier to avoid:

    https://dl.dropboxusercontent.com/s/zvmn8vkfm84r075/wanderDemo.html

    The villagers will have huts, and will need to be able to enter them through a door. I know that this is highly unlikely without the node map, but would it work with one or two nodes placed strategically either side of the door?

    You wouldn't need nodes for this necessarily, you could use wayPoints or even assign the door as the villagers target. There is a conditional wayPoint demo scene included that gives an idea of how you could do something like this, but these options would probably involve scripting on your end. If you are familiar with C# it wouldn't be much trouble though :)

    The villagers and animals have a complex behavioural system which will be the "brain" behind the Node AI movement. I know it won't be as simple as Unity's NavMesh.destination, but would it be possible to call functions of the Node AI code via my "brain" script without getting messy with cross-referencing?


    The agents target variable is hidden (but not private) by default, and automatically assigned to the Transform with the tag "Player" during the start function. So you could write a script that reassigns the target to whatever you want, based on your characters "brain" script.

    Hope that answers some of your questions! I think node AI would work great for you IF you know your C# basics and have some scripting experience :)
     
  30. Bionicle_fanatic

    Bionicle_fanatic

    Joined:
    Jun 8, 2013
    Posts:
    368
    Thanks for getting back, I'll look into getting a copy soon [;)]
     
  31. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    279
    Hi just got your asset yesterday and think it is awesome!, however i created a plane and created a divide in the centre and place an enemy one side and a player prefab the other. I set the enemy to wander which work great, but when he got to the edge he just fell off. Seems like the enemy did not recognise the edge?
    As my game is based on floating islands is there a way to get the enemy to recognise edges without having to create colliders around the entire maps/levels i have created? I think node would do it but i love the wander feature.

    Thanks

    Daniel
     
  32. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    279
    One more question:

    Is there auto node placement, something along the lines of navmesh setup?
    Set the ground area and auto scan the scene?

    Thanks

    Daniel
     
  33. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi Daniel,

    First of all, thanks for buying node AI I really appreciate it :)

    Sorry for the late reply, for whatever reason I don't get sent alerts from this thread. The best way to contact me is nodeaiunity@gmail.com, I usually get to those within 48 hours (and often much faster then that).

    Edge Detection - I do use colliders for edges, mainly for performance reasons (multiple raycasts can start to add up).

    Also, there is no auto node placement unfortunately. Node AI is definitely very hands-on, it does require a bit of work to get everything just right.

    One thing to keep in mind, if you have an open or not very complex scene, you might not even need to use nodes ;) test it out without nodes, you might be surprised... but if you want the best results possible, you're gonna have to set nodes up by hand.

    One thing you can check out is the various prefab drawing tools, like this:

    https://www.assetstore.unity3d.com/en/#!/content/3431

    They can really speed up placing nodes (but I still prefer to do it by hand)

    I am looking to streamline node placement in the future though, and I have received a couple of requests about built in edge detection so I will look into it.

    Cheers,
    -Curtis
     
  34. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    279
    Hi Curtis,

    Thanks for the reply and look forward to the future additions. Nodes will be fine and work as i need for the time being, just thought i would ask.

    keep up the great work

    Best

    Daniel
     
  35. BobbyDoogle

    BobbyDoogle

    Joined:
    Dec 3, 2013
    Posts:
    17
    I'm considering using this asset in a few projects. How well does it work with objects that are not grounded, IE in 3d space. Assuming node points are well distributed should it still work just fine?
     
  36. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi Curtis,

    This asset looks great and very straight forward to implement, but I have a few questions about it if you don't mind:

    1) Is it possible to have enemies chase the player in overlapping, multi-level scenes? For example having a set of nodes on each floor of a multistory building and the enemy would follow the player up and down stairs.

    2) Is it possible to setup special nodes over gaps, in which enemies will "jump" across?

    3) Can nodes be made only one way? Eg. enemy can travel from node A to node B, but not from node B to node A.

    4) Can nodes/paths be dynamically changed at runtime based on dynamic objects? Eg. A door exists between node A and node B; when the door is open the path between node A & B can be used by the enemy, but when the doors is closed the enemy cannot use that path.

    I look forward to discussing this asset with you further. Keep up the great work!
     
  37. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi Hamesh,

    Thanks for checking out Node AI! I'd be happy to answer your questions.

    1) Yes. AI agent must be able to "see" a node to move towards it, so it wouldn't detect a node on a floor above/below it.

    2)This is kind of tricky to answer, because there are many ways to do this, it kind of depends on your game. For instance, you can have flying/floating agents that use nodes with no gravity, so in that case, a gap would be no problem. But if you are using gravity, your agent would fall in the hole... except that you could always program around that. You could possibly set up a trigger around the gap that turns off gravity on the agents rigidbody temporarily while it "floats" across the hole, then turn the gravity back on when it exits the trigger (haven't tried this myself, just an idea).

    So my answer would be yes, but not "out of the box". You would have to think about your scene/agent and come up with a way that suits your game. Would probably require a bit of programming on your end.

    3) No.

    4) Hmmm, for doors I am going to have to say No, I think it is possible but I can't think of a "quick and easy" way to do it. But agents can get around dynamic objects that are in the open, for instance if an agent was in an open field moving from point A to Point B, and a meteor landed in that path, the agents would detect the meteor and move around it.

    The door problem is interesting though, I am surprised that hasn't come up before. I will keep that in mind as I work on updates.

    Thanks for the great questions, gives me a couple of things to think about for future updates :)
     
    Hamesh81 likes this.
  38. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Thanks for your detailed answers Curtis. I have a few clarification questions if you don't mind.

    1) How about if the floors are joined by stairs and there were nodes positioned incrementally up (or down) the stairs. From floor 1, the AI Agent could see the nodes on the lower part of the stairs, and as they followed them they would eventually be lead up to floor 2. Could this work?

    4) Would it be possible to add a trigger box to each node, and if certain objects enter the trigger box, that particular node would disable itself (leaving only the trigger enabled). Would the AI Agent then simply ignore that (disabled) node, and use other nodes to make its way around this object? Then if the object exited the trigger it would re-enable the node.

    I look forward to your thoughts on this.
     
    cmart likes this.
  39. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    No problem, happen to answer any questions.

    1) Yes, you can do this, in fact this is one of the main reasons I built node AI, I needed to do exactly that for the project I was working on :). The only issue you might run into, is say you have some nodes going up a ramp with no walls, it is possible a node on the ramp might make a connection to a node on the floor, so an enemy on the floor could try to go directly from the node on the floor to the node up the ramp, instead of going around to the start of the ramp. So in in a situation like that, you could use invisible walls to block the node connection, or simply adjust the nodes connection distance so you don't get any unwanted "short cuts". Hopefully that makes sense, if not I will make a picture to explain better. Other then that, nodes will work just fine with stairs.

    4) You wouldn't want to do that. Try not to think of individual nodes, but think of the collection of nodes as a node graph, or a simple navmesh. If you took out one node, it would ruin the graph. All the nodes do is mark space that can be traveled to, so you don't really use them for assigning destinations, you would use wayPoints or an enemy/target. Then the wayPoint/target uses the node graph to guide your agent.

    So what you could do is something like you described, but you would use wayPoints instead. No Harm in enabling/disabling wayPoints as far as the Node Graph goes, and there are a few examples in the package of using wayPoints in creative ways. For instance,I included a conditional wayPoint, that lets you pick a destination by keypress. WayPoints are pretty flexible, you can do quite a bit with them ;)

    Hope that helps!
     
  40. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Thanks a lot. I will try out some of these things and let you know if I have any further questions.

    *Edit: Working well in my initial tests :)

    Screenshot - 19 12 2015.png
     
    Last edited: Dec 19, 2015
    cmart likes this.
  41. studio1h

    studio1h

    Joined:
    Jul 6, 2012
    Posts:
    31
    Hi Curtis,

    I just imported Node AI into a new Unity 5.3 project and I'm getting the following warnings:

    Shader warning in 'Reflective/Diffuse Reflection Spec Transp': Fixed function TexGen used; it doesn't do anything now at line 8

    Assets/NodeAI/scripts/demoScripts/demoLevelSelect.cs(10,60): warning CS0618: `UnityEngine.Application.loadedLevelName' is obsolete: `Use SceneManager to determine what scenes have been loaded'

    Assets/NodeAI/scripts/demoScripts/demoLevelSelect.cs(10,37): warning CS0618: `UnityEngine.Application.LoadLevel(string)' is obsolete: `Use SceneManager.LoadScene'

    Assets/NodeAI/scripts/demoScripts/levelControl.cs(12,60): warning CS0618: `UnityEngine.Application.loadedLevelName' is obsolete: `Use SceneManager to determine what scenes have been loaded'

    Assets/NodeAI/scripts/demoScripts/levelControl.cs(12,37): warning CS0618: `UnityEngine.Application.LoadLevel(string)' is obsolete: `Use SceneManager.LoadScene'

    Assets/NodeAI/scripts/playerScripts/playerHealth.cs(31,52): warning CS0618: `UnityEngine.Application.loadedLevelName' is obsolete: `Use SceneManager to determine what scenes have been loaded'

    Assets/NodeAI/scripts/playerScripts/playerHealth.cs(31,29): warning CS0618: `UnityEngine.Application.LoadLevel(string)' is obsolete: `Use SceneManager.LoadScene'
    I assume most of these warnings have to do with the changes in 5.3 to support multi-scene editing, but would it be possible for you to update Node AI so as to address these warnings?

    Thanks! -- Node AI looks great, and I'm looking forward to using it in my current project.

    : )

    J
     
  42. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi Curtis,

    I am trying to add the ability for AI agents to climb vertically up the side of buildings. I have setup a series of nodes vertically and placed a trigger box around them that switches an agent's gravity on and off.
    Screenshot - 21 12 2015.png
    At the moment, when the AI agent enters the trigger their gravity gets turned off and the raycasts show that they can "see" the next node above, but for some reason they do not rise to the next node up. I have had a look at the Movement function (in aiMovement.cs) and noticed that at several points the moveSpeed is multiplied by the transform.forward. Would it help if I added a conditional check that took the trigger into account and use transform.up if inside the trigger?

    I look forward to your advice.
     
  43. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi J,

    Thanks for the heads up. I am working on a node AI maintenance update at the moment, should be ready very soon. Those warnings are taken care of, and the manual has been updated for the newest version of UFPS.

    If you notice anything else, please let me know :)
     
    studio1h likes this.
  44. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    That is what I would do :) I haven't tried that myself, but it should work.

    What you could do, is add a new bool to the aiMovment script, something like "climbing". Then when you enter the trigger, set climbing true (and use gravity false), when you exit set climbing false (and gravity true).

    then in the aiMovement script, search for

    transform.position+=transform.forward*Time.deltaTime*moveSpeed;

    There are 7 instances in the unmodified aiMovement script.

    and change it to

    if(climbing){
    transform.position+=transform.up*Time.deltaTime*moveSpeed;
    }

    if(!climbing){
    transform.position+=transform.forward*Time.deltaTime*moveSpeed;
    }

    Like I said I haven't tried it myself, but I don't see why it wouldn't work. Let me know if you get something working, sounds like you are using Node AI in some interesting ways :)
     
    Hamesh81 likes this.
  45. studio1h

    studio1h

    Joined:
    Jul 6, 2012
    Posts:
    31
    Super! -- Thanks very much Curtis!!

    : )

    J
     
  46. kregenrek

    kregenrek

    Joined:
    Dec 21, 2014
    Posts:
    10
    Hi

    is this plugin suitable for Tile Grid Based Games ?

    I need Agent/Enemy Pathfinding to the Player in an orthogonal non diagonal Movement.
    The Grid looks like here in this Game:
    (But just in 3D).
    XZ Plane (Y is up). And of Course I'll need collision detection - is Tile occupied by an agent then other agent has to look for another tile.

    Regards Kevin
     
  47. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi Curtis, I hope you have had a merry xmas and happy new year! I managed to get some good climbing functionality happening with your previous tips and also added some jump detection. It's quite exciting watching the AI agents climbing to the roof and then jumping from roof top to roof top :D

    I have a question/suggestion for Node AI. I have setup a "sentry" type of enemy which guards in place (does not wander or patrol) and only when they can see a player will they give chase, attack etc. For this type of enemy, it would be useful to have them be able to find their way back to their guarding spot, if they have lost track of the player. At the moment the sentry guard simply stops where ever it looses track of the player; where as it would be good if, after a certain delay, it would start pathfinding its way back to the initial guarding spot. Then once reaching the guarding spot, the enemy would go back to "guarding".

    Any suggestions as to how this could be implemented?

    Edit: I experimented a bit more with a "patrolling" type of enemy. I found that if losing its target the enemy will by default go back to its first waypoint and start patrolling again. However, it only does this if it is close enough to it, if the enemy loses the player far from its initial waypoint it seems to not be able to see it anymore and starts to wander around. Not sure why it wanders since I have "Use Wandering" turned off, although I do have "Use Nodes" turned on though. Looking forward to your insights on this :)
     
    Last edited: Jan 11, 2016
  48. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi Kevin,

    Unfortunately, I don't think Node AI would be very suitable for a game like that. It could be possible, but it would take some in depth scripting and heavy modifications on your end to get that kind of behavior.

    So I can't recommend Node AI in this case, out of the box it won't work with a game like that.

    But thanks for checking out Node AI, and good luck with your game :)
     
  49. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    121
    Hi Hamesh,

    I am having a great new year so far, I hope you are too! Glad to hear you have your AI climbing and jumping, that sounds pretty cool! I'll have to test some ideas like that out myself.

    "At the moment the sentry guard simply stops where ever it looses track of the player"

    " I found that if losing its target the enemy will by default go back to its first waypoint and start patrolling again. However, it only does this if it is close enough to it, if the enemy loses the player far from its initial waypoint it seems to not be able to see it anymore and starts to wander around."

    To address the top quote, there is a setting in the aiMovement under "detection settings" called "Camp Last Known Spot". If this is checked, when a Enemy looses the player, it will "camp out" (or "simply stop") at the last spot it saw the player. You can adjust how long the enemy will camp with the "look time" setting under detection settings. The default value is 10 seconds. So after that time is up, the enemy should resume what it was doing, like returning to its wayPoint patrol which brings us to the second quote...

    That is a little trickier to answer. I tested this out with the nodeDemo scene that comes with node AI, and everything seemed to be working properly. For the test, I disabled all the enemies except "defaultEnemy-01" who uses two wayPoints. I turned his chase speed down to 3, so it would be easy to loose him. I started up the scene, got the enemy to chase me far away from his patrol, and then lost him. After the enemy waited the default 10 seconds, he followed the nodes back to his post and resumed his patrol.

    So I am not exactly sure what the issue is in your scene :/ are you sure all your nodes are connected properly? If there is a break in the node graph, that could cause the enemy to behave weirdly and not resume its patrol.

    That is my best hunch at least, let me know if you are still having problems.

    Thanks,

    -Curtis
     
  50. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi Curtis, thanks for your reply. It is quite puzzling since what you described above is exactly the kind of functionality that I'm trying to achieve. I have included a video below showing the odd behavior. It is also the NodeDemo scene with no changes to the aiMovement script. I have only added an L-shaped waypoint path on the bottom left and set two of the waypoints to pause the AI Agent (I have kept the agent selected so that his inspector is visible). You will see in the video that the agent starts to wander around after the chase ends. I'm not sure why.



    The patrol enemy I am using is a duplicate of the existing enemy prefab. I have compared the variable values of it to the "defaultEnemy-01", and it appears similar to me. Not sure what I am doing wrong here.

    In this video the patrol does manage to go back to patrolling, but the chase ends very close to the waypoints.



    I would appreciate some pointers. Thank you :)
     
    Last edited: Jan 14, 2016