Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

[RELEASED] Emerald AI 3.2 (New Sound Detection) - The Ultimate Universal AAA Quality AI Solution

Discussion in 'Assets and Asset Store' started by BHS, Jun 26, 2015.

  1. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    You may need to increase their Stopping Distance (located within the Movement tab). It sounds like they can't reach their generated destination.
     
    khushalkhan likes this.
  2. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    Would you mind posting your scripts? I'm having issues integrating it.
     
  3. timerace

    timerace

    Joined:
    Feb 27, 2019
    Posts:
    27
    @BHS hello, Is there anyway to make the ai stunned for a while?
     
  4. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    @BHS What is the correct way of making something like a dragon's tail attack that deals damage behind them? Should I be using an ability instead of a normal melee attack?
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I will be adding support for this with the next version of Emerald AI, but for now, you can add a custom animation state the the AI's Animator Controller that can transition and exit from any other state.

    StunnedState.png

    Next, create a Stunned Trigger and Stunned Active Bool parameter:
    StunnedParameters.png

    Have the following transitions:
    AnyState to Stunned
    AnyStateToStunned.png

    Stunned to Exit
    StunnedToExit.png

    You would need to call this manually when needed. The below will toggle the Stunned state, but you could also have this be functions like Stun and Unstun.
    Code (CSharp):
    1. EmeraldComponent.AIAnimator.SetBool("Stunned Active", !EmeraldComponent.AIAnimator.GetBool("Stunned Active"));
    2. EmeraldComponent.AIAnimator.SetTrigger("Stunned");
    3. EmeraldComponent.m_NavMeshAgent.enabled = !EmeraldComponent.m_NavMeshAgent.enabled;
    Keep in mind that the Animator Controller will lose these changes if it's completely regenerated.
     
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Once the next version of Emerald AI is released, this will be a lot easier. For now, you can try the following:

    Use a collider on the tail that's enabled and disabled through an Animation Event when the attack is triggered. Using something like the example below, you can damage an AI when a collision happens and use the current ability object's data (which could be something like tail attack).

    Code (CSharp):
    1. private void OnCollisionEnter(Collision collision)
    2. {
    3.    if (collision.gameObject.GetComponent<EmeraldAISystem>() != null)
    4.    {
    5.       var EmeraldComponent = collision.gameObject.GetComponent<EmeraldAISystem>();
    6.       EmeraldComponent.Damage(EmeraldComponent.m_EmeraldAIAbility.AbilityDamage, EmeraldAI.EmeraldAISystem.TargetType.AI, transform, 300);
    7.    }
    8. }
     
    iChuy likes this.
  7. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Wow! You are building this up update! Can't wait to see what is supposed to be in it! Are you doing some type of FSM or BT?
     
    Last edited: Jan 12, 2023
    iChuy likes this.
  8. Erlend1

    Erlend1

    Joined:
    Dec 18, 2019
    Posts:
    22
    Hello, just began to test out Emerald AI - it's slightly overwhelming, but the documentation and tooltips for what to do next helps a lot. Currently, I'm just setting up a deer on wandering behavior and its "center of gravity" doesn't align well with the terrain. I would appreciate some advice on how to make it more realistic (standing and walking on the ground)?
    em-deer-standing-partly-in-midair-idle.jpg em-deer-walking-partly-in-midair.jpg

    The deer has a long box collider, which I suspect is part of the reason to it. Is there a way to make the deer tilt slightly downwards/upwards when it's moving on even ground - or what would you recommend?
    em-deer-box-collider.jpg
     
  9. Erlend1

    Erlend1

    Joined:
    Dec 18, 2019
    Posts:
    22
    Update: So I've kept looking and found the "Alignment Settings", which is a good start. Just wondering, what's the performance cost of having it enabled? For instance, if I have 100 AIs or even a 1000 simultaneously.

    Another thing: What's the setting for determining how often to update the 'destination' of a fleeing AI? I tested it with another deer where I outran it, and it kept running straight for a few seconds before detecting that I (the player) was in front of it to then proceed to run the other way.
     
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there,

    Yes, the Align AI feature will align your AI to slopes and surfaces. This is calculated from the center point of your AI. Your AI is hovering because of the NavMesh. You can adjust this by going to the AI's Settings>NavMesh tab and setting the Agent Base Offset to a negative value (most likely something between -0.05 and -0.25). This will make the AI lower to the ground. With quadruped AI, it's a little trickier to get their alignment perfectly, especially with drastic slopes. This can be fully resolved by using inverse kinematics on the feet and legs, which isn't including with Emerald AI, but will be with the upcoming version. The alignment feature is pretty performant and you can adjust how often it's updated with the Alignment Quality.

    The detection is updated based on the Detection Frequency (located within the Detection Options tab). If you want your AI to react faster, you can decrease this value. By default, it is set to 1, which means it takes 1 second for an AI to detect a target and react according to its Behavior Type.
     
    Erlend1 likes this.
  11. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    I'm trying to use Final IK with EAI, how do I prevent these abrupt changes in position? You can see how it looks worse if I turn off IK.

     
  12. Erlend1

    Erlend1

    Joined:
    Dec 18, 2019
    Posts:
    22
    Thanks, I'll try that. Yes, I understand it's harder to align animals like deers and horses that stand on four feet to the terrain. So is the current, best solution only to tweak the Alignment Settings for these animals?

    By the way, for the issue with fleeing, I think the deer is, regardless of my position, running a set distance, the Flee Range, before changing direction. It's a bit difficult to track, but that's the feeling I got when setting the Flee Range from 30 to 23 (minimum). Is there a way to reduce the flee range below 23? Or otherwise make it change destination a bit more frequent. Updating the Detection Frequency didn't make a difference.
    em-deer-fleeing-but-hasnt-updated-direction.jpg
     
  13. micuccio

    micuccio

    Joined:
    Jan 26, 2014
    Posts:
    143
    Apologies to ask it again:
    @BHS : is there planned an integration with RPG Builder? It would be great.
    no issue to pay for it.

    Best regards,

    Dom
     
  14. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    RPG Builder already has an AI builder with it?
     
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    My guess is that the deer is not detecting the proper object of your player, which is why things seem off. Enable the Debugging Tools and ensure that the deer is getting the right object of your player and that there’s no obstructions.
     
  16. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    You need to have a separate plane for the stair's slope that's baked with NavMesh. Once the NavMesh is baked, you can disable the plane. This allows the NavMesh to have a smooth transitions between each step while also having Final IK position correctly.

    Position the plane and rotate it so it matches the stairs:
    NavMeshStep1.png

    Once it's done baking, disable it so that Final IK won't detect it when positioning the feet/legs for its IK.
    NavMeshStep2.png
     
    Setmaster likes this.
  17. Nikodemus

    Nikodemus

    Joined:
    Nov 28, 2014
    Posts:
    32
    Any update on releaste date?
     
  18. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    He said a few months @BHS. Any chance it has some type of cover system for shooters or more realistic shooter type AIs?
     
  19. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    177
    @BHS emerald should have an option for target transform or tag in wonder type variable, destination wonder type is useless target transform would be helpful for aggressive ai to track player easily
     
  20. trblst

    trblst

    Joined:
    Feb 18, 2015
    Posts:
    14
    Sounds like dodging and stun is being implemented in the next patch? I'll be sure to buy this when it comes out! For the meantime I'll look into some other AI solutions. Keep up the great work!

    Also, is there any reason there's a limitation on number of attack animations that can be used? It says only 6 is supported. This makes things a bit limited if the AI is both ranged/melee.
     
    Last edited: Jan 22, 2023
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    A cover system is something that's on the roadmap for the next update, but it most likely won't be available at the release of it.
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks for the suggestion. I will look into making this kind of functionality easier to access.

    You can do this now by assigning your player to the AI's StartingDestination variable. This will allow it to generate waypoints around the YourPlayerTransform within the AI's Dynamic Wander Radius.

    Code (CSharp):
    1. void Start ()
    2. {
    3.    EmeraldAISystem EmeraldComponent = GetComponent<EmeraldAISystem>();
    4. }
    5.  
    6. void Update ()
    7. {
    8.    EmeraldComponent.StartingDestination = YourPlayerTransform.position;
    9. }
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, dodging and stun are panned for the next update.

    As for the attack animations, there’s 6 for ranged and 6 melee weapon types so there’s a total of 12. An AI can also have as many attacks as needed by being able to use the same attack animation for different attacks (mage attack 1 animation could shoot both a fire projectile and an ice project spell). However, this is all getting a massive improvement with the next version, which I will explain everything more in-depth when it’s closer to its release.
     
  24. BaoBao55

    BaoBao55

    Joined:
    Apr 8, 2016
    Posts:
    13
    Can I use the AI with the object like a tank to damage and get damaged? It has no animation.
     
  25. trblst

    trblst

    Joined:
    Feb 18, 2015
    Posts:
    14
    Thanks for clarifying @BHS! Is your roadmap public or private? I'd love to see what's in store for the future.
    Also, is it possible to have more than one droppable weapon? The droppable weapon field only allows one input and I'd like the AI to drop the weapon and the shield (I can make this change myself I just thought other people might like it too).
     
    Last edited: Jan 25, 2023
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    No, an AI requires animations and an Animator Controller to function. You could try using blank animations though.
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Currently, the roadmap is private (done through Trello). Once I’m closer to release, I will make it public. I have some really unique features and extensions that I’m working on and I’d like to keep them under wraps for now. I’m looking forward to sharing everything though.

    I like the idea of having multiple droppable weapon slots for a weapon type. I already rewrote the droppable weapon code so it’d be easy to add these changes.
     
    imedinaisaias likes this.
  28. maximmolek785439

    maximmolek785439

    Joined:
    Sep 19, 2020
    Posts:
    89
    hello, I need help, I also wrote an email but no one answered me, so I am writing, how can I make a block ai and where can I set it (do I have to add some event to the animation or not? couldn't find documentation about this anywhere
     
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, it was a weekend and it's been less than 24 hours :)

    You can enable blocking through these tabs. The blocking settings will become visible once it's enabled.
    EnableBlocking.png

    After this, you must add a blocking loop and blocking impact animation.
    EnableBlocking2.png
     
  30. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Yall best wait in line. Will needs to kick out massive updates for me projects.
     
    imedinaisaias likes this.
  31. Nikodemus

    Nikodemus

    Joined:
    Nov 28, 2014
    Posts:
    32
    Are u going to enable cleave attack? So AI can damage multiple enemies at the same time.
     
  32. Loki18000

    Loki18000

    Joined:
    Apr 1, 2015
    Posts:
    75
    Getting a huge amount of lag on the Oculus Quest 2 with only 5 or so AI. Runs fine without the asset though.
     
    Last edited: Jan 31, 2023
  33. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, but you can do this now by using collision based damage (on your AI's weapon) instead of an EmeraldAttackEvent. See the DamageAIByCollision for an example on damaging an AI with collisions.
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Emerald AI is pretty optimized. When you say it runs fine without the asset, are you removing the animated models within the scene? Have you tried testing this with just the animated models without Emerald AI's components on them? Are you receiving any errors?
     
  35. bdsmithproductions

    bdsmithproductions

    Joined:
    Dec 19, 2019
    Posts:
    2
    Heyo!

    First off, just bought the asset and already am deeply in love with it. I do however have an issue. I was following the tutorial about Invector integration. My player is now able to kill the enemy 100% fine. However, the enemy is unable to damage the player. Any time the enemy attacks, the damage numbers appear around the player however, his health bar, and health tab in inspector stay at 100% health. Not sure what's going on there.

    Unity 2021.3.16f
    Emerald AI 3.0
    Invector Melee (only)

    upload_2023-2-2_14-47-46.png
     
  36. bdsmithproductions

    bdsmithproductions

    Joined:
    Dec 19, 2019
    Posts:
    2
    Scracth that I was watching the video but I see on code snippet page, this part at the bottom

    DamageInvectorPlayer(int DamageAmount, Transform Target) function

    I enabled and we are good to go! 1000% satisfied
     
  37. adifrank

    adifrank

    Joined:
    Dec 11, 2017
    Posts:
    26
    Can I create AI with dual weapons?
     
  38. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Not
    Yes.
     
  39. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
    Any news about adding Knockback to Emerald AI?
     
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, it's been added to the roadmap for the next big update.
     
  41. kelly_unity282

    kelly_unity282

    Joined:
    Nov 10, 2022
    Posts:
    5
    Hello, I want to ask if Emerald AI can be applied on models having LODs? When I added the AI to the parent of the model, only the first layer of the LODs can be animated but not the other layers. So when I move further away, the model is not animated. Is there a solution for this? Thank you!

    I added AI to the parent male_suite1_LOD
    male_suite_LOD.png

    The lod0 is animated
    male_suite_LOD0.png

    But lod1 is not animated
    male_suite_LOD1.png
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, if you are using the optimization feature, which it sounds like you are, you need to enable Has Multiple LODs. You can also press the Auto Grab LODs for Emerald AI to attempt to grab all of them automatically.

    OptimizeWithLODs.png
     
  43. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Roadmap when?
     
  44. kelly_unity282

    kelly_unity282

    Joined:
    Nov 10, 2022
    Posts:
    5
    Thank you for your reply, but it did not work even I did it in a new project. Can I send my project to the team or raise a issue? Thank you!
     
    Last edited: Feb 13, 2023
  45. artbyter

    artbyter

    Joined:
    May 8, 2017
    Posts:
    3
    I wonder if Emerald can be used with non-animator approaches as Animancer? All AI solutions I've seen have very tight link with animators
     
    Willbkool_FPCS likes this.
  46. trblst

    trblst

    Joined:
    Feb 18, 2015
    Posts:
    14
    Are ability cooldowns (as opposed to random/order based) going to be part of the next update?
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, I got your email. I will be able to take a look at your project first thing in Monday.
     
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Emerald AI is dependent on the Animator because it’s Unity’s built-in solution for animations, and available for everyone. Using another tool, like Animancer, would require a dependency and completely different code.
     
  49. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, it’s officially on the roadmap. I’m still trying to figure out how to integrate this with stats. I will probably end up combining both cooldowns and stats. I do still think an option for order based attacks is important for users who want recognizable boss-like attack patterns.
     
    trblst likes this.
  50. artbyter

    artbyter

    Joined:
    May 8, 2017
    Posts:
    3
    Completely understandable. But is it feasible for users to make a bridge to Emerald from low level Playables used by Animancer and how difficult it can be?
     
    Willbkool_FPCS likes this.