Search Unity

[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 should be able to just use the damage function: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#damaging-an-ai The int RagdollForce parameter controls the amount of ragdoll force that is applied on death. So experiment with what value works. It should add force in the opposite direction of the damage source. The damage amount should be a high value that would instantly kill the AI.
     
  2. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    I went there is not one clear concise manual saying where to add any of the lines. And it seems
    people are still having problems. Thanks for your help. The answers there seem to assume you
    know some coding. But thanks so much for pointing me there, still the same.
     
  3. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Most of the combat settings can just be ignored, but I do agree that it can be overwhelming when trying to navigate the editor when you do not intend to use the combat features. I already have plans with the next update to make the editor easier to use for AI who are not using the combat features.
     
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Have you double checked it's the correct AI Main Renderer? Have you tried disabling the feature to see if it resolves the problem? I don't believe I have had any issues with spawning AI into a scene. What code are you using to spawn the AI?

    OptimizationSettings.png
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I'm trying to get it out by the end of this month.
     
    julianr likes this.
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    1) A while back I did a complete rewrite of Emerald AI. The 2.0 is just a rename for the 2.0 version as a whole. 2.4.1 is the current version.

    2) I can't tell you specifically how to damage your player as it likely has its own custom code, but all you have to do is add your own damage calls through the EmeraldAIPlayerDamage script within the SendPlayerDamage function. There's other commented code in there to give you an idea of how it's done.

    3) Not currently, location based damage is coming with the next update.

    4) A box collider provides a little bit easier setup without having to deal with axis rotation. I also found this easier to calculate when auto-generating the collider based off of the AI's model source. However, I can certainly look back into this as I have had several requests for it.

    5)
    Hit_Transform.png

    6) You can clear an AI's current target with this: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#ClearTarget
     
    jnbbender likes this.
  9. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Not by default. If you wanted AI to walk on surfaces outside of normal, such as 90 degrees, you could try to use Unity's NavMesh Building Components: https://docs.unity3d.com/2019.2/Documentation/Manual/NavMesh-BuildingComponents.html

    I'm not sure if spherical mesh generation is possible so you would have to test these components out first. You would also need to modify Emerald AI's destination code to include the generation points outside of just flatter surfaces.
     
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks for the suggestions. I'll see what I can do. I do have plans to implement some type of resistance system and level system. Adding an override for the damage amounts should be possible with a future update.
     
  11. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    If you want to check if there are any objects obstructing your AI's line of sight, you can enable the Debugging tools: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Enabling-an-AI's-Debug-Tools This will debug log any obstructions between the AI and their target to the Unity Console.
     
  12. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    92
    Dude I really don't know what to tell you there is literally a full guide on the Opsive forums it's called
    Emerald AI Integration by magique. It has a full documentation guide on what to do it gives you the code so you can literally copy and paste. If you can't find it maybe you don't have permissions to view the forum.
     
    Kennth likes this.
  13. kenlem1

    kenlem1

    Joined:
    Mar 20, 2014
    Posts:
    40
    Thanks for the tip about the debugging tools!

    I did sort out my issue. I had disabled the collider on my player controller while working on some other issues and forgot to re enable it. I figured it was something simple on my end.
     
  14. chlorineknight

    chlorineknight

    Joined:
    Sep 6, 2019
    Posts:
    1
    I need Answer for this behavior:
    when my AI get hit using a projectile by Player, the AI rush to the player position. then it do nothing just standing there, if then player run from AI, it chases but not attacking.
    why is it happen?
    I am using manual Damage to damage the AI . Damage method that passes damage amount, damage done by , attacker transform.

    when AI detect player, it behave normally, it will attack both Melee and ranged according to setting.
     
  15. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Just wondering, has this changed?
    Is it still not possible to trigger animation at start and end of waypoints?
     
  16. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    I did find 3 Pdf's I will try the copy paste as you said. I hope this will work with arrows as well.
    Thank you for your time and patience.
     
  17. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    92
    Issues 3 & 4 seem to be gone now but setting up the spawn animation like you've shown breaks my ai. My ai starts inching toward the player instead of normally running to them. Removing the on start event stops the ai from breaking but i'm back to square one. With it active i get an error saying my ai can't reach the target. I'm sure it has to do with the fact that the ai crawls out of the ground in its spawn animation.
     
  18. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Which example is suppose to support breeding?
     
  19. XVB75

    XVB75

    Joined:
    Sep 12, 2020
    Posts:
    11
    Thanks! Tried this but the only difference is that the bird is sitting picking 10 meters up in the air.

    Is landing, flying etc possible together or only constant flying? My goal is for the bird som walk around picking etc (all animations exist) and occasionally fly away (for example when the player is close).
     
  20. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Sounds like EmeraldAI might be overkill for your use case.

    If I understand, you want birds that will fly in, peck a little bit, then fly off when the player gets near.
    You might want to try to modify the FREE living birds asset. I use it in my game just to have some random wildlife.
    https://assetstore.unity.com/packages/3d/characters/animals/birds/living-birds-15649

    Mark
     
  21. kechappu

    kechappu

    Joined:
    Apr 7, 2020
    Posts:
    4
    Hello! Will there be support for the new input system for the controllers? Also, currently working on a dragon AI. Will you be adding transitions from running to flying to landing in the near future?
     
  22. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    We just completed final editing to our latest video, "Apollo's Dream", and it will be coming soon to our YouTube channel.
    Using Emerald AI and Crux.
     
    Vaupell likes this.
  23. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
  24. Silvermurk

    Silvermurk

    Joined:
    Apr 29, 2016
    Posts:
    164
    Manual control of abilities - it uses only melee and\or first ranged ability untill asked otherwise (if MaunalControl is on):
    https://pastebin.com/rGr5f3Wu
     
  25. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Alright, this should be super simple. I have a BIG car which is all set on the Default layer. Currently my AI blasts right through it. I've set "Obstruction Ignore Layers" to Nothing, Default & Everything and they all have the same effect. The AI runs right through the car.
    Any ideas?

    Here's what I'm seeing
     
    Last edited: Jan 14, 2021
  26. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    92
    Since your car isn't static attach a nav-mesh obstacle script to the base and set the bounds.
     
    dsilverthorn likes this.
  27. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    The wording is confusing on that part of the setup imo. Does it mean these layers will be ignored as obstructions, or ignored as though they are not obstructions?
     
  28. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Exactly. If you look at the very nice UI in the inspector there is a write-up about what it means underneath that parameter. It appears to mean one thing but then seems to state another. That's why I ran it with many different layer choices.
     
    Deckard_89 likes this.
  29. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Ahhhh. Thanks. I'll give it a go.
     
  30. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Are there any plans to add multiple Detection types to one AI? I'd like my AI to be able to see ahead at his target but then also a small radius behind him to act as sort of his hearing.
     
  31. Ben2390

    Ben2390

    Joined:
    Sep 6, 2014
    Posts:
    11
    Hi guys, does anyone know the best way to achieve the following when an AI is in combat with the player:

    - AI briefly pauses combat, plays Emote /animation, then continues combat?
     
  32. Ben2390

    Ben2390

    Joined:
    Sep 6, 2014
    Posts:
    11
    I've tried some of the eventsystem functions like clear target then play emote but not had any luck.
     
  33. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    Having an issue where an enemy AI won't face the player. He performs his walk/run animations and attack animations, but won't turn to face the player, as though the turning radius is too great for him to turn or something, so he just keeps circling around.
     
  34. agent_Macgyver

    agent_Macgyver

    Joined:
    Sep 1, 2012
    Posts:
    36
    My solution has been to not use the emote animation, but to use the block animation, and force the AI to play the "block anim" whenever i need an animation played during combat.
     
  35. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    Sorry - my fault. Fixed by setting animations' root transform field to Original instead of Root Node.
     
  36. Ben2390

    Ben2390

    Joined:
    Sep 6, 2014
    Posts:
    11
    Thanks for the reply, I decided to add the animation into the animator directly and made a trigger to go to it from anystate.
     
  37. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Why does the AI collider remain upright? How can I correct this since I don't think I'd be able to re-parent?
     

    Attached Files:

  38. LaCorbiere

    LaCorbiere

    Joined:
    Nov 11, 2018
    Posts:
    29
    Hola. New user. Been running into a couple of issues with Emerald AI. Unity version 2020.1.16. The animations suddenly stopped working and I'm getting a warning: 'Animator is not playing an AnimatorController'. Character 'moves' but in a frozen pose (ie: stuck on first frame of the animation). Animation Events are still firing though! Weird. Applied and rebuilt the EAI from scratch and it works ok. Would like to know if anyone else has run into this.

    Also, head look. Got it to work on one of the supplied demo characters i set up from scratch but not on my own FBX character. My rig has a head bone that can rotate the head so just don't understand why it's not working in this instance. I got round it with a my own script for the head look but would be nice if I could use the EAI one.

    Thanks!
     
  39. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    I have setup a REALLY simple Box collider set to a Trigger at the Default Layer that the AI is supposed to trigger. My Physics settings are set for everything to collide with everything. I have put my AI on the Default layer and his own AI layer. I cannot get the AI to trigger the OnTriggerEnter function. My FirstPerson player does trigger it as well as other things. Ideas?
     
  40. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    BTW. I fixed the collider remaining upright by changing the BoxCollider to be set on my Player's spine. Now it follows along just fine. There were only about 5 1-line code changes that needed to be done. In case anyone is interested.
     
  41. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    Try putting a Rigid Body on it.
     
    jnbbender likes this.
  42. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    BUG: Events are not saved, when saving and respawning a prefab.
    This has gameobjects in it before, when i saved it as a prefab, and i pull it back out, they are gone.
    Even though they are still in the scene.

    upload_2021-1-17_21-11-53.png
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    That's not a bug. When you save something as a prefab, the prefab can no longer reference scene objects since the prefab exists outside of any scenes. However, if you were to assign the EmeraldAISystem GameObject itself to the UnityEvent, it would still keep that reference since it's self-contained.
     
  44. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    So in theory i could add a script to the Gameobject it self,
    that finds what it needs when starting, but is also refererencing to the events.. o_O

    BRB, will try asap.
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Yes. Or your script could hook up the UnityEvent at runtime. Example:

    Code (csharp):
    1. OnDoDamageEvent.AddListener(() => { FindObjectOfType<ScreenFlash>().Flash(Color.red); });
     
    Vaupell likes this.
  46. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Ahh yes,, didnt see your message until now..

    But it works,, I added a script to the prefab itself, and tested it, spawned them in with Crux and they work..
    This is great.

    My current solution for this problem.

    upload_2021-1-17_22-36-57.png

    Edit: changed line 22: DestrucibleResource = this.GetComponent<Destructible>();
     
    Last edited: Jan 17, 2021
  47. adamofeden

    adamofeden

    Joined:
    Sep 19, 2020
    Posts:
    4
    Hi,

    I am working on a VR stealth game where the player is sneaking through patrolling AI and when the player has been seen by the AI, the AI will then chase the player and the player can run and hide.

    My problem is that when the player is seen and the AI enters its combat behavior the AI is able to detect the location of the player even if the player is behind multiple walls and out of the AI’s line of sight. (This is only happening when the AI is in combat mode.)

    I would like to change this so that the AI will go to 'the last sighting of the player’ then patrol randomly for a set amount of time, then return to his original patrol behaviour.

    I am new to Emerald AI and C# but if you could point in the right direction that would be amazing. I know this is possible I am just not sure how.

    Thank You
     
  48. LaCorbiere

    LaCorbiere

    Joined:
    Nov 11, 2018
    Posts:
    29
    Hi. I want to instantiate a destructable version of the NPC instead of using an attack animation or rag doll on AI death. Where would I access the event to to this please?
     
  49. Ben2390

    Ben2390

    Joined:
    Sep 6, 2014
    Posts:
    11
    Have a look at their Wiki documentation... https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Using-Emerald-AI-Unity-Events. The first example is pretty much what you want.

    Probably best to make a new script, attached to the NPC and do something similar to:


    public GameObject DestructibleNPC; (add destructible version in the inspector)
    EmeraldAISystem EmeraldComponent;

    void Start ()
    {
    EmeraldComponent = GetComponent<EmeraldAISystem>();

    EmeraldComponent.DeathEvent.AddListener(() => { OnDeath(); });
    }

    void OnDeath ()
    {
    //Do what ever here eg Instantiate DestructibleNPC version etc

    Destroy(gameobject);
    }
     
  50. LaCorbiere

    LaCorbiere

    Joined:
    Nov 11, 2018
    Posts:
    29
    That's spot on thank you very much. :)