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. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    When is 2.4.1 out?
     
  2. fabiobh

    fabiobh

    Joined:
    May 28, 2013
    Posts:
    92
    Does Emerald AI support any type of localized damage?
    I mean, if I hit the enemy in the head, it will give more damage if I hit the enemy in the body
     
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    This might help: https://stackoverflow.com/questions/47859605/unity-health-and-armor
     
    Pandur1982 likes this.
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Maybe you need a brief delay before setting the target. Try using Invoke("YourFunction", 0.1f); to see if it gets it to work.
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    2.4 is the upcoming update, if that's the one you are referring to :). It's nearly finished. I'll post it here when I've submitted it. There's a lot of changes to the faction system and target detection so I'm making sure everything working properly and will update as seamlessly as possible with the current version.
     
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Not yet, but I do plan on adding this with the 2.4.1 update.
     
    julianr likes this.
  7. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    is their going to be much changes in the new update that will effect current projects?
     
  8. vorokoi

    vorokoi

    Joined:
    Oct 18, 2019
    Posts:
    39
  9. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah thank you :) just a quick question is their a way to lower the ai chase distance yet ?
     
  10. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @BHS looking forward to the 2.4 update - keep up the good work! This update will add a lot of value, especially with factions!
     
    BHS likes this.
  11. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I would be good if you could define each hit box (each arm, each leg, head, body) with the amount of damage per hit. That would be awesome!
     
  12. fabiobh

    fabiobh

    Joined:
    May 28, 2013
    Posts:
    92
    Do you an idea of which month this update could be released?
     
    AdminArdagor likes this.
  13. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    145
    Hello every one i started to using emerald ai for a mobile game
    I started to learn it and i end up its so easy but i have alittle problem on setting up the specified animations to the slots
    So im asking is there any animation pack available that suits emerald ai?
    I mean the animations we have to put on every slot of the emerald component
    I dont have much time to search for animations and see if tgey synch together
    So im searching for a drag and drop solution
    Any help will appreciated
     
  14. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    315
    When I am above an enemy, like up some stairs that they are beneath - so a significant height, they are still able to hurt me. Have you considered implementing a collision-based damage system to avoid this?

    In the meantime, is there a way to fix this?

    EDIT: For melee.
     
    Last edited: Mar 15, 2020
    SickaGames1 likes this.
  15. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    @BHS Any way that we can get hit boxes zones of damage as well as a type of duck and cover system? I also liked you doing a sit down type of utility animation section. Also please see PM :)
     
    Last edited: Mar 16, 2020
    dsilverthorn likes this.
  16. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Yes, all ability lists, melee attacks, run melee attacks, and an AI's factions will need to be reassigned or redone due to the updated code. These changes will make Emerald AI much more flexible and will allow future updates to not reset said variables, given that additional features are added to abilities, factions, attacks, etc.
     
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Yes, there should be a setting called Chase Distance under the Detection Options. However, it cannot be set lower than the Detection Distance.
     
  18. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    That's the plan. :)
     
    julianr likes this.
  19. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right would it be possible to add an option to have to make the chase distance lower then the detection in the future updates?
     
  20. liu_jiaye

    liu_jiaye

    Joined:
    Jan 31, 2020
    Posts:
    2
    @BHS Hi there, may I know how does it work with Oculus Quest? Do I get to grab and swing the weapon using the controllers etc. I am trying to make a VR game and I am not sure if the AI system can be easily integrated into the game as there seems to be no documentation on how to implement this asset in VR.
     
  21. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
  22. adifrank

    adifrank

    Joined:
    Dec 11, 2017
    Posts:
    26
    @BHS Is there anyway to make enemy stop at random(between some range) distance. When I make number of same type of enemy they all appear in straight horizontal line and that looks weird.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I don't have a set month for when this update will be released quite yet.
     
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    If you are missing some needed animations, you can use other animations in their place such as walk left and walk right can also be walk forward. Just make sure you duplicate the animations so they are different animation files. If you are looking for a free library of animations, I would recommend Mixamo.com. The only drawback to these is that they require some tweaking to get them looking good.
     
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    What version of Emerald AI are you using? I fixed this with with the latest version by adding a height check for melee attacks. Look for the Attack Height under Damage Settings and try setting it to a lower value. As for collision-based damage, I am considering this for the 2.4.1 version of Emerald AI.
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I can look into this for version 2.4.1.
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    To have your VR player be identified as a player, you just need to setup its layer and tag to be detected by the Emerald AI agents. This can be covered here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Setting-up-an-AI's-Layers-and-Tags. The wiki site uses the upcoming version 2.4, but the setup process is mostly the same.

    As for your weapon system, you would have to provide more detail on how exactly it works. Any AI can be damaged using the following API: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#damaging-an-ai

    I can certainly work on getting a guide on the Emerald AI wiki site to cover VR implementation when I get the chance.

    If your weapon system uses collisions, then you could try using the following example:
    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. namespace EmeraldAI.Example
    7. {
    8.     /// <summary>
    9.     /// A script that damages AI based on collisions. Can be used for dynamic damaging objects such as rocks, logs,
    10.     /// and other falling objects or collision based weapons.
    11.     /// </summary>
    12.     public class DamageAIByCollision : MonoBehaviour
    13.     {
    14.         public int DamageAmount = 10;
    15.  
    16.         private void OnCollisionEnter(Collision collision)
    17.         {
    18.             //Damages an AI to the collided object
    19.             if (collision.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>() != null)
    20.             {
    21.                 collision.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>().Damage(DamageAmount, EmeraldAI.EmeraldAISystem.TargetType.Player, transform, 400);
    22.             }
    23.         }
    24.     }
    25. }
    26.  
     
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    My apologies for that. I haven't had the time to update the guide, but I will work on getting it updated asap. The only thing that has changed on Emerald AI's side is some script names and the addition of namespaces to scripts. So, you would just change all portions of Emerald_AI to EmeraldAI.EmeraldAISystem. Does making these changes allow it to work properly for you or are there also changes on Ootii's end?
     
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Not currently, but I can look into adding some randomness to the ranged attack distance for version 2.4.1. If you want a quick solution, you could just add the following code to the EmeraldAISystem script inside the Awake function:
    Code (CSharp):
    1. if (WeaponTypeRef == WeaponType.Ranged)
    2. {
    3.    //Randomize the attack distance between 15 and 30
    4.    AttackDistance = Random.Range(15, 31);
    5. }
     
  30. theonerm2_unity

    theonerm2_unity

    Joined:
    Sep 7, 2018
    Posts:
    131
    Hey cloverme. I need a response quickly. How exactly do I make the ai damage the hfps kit player? I'm trying to get a demo of my game done by tomorrow and I feel like I'm just stuck in the mud with this ai.
     
  31. vorokoi

    vorokoi

    Joined:
    Oct 18, 2019
    Posts:
    39
  32. theonerm2_unity

    theonerm2_unity

    Joined:
    Sep 7, 2018
    Posts:
    131
  33. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    I don't think Ootii's system has changed very much, it's mostly on LTS-mode now with no new features, just fixes.
    I'll try again but all the scripts and functions have changed and I'm not familiar with Emerald AI so I don't know what to look for.
     
  34. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    145
    Hi and thanks for guidance
     
  35. BHS

    BHS

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

    Emerald AI 2.4 has been submitted and is awaiting approval! This update brings tons of improvements and requested features. I look forward to seeing what everyone can create with this update!

    Due to all Unity employees working from home, there are curation delays on Unity's end. This could make the update take as long as 2 weeks to be accepted, but it's possible to have it accepted sooner.

    Note: 2.4 requires all ability lists, melee attacks, run melee attacks, and an AI's factions to be reassigned or redone due to the updated code. These changes will make Emerald AI much more flexible and will allow future updates to not reset said variables, given that additional features are added to abilities, factions, attacks, etc. All Animator Controllers will also need to be regenerated in order to utilize the additional animations.

    Features
    • The Completely redesigned faction system has been improved to support as many faction relations as needed so users are no longer capped at 5. This new method also allows factions to be added, removed, and modified during runtime. New faction API has been added to the EmeraldAIEventsManager.
    • Redesigned the player relation system to 3 categories like the faction system; Enemy (An AI will react to the player according to their Behavior Type), Neutral (An AI will need to be hit by the player to react to their Behavior Type), and Friendly (An AI will not react to the player, even if they are damaged by them)
    • Added OnKillTargetEvent Emerald AI Unity Event to the Emerald AI Editor.
    • Added OnDoDamageEvent Emerald AI Unity Event to the Emerald AI Editor.
    • Put the faction options in its own tab called Faction Options to keep the Detection Options section less cluttered.
    • Added a Random option to the Target Picking setting. This allows an AI to pick a random targets from all available targets within an AI's detection radius upon entering combat. This helps the AI target picking to feel more dynamic and less precise so the same, most logical target, isn’t always picked.
    • Included a few more example systems such as damage AI by collision, another damage AI example system limiting the damage to customizable angle, a test event script that can be used to debug logs Emerald AI Unity Events.
    • New documentation - All Emerald AI documentation has been moved to the Official Emerald AI Wiki Site. The Google Docs documentation will no longer be updated. GitHub's wiki site is better formatted so much more information can be covered, rather than having all information on 1 section.
    New Ranged Attacks List
    The ranged attacks have been redone for Offensive, Support, and Summoning abilities. This allows an unlimited amount of abilities an AI can use. There are also 3 pick type options; the first is Odds where each ability is picked according to its odds, the second is Order where each ability is picked in order within the ability list, and the third is Random where each ability is picked randomly from the ability list. Each ability will also allow users to customize the animation that will be used.
    NewAbilities.png

    New Melee Attacks List
    The way melee attacks are handled have been redone with a list so users can customize the animation used, the damage amounts, and the order in with the attacks are picked. This allows an unlimited amount of melee attacks an AI can use. The Pick Type has three options; the first is Odds where each attack is picked according to its odds, the second is Order where each attack is picked in order within the melee attacks list, and the third is Random where each attack is picked randomly from the melee attack list. There are not caps to the amount of melee attacks that can be used so AI can have multiple attacks that use the same animation, but do different damage or effects. The index of the currently used melee attack index can be found using the following code for custom functionality.
    NewMeleeAttacks.png

    Additional Animations
    Animations have been increased to the following. This brings the total up to about 100 usable animations. Note: This requires all Animator Controllers to be regenerated to utilize new animations.
    • 6 Melee Hit Animations, up from 3
    • 6 Melee Attack Animations, up from 3
    • 6 Melee Death Animations, up from 3
    • 6 Ranged Hit Animations, up from 3
    • 6 Ranged Attack Animations, up from 3
    • 6 Ranged Death Animations, up from 3
    • 6 Hit (non-combat) Animations, up from 3
    • 6 Idle Animations, up from 3
    • 10 Emote Animations, up from 3
    Fixes
    • Fixed an issue with the GUILayout.SelectionGrid buttons' height in the Emerald AI editor and Unity 2019.3+
    • Fixed block angle calculations to be more accurate.
    • Fixed an issue that didn't allow ranged AI to move to their target when having low attack speed (near 0).
    • Fixed an issue that allowed a Cautious AI to play its warning animation while attempting to move to its wandering destination.
    • Fixed a rare issue that didn't allow the Animator Controller Updater to update some animations accurately.
    • Fixed the issue "ArgumentException: UnpackPrefabInstance must be called with a Prefab instance." that happened with newer version of Unity when using the Emerald AI Setup Manager and a non-prefab object.
    • Fixed an issue that applied the wrong speed settings to an AI's Backup state when using the Both Weapon Type setting.
    • Fixed an issue that allowed an AI to play a blocking sound if they were blocking than transitioning to its turn animations.
    • Fixed an issue that allowed an AI to get stuck in the SeachForTarget function for a few seconds when sometimes switching between targets.
    • Fixed a few Emerald AI console warning messages that happened even when the proper animations and animation events were applied.
    • Fixed an issue that caused the AI's look at feature to glitch when no targets were left and it was transitioning back to its default look at position.
    • Fixed an issue that didn't allow an AI's projectile to utilize the Player Offset Y Position setting.
    • Projectiles will no longer always hit a player's feet, when adjusting the projectiles using the AI's Player Offset Y Position.
    • Fixed an issue that made AI walk or run slow when using Root Motion movement type (This was related to the Rigidbody Component and some newer versions of Unity)
    • Removed the Rigidbody component from the Emerald AI system as it is no longer needed and caused issues with the Animator Controller in some newer versions of Unity. Note: If you are using a custom collision with an Emerald AI agent, you will need to have a Rigidbody component on the collision object.
    • Improved the AI's look at feature to be smoother and more responsive when switching between targets.
     
    Last edited: Mar 20, 2020
  36. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Awesome! Nice work on this release BHS - thanks for getting it out during this time. I will post some screenshots/videos with it soon.
     
    BHS and SickaGames1 like this.
  37. Alexandus

    Alexandus

    Joined:
    Sep 5, 2012
    Posts:
    25
    Amazing! Thank you BHS!
     
  38. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BHS I sent you a PM.
     
  39. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    is it possible to set another ai as a leader so other ai follow it?
     
  40. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,726
    Heya guys, cant wait for the new version, looking good :) I have an odd situation with EAI in Jurassic Extinction, and i need some help or advice. Heres the situation:

    I have a flying species called Pteranodon. Everything is working perfect, but they die (when you kill them) at navmesh level or height offset level, and die in the air, doesnt fall to ground level. Looks bad, lol. Im currently looking into the EAI API/code, and etc. Heres a video to demonstrate the "die in the air at navmesh/offset level":

     
    Neviah likes this.
  41. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    After derping around for a bit.. I found an old script made by @Salja and updated it to support the new Combat text feature in EmeraldAI 2.3++

    This new script "EmeraldAIDamageAdapter.cs" needs to be attached to every EmeraldAI NPC in your scene.
    This updated "EmeraldAIPlayerDamage.cs" should replace the original to enable support for Ootii MC damage.

    Enjoy!

    My next step is adding support for EmeraldAI NPC to cast spells created using Ootii spell casting pack. cheers!

    if you haven't checked out Ootii Motion Contoller.. you really should.. it's the best character controller out there. :D

    upload_2020-3-22_16-0-25.png
     

    Attached Files:

    Last edited: Mar 22, 2020
    LNMRae and BHS like this.
  42. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    Did you try giving them a rigidbody and enabling gravity? If that works you can just enable rigidbody/gravity on death via script and it will fall on death.
     
  43. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    @BHS Any idea when this will be uploaded?
     
  44. AaronVictoria

    AaronVictoria

    Joined:
    Aug 21, 2010
    Posts:
    176
    @BHS, did the turn to face functionality ever get added. Doing some code planning and looking at what hacks I'll still need after updating to the upcoming release.
     
  45. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    2.4 is now live :)
     
  46. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi, with the new update not sure if this was present before... but if I have an ai with both combat selected, the ai comes with some errors

    says the run Attacks are missing animation events, but they are setup correctly and I am using them only for melee combat as there is no option for run attacks with ranged

    also in-game the ai doesn't seem to use melee attacks even up close, when I do go close the ai goes into t-pose and throws errors with point to this line in emerald system
    Code (CSharp):
    1. CurrentAnimationClip = AIAnimator.GetCurrentAnimatorClipInfo(0)[0].clip;
    Thank you very much for the new update, being able to add more animations and factions is awesome.
    Jim
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    This is happening because animations are constant. It's only designed to fall a certain depth before being finished. If you want an AI to fall dynamically, you will need to use a ragdoll.
     
    warthos3399 and dsilverthorn like this.
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Thanks for the bug reports, have you tried clearing the Animator Controller and recreating it? It may be due to the new animations added to the Animator Controller. Also, the way both melee and ranged attacks are handled have been redone so you will need to manually setup your abilities and melee attacks again. I've already found the cause of the attack events missing issue, which can simply be ignored for now. I'm already working on an update to address any 2.4 issues.
     
    Last edited: Mar 25, 2020
    llJIMBOBll and dsilverthorn like this.
  49. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    315
    After the new update (2.4) I've run into a few issues:

    1. When the AI damages something, a combat text/number is generated. How can I prevent this?
    2. I have warnings in the console relating to missing animations (run), but they are there. I also created a new animator controller after clearing the old one.
    3. Saved the best til last: My enemy cannot detect the player unless I get right in his face. The player is definitely in the fov cone and has the correct layers and tags. Many layers are on the Obstruction Ignore Layers so as to not block the AI's view of the player. Not sure what else to try?
     
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    1) The Combat Text System can be disabled through the Combat Text Manager: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Using-the-Combat-Text-System
    2) This is being fixed with version 2.4.0.1, which I will submit sometime today.
    3) Enable all of the Debugging Tools to see if the player is being properly detected when it enters the AI's detection radius. It will also tell you if something is obstructing the AI's line of sight. A guide on this can be found here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Enabling-an-AI's-Debug-Tools