Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

[RELEASED] Emerald AI 2.4.2 - The Ultimate Universal AAA Quality AI Solution

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

  1. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,168
    Yeah, I'm sure they are fine - last seen on 16th UniStorm forum. So they are probably lining up the next Unistorm update before getting back to Emerald.
     
    ellisthemiracle likes this.
  2. DanielFF

    DanielFF

    Joined:
    Aug 29, 2012
    Posts:
    41
    Hi,
    When I have several melee Ais, they stand side by side to attack the player and it is weird, would there be a way for the Ais to position themselves around the player?
    Thank you!
     
  3. konradkozaczenko

    konradkozaczenko

    Joined:
    Apr 8, 2019
    Posts:
    35
    Hi, I would like to ask you guys how to handle large map with a lot of Emerald AI GameObjects. When agent is far away from player it should be disabled to not wasting CPU but I don't know how to achive that :/
     
  4. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,168
    You could do camera culling, only activate the Emerald AI scripts (not disable) when in view. Alternatively you could do a distance check every so often on the AI to disable them when your player is a fair distance away. There are other alternatives if you wanted to code them yourself, or some assets in the store that can handle it.
     
  5. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,075
    @BHS are you ever going to be as active as you once were?
     
  6. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    148
    Hello, I own this and the unistorm. Do these assets have any use in 2D games? Or its 3D only?

    I am really interested to make things work with a 2D game the Emeral AI. Thanks for letting me know
     
  7. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    181
    Can someone give me some advice regarding Emerald AI and VRIF? I've followed the youtube video to the letter and I still cannot get this to work, essentially what happens is that the enemy is killed however, n animation is a play on either hit or dead, essentially the gun fires bullets at the enemy and it continues to attack then it disappears which I'm assuming the object is destroyed. However, there is no indication but animations at all. Is there a bug in the integration script?

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    namespace BNG {

    /// <summary>
    /// Attach this Component to any EmeraldAISystem object you wish to deal damage to.
    /// </summary>
    public class EmeraldAIDamageable : Damageable {

    public override void DealDamage(float damageAmount) {
    if (GetComponent<EmeraldAI.EmeraldAISystem>() != null) {
    GetComponent<EmeraldAI.EmeraldAISystem>().Damage((int)damageAmount, EmeraldAI.EmeraldAISystem.TargetType.Player, null, 400);
    }
    }
    }
    }
     
  8. konradkozaczenko

    konradkozaczenko

    Joined:
    Apr 8, 2019
    Posts:
    35
    Hi, my NPC AI invokes EmeraldAIEventsManager.StopMovement function when OnPlayerDetectionEvent occur which is what in order to start a dialogue. The problem is that when player walks away the AI is still not moving. How to invoke ResumeMovement function automatically when player is not being detected anymore?
     
  9. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    666
    New Video coming tomorrow. "Apollo's Dream II" Using tons of assets, as usual.
    Hope everyone enjoys it, the scene and music has been in the works for a long time. We are glad we are finally coming to a final product.

    Keep an eye on our YouTube for the new video.
    https://www.youtube.com/user/silverthorndavid/videos
    Apollo's Dream II.jpg
     
    iChuy likes this.
  10. gtox

    gtox

    Joined:
    Apr 23, 2013
    Posts:
    20
    I've created a system to frighten animals off using an air horn, where the attacking animal's health is set to just below the flee threshold when you toot the horn. It works very well with some animals, but others flee for a few meters, then turn around to attack, then turn around flee, over and over again. Even when I copy the settings for the working animals to the non-working ones, they still do this. I tried using On take Damage Events to set them to Coward, to FleeState, among others, but nothing works. Is there is more blunt force way of getting animals to flee and stay fled?
     
  11. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    666
    Apollo's Dream II is now live!
    A ton of work went into this one, I hope everyone will enjoy it.
    Creating beauty with Unity for a Virtual Experience with an original soundtrack is a lot of fun and I hope it shows in the video.

    Emerald AI helps create a wonderful living environment for this old west experience.
     
    BHS and iChuy like this.
  12. gtox

    gtox

    Joined:
    Apr 23, 2013
    Posts:
    20
    Love the hatted animals.
     
    dsilverthorn likes this.
  13. konradkozaczenko

    konradkozaczenko

    Joined:
    Apr 8, 2019
    Posts:
    35
    Hi, is it ok that AI if once fled then it will always flee from player, even if it health has been fully recovered? Cause that's my enemies behaviour right now :/
     
  14. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    Anyone know how to interrupt a emote? got it stopping fine but it wont play next animation until the emote is finished
     
  15. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,075
    Kidney shot
     
  16. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,075
    I figured out how to make a Player healer out of a AI. Below is my RFPS/S-Inventory/Dialogue System/Emerald AI game.

     
    BHS and TonyLi like this.
  17. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    240
    Hi, I have had Emerald AI working before but what would cause a problem with it not attacking the player. It runs to the player then stops when it reaches the player then just goes into idle animation instead of attacking the player. I am using the Opsive controller integrations with this asset and I have had this working once before.
     
  18. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    No speed modifiers are using for Root Motion so it sounds like Root Motion may not be enable. Root Motion needs to be set through the Emerald AI editor as explained here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Setting-up-an-AI's-Animations#step-6
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    There's currently no API do so, but add the following function to the EmeraldAIEventsManager script to give the ability to do so:

    Code (CSharp):
    1. /// <summary>
    2. /// Changes the AI's faction. (Note: The FactionName must exists within the Faction Manager's Current Faction list)
    3. /// </summary>
    4. public void ChangeFaction(string FactionName)
    5. {
    6.    EmeraldAIFactionData FactionData = Resources.Load("Faction Data") as EmeraldAIFactionData;
    7.  
    8.    if (FactionData.FactionNameList.Contains(FactionName))
    9.    {
    10.       EmeraldComponent.CurrentFaction = FactionData.FactionNameList.IndexOf(FactionName);
    11.    }
    12.    else
    13.    {
    14.       Debug.Log("Faction not Found");
    15.    }
    16. }
    You can then go through Emerald AI with a reference to the EmeraldAISystem script like this:
    Code (CSharp):
    1. EmeraldComponent.EmeraldEventsManagerComponent.ChangeFaction("Undead");
     
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    Not currently, but I have plans to implement these features at some point. I don't have a road map of what I have planed, but I'll work on putting something together for those who are interested.
     
    shyamarama likes this.
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    I'm still very involved with Emerald AI. I have just made email my main focus for support. I can certainly start being more active on the forums though. :)
     
    shyamarama and dsilverthorn like this.
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    Ensure that you are using First Detected or Random for your Detection Type. The Closest Detection Type, while the most logical, can result in AI making line formations while attacking. This is briefly explained here: https://github.com/Black-Horizon-St...Type-and-Target-Picking#target-picking-method
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    Ensure you have setup your AI's Optimization Settings as explained here: https://github.com/Black-Horizon-St...tings#setting-up-an-ais-optimization-settings Emerald AI has built-in optimization features.

    This allows AI to automatically be disabled (most Emerald AI components as well as the AI's Animator) when they are not visible by the camera. If your AI have an LOD Group component (https://docs.unity3d.com/Manual/class-LODGroup.html) They can also be disabled when they have reached the Culled level. This can work even if your AI only has 1 level of LOD. The cull distance is based on what you set within the LOD Group component.
     
  24. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    240
    Will there be proper integrations to the newest Opsive controller because I have noticed there is for the old UFPS. Please people would benefit from this.
     
  25. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    69
    There is integration written by someone else on the Opsive fourms that is up to date.
     
  26. gtox

    gtox

    Joined:
    Apr 23, 2013
    Posts:
    20
    I couldn't figure this out, so I created a script that disables the EAI components, and handled the fleeing separately. The problem I have now is how to get the running animation. EAI's override controller is a spaghetti junction, I have no idea what's going on there.
     
  27. RazT

    RazT

    Joined:
    Feb 7, 2019
    Posts:
    8

    Hello all! I am also seeying quite a bit of garbage collection on my scene. Can also see some peaks in the profiler. Has this issue been adressed? THX!
     
  28. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,075
    @BHS ok,. Let's get a mana pool added to casters, strafing, Companion healing, API to call abilities directly.
     
    BHS likes this.
  29. StudioIncorrect

    StudioIncorrect

    Joined:
    Aug 10, 2015
    Posts:
    4
    I would also like to know how to interrupt (i.e., stop) an emote that is currently playing.

    Using Unity 2020.3 with Bolt, I notice that the StopLoopEmoteAnimation does not interrupt my PlayLoopEmoteAnimation.

    It should be noted that the documentation for the StopLoopEmoteAnimation states "Loops an emote animation according to the Animation Clip parameter until it is called to stop.". Shouldn't it refer instead as to how it "Stops" an emote animation?

    https://github.com/Black-Horizon-St.../Emerald-AI-API#emerald-ai-events-manager-api

    Thanks!
     
  30. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    240
    It works but it never attacks the player it just goes in the idle state. Other people have had the same problem too.
     
  31. Felinsky

    Felinsky

    Joined:
    Jan 22, 2018
    Posts:
    23
    is AI strafing in future list ?
     
  32. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,075
    It was on his list at one point. Should be coming soon I would think.
     
  33. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,075
    Will we need you to do a HUGE upgrade.
     
  34. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    406
    I am using an AI with Ranged and Melee attacks. The problem is when I am out of melee range but in shooting range, the AI shoots me. Fine. But he only shoots once. When I move in for Melee it attacks me multiple times which is great. But when I move back out into firing range, it never shoots again.
    Any ideas? In the video I used a grenade throw to make the shooting more obvious.

    I also can't seem to find an example of an AI which uses both in the Demo scenes.



    Another interesting feature is when I have an animation for the ranged attack assigned and enter play mode. The selection disappears and says I need to add at least one animation for my ranged attack. Even though it plays the animation the first time. Come to think of it, this may be the reason for the problem I stated above.



    It's very interesting. In UpdateAbilityAnimationEnums, RangedEnumAnimations is set properly but by the time it gets around to the GUI reading it, it's null. Can't figure out where else this would be set.
     
    Last edited: Apr 11, 2021
  35. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    69
    Keep in mind that the integration was written a couple of versions ago and might be out of date with recent versions of Opsive. For me it works perfectly fine. Also there are multiple updates to the integration package so you have to scroll to the later pages. Edit: Integration doesn't work with Emerald AI 2.4.2 but does with 2.4.1.1.
     
    Last edited: Apr 12, 2021
  36. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    69
    Hey the location based damage update doesn't work with the Opsive UCC anymore how can I change the OpsiveBridge to work with location based damage? Also all my colliders are being disabled at runtime causing me to not be able to hit my ai. How can I fix this? This started happening after the update.

    Code (CSharp):
    1. using UnityEngine;
    2. using EmeraldAI;
    3. using Opsive.Shared.Events;
    4.  
    5. namespace Magique
    6. {
    7.     public class OpsiveBridge : MonoBehaviour
    8.     {
    9.         private EmeraldAISystem _emeraldAI;
    10.         private void Awake()
    11.         {
    12.             _emeraldAI = GetComponent<EmeraldAISystem>();
    13.             EventHandler.RegisterEvent<float, Vector3, Vector3, GameObject, object, Collider>(gameObject, "OnObjectImpact", OnObjectImpact);
    14.         }
    15.  
    16.         private void OnObjectImpact(float amount, Vector3 position, Vector3 forceDirection, GameObject attacker, object attackerObject, Collider hitCollider)
    17.         {
    18.             if (_emeraldAI != null)
    19.             {
    20.                     _emeraldAI.Damage ((int)amount, EmeraldAISystem.TargetType.Player, attacker.transform);
    21.                     Debug.Log (name + " impacted by " + attacker + " on collider " + hitCollider + ".");
    22.             }
    23.         }
    24.  
    25.         public void OnDestroy()
    26.         {
    27.             EventHandler.UnregisterEvent<float, Vector3, Vector3, GameObject, object, Collider>(gameObject, "OnObjectImpact", OnObjectImpact);
    28.         }
    29.     }
    30. }
    31.  
     
    Last edited: Apr 12, 2021
  37. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    747
    If I want to kill an Emerald ai using an event, what do I call, "InitializeAiDeath()" ? If I do this will the ai play its death animation and enter DeadState?

    Answered: Found it, KillAi ()
     
    Last edited: Apr 12, 2021
  38. abdou_simou_unity

    abdou_simou_unity

    Joined:
    Feb 29, 2020
    Posts:
    1
    can i make game for mobile with this asset. includes 300 or 200 enemies in every scene. and can i make with that asset:zombie enemies
     
  39. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    when my ai goes from cautious to aggressive (if enemy enters radius) , When the enemy leaves the radius my ai insist on staying in aggressive mode with combat state enabled. I have the newest update and still same thing happening.... anyone can shed a light ? please
     
  40. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    wont result once away from distance
     

    Attached Files:

  41. konradkozaczenko

    konradkozaczenko

    Joined:
    Apr 8, 2019
    Posts:
    35
    Hi, thanks for answear but I can see one problem here. AI Optimization is handled in EmeraldSystem.CheckAIRenderers right? Well, AI need to have lod group for that to work because all if statements checks if TotalLODsRef >= TotalLODsEnum.Two. Am I right?
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    If you want to force an AI to run, you can use the following code:
    Code (CSharp):
    1. EmeraldComponent.CurrentMovementState = EmeraldAISystem.MovementState.Run;
     
  43. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    Emerald AI and UniStorm are for 3D, as well as 2.5D, but not 2D.
     
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    I have not personally tested this integration, but this may be because you are passing null as the target within the Damage function call. Pass the player transform instead (as explained here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#damaging-an-ai) to see if this helps resolve the issue.
     
  45. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    You can add the following function to the EmeraldAIEventsManager that will tell you whether or not the player is currently within the AI's detection radius. This could be checked continuously once the player has started dialogue and
    EmeraldAIEventsManager.ResumeMovement(); can be called once CheckForPlayerDetection returns false.

    Code (CSharp):
    1. /// <summary>
    2. /// Checks to see if the player is currently within the AI's detection radius.
    3. /// </summary>
    4. public bool CheckForPlayerDetection ()
    5. {
    6.    if (EmeraldComponent.CurrentTarget != null && EmeraldComponent.TargetTypeRef == EmeraldAISystem.TargetType.Player)
    7.    {
    8.       return true;
    9.    }
    10.    else
    11.    {
    12.       return false;
    13.    }
    14. }
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    I'm not sure why that's happening. AI who have a Confidence Type of Brave are the only AI that will flee once their health reaches the flee threshold so ensure that your AI all have an Aggressive Behavior Type and a Brave Confidence Type.

    Another way you could do this is by calling the FleeFromTarget function: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#fleefromtarget that forces an AI to flee from the specified target.

    If you want an AI to continuously away from the player after they have been frightened, you can try permanently changing their behavior to Cautious prior to calling FleeFromTarget with ChangeBehavior: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#changebehavior
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    This looks like it's a bug. I will fix it with the next update.
     
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    This may be related to to Has Exit Time being enabled. Try setting this to false for each state's transition that you would like to be interrupted within the AI's Animator Controller:

    InterruptEmote.png
     
  49. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    I've created a guide for using the Location Based Damage system here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Using-Location-Based-Damage

    You need to use a different damage function to damage the location based damage components. This is explained here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Using-Location-Based-Damage#step-3
     
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,410
    For the first issue, enable all Debug Tools and ensure that there's no colliders blocking the AI's line of sight. This will display any obstructions to the Unity Console: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Enabling-an-AI's-Debug-Tools

    This is strange and I cannot recreate it. I've tried to on two different versions of Unity with multiple AI. You can try clearing the AI's Animator Controller, within the Animation tab, and recreating it to see if it resolves the issue. If you have copied the AI's EmeraldAISystem component and pasted it on another AI, this could also be the cause of the issue.
     
unityunity