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

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    106
    Appreciate the tips on this. When I try to preview any of the animations on this character, it seems to always drop to fetal position. I've verified it's humanoid rig, so guess only choice is to reach out to character asset developer to see if he has any clues.
     
  2. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I have a question on movement. I see there is a choice between walk and run for movement. What if I want an AI to normally walk, per this setting, but to run when in combat?
     
  3. GWStudio

    GWStudio

    Joined:
    Sep 27, 2016
    Posts:
    109
    Hi ... Can this AI hear !!!??? for example bullet sound to know the player position i am using RFPS??
     
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, a box collider allows for more control over each axis rather than just an overall radius.
     
    Deckard_89 likes this.
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    It sounds like you are trying to retarget animations. If your AI is sinking below the ground, this is an indication that the animations are not working correctly with that model. I'm not sure of your exact setup, but this guide may help you get things working correctly.

     
    Akshara likes this.
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    The movement option is for non-combat movement only. If this setting is set to walk, the AI will walk to its destination. Run is always used when an AI is in combat.
     
    wood333 likes this.
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there,

    AI cannot hear yet, but you can fake it by adding a trigger collider to your bullet and having it trigger a flee if it's within range of a nearby AI using the collider's radius.

    This allows an AI to flee if it's within the collider's radius. To set it up, use a Sphere Collider with Is Trigger set to true. Adjust the radius of the sphere collider to determine how far it will affect the AI.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using EmeraldAI;
    5.  
    6. public class FleeFromSound : MonoBehaviour
    7. {
    8.     private void OnTriggerEnter(Collider other)
    9.     {
    10.         if (other.GetComponent<EmeraldAISystem>() != null)
    11.         {
    12.             EmeraldAISystem m_EmeraldAIComonent = other.GetComponent<EmeraldAISystem>();
    13.  
    14.             if (m_EmeraldAIComonent.ConfidenceRef == EmeraldAISystem.ConfidenceType.Coward)
    15.             {
    16.                 m_EmeraldAIComonent.CurrentTarget = transform; //Sets the target to flee from
    17.                 m_EmeraldAIComonent.EmeraldBehaviorsComponent.ActivateCombatState(); //Activates the proper settings to flee
    18.             }
    19.         }
    20.     }
    21. }
     

    Attached Files:

  8. pjccccc

    pjccccc

    Joined:
    Oct 7, 2015
    Posts:
    43
    Hi, I'm trying to integrate your plugin, but it works perfect with scene object (instantiated by scene, without script)
    but it does not works with runtime instantiate objects.

    Enemy just follows player and never attacks.

    Everything is perfectly same between 2 objects, because they're just prefab and prefab on the scene.

    How can I check what's gone wrong?
     
  9. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there,

    See the Spawn Companion AI Example for an example on spawning AI during runtime. You need to ensure an AI is properly setup with animations and all needed settings. You must go through the Emerald AI Setup Manager (Window>Emerald AI>Setup Manager) if you haven't already done so. Are you receiving any errors? What exactly isn't working?
     
  10. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    @BHS any eta on 2.3 (what i have been waiting for since December). Months? Weeks?​
     
  11. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    This is why it's difficult for publishers to give ETAs. :)

    I'm hard at work on Emerald AI 2.2.2. The most notable feature with this update will add switchable melee and ranged combat. When this was added, it added many more animations that an AI could use. This made manually applying animations to AI that shared the same rigging and animations very tedious, which is common in a lot of projects. So, I needed to improve the workflow and animation applying process.

    What I've been working on is a built-in system that exports and stores all of an AI's animations and animation settings to a scriptable object, called an Animation Profile, that can be imported to other AI that share similar rigging or animations. Animation Profiles can also be altered once saved. I will also be added an additional profile for saving an AI's settings to be imported to other AI as well. This drastically increases the speed in which AI can be created, especially for users with 100+ AI that all share the same animations.

    This all required some time to figure out the best way to go with handling this limitation, but now I have a solid direction on a solution and I will release version 2.2.2 as soon as possible. This was essential to have finish before version 2.2.2 was released as the new total animation count will be nearly 70 animations.

    I will go more in-depth with this with an official status update within the next couple of days.
     
    julianr, Akshara, magique and 2 others like this.
  12. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Well that is a step toward what you were saying about 2.3. Cant wait!
     
  13. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BHS I have 2 issues. I'm setting up some companion AI and I've enabled the Head Look feature and have the Head transform assigned, but the AI never looks at the player. Second, even though I don't have any footstep sounds in the list, I keep getting the following errors when I run:

    'Torr-AI' AnimationEvent 'LeftFootDownEvent' has no receiver! Are you missing a component?
    'Torr-AI' AnimationEvent 'RightFootDownEvent' has no receiver! Are you missing a component?
     
  14. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    1. Is the companion AI a humanoid model? Head Look is IK-driven so it only works on humanoids I think.

    2. Your animations probably just need to have events removed, even if sounds are not applied in the list.
     
  15. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Yes, it is humanoid.

    Ahh, I did use some animations that had some events on them and didn't realize it. My mistake.
     
  16. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Make sure your companion's Player Tag is properly assigned. Without this, the AI will not look at the player using the head look feature.
     
  17. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    The Companion's Player Tag is set to Player and the Player's tag is Player.
     
  18. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Strange, I just did a quick test with a few different companion AI and everything is working on my end. Are your AI's Max Head Look Distance and Angle Limit set high enough?
     
  19. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I just left it with the defaults.
     
  20. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    Just curious is there a way that the AI will act more dynamic? they just stand there and attack.
     
  21. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197

    Hey, i use the code,and it works, but there is a problem;the animal begins to flee but stops immediately.Is possible to increase the flee distance when the animal is scared too?Thanks
     
  22. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Well, I copied my prefabs of the AI from one project to another and they are suddenly working now with the head look. I had to tweak the settings to get the proper height and angle, but it's working.
     
  23. pccross

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    106
    I noticed earlier in the forum, there were references to getting Emerald working on non-humanoid AI's. Are there example tutorials for that? Know it's much more complicated due to navmesh mechanics, but hoping to apply it to something like an in-game drone type object that follows or fires at player.
     
  24. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I just did the Invector integration and I get this error message:

    Assets/Emerald AI/Scripts/Components/EmeraldAIPlayerDamage.cs(49,76): error CS0122: `Invector.vCharacterController.vMeleeCombatInput.meleeManager' is inaccessible due to its protection level

    Using Emerald 2.2.1 and Shooter 1.3.0 in Unity 2018 3.6
     
  25. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Check if the fubction vMeleeCombatInput.meleeManager is marked public. If not, try making it so.
     
    wood333 likes this.
  26. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    On closer examination I may be running Invector version 1.2.3. What versions of Shooter is the Emerald 2.2.1 integration compatible with?
     
  27. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Hi @BHS Ive got serious problem using Emerald at the moment. Setup manager is not working on my AI character. This would not be so bad but for some reason it also ruined my prefab character! I had 3 lods on char and after attempting emerald setup it removed 2 lods leaving just the high detail lod. This is an Iclone 7 character rigged and setup and working fine on its own in unity. Setup did not even add any untiy components. Have you encountered this before and any idea how to fix it?
     
  28. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BHS How do we get this auto scaling UI to work? I don't see any setting for turning this on and my UI are definitely not scaling. When the AI gets close to the camera, the bar and text are so big.
     
    SickaGames1 likes this.
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Enabling aggro can help AI act more dynamic, but I'm working on improving this with the next update.
     
  30. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, by increasing the Expanded Flee Distance located under the Detection Options.
     
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Non-Humanoid models shouldn't be much different. Just apply some sort of movement animations and increase the AI's Agent Base Offset (located under the NavMesh Settings Tab) to a negative value to allow the AI to hover.
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I'm not sure of the exact version that was used, but everything should be working. I have no way of getting a previous version of Invector so I will test the newest version, version 1.3.1, and update the tutorial if needed.
     
  33. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Very strange, this is the first time I've heard of this. All the Setup Manager does is find the references to the model's LODs and assign them to the Emerald AI's LOD slots. It does break the prefab connection with newer versions of Unity because this is required when modifying a prefab. However, this has never been an issue and was tested extensively. Since the components were never added, something must have stopped it from finalizing the setup process.

    Did you receive any errors when this happened? What version of Unity are you using? I will see if the issue can be recreated.
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    The scaling is based off of the player's distance from the camera with a minimum and a maximum cap on the distance so it won't scale larger or smaller than a value of 40 for the maximum and 10 for the minimum. Modifying these values will allow you to scale the UI as needed. This is located in the EmeraldAIHealthBar script around line 60.
     
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    OK, I'll take a look. For me, when I'm right next to an enemy, the health bar is so big it covers from one side of the display to the other. It's huge.
     
    SickaGames1 likes this.
  36. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Yeah I get the same thing.
     
  37. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    the problem is that immediately after begin to flee ,the animal stops,never reaches the max distance(with the bullet scare script)).My settings

    Screenshot_77.png
     
    Last edited: Jul 24, 2019
  38. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I found the problem. Here is the code you referred to:

    Code (CSharp):
    1.                 if (dist < 40 && dist > 10)
    2.                 {
    3.                     canvas.transform.localScale = new Vector3(dist * 0.085f, dist * 0.085f, dist * 0.085f);
    4.                 }
    5.                 else if (dist > 40)
    6.                 {
    7.                     canvas.transform.localScale = new Vector3(40 * 0.085f, 40 * 0.085f, 40 * 0.085f);
    8.                 }
    9.  
    This causes scaling to occur only for anything > 10 distance. So if the AI is closer than 10 then no scaling occurs. If I change to the following then it works as expected:

    Code (CSharp):
    1.                 if (dist < 40)
    2.                 {
    3.                     canvas.transform.localScale = new Vector3(dist * 0.085f, dist * 0.085f, dist * 0.085f);
    4.                 }
    5.                 else
    6.                 {
    7.                     canvas.transform.localScale = new Vector3(40 * 0.085f, 40 * 0.085f, 40 * 0.085f);
    8.                 }
    9.                
     
    SickaGames1 likes this.
  39. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    @BHS Good! Now he can update his code!
     
  40. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    As I see it in Shooter version 1.3.1, vMeleeManager has the protection level of "protected"
    Since the error is thrown 4 times based on the code provided by BHS accompanying his upgrade vid I will leave it to him to make an official solution. Looks like you correctly identified the crux of the problem.
     
    Last edited: Aug 13, 2019
  41. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    @BHS Any idea when we will see what changes 2.2.2 brings?
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks, I'll get this applied to the next version update.
     
    magique likes this.
  43. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    There may be changes to the newer version of Invector. I will be going over it soon to update the code where needed.
     
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I will be posting a status update sometime today discussing the update I've been working on. There's a lot of awesome features and improvements coming.
     
    AaronVictoria and SickaGames1 like this.
  45. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    @BHS looking forward to the updates and fixes!
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I'm posting the status update now. :)
     
    AaronVictoria likes this.
  47. BHS

    BHS

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

    First off, my apologies this update is taking so long. The switchable melee and ranged combat feature required quite a bit of rewriting to several major sections of the system in order for everything to function smoothly. I don't believe this update will require Emerald AI to be removed and reimported. For those who don't want to read everything, the spells and abilities system will be available with the next version. This update also includes the switchable range and melee combat as well as the addition to Animation Profiles.



    I will discuss everything regarding this updated in-depth below:

    When adding the additional animations, this took to the total animation count to nearly 70 animations. Apply animations manually every time took way too long. So, I designed an Animation Profile system that allows users to export all of an AI's animations to a scriptable object (called an Animation Profile) which can then be imported to another AI that is compatible with said animations. This includes all animation settings including speeds and mirroring.

    When an Animation Profile is created, it copies all of an AI's animations and animation settings. These objects simply store all the information to be copied to other AI so the animations don't have to be applied manually. Animation Profiles can be modified manually, if desired. They will just need to be imported for the changes to be applied.
    AnimationProfileImporting.gif

    The next issue was the way the projectiles were designed. They were dependent on individual AI and needed to be edited within the Emerald AI editor. It also required having to manually update the projectile each time you made a change which made it difficult to share projectiles between multiple AI.

    To fix this, I went back to my initial concept the of spells and abilities system I designed last year. This allowed all of a projectile's information to be stored using a scriptable object and could be shared between multiple AI. It also allowed for much more complex options and functionality because the projectiles weren't confined to the Emerald AI editor.

    How the new spells/ability system works is, each AI has 3 sets of lists; one for Offensive abilities (projectiles such as spells, arrows, bullets, etc), one for Support abilities (healing and healing overtime), and Summoning abilities (the ability to summon other AI to help the caster fight). The logic in which these abilities are picked is handled internally to maximize an AI's ability to survive such as choosing to heal over casting an offensive ability when the AI's health is low, given the AI has support abilities. Each ability category has settings to specify which abilities are in said categories. Users can share abilities between other AI. Each Ability Object can be customized with effects, sounds, timers, amounts, and more. These will be expanded over time with future updates to include area effects, shields and protection abilities, and more. I'm more than happy to take requests and suggestions to improve and build upon this.

    Healing
    HealingAbilityCompressed.gif

    Summoning
    SummoningOffensiveAbilities.gif

    AbilitiesCategories.png
    AbilitiesEditors.gif

    The projectile system's calculations have all be redone to function properly. Previously, projectiles would sometimes not explode on collision, fly in a random direction if a target was killed before it met its target's destination, and more. Now, if an AI's target happens to die or be out of the AI's ranged firing angle, the projectile will continue to travel toward the last visible/available position until it times out or collides with another object. Projectiles with the 2.3 version now function perfectly.

    I'm hoping to have this update submitted as soon as possible. Future updates will include breeding functionality, improved faction system, and more spells and abilities. Like always, this, and future updates, are free.

    Updated: More information regarding the upcoming animal needs system available with version 2.3 that allows AI to generate waypoints to resources/food sources: https://forum.unity.com/threads/rel...lls-blocking-more.336521/page-73#post-4882796
     
    Last edited: Aug 22, 2019
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BHS The update looks fantastic. The Animation Profile is one I am really happy about. Great job.
     
    BHS and julianr like this.
  49. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Oh baby. I hope Unity reviews this fast. It looks awesome. I don't use magic in my current project but I can see how these can be used to add functionality that I was trying to build manually, like AI calling for backup and AI using medkits to heal. Good job!

    @BHS Is there any easy way to integrate Tony Li's LoveHate for use within or as a replacement for factions? Dox maybe?

    Mark
     
  50. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Nice job @BHS now for 2.3 with boss fights AI. Cant wait!
     
    BHS and julianr like this.