Search Unity

[Released] Advanced AI Pro - AAA AI Solution -

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

  1. sowatnow

    sowatnow

    Joined:
    Jun 12, 2014
    Posts:
    309
    Hi Zozo

    Is there a way to make only bake a certain area/region?.
    I got a big terrain and baking it as a whole significantly kills the performance.

    How do I overcome this issue?
     
    Last edited: Jan 22, 2015
  2. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    This is not an issue with AI package, it is a navigation component issue. If you don't want your whole terrain to bake into navigation mesh, you should try to dissect it into little pieces or use meshes for navigational places.
     
    sowatnow likes this.
  3. sowatnow

    sowatnow

    Joined:
    Jun 12, 2014
    Posts:
    309
    I tried that, but still when two AI attacks the player, frame rate drops significantly. It is usually ok with one AI.
    I have no idea what is causing this issue. Even though i tested it in different scene with small meshes, issue still exists.
     
  4. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Try to uncheck "Can Alert" option for your two AI if you don't need it, it will improve the performance a bit.
     
    sowatnow likes this.
  5. sowatnow

    sowatnow

    Joined:
    Jun 12, 2014
    Posts:
    309
    Thank you, thank you. I was about to remove advanced ai from my project thinking that i wasted my money and time choosing this. However, by unchecking "Can Alert", my game performance has improved significantly from not playable to playable now. :)

    P.S is there a way to use alert still which uses less resources?
     
    Last edited: Jan 26, 2015
  6. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @sowatnow reducing your AI's GoIdle radius range will help improve on performance.. good for when you are using AI in contained areas, not so good for open areas as they will remain static until you go near them and sometimes if your idle min is set too high, they may skate.
     
    sowatnow likes this.
  7. sowatnow

    sowatnow

    Joined:
    Jun 12, 2014
    Posts:
    309
    Thanks for the tip, will try and see if it helps. Yes i did notice the AI remain static until I move (not go hear them).
     
  8. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    You could also put LOD on the AI so that they cull after going out of range. 1 full LOD and 1 Cull. Unfortunately Advanced AI Pro doesn't support more than one LOD. It stops the animations - not figured out why yet.
     
  9. JesterMaster

    JesterMaster

    Joined:
    Oct 29, 2014
    Posts:
    34
    Hi, Have you tryed to make low poly AI's and using them in LOD? I have this and three LOD levels.

    My new problem is that my AI's have total 3 different chasing animations: Walk, Run and Run fast.
    I need AI to random this animation and also give the correct speed for the chase. Running with walking speed does not look so good.

    UPDATE: I fixed this myself, so no need for help :)
     
    Last edited: Jan 30, 2015
  10. IntegraC

    IntegraC

    Joined:
    Jan 20, 2015
    Posts:
    16
    Pretty stumped on sending damage to the AI.

    I'm trying to deal melee damage to it, so what I did was added an empty trigger and wrote a script with OnTriggerEnter that sees if the other tag is the 'enemy' and then to deal damage as per the PDF but it's not working. I skimmed this thread and a lot of the advice is for ranged FPS type games, but even trying to apply that logic doesn't work.

    Not looking for code, just a better explanation as to what I'm supposed to do. Am I going about it the wrong way? I looked at the sample melee scene, and there are NO additional scripts on either the AI or the player, so where exactly am I editing the ability to damage the AI?

    Also, I notice now the AI bugs out in wandering mode. It walks around, but then when it gets in corners and other spaces where it's fairly tight it just gets stuck there and stops. I baked out the scene correctly, and I also went back in to tag obstacles. Is it picky about how much room it has between colliders?

    Thanks.
     
    Last edited: Jan 31, 2015
  11. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I had problems with this before, the additional LODs animations were not working when you go out of range. Might have been something to do with the scaling of the character, when animations needed to be done also. I'll give it another try though.
     
  12. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Are you using UFPS?
     
  13. IntegraC

    IntegraC

    Joined:
    Jan 20, 2015
    Posts:
    16
    No I am not making a FPS. I am simply trying to work on hand to hand combat. Using my own models, and movement scripts for the player. Enemy I was able to get to patrol and all that via the AI Pro, but I am stumped as to where to set the 'GotHit' line(s) of code to hurt the AI. I see him dealing damage to the player via the inspector health meter, so I know there's contact made on the flip side of the attack, now I just want to hurt the AI back via melee attacks not ranged.

    When I look at the sample scenes, I didn't see any custom scripts on the player character besides the default ones from the Unity character controller, and the enemy AI in the sample scene didn't have any other scripts either.

    Thanks.
     
  14. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Ok.. so you are doing a raycast to the AI, using hit detection on the AI's collider? Then getting a reply back for example;

    On your player script...
    Do punch animation, then call a hit. Making sure the AI has a tag name.

    Code (csharp):
    1.  
    2. if(hit.transform.tag == "AI") {
    3. // do damage to AI based on it tag name, so you could have different AI types with different damage levels.
    4. hit.collider.SendMessageUpwards("Damage", -1);
    5. }
    6.  
    In your AI inspector, make sure that the damage method name is set to "Damage"

    Untested, but might work
     
  15. IntegraC

    IntegraC

    Joined:
    Jan 20, 2015
    Posts:
    16
    Added that code to my attack script, and its throwing this error:

    "Object reference not set to an instance of an object" at the line starting with the if statement you suggested.

    Here's the code, without the if statement:

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class Attack : MonoBehaviour
    6. {
    7.     public Animator animator;
    8.     private RaycastHit hit;
    9.     private float dist;
    10.     private Vector3 direction;
    11.  
    12.     void Awake()
    13.     {
    14.         animator = GetComponentInChildren<Animator>();
    15.     }
    16.  
    17.     void Update()
    18.     {
    19.         dist = 1.0f;
    20.         direction = new Vector3(0, 0, 1);
    21.         Debug.DrawRay(transform.position, direction * dist, Color.white);
    22.  
    23.         if (Input.GetButtonDown ("Fire1"))
    24.         {
    25.             animator.SetTrigger("Attack");
    26.         }
    27.     }
    28. }
    29.  
    I added the if statement suggested in the Update() function right after the SetTrigger if the Fire1 button is hit.

    Also, I changed the damage method name to Damage, but now when the AI hits the player his health is no longer reduced, so I switched the damage method name back to SubtractHealth.

    Thanks.
     
  16. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Yes, sorry (Damage) is more aimed at the UFPS camera system. Happy to help you out via private message, then you can always post a solution here to avoid spamming the thread.
     
    IntegraC likes this.
  17. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    hi, i need help
    so im making survival game and i have models of sharks, whales and etc, so i wonna make that shark swim in dynamic way in "water" that can go out of water and when shark attack player and player go out of water shark go away
    so can you writte tutorial what i need to do for that :)
     
  18. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    can't go out of water*
     
  19. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Hi Zozo - can you take a look at this please. I think the projectile impact FX are not deleted after a player dies. Thanks
     
  20. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi

    There is a trick to do that, you need to add an invisible plane surface inside the water so it will be the swimming level of your shark/fish, set it to static then bake it, put the shark on it and it should working fine like that.
     
  21. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi

    I did not understand, do you mean the player or the AI? Normally Projectile Impact FX has its own script attached to the projectile gameobject so it is unrelated to AI.
     
    julianr likes this.
  22. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Ok, thats fine. Now I know I can sort that out.. I thought it was all handled in the AI side of things.
     
  23. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17

    i need to my shark go up on surface and down
     
  24. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    game is like trying to find food on land and under sea but sea is big and im trying to make that shark go on surface and can go down to botton chasing the player
     
  25. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    So you need another trick, shape your own customized surface using planes, attach them then bake them, by example a horizontal plane for the underwater attached to a diagonal sloping surface which goes up, AI will follow that way.
     
  26. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    i cant understand im new in unity and my english is second language.
    can you show or picture that
     
  27. WaqarKhan703

    WaqarKhan703

    Joined:
    Sep 9, 2013
    Posts:
    7
    Hi Zozo,

    I'm having an issue with NPC aggresive. I'm using UFPS 1.4.8 with mobile add on.
    I've followed your guide of UFPS and set up my project as instructed. The problem I'm facing is that once I shoot the enemy my got hit animation is played and carries on playing in a loop. While I expect that after finishing animation it should attack the player. Please help me solve this.
     
  28. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @WaqarKhan703 - is your gothit animation set to once or loop? Should be set to once
     
    WaqarKhan703 likes this.
  29. WaqarKhan703

    WaqarKhan703

    Joined:
    Sep 9, 2013
    Posts:
    7
    @julianr Thanks for the help. It worked :)
     
    julianr likes this.
  30. jag9980

    jag9980

    Joined:
    Jul 10, 2013
    Posts:
    4
    hey.. just purchased this asset.. but i cant get it to work.
    i ve done everything in the video.. baked my level then i even used one of the prefabs of dummy. they stay idle. Never move.. niether in waypoint or free roam

    could u tell me where have i gone wrong?
     
  31. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello

    Are you sure that you assigned the layer of your player (target) in the AI inspector (Layers section)? And be sure that this layer is unique and only used by the player target (not the Default layer)

    Also your player target must have a collider attached to it, any type no matters.

    Also don't forget to tag your target player as "Player".
     
  32. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    Hi I just noticed that my version of Advanced AI Pro (6.1) causes the following warning in Unity 4.6.2:

    Assets/Advanced AI/Scripts/AdvancedAiNpcAggressive.cs(251,18): warning CS0414: The private field `AdvancedAiNpcAggressive.rangedAttacksSwitch' is assigned but its value is never used

    Is there anyway to fix this warning without upgrading my Advanced AI Pro as I am quite comfortable with my current version as it is serving me well and running very stablke and reliable (Ive also made some of my own modifications to some of the code already as well).

    If I need to update in order to fix it I understand (unless the new update adds even more warnings), I just wanted to confirm on what would be the best way to solve this warning?
     
  33. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    I also seem to be getting the following error while playing the game in editor:

    "Stop" can only be called on an active agent that has been placed on a NavMesh.
    UnityEngine.NavMeshAgent:Stop(Boolean)
    AdvancedAiEnemy:GoDeath() (at Assets/Advanced AI/Scripts/AdvancedAiEnemy.cs:1565)
    AdvancedAiEnemy:Update() (at Assets/Advanced AI/Scripts/AdvancedAiEnemy.cs:934)

    Again any help would be immensely appreciated.
     
  34. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello

    Send me your AdvancedAiEnemy.cs script file via email, I will fix it for you.

    Cheers
     
  35. Nhak

    Nhak

    Joined:
    Feb 15, 2015
    Posts:
    1
    Hi, Zozo

    Bought the asset, scoured the tutorials, forums and manual, have all my layers assigned right,
    but I just can't get a simple melee to melee AI fight to go right when there are more than two combatants, and even then I cannot get the winner of the fight to attack its nearby enemies. I have a setup with three guardian AI VS 3 Enemy AI's.

    Most of the time they get stuck running into place when they get near the fight, even though they aren't colliding with anything. The guardians kill one Enemy, then they stand around while the enemies hit them. No matter what I do I cannot replicate the behavior of the demo scenes.

    Are there restrictions on manipulating the colliders bestowed on the character by the AI Script?
    Or restrictions on copying and pasting an AI Guardian or Enemy?



    Any help with this would be appreciated.
     
  36. TheTwisted

    TheTwisted

    Joined:
    Sep 27, 2014
    Posts:
    3
    Hey there, I love the A.I. but I am having just one small problem with it. You see, everything else works great except when the enemy attacks the player, that's when it gives me this error:


    IndexOutOfRangeException: Array index is out of range.
    AdvancedAiEnemy+<MeleeDelay>c__Iterator4.MoveNext () (at Assets/Advanced AI/Scripts/AdvancedAiEnemy.cs:1716)

    I'm using UFPS and the latest version of Unity and the A.I. I'm not the best programmer so I was hoping someone could help me out. Thanks a bunch.
     
  37. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Do you have the two AI on different Layers? eg. AI1 and AI2.

     
  38. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    It might be that you have an animation missing on the melee, or you need to regenerate your Nav Mesh with some different settings?

     
  39. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello

    You have to set a value for the melee "Damage Amount" parameter, set the size to 1 (if you have one melee animation) and then enter your desired amount value.
     
    julianr likes this.
  40. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    What are the best settings for the NavMesh (Step Height, Height etc.) for the AI.

    Im having some navigation problems with my enemies, also all my enemies seem to bug out on animations, their chasing animations seem to play extremely fast and jittery (especially when more than one enemy is present) I dont know if this could be related to the NavMesh somehow but Ive tried everything (setting the animation speed, blending time, settng different navigation properties).

    Please get back to me ASAP, Im trying to get my enemies sorted out, but the AI is just eating up more and more of my time.

    Thanks in advance for any and all help.
     
  41. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Anyone tested this with Unity 5 release yet?
     
  42. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @XMachinaX
    Try these settings, I worked on them for ages to get it right.. under bake..

    Radius 0.5
    Height 1
    Max slope 25.3
    Step height 0.7
    Drop Height 3
    Jump Distance 0

    Advaced drop down....

    Min region area 1
    Width Innaccuracy 17.2
    Height Innacuracy 5.5
    Height Mesh ticked
     
  43. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    Upgraded to unity5 yesterday got some compile errors, but that was expected because of the new API. Has the developer any spesific plans for the future ?
     
    julianr likes this.
  44. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    I will fix all Unity 5 issues and release an update very soon :)
     
  45. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    Thanks so much for the advice @julianr, will give it a try as soon as I jump back to AI/Navigation again. I think my Height and my Step height is definietly off then, cause my Height is currently on 5 and my Step height is on 3 so I think those are the main culprits.

    My Main worry is in ticking Height Mesh as whenever I try to create Height Mesh data in my NavMesh my project crash and becomes corrupt, but I have optimisez and cleaned up my project/scene a lot since the last time I tried baking Height Mesh data so I think I will try it again.

    Im actually wondering how complicated are youre scenes/projects when you bake with these settings as my project/scene is quite big and complicated.
     
  46. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @XMachinaX - my scenes and projects are huge, with 2 level buildings and interiors. So it should be ok
     
  47. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello

    I have just submitted the new Unity 5 Ready update v6.8

    Stay tuned
     
    Lupus_Solus, julianr and fredr92 like this.
  48. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello

    The new update is available on the asset store, full support for Unity 5.

    Enjoy
     
    julianr likes this.
  49. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    Hi;
    When I upgraded to Unity 5, only warnings I had for Advanced AI was about the navmesh agent, which required Stop(bool) to be only Stop() without any parameters (well, it was what it should have been from start). I changed them to that and all warnings disappeared.
    Are those only ones you changed in this update? Or did you change something else too? I have no internet access at home and at work I cannot install Unity to access Asset Store so I am not able to update for a while. I will appreciate if you can confirm this.

    Thanks.
     
  50. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello

    As you said I only fixed those warnings + another warning from NPC Aggressive script, so normally you should be ok :)

    Cheers