Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] Emerald AI 2.4.1 - 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,284
    I'm not sure I understand exactly what you are asking. If an AI detects any opposing AI, it will react according to its behavior type. An AI won't just follow an AI by default, but this can be added via custom code.

    You can check out Emerald AI's API to see if it will help you find some useful built-in functions: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API
     
  2. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,009
    When is 2.4.1 out?
     
  3. fabiobh

    fabiobh

    Joined:
    May 28, 2013
    Posts:
    90
    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
     
  4. BHS

    BHS

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

    BHS

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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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.
     
  7. BHS

    BHS

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

    unity_7UFP4-iCkwsgjg

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

    vorokoi

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

    unity_7UFP4-iCkwsgjg

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

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,152
    @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.
  12. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,152
    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!
     
  13. fabiobh

    fabiobh

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

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    94
    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
     
  15. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    284
    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
    SickaGamer likes this.
  16. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,009
    @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.
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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.
     
  18. BHS

    BHS

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

    BHS

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

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    316
    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?
     
  21. 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.
     
  22. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    198
  23. adifrank

    adifrank

    Joined:
    Dec 11, 2017
    Posts:
    6
    @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.
     
  24. BHS

    BHS

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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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.
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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.
     
  27. BHS

    BHS

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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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.  
     
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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?
     
  30. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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. }
     
  31. theonerm2_unity

    theonerm2_unity

    Joined:
    Sep 7, 2018
    Posts:
    73
    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.
     
  32. vorokoi

    vorokoi

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

    theonerm2_unity

    Joined:
    Sep 7, 2018
    Posts:
    73
  34. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    198
    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.
     
  35. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    94
    Hi and thanks for guidance
     
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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
  37. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,152
    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 SickaGamer like this.
  38. Alexandus

    Alexandus

    Joined:
    Sep 5, 2012
    Posts:
    20
    Amazing! Thank you BHS!
     
  39. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    @BHS I sent you a PM.
     
  40. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

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

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    822
    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.
  42. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    198
    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.
  43. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    198
    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.
     
  44. SickaGamer

    SickaGamer

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

    AaronVictoria

    Joined:
    Aug 21, 2010
    Posts:
    149
    @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.
     
  46. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,152
    2.4 is now live :)
     
  47. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    576
    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
     
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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.
  49. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    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.
  50. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    284
    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?
     
unityunity