Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

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

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

  1. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    You can't just replace the controller. Emerald builds a specific controller based on the animations you've selected when you create the AI.
     
  2. pccross

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    92
    I kind of thought that based on my past experience. I can't figure out why none of the other controllers cause my player to sink into the ground, only the Emerald AI controller causes it.
    It seems similar to this issue:
    https://answers.unity.com/questions/398465/character-falls-thru-to-his-waist.html

    That link alludes to what you mentioned earlier about the missing avatar. But that is fixed now, and I'm still having the same issue. It mentions possibly removing a 'bad' Idle animation from the controller.
    How would I remove that from the controller Emerald creates?
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    You should verify that your idle animation actually works with your AI character. If you click on the animation and hit play in the inspector preview, does it work? You can drag the fbx model of the character into the preview to make sure it is previewing the character you are using the animation for.

    It might be that you have the animation using a different avatar than the one your AI is assigned to as well. Or that the animation is Legacy and needs to be Generic or Humanoid.
     
  4. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    386
    Click on your character in scene, and click on the animator controller in the animator field. It should show you the animator controller in the hierarchy. If you click / double click on that, it should open the animator window and from there you can click on the idle animation holders. Each will show the animation that is assigned.

    I would look for animations that are either blank or not set to humanoid. Assigning a Legacy or Generic animation to a Humanoid character results in "the fetal position". Knees come up, arms are bent, Y position sinks down....
     
  5. pccross

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    92
    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.
     
  6. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    642
    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?
     
  7. GWStudio

    GWStudio

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

    BHS

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

    BHS

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

    BHS

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

    BHS

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

  12. 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?
     
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,010
    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?
     
  14. SickaGamer

    SickaGamer

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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,010
    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.
  16. SickaGamer

    SickaGamer

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

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    @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?
     
  18. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    202
    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.
     
  19. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    Yes, it is humanoid.

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

    BHS

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

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    The Companion's Player Tag is set to Player and the Player's tag is Player.
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,010
    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?
     
  23. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    I just left it with the defaults.
     
  24. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    164
    Just curious is there a way that the AI will act more dynamic? they just stand there and attack.
     
  25. 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
     
  26. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    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.
     
  27. pccross

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    92
    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.
     
  28. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    642
    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
     
  29. Mad_Mark

    Mad_Mark

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

    wood333

    Joined:
    May 9, 2015
    Posts:
    642
    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?
     
  31. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    869
    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?
     
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    @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.
     
    SickaGamer likes this.
  33. BHS

    BHS

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

    BHS

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

    BHS

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

    BHS

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

    BHS

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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,010
    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.
     
  39. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    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.
     
    SickaGamer likes this.
  40. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    789
    Yeah I get the same thing.
     
  41. 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
  42. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,633
    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.                
     
    SickaGamer likes this.
  43. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    789
    @BHS Good! Now he can update his code!
     
  44. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    642
    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
  45. SickaGamer

    SickaGamer

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

    BHS

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

    BHS

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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,010
    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 SickaGamer like this.
  49. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    789
    @BHS looking forward to the updates and fixes!
     
  50. BHS

    BHS

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