Search Unity

[Released] Advanced AI Pro - AAA AI Solution -

Discussion in 'Assets and Asset Store' started by Zozo2099, Feb 3, 2013.

  1. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    @XMachinaX, for the flying enemies I'd try parenting them to an empty maybe making the models transform off the ground, and try putting Advanced AI on the empty.

    Not saying it'll work, but it's a thought.
     
  2. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi

    Advanced AI Pro supports navmesh height of course, but If you have several enemy types in your scene (like ground + underwater enemies) then the only solution to get them all together is to set several navmeshes where they move, by example; for ground enemies it is the terrain (or the floor) gameobject set to static, now for underwater enemies you create an invisible static floor through the water where enemies swim! Same for flying enemies, you create an invisible static gameobject like a surface where you want your birds to fly and voila you bake the scene you get all them together without playing with height!

    Now if you want a terrestrial enemy to go into water easy, you bake the offmesh links too, so the AI will change surface and it plays its jump animation (if assigned) (You need Unity Pro for that).

    Here an example I did for you, you have the sky, floor, and the underwater swimming surfaces, and you have those offmesh links linking the land to the underwater :) (In your game you disable the renderer/collider of the sky and underwater surfaces gameobjects):

     
    Last edited: Nov 3, 2014
  3. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Hi, what option or configuration would I need for the Enemy AI using Melee to constantly attack with a weapon no matter what, it seems they chase me to a distance, run the attack animation (randomly) - sometimes once/twice or three time, do damage to my player and stop, they then wait for me to move or hit them with my own melee weapon before they strike again.
     
    Last edited: Jul 12, 2014
  4. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    In addition to the above, I added in a retreat after half the health of the AI had decreased, it retreated then the idle animation played, but the AI did not move after that, just remained idle. Using your latest build.
     
  5. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I think there is also a bug with the the melee damage, I have two animations, but only one hits the player with damage and have specified two damage elements. Both with the same values.
     
  6. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi julian

    Concerning the retreat feature I had intentionally programmed it that way, AI retreats then idles in place waiting for you to kill him, now I have another scenario for that:

    AI retreats when its health reaches a specific value, then after reaching its destination it will play "wounded idle" animation (if assigned) and its patrol mode will change to "In Place" (strategy to survive :D)! But if it detects you or any second target it will defend itself though! What do you think of this scenario? I am working on it now for the next upcoming update.

    I have tested with two melee animations, two different damage values for each, it is working perfect, each melee animation hits the player once!
     
  7. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    strange on the melee damage, I swapped the animations around to see if it was the animation, but no second animation played without damage. I'm wondering if its a UFPS thing again. I'll test it without UFPS.

    On the woulded idle. Yes, sounds good. I've used and implemented many AI solutions in the past. It would be useful for when you attack the enemy that they move away to either seek a health pack (which could be added as an option), avoid your player, or move out of the players way when another AI with full health comes into attack. If they are on low health, apply the wounded animation for a set time, then like you say defend themselves again and attack, or go back into the idle pose.
     
    Last edited: Jul 13, 2014
  8. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Ok, so I will improve the scenario a little bit, I will add a slot for "med kit" transform which is present in your scene, if assigned then AI will retreat towards it to replenish its health! If not assigned then AI will retreat randomly (according to your desired retreat distance) and continue with my scenario above! :)

    I will add a slot named (Retreat Destination) (it can be the transform of your medkit or the place where it replenishes its health) and a slot for your desired amount of health replenished.
     
    julianr likes this.
  9. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    @kurotatsu Thanks for the advice man, I did something similar to fake underwater enemies in a video update we did of our project. I bet it can be taken further, but I dont know how reliable and dynamic it will be though.

    @Zozo2099 Thanks for the advice, I suspected that different height mesh levels would need to be created as a work around, but this method worries me a bit.

    The problem is the heights are very rigid and the enemies cant really move inbetween the depths of the different height mesh levels, unless you make them switch but that is just a switch they cant attack or really interact with the player in between those nav mesh heights.

    Now, this isnt too much of a problem really for flying enemies as the player wont be flying and will be on pre-determined cliffs so the flying enemies can have different nav meshes at different heights.

    The main problem with this approach is the underwater enemies, as the player will be able to swim and has dynamic height, so the enemies must also have dynamic height underwater (especially if they use melee attacks).

    I thought that perhaps mutiple different layers of nave meshes connected via offmesh links underwater could do the trick but then you would need to do different sets for each enemy type (as each enemy is a different size and thus take up a specific space and needs to adhere to specific height levels to reach the player).

    Apologies for the long message, hope that Im explaining the problem with enough detail.

    Again thanks for all the help so far, hopefully we can get something sorted out.
     
  10. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    111
    It would be great if someone created a nav mesh volume mesh, like a cube or sphere or whatever geometric shape. It would be similar to the physics volumes in unreal toolkit. This would allow for free flying and or swimming npcs.
     
  11. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Hi, I'm having issues with severe lag when using two enemy AI together, they seek my player out and the lag starts when they both meet together. Is there a piece of code that enables distance between AI so they do not intersect?
     
  12. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    @Blackghost: Yes, that is what I was thinking as well. There should be a way to do this in Unity already though by baking a height mesh along with the usual nav mesh.

    Although Advanced AI Pro doesnt use height mesh calculations, it would be great if it did though, then it really would be the ultimate AI package for Unity, feature wise, as well as flexability and ease of use.
     
  13. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello

    New update 5.9 is available on the asset store.

    Changelog 5.9
    • Improved the retreat behavior, added new parameters:
      - Retreat Destination: The destination transform to retreat to, if not assigned then AI will retreat randomly according to "Retreat Distance" parameter. (it can be a medkit transform gameobject for example).
      - Retreat Multiple: Does AI retreat only once, or several times.
      - Replenish Health: Amount of health AI could receive when arrived to its retreat destination.
      - Retreat And Stop: Does AI stay at place when arrived to its retreat destination, or continues to patrol.
    • Smoothed AI rotation in ranged attack mode by the "Look At Speed" parameter.
    @julian What are the specs of your machine? In the epic battle demo scene I can run it at 60 FPS on my laptop with more than 30 AI(s).

    Cheers
     
    Last edited: Jul 15, 2014
    Blackghost and julianr like this.
  14. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @Zozo2099 - not sure what the problem was.. I went back to a previous backup and it was fine - might have been something conflicting. I placed 15 AI on screen no problem. Using a quad core processor i5, with Geforce 650 gtx - so wouldn't have expected any issues.

    Nice work on the update. Thanks!
     
  15. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Just checked out 5.9 - really good work on this, loving the retreat options!
     
  16. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    @Zozo2099 Is there perhaps a way of working in height mesh calculations with Advnaced AI Pro's Nav Mesh calculations?

    I really do need dynamic free flowing AI for our project and I dont want to abandon Advanced AI Pro as it truly is by far the most reliable, flexible and feature rich AI pacjage available for Unity (and I have tried a few, but they either seem, glitchy, very complicated and/or missing necessary features).

    I was thinking perhaps A* pathfinding could help as it uses a grid method, but again Advanced AI Pro doesnt use A*. I actually prefer nav mesh myself though as it is a bit more reliable and better with more complicated scenes (especially hybrid terain outdoor + indoor scenes).

    Sorry that I keep pushing this, but it is something that we need desperately and it is also something none of the other Unity AI plugins have, so if you can implement it you can get the jump on them.

    Hopefully it wont be too difficult to work into Advnaced AI Pro.
     
  17. Z43D

    Z43D

    Joined:
    Jan 2, 2013
    Posts:
    100
    Apex Path launched today as well. Looks like a very promising alternative and more efficient pathfinding solution. It also looks a heck of a lot more artist friendly than A* or the built-in. I'd love to see some support for 3rd party navigation for sure!
     
  18. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    @ZedalisDesign Thanks for the heads up man, Apex Path looks amazing, Im just worried how stable and bug free it is as it is an initial release, also it would be great if Advanced AI Pro could support it somehow, as I dont want to abandon Adanced AI Pro and still would want to use it for AI behaviours and conditions, but then just use Apex Path for the pathfinding.

    I noticed that Apex Path uses A* though, I hope that isnt too much of a problem for Zozo to work with as Advanced AI Pro uses Navmeshes.

    The thing I like about A* is that the grids are very flexible and specific, but Ive seen a lot of A* solutions freak out when there are terrain outdoor areas and indoor areas present in the same scene, hopefully Apex Path can fix that little problem.

    EDIT: I also just checked out their tutorial on baking and setting up their height maps. It still seems very rigid and only for stuff like ramps and certain levels at specific baked heights. It doesnt seem to be intended for flying/underwater enemies particularly.

    This is similiar to Zozo's workaround with different Nav Meshes at different heights and then connecting them with Off-Mesh Links. It is too rigid.
     
    Last edited: Jul 16, 2014
  19. AlteredPlanets

    AlteredPlanets

    Joined:
    Aug 12, 2013
    Posts:
    455
    Hey what about mecanim any support for that?
     
  20. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    @Zozo2099 Apparently the best way of doing flying/underwater enemies is using steering behaviour.

    There are quite a few references on it:

    Steering Behaviours by Craig Reynolds
    pdf of the GDC99
    tutorial series on steering behavior

    Apparently it is mostly built on vector math but nothing too hectic from what other Unity users are posting. Unfortunately I am not a coder at all and am relying on awesome plugins such as Advanced AI Pro and Playmaker (among others) to build the mechanics and functionality of my project.

    Please Zozo as soon as you get time try look into Steering Behaviours and see if it is possible to work it into Advanced AI Pro. It would really bring so much to an already spectacular AI plugin and as I said before there is no one else I could find on the Asset Store doing it yet (not to mention even if they did, not many other AI packages has the level of polish and well as the rich feature set, ease of use and flexibility of Advanced AI Pro).

    Again sorry for keep pushing this but I just assumed a bit of info on a proven method might help a bit.

    EDIT: I also found Opensteer, it is a open source Steering Behavior library.

    You can also check out Unitysteer

    It is a Open Source Steering Behaviour plugin for Unity.

    Hopefully these should give a decent headstart as to how to work in Steering Behaviours into Advanced AI Pro.
     
    Last edited: Jul 18, 2014
  21. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    @XMachinaX

    Thanks for your useful resources, I will check them out, but I wonder how steering is compatible with Unity built-in NavMesh as it is static baked! Just thought about a trick, if you want to make AI flies or swims in different height levels then you need to do it with a custom mesh, instead of using a plat surface , you can model your own mesh, or using several overlapped Unity planes (like stairs) hide them, and bake them, so AI will go up and down!

    Cheers
     
  22. AlteredPlanets

    AlteredPlanets

    Joined:
    Aug 12, 2013
    Posts:
    455
    Hey what about mecanim any support for that?
     
  23. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    @Zozo2099

    Glad that the resources could be of help.

    As for the custom mesh I also thought of a similar solution but unfortunately it still more or less the same, as the mesh can have an arbitrary shape but the nav mesh is still going to create flat surfaces based on that shape, not a volume based shape.

    So the movement and pathfinding is still restricted to the shape of that surface, meaning the enemy cant follow the player truly dynamically as the player can move freely in the water.

    You would need to create 10s of 100s of layer of different nav meshes just to cover every single enemy's height at every possible height they can possible swim and or fly. Not to mention all the nav mesh layers you would need to set up to prevent certain enemies from going up in the air and/or not going into the water.

    Apologies for being so adamant on this. But I have bought 2 AI packages already and tried out numerous free solutions and this is by far the best AI solution I have come accross, so I really dont want to abandon it.

    Also it still just baffles me that there isnt one proper Steering Behaviour AI solution on the Asset Store not even one (ok there are aircraft game starter kits, but they dont use proper object avoidance or crowd simulations). There are a bunch of open source packages and libraries for Steering Behaviours some of them have been available for years and a lot of people and developers still regard Steering Behaviours as the go to method for fully dynamic and 3D movements and pathfinding.

    So it just baffles me how there isnt one proper AI package that supports it on the Asset Store.

    Thanks again for the reply Zozo. Hope that it wont be too difficult to work Steering Behaviours into Advanced AI Pro.
     
  24. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    Thx for the newest updates :)
    My game is getting closer too a alpha Version, when i Reach that Version i will show what im using Your awsome AI for. Im using it for everything living in my game, and im aiming for an alive environment With all kind off animals and Creatures.

    Im very glad i bought Your package its Worth every cent, and im looking forward too follow this package in the future, and i hope you will keep working and do more cool stuff With it.

    Thanks for this AI package !
     
  25. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi
    Mecanim support is planned, hopefully within the next few months :)
     
    Last edited: Jul 26, 2014
  26. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Hi Zozo

    Re: -Retreat Destination: The destination transform to retreat to, if not assigned then AI will retreat randomly according to "Retreat Distance" parameter. (it can be a medkit transform gameobject for example).

    Could we have a Retreat Destination Anim? So when AI reaches the destination, if a Retreat Destination Anim is set it will use that animation. For example, Ai goes to retreat destination transform, like a Medkit, upon reaching that destination it plays the animation (example: AI picks the item up from the floor), then plays the pick up pose. If no animation is specified it will use an Idle pose, like it does now.
     
    Last edited: Jul 30, 2014
    Blackghost likes this.
  27. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    In a future update would it also be possible to add further hit boxes (capsule colliders) or other? Maybe just define 3.. head, torso, legs - each can have their own damage levels and if you wanted to take it a step further display animations based on how much health is left on each hit box. You could then have a real low value on the head for head shots, torso would be higher and legs. Headshot would then have a straight death sequence, torso a damage hit sequence, leg shot, a limp or falling to the ground then getting up sequence - that sort of thing.
     
    Blackghost likes this.
  28. Cal2

    Cal2

    Joined:
    Jun 2, 2014
    Posts:
    11
    I had planned on being able to make small modifications to the code as needed, but I see no comments in the code. Will there be an update in the future to add comments to the code? This would help me a lot, even if the comments aren't super detailed, just enough to scroll through it to find the area that needs to be changed.
     
  29. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    111
    It would also be great if retreating enemies could call for backup and recruit allies to return and search/hunt for the player and npc allies. As a side note, it would be nice to set up an option to allow for specific tagged enemies to be able to search for specific tagged game objects/npcs/players. Would be cool for search and destroy based games as well as hunt and capture type gameplay. The script can have an option in the settings, to be time based.
     
  30. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    @julianr
    - Ok, I will add a retreat destination anim which plays once when AI arrives.
    - Currently you can substitute the capsule collider with a box or other, for example if you have an animal then a box collider will fit better than the capsule, so delete it and put a box instead, no problem with that! Multiple colliders; like one for the head, and another for the body seems a good idea to me :)

    @Blackghost
    You mean AI alert its companions when it arrives its retreat destination which could be far from the battle area, so other idling enemies there will be alerted, ok for that why not :)

    @Cal2
    In the future I can start by adding headline comments for the core parts of the code! Then with time I can add more detailed ones!

    Cheers
     
    Blackghost likes this.
  31. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Zozo - thanks! It will certainly make it more useful and dynamic when it comes to melee, and ranged weapons for all types of gameplay. Going back to pick up a health item with an animation at the end will make things more realistic, plus I have a few ideas on what it can be used for.. not just health.
     
    Last edited: Jul 30, 2014
    Blackghost likes this.
  32. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    111
    @zozo- Thank you kind sir! Your package is truly taking shape into an expansively creative piece. Myself and many others will truly enjoy this.
     
  33. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    111
    Good request. I have a few ideas myself with this feature
     
    julianr likes this.
  34. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @zozo - Making modifications to your pack is great, except when having to update each time then migrate changes over. Have you thought about a more modular way of adding custom scripts without breaking what you have? For example.. on attacking you could add an option to define one custom script per action, such as attacking... if script exists run attack as usual but also include the extra custom script to run with the option to run before the default attack or after. So you could have a melee attack on the player, run the custom script to display special effects before or after the attack, or even to spawn more enemies. Same could be useful for other actions like AI Death, spawn more enemies, these would be more advanced options with custom scripts which the player could add, or you could add some example scripts that the end user could use, and other users of this pack could contribute to a library if they wish.
     
  35. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    111
    Hey Zozo, Can you add an option for enemies to recruit neutral npcs and player allies? I guess certain enemies can be tagged to search for npcs/allies to "convert" into bad guys. This would make it possible to create zombie like games. This option isnt a part of the enemy retreat script. It would be a separate selection box.
     
    Last edited: Jul 31, 2014
    julianr likes this.
  36. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @Blackghost - that sounds like a good idea. Currently you have NPC to Enemy if you attack it.. NPC to follow you as a Companion, but I'm not sure they attack other players like a recruit/team mate would.
     
  37. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Here's a low res video of my project so far using Advanced AI Pro

     
    kurotatsu, Zozo2099 and Blackghost like this.
  38. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    111
    Cool. Good Start
     
  39. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi to all;

    I've just submitted the new update to the asset store, hopefully it will become online soon :)

    @julianr
    I liked your video, good level design and nice characters.

    Thanks to all for your ideas!

    Cheers
     
    Blackghost likes this.
  40. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    111
    Thank you Sir.
     
  41. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @zozo - thanks for the update, appreciate all the work you put into your pack!

    I'll post another video soon once I have finished all of the zombie models.
     
  42. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi

    Now it is possible for AI enemy to recruit NPC Aggressive (even if it is still neutral) when it is within the alert distance. I resubmitted the update this morning, so I think it will be online on Monday or Tuesday.

    Cheers
     
    Blackghost likes this.
  43. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    Hi Zozo, just wanted to check if there is any way of making the enemy freeze on command like an ignore or freeze mthod of some kind, a we have a time stop plugin that stops the sound and the animation of the enemy but Im not sure on how to go about on freezing the actual AI behaviour while still having the its health subtract while attacking it.
     
  44. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Hey Zozo.. when a zombie is attacking my player I get an echo on the detection sound effect as if its playing more than once. Any idea how to resolve this?

    Edit: reduced the detection volume right down, its not so loud now, not sure if its a fix, but it's not so loud when it starts to do multiple echo sounds.
     
    Last edited: Aug 2, 2014
  45. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi all;

    V6.0 is now available in the asset store.


    v6.0 Release Notes
    • Added "Can Reload" option, so it is possible for a ranged attack without reloading.
    • Improved the "Smart" AI behavior, if the initial patrol mode of AI is "In Place" and it gets hits from far, or hears the target, or alerted, then the patrol mode will be changed to "Dynamic Wandering" to search the destination area for the target.
    • Added "Retreat Arrival Anim", an optional animation to be played when AI arrives to its retreat destination (e.g. animate picking up a medkit).
    • When AI arrives to its retreat destination and can alert then it will alert (call for backup) its companions which are near the retreat destination area to go search for and attack the target.
    • Now AI Enemy can alert (recruits to its side) NPC Aggressive if available within its alert distance.
    @julianr I will investigate that echo issue for the detection sound.

    Cheers
     
    Blackghost and julianr like this.
  46. RealSoftGames

    RealSoftGames

    Joined:
    Jun 8, 2014
    Posts:
    220
    I have followed these instructions as accurate as possible and have redone this several times the only thing my Ai ( The Existing Ai that comes with Advanced Ai) only walks around and does nothing, doing this with UFPS and have followed the instructions accordingly and does not Attack the player. is there something im missing or doing wrong, so far none of the AI i have purchased seem to have worked at all. this one has at least hope as it actually moves around thus far.

    EDIT:

    Got it working slightly better now it seems to attack the player but its very glitchy when it does attack. Mele attacks fro ma distance, and you can trick it to never actually play the attack state nor actually do any damage.
     
    Last edited: Aug 14, 2014
  47. AlteredPlanets

    AlteredPlanets

    Joined:
    Aug 12, 2013
    Posts:
    455

    Any date when mecanim will be impplemented?
     
  48. RealSoftGames

    RealSoftGames

    Joined:
    Jun 8, 2014
    Posts:
    220
    Hi just a little problem i found when using UFPS and Advanced Ai, i find that when i shoot or att the enemy it stops chasing for a split second every time it gets hit. the problem is you can technically kite an entire army with a handgun or even a machine gun using this glitch which is no good at all =/ how would i be able to fix this issue if anyone knows of a way. i have tried reducing the Bullet prefab force to 0 and 1 thought that may have caused it but still no change. also changed the Ai Got Hit anim to nothing so it would continue the chase anim. as well as the got hit anim and got hit blend time to 0 still no luck, any suggestions for this?
     
  49. andrydeen

    andrydeen

    Joined:
    Aug 11, 2012
    Posts:
    37
    We add GotHitAnimationChance and we use value 0,1 - 0,5 , and now enemy doesnt play hit animation every time when got hit.
    public float GotHitAnimationChance = 1f;

    public bool CanPlayHitAnimation()
    {
    return (animations.gotHitAnim.Length != 0) && (Random.Range(0f, 1f) < GotHitAnimationChance);
    }
     
  50. andrydeen

    andrydeen

    Joined:
    Aug 11, 2012
    Posts:
    37
    And try to slightly increase the speed of the animation GotHitAnimation