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] 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,760
    Yes, Override Controllers are the only way to assign animations at runtime. The Animator Controller tree uses blank animations as a reference and the Override Controller assigns them when needed.


    1) Use Line of Sight detection type and set the expanded detection radius to a high value. This will allow the AI to expand its detection radius when it gets hit and there is no nearby target.
    2) An AI's collider is disabled automatically when the AI dies.


    I'm working on adding additional features after the 2.2 update. I can certainly look into adding a cover system.
     
    Mark_01 and SickaGames1 like this.
  2. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    That along with advanced AI attack system :)
     
  3. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    239
    1.Can sound set 3D?

    2.How to let AI attack building?

    3.When using the waypoint system, ai kills another ai and then moves through the other's body to continue moving forward. This looks very unreal. Is there a way to let it bypass the dead ai?
     
    Last edited: Oct 15, 2018
  4. UserNotHere

    UserNotHere

    Joined:
    Jan 22, 2018
    Posts:
    9
    Is there a guide for working out First Person Controller/UCC and Emerald AI?
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    A more advanced attack system is coming with version 2.2. I've made a new video and I will explain in my status update post I will be posting within the next few hours. :)


    1) I'm not sure what you mean with this question.
    2) An AI can attack a building by using a Non-AI tag. You can customize the code within the Damage function. However, I will be adding an event for this with the 2.2 update.
    3) This is because all components are disabled when an AI dies. If you want an AI to avoid the dead AI, create an On Death event to add a NavMesh Obstacle on death to the dead AI.


    Yes, @magique was nice enough to create one which can be found here: https://www.dropbox.com/s/yr7pbclgl4tf5h2/Opsive_V2_EmeraldAI_Intgration.pdf?dl=0


    Thanks for making a guide to add support to UCC until I have time to make one.
     
    Last edited: Oct 16, 2018
    SickaGames1 likes this.
  6. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Thanks! The fact you added this to 2.2 has me super pumped!
     
    BHS likes this.
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Hey everyone,

    I was going to do my status update on version 2.2, but YouTube is down so I won't be able to show off what I've been working on. I will do the status update tomorrow. :)
     
    SickaGames1 and ftejada like this.
  8. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Have this problem too, i am on Windows 10 and Unity2018.2.12f1.
     
  9. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Strange, I haven't been able to recreate it. I've even tried using that exact version of Unity. Is there anything you did directly that caused the issue to appear?
     
  10. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    I am on that version and it works well for me... Can't wait for your video!
     
  11. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Have not done anything special. Only imported Emerald AI fom asset store and created an AI. I had this problem with some other assets from the store too, but the authors has fixed them somehow.
     
    C_p_H likes this.
  12. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Are you using a crapple as well?
     
  13. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
  14. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi Sir, Thank you for such amazing systems, truly have made my game possible.

    I have a problem with Crux I think as it places my Wildlife AI. I keep getting not close enough to navmesh errors. I'm wondering if you have or anyone else has encountered this and if you have a cool solution :D

    I made a script that OnEnable and OnStart will check if is on NavMesh and if not it should move the AI to the nearest position with NavMesh.

    Code (CSharp):
    1. protected float m_MaxDistance = 500f;
    2.     public float MaxDistance
    3.     {
    4.         get { return m_MaxDistance; }
    5.         set { m_MaxDistance = value; }
    6.     }
    7.     protected int m_AreaMask = 1;
    8.     public int AreaMask
    9.     {
    10.         get { return m_AreaMask; }
    11.         set { m_AreaMask = value; }
    12.     }
    13.  
    14.  
    15.     void Start ()
    16.     {
    17.         DoCheck ();
    18.     }
    19.  
    20.     void OnEnable ()
    21.     {
    22.         DoCheck ();
    23.     }
    24.  
    25.     public void DoCheck ()
    26.     {
    27.         NavMeshHit closestHit;
    28.         if (NavMesh.SamplePosition (transform.position, out closestHit, MaxDistance, AreaMask)) {
    29.  
    30.             gameObject.transform.position = closestHit.position;
    31.         } else {
    32.  
    33.             Debug.LogError (Time.time + " Could not find position on NavMesh! " + gameObject.name + ", " + gameObject.transform.position.ToString());
    34.         }
    35.     }
    but still I'm getting errors :/. I know its not related to Emerald at all but thinking someone can help :D

    Thanks
    Jim
     
  15. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    llJIMBOBll likes this.
  16. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Interesting, I will try to have it fixed by the time Emerald 2.2 is released.


    Hey there!

    Great to hear Emerald AI and Crux have helped your game.

    I will work on trying to create a solution for this for Crux 1.2. When I get the time, I will look into this to see if I can provide a temporary solution for you.
     
  18. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Video?
     
    BHS and ftejada like this.
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Hey everyone,

    The 2.2 update has been taking longer than expected. This is largely due to the Animator Controller having to be completely redone along with quite a few portions of the main Emerald AI script. Below I will discuss things more in-depth, but to sum it up quickly, the 2.2 update will allow for much smoother animation blending, Root Motion support, more animations for all states, improved fighting mechanics, smoother and more realistic combat, AI blocking, built-in head look control, and tons more. To reassure users who want an awesome animal AI system, Emerald AI 2.2 will allow for animal AI to move and function more realistically than previously. I'm hoping to have version 2.2 finished up within the next 3 to 4 weeks and it will be a free update.

    It's worth noting that all humanoid animations used in the videos below are Mixamo's free animations. :)

    Root Motion Support
    Version 2.2's new Animator Controller uses Blend Trees for super smooth animation blending. This allows AI to seamlessly transition between idling, walking, running, and turning. Emerald AI 2.2 will allow for there to be 2 Blend Trees, one for Non-Combat (idle, walking, turning, and running animations) and one for Combat (idle, walking, turning, and running animations) with the ability to have an AI use a pullout weapon and put away weapon animation. Animation Events can be used to enable or disable an AI's weapon.



    Improved Combat Mechanics, Animation Events, AI Blocking, and Bug Fixes
    The new Animator Controller and Root Motion support allows an AI's movement to be driven by their animations. This makes it possible for AI to have running attacks, staggering hits, and proper foot motion during animations.

    Support for Animation Events allows for an AI's attacks to always perfectly match the exact frame of impact regardless of the animation's speed. This also allows AI to use combo animations where multiple swings are used. Depending on feedback, the old "time based" method may be removed. However, I feel like it is an easy way for beginner users implement attacks to their AI's animations so I'm unsure at the moment.

    AI have also been given the ability to block incoming attacks. This feature has been heavily requested and I felt was important to add to the 2.2 update. The amount of mitigated damage from blocking can be controlled through the Emerald Editor as well as the blocking sounds.

    The way an AI moves if a target is too close has also been changed. AI now have a separate state for backing up that can be customized. When an AI reaches its backing up destination, it will determine if it's viable to do a running attack. The way an AI triggers a run attack has been fixed and should now be consistent. The issue that allowed players to continuously backup while avoiding a running attack has also been fixed.



    Ragdoll Deaths
    Another heavily requested feature has been added to 2.2 and this is ragdoll deaths. All users have to do is use Unity's built-in ragdoll system to create their ragdolls for their characters and Emerald AI will efficiently disable and enabled the components when needed. An AI can seamlessly transition to its ragdoll while in its current animation. This feature also makes it possible for AI to die from traps or falling/rolling objects while transitioning to its ragdoll on death.




    Built-In Head Look Controller
    The Head Look Controller will allow humanoid AI the option to look at their targets or a nearby player. This feature is usable during combat and is also usable while the AI is wandering or walking to a destination similar to what's done in The Elder Scrolls series. The weight and intensity of the head look feature can controlled and is a completely optional feature. It is currently only usable by the Humanoid Animation Type.

     
    Last edited: Oct 18, 2018
  20. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Very nice. I love the new update a lot. Looking really good.
     
    llJIMBOBll and BHS like this.
  21. hoodoo

    hoodoo

    Joined:
    Oct 19, 2012
    Posts:
    154
    Can't wait to get the new update! Great stuff!
     
    llJIMBOBll and BHS like this.
  22. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Great work! Can't wait for 2.3 as well. I think with the great work you have already done with 2.2 along with 2.3 (Modular Attack System) you may start getting a lot of the disappointed ICE people over here. You have a HUGE opportunity to get Emerald to be THE top AI.
     
    Last edited: Oct 18, 2018
    radiantboy and llJIMBOBll like this.
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Thanks! That's the plan :)
     
  24. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    The newest Unity release (Unity2018.2.13f1) fixed it for me. :)
     
  25. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Awesome! You can disregard my Crux requests and proceeds to 2.3 ;)
     
    llJIMBOBll and BHS like this.
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Thanks for that information. Maybe an update to the newest version is all that's needed.
     
  27. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    239
    1.When the Emerald AI attacks the building, it attacks the center point of model, which often causes the AI to pass through the model. Is there any way for the AI to attack the Collider of the building instead of the center point?

    2.My Emeral_AI is so big that it can't attack the floor on the ground unless I lift the floor up. Is there a way to optimize?

    3.I want to change the AttackDistance attribute when Emerald_AI finds the Non_AI target and when AI dead it return to default value. Where should I add this logic in the Emerald_AI script?
     
    Last edited: Oct 22, 2018
  28. BryanO

    BryanO

    Joined:
    Jan 8, 2014
    Posts:
    186
    What would be required to integrate into UMMORPG?
     
  29. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    153
    @BHS
    Upgraded to macOS Unity 2018.2.13f1, but there's an issue with the title text word wrapping & logo centering. I've uploaded two youtube(unlisted) recordings for your review. No console errors appeared for E_Ai2 when I checked after my recordings:confused: so I'm stumped on what its cause could be.

    Light mode

    Dark mode
     
  30. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Hiya,

    I have some worker AI, and using the emote animation I can get the AI to play their "work" animation, ie chopping wood etc. when they reach a destination, but it will only play the animation once even though I have it set to loop.

    Wondered if it would be possible to have an emote animation play as a loop until say another destination is set or the AI wandertype is set to something different.

    As part of the process, in the ReachedDestination Event, I set the AI.WanderTypeRef to Stationary, but the AI just walk around in a tight circle, around the destination transform, any ideas?
     
    Last edited: Oct 22, 2018
  31. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    I'm having an issue with the tab stretching and not showing the menu properly. anyone find a solution to that its quite irritating and certainly slows down your work.
     
    Last edited: Oct 22, 2018
  32. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Hi @BHS is there a separate document showing how to apply attack damage? There is only a brief mention in the docs and no detail of how to apply damage to a player or another ai or non emerald AI. Apologies if i've missed it but please point me in the right direction.
     
  33. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    These integration docs should help. Although they are for various third party controllers, the concepts should help you translate them to work with any asset.

    https://docs.google.com/document/d/1QGSEdc2-6bks22KIelYlBw_601uHce2BVLM3QTq5axg/edit#!
     
    AndyNeoman and StevenPicard like this.
  34. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    573
    when will the version 2.2 will be released
     
  35. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    He said in about 3-4 weeks.
     
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    1) The best solution for this would be to expand the Attack Distance like you suggested with question 3, which I will provide an example.
    2) Increasing the Attack Distance should fix this, which will also be covered below.
    3) See if the script below helps. Just attach it to the AI that need to have their Attack Distance controlled.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class ChangeAttackDistance : MonoBehaviour {
    6.  
    7.     public int NonAITargetAttackDistance = 10;
    8.     public int DefaultAttackDistance = 5;
    9.     Emerald_AI EmeraldSystem;
    10.  
    11.     void Start ()
    12.     {
    13.         EmeraldSystem = GetComponent<Emerald_AI>();
    14.     }
    15.  
    16.     void Update ()
    17.     {
    18.         if (EmeraldSystem.TargetTypeRef == Emerald_AI.TargetType.NonAITarget)
    19.         {
    20.             EmeraldSystem.AttackDistance = NonAITargetAttackDistance;
    21.         }
    22.         else
    23.         {
    24.             EmeraldSystem.AttackDistance = DefaultAttackDistance;
    25.         }
    26.     }
    27. }

    I'm not sure yet. After the 2.2 update I will look into this as there's a decent portion of Emerald AI being rewritten.


    Thanks for providing the videos. There have been a few users who have had this issue and I'm looking into a solution for it. The problem is that I have yet to be able to recreate it which is making it hard to find a proper solution. As soon as I can figure out what's going on, I will release an update to fix it. Sorry for any inconveniences this is causing.


    Currently AI cannot loop their emote animation. I will be adding this feature with the 2.2 update.

    If your AI is walking around the destination point, your AI may need to have a larger Stopping Distance.


    There have been users who are having this issue and users who aren't. I have tried using the exact version and cannot recreate the issue.

    Have you tried using Emerald AI in a new project without any other assets to see if the problem persists? There's a possibility that another asset could be causing an issue with Emerald AI.
     
    Last edited: Oct 22, 2018
    hessex likes this.
  37. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
  38. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Is there another link to this or location for some reason I can't get it. says I have no internet connection when obviously I do.
     
  39. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    153
    @BHS
    Recorded a fresh install and new clean project with just Emerald Ai2 on a different mac that has an AMD instead of an Nvidia GPU both are running macOS Mojave 10.14.
    Results were identical (so weird didn't expect that), no errors in the console again either.

     
  40. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    153
  41. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Thanks. I've taken a look but these tutorials have created more questions than answers. I use ootii but don't have or need motion packs. So it seems I can't integrate which is strange. I also use ICE AI and want to link to that for my player health. Is there not just an event I can subscribed to in order to get the damage dealt by an emerald so and send it to my player controller or ICE AI? I will dig around the scripts which I was trying to avoid lol. but if anyone has an idea.
     
  42. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Thanks for the links guys. It was pretty straight forward to give/receive damage to player, ICE AI and emerald. I've also been looking at the emotes. Look quite interesting. Maybe they could be utilised to get the extra social functionality I need with some of my AI (Which I use ICE for). It could be called for any animations I want extra related to specific events/quests in the game.
     
  43. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    @BHS worked a treat, stoked you have loopable emotes coming!! :)

    Can I add another request, can we get an OnAlertEvent(), maybe you have already changed things in the next version, but it would be awsome to have some kind of dynamic event system based on the ai state or some way of adding custom events, without adding them in the emerald ai code..
     
  44. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    You need to add code to the DamagePlayer function and attempt to get the appropriate ICE component off the target object. If it can fetch that component then you know the AI hit an ICE agent. Then you simply call the appropriate ICE function to apply the damage.
     
  45. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    239
    I used the Non-AI Tag to let the Emerald AI attack Building, but after the AI destroys a building it will not attack another building nearby, it will continue to walk towards Waypoint.
     
  46. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    On player health script, should add play animatiom. Death animation. Just for simplicity
     
  47. evan_mundy

    evan_mundy

    Joined:
    Nov 4, 2017
    Posts:
    2
    Is there a way to have a ranged ai swith to melee when enemy gets close?
     
  48. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    I have meshes (buildings and obstacles) that I instantiate at run time with colliders, how do I get the AI to recognize them and avoid them, at the moment they just ignore them and walk through.
     
  49. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Add a NavMesh Obstacle component :D.
    if it's a moving object set to carve
     
    Mojo-Game-Studio likes this.
  50. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Is there a way I can use a mesh collider? I can get away with some runtime gameobject just using a box or cylinder collider but most are complex meshes.