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
    Hey everyone,

    Emerald AI 2.3.1 has been accepted and is now live!

    2.3.1 Release Notes
    New Features
    • Added a brand new example character controller. This is a top-down style similar to Diablo. It features adjustable attack speed, critical hits, various sound effect options, built-in target indicators, and is fully implemented with Emerald AI's new Combat Text System and Camera Shake system.
    • Added global Combat Text System which replaces the previous individual combat text system. The new system has been updated to Unity's newer UI system, can be globally controlled with the Combat Text Manager, detects critical hits, AI healing, player damage, and tons more. It also has 5 options for text animation and various settings for controlling speeds, sizes, and colors.
    • Added an option for melee AI to have critical hits.
    • Added an option to adjust the critical hit odds and damage multiplier for successful melee critical hits.
    • Added a Camera Shake system that can be called on using: CameraShake.Instance.ShakeCamera(float ShakeTime, float ShakeAmount); This is useful for critical hits, but can also be used for other custom mechanics. This requires dragging the Camera Shake System prefab into the scene to be used.
    • Added various new sound effects, new abilities, and new spell effects.
    • Added various font styles to demonstrate the new Combat Text System.
    Improvements
    • Rewrote the way the single mesh Disable When Off-Screen feature was handled to be more reliable and efficient.
    • Added an option to allow AI to be disabled on start. Previously, all AI would be enabled on start until they were culled or not visible by the camera.
    • Added an option to control if an AI will attack with its melee attack right when it arrives or wait for its attack speed to calculate an attack (This only happens on the arrival of an attack).
    Fixes
    • Fixed an issue where non-heat seeking projectiles would hit the base of the player (their feet) instead of the center of their collider.
    • Fixed an issue where the damage over time effect spawned incorrectly.
    • Fixed an issue where AI would sometimes play a ranged attack animation and not use an ability.
    • Fixed an issue where damage was being generated per animation instead of per hit, when using a melee animation with multiple damage hits.
    • Fixed an issue where an AI would sometimes fire a projectile in the wrong direction, if the AI's aggro made it switch targets mid attack.
    • Fixed an issue that didn't allow the Start Combat Event to trigger if using the First Detected detection type.
    • Fixed an issue that allowed impact sounds and hit effects to play after an AI had died.
     
  2. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Strange. You can try setting the starting destination of the currently spawned AI right when the AI is spawned using:
    Code (CSharp):
    1. SpawnedObject.GetComponent<EmeraldAI.EmeraldAISystem>().StartingDestination = SpawnedObject.transform.position;
     
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks, I'll look into this and get a fix added with the next update.
     
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there, how are you damaging the AI? Are you using the Damage function? An AI will only play a hit animation (if this is the animation you are referring too) if the AI is stationary and not currently attacking.
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    1) This would need to be handled with a simple script that temporarily stops the companion AI from following its follower as the companion's destination is continuously updated to follow its follower. There's an included system that allows an AI to search for "resource" objects, go to the detected object, and play an animation. You could use this system when the above mentioned script stops the companion AI from following its follower.
    2) Not currently, but I can look into adding a couple different following types for companion and pet AI with a future update.
    3) I do plan on adding a feature for AI to look for cover spots within the next update or two.
     
    SamRock likes this.
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    To clarify, if you do not call SetDestination, the AI will not detect the player or move? This may be how the AI sets its destination within the EmeraldAIInitializer script. When generating dynamic destinations, a raycast is fired downwards from the world up position which would make this unreliable for a spherical word. Custom destinations could be set using a custom script that uses the direction of your spherical world. If you could please post a few screenshots of your generated navmesh in your scene, it would help me get a better understanding of what might be happening.
     
    SamRock likes this.
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Currently, there are two types of target detection, first detected and the closest detected target. I have plans to add more detection types with the next update such as randomly picking between the currently detected targets.

    For now, here's a script that will allow AI to randomly pick from targets within their detection radius when they enter combat. This is triggered using an OnStartCombat event. Simply attach it to the AI you'd like to have their detection type overwritten. There's also a delay variable to allow other targets to get within range so the AI doesn't pick the first detected target.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using EmeraldAI;
    5.  
    6. public class SwitchToRandomTarget : MonoBehaviour
    7. {
    8.     public float CallDelay = 1;
    9.     EmeraldAISystem EmeraldComponent;
    10.     Coroutine RandomTargetCoroutine;
    11.  
    12.     void Start ()
    13.     {
    14.         EmeraldComponent = GetComponent<EmeraldAISystem>(); //Get a reference to this AI's Emerald AI Component
    15.         EmeraldComponent.OnStartCombatEvent.AddListener(() => StartGetRandomTarget()); //Create an event that triggers when the AI starts combat
    16.     }
    17.  
    18.     void StartGetRandomTarget ()
    19.     {
    20.         if (RandomTargetCoroutine != null){StopCoroutine(RandomTargetCoroutine);} //Stop the courtine if it's already running
    21.         RandomTargetCoroutine = StartCoroutine(GetRandomTarget()); //Start the GetRandomTarget courtine
    22.     }
    23.  
    24.     IEnumerator GetRandomTarget ()
    25.     {
    26.         yield return new WaitForSeconds(CallDelay); //Delay the call so the first detected object isn't assigned
    27.         if (EmeraldComponent.CurrentTarget != null)
    28.         {
    29.             EmeraldComponent.EmeraldDetectionComponent.SearchForRandomTarget = true; //Enable the SearchForRandomTarget bool which allows the SearchForTarget to look for a random target.
    30.             EmeraldComponent.EmeraldDetectionComponent.SearchForTarget();
    31.         }
    32.     }
    33. }
     

    Attached Files:

    Akshara likes this.
  8. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    Thank you for responding!!
    For 1) Do you have any examples that I can follow? What Events do I capture to make this work?

    2)Would love to have such an option!! Thank you so much :)
    3) Awesome! You made my day :)
     
  9. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    @BHS Roadmap for next update?
     
  10. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Casting bars for spells or abilities would be awesome for the AIs
     
  11. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    low poly fps pack integration would be awesome as well.
     
  12. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    Low poly fps isnt a controller.... its just animations with a basic mini demo controller.
     
  13. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BHS I checked the latest version and it still has the issue where if I set TotalAttackAnimations to 0 in a script that the AI still randomizes an attack and performs the attack. By being able to set this to 0 in script, but still have attacks in the list, it makes it possible to script phased boss battles and control attacks. It's not a hard hack to fix, but if we can have it in the next version that would be great.
     
    AaronVictoria and SickaGames1 like this.
  14. AaronVictoria

    AaronVictoria

    Joined:
    Aug 21, 2010
    Posts:
    176
    Yea I had to do my own little hack for that and I'm still using it. Would be nice to have some native control over that would be nice.
     
    magique and SickaGames1 like this.
  15. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Hi, i have a tarantula AI which is firing green slime balls at the player. Sometimes it works, but the most time not. Then i can see the slime ball under the tarantula firing, but its not flying at the player. Having this problem with other ai`s too which are firing other projectiles. Never got ranged attack to work steady. What could be wrong ? Thank you.

    Projectile working fine_2.jpg
    Projectile under ai_2.jpg

    I have reduced the size of the box collider, but nothing helped.
     
  16. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Are the projectile and enemy layers set to collide in your physics settings?
     
  17. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
  18. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
  19. micuccio

    micuccio

    Joined:
    Jan 26, 2014
    Posts:
    143
    Hi there!
    I am trying to make the AI "faint" by using the ragdoll system. How can I call via script?
    Thanks in advance!

    Dom
     
  20. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    151
    Hi,
    I was trying to follow


    to setup my AI but the options I had were less. Why is that? I'm using the latest version 2.3.1.
    Screenshot 2020-01-10 at 20.55.36.png
     
  21. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    Looks like half f your inspector is off screen. Try docking it to a other side of the screen
     
    lolaswift likes this.
  22. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    151
    Thanks!. That's the reason.
    But docking it to the other side didn't help. I had to change my resolution but that's not what I want. Everything became so small. Hard to see anything. There is no scrollbar? I've used so many assets. It's the first time like this for me.

    Screenshot 2020-01-10 at 21.52.46.png
     
  23. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    I doubt you are going to get any quick response here. You should head to Black Horizon Studio's Discord page. They are quite active there
    https://discordapp.com/channels/580130304174456842/580138530383331328
     
    lolaswift likes this.
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    It might be your Ranged Attack Transform. It may be in a position that's too low which would make it collide with the ground before reaching its target. Try using a different transform that's higher. Did you add any other colliders to your projectiles? This could also be the cause of the issue. A video of the issue would help me better understand what's happening though.
     
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I haven't tested enabling the ragdoll components while the AI is still active, but you can try using:
    Code (CSharp):
    1. YourAI.GetComponent<EmeraldAI.Utility.EmeraldAIInitializer>().EnableRagdoll();
     
    combatsheep likes this.
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    What version of Emerald AI are you using? This was fixed a little while back. It's because the pixel difference with 4k monitors.
     
    SamRock and lolaswift like this.
  27. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    151
    thx for your attention. I downloaded it yesterday and it should be 2.3.1. Where can I see the version?
     
  28. AdminArdagor

    AdminArdagor

    Joined:
    Feb 6, 2018
    Posts:
    42
    Hi BHS !, can we expect an increased number of animations in the next update?
     
    AGregori and dsilverthorn like this.
  29. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    198
    It is, but you have to do some coding. There's only really two pieces you need to modify. I'm using older versions of both packages, but integration is likely similar. If you look in the docs for both packages, you'll see the updated code blocks you need to add.

    In for horror, locate the weaponcontroller.cs, in the bulletmark method, you want to add something similar to this:

    Code (CSharp):
    1.  
    2. if (hit.collider.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>() != null)
    3.  
    4. {
    5.  
    6. hit.collider.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>().Damage(damage, EmeraldAI.EmeraldAISystem.TargetType.Player, player.transform, 400);
    7.  
    8. }
    9.  
    In the emerald package, in emerald_ai.cs, my version has a damageplayer method, you need to add code similar to this:
    Code (CSharp):
    1.  PlayerGameObject.GetComponent<HealthManager>().ApplyDamage(DamageToPlayer);
    The more difficult challenge is actually the save game portion, you have to add an object dictionary to emerald_ai to collect data and then set the data (position, alive or dead, health, etc). Then you have to modify the saveobject.cs from hfps to add emerald as a new savetype. If you need to code, let me know and I can provide you what I have for it, but my versions are older (emerald 2.0 and hfps 1.42). Something to keep in mind is that once you start modifying the packages, you orphan yourself from being able to upgrade without going back and updating your modifications.
     
    lolclol likes this.
  30. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    Thankyou for replying @cloverme. I have sent you a pm.
     
  31. micuccio

    micuccio

    Joined:
    Jan 26, 2014
    Posts:
    143
    Thanks! I will try and let you know!
    thanks again :)
     
  32. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Has anyone integrated opsive ultimate controller?
     
  33. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    SickaGames1 likes this.
  34. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    575
    how to make a flying ai i wonder?
     
  35. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    The Asset Store should tell which version you are currently using.
     
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, I will be increasing all animation lists to 6 animations and redoing the faction system with the next update.
     
    dsilverthorn and SamRock like this.
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    It should wander and generate waypoints using the Dynamic Wander Type.
     
  38. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    The ability to have NPC sit?
     
  39. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    Could we get the option to use an event for inflicting damage in a future update? In combat events, currently we can specify a receive damage event (and attack event), it would be great to also use an inflict damage event (or however you wish to word it). So then we could play an animation of the enemy taunting, or make him less aggressive or whatever you want really, many possibilities would be opened up just from that one option.
     
  40. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I have a DamageAI action in my Playmaker integration if you are interested in going that route. The integration can be downloaded from the following forum post:

    https://forum.unity.com/threads/rel...ality-ai-solution.336521/page-89#post-5132540
     
    Deckard_89 likes this.
  41. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    Thank you, but I have damaging AI working already. I think I should explain it better:
    When the AI damages a target (e.g player), then call an event. Currently, we can call an event if the AI attacks or gets damaged itself.

    I could find a way around this of course, but it would be a time-saver if implemented.
     
  42. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    To me, this is better handled by the Player Controller itself since it is the one getting damaged. What controller are you using?
     
  43. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    @magique I am just using Unity's character controller with Adventure Creator. What I was thinking is, the AI would earn "XP" when it makes contact using it's attack. But, I can no doubt find ways around this if it is never added.
     
  44. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Well, in order to damage the player, you have to modify the DamagePlayer script anyway, so you can easily put the code right there to tell some global GameManager class how to handle it.
     
    Deckard_89 likes this.
  45. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    having issue again where my ai wont die :( log states they are dead but they just slide along any ideas? [RESOLVED]
     
    Last edited: Jan 13, 2020
  46. Neviah

    Neviah

    Joined:
    Dec 1, 2016
    Posts:
    235
    My AI will shoot at the Players feet no matter what I try. I raised the player offset like in the picture below which is represented by the green line (top one), but the AI will ALWAYS fire along the yellow line (bottom line). What do I do?
     

    Attached Files:

  47. Kojote

    Kojote

    Joined:
    May 6, 2017
    Posts:
    200
    Hi!

    I'm trying to get the enemy's ad in a canvas ad. So I don't want to have the health meter above the enemy directly anymore.

    Question of mine would be, where can I read out, which target is currently active and how do I get his values from the target for the display?

    Hope you can help me further.

    Greetings from Kojote
     
    Last edited: Jan 14, 2020
  48. unity_dev3194

    unity_dev3194

    Joined:
    Apr 17, 2017
    Posts:
    79
    @BHS Hello, what is the current state of compatibility with Malbers animal assets? I was hoping to use them with Emerald for the purposes of companion AI and also with Crux Spawner for general fauna.
     
    Last edited: Jan 16, 2020
    dsilverthorn likes this.
  49. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    For some reason my ai wont damage each other, they attack but no damage is taken :( Update (AI will only cause damage to each other if neither are companions, if one is a companion no damage is done to either parties
     
    Last edited: Jan 20, 2020
  50. bran76765

    bran76765

    Joined:
    Jul 14, 2018
    Posts:
    26
    Hi all,

    Just wondering, approximately how many AI ingame are supposed to be used before emerald AI starts becoming a real bottleneck? Because I can only get up to ~500 AI before the AI themselves are taking about 10-15ms on the server and for any type of multiplayer game that's supposed to have dynamic AI, this seems pretty low. (500 seems high at first but if you're on an 8kx8k island and spread them over it, you barely encounter one every 10m if you're constantly moving. Also there is other stuff that needs computations as well-not just AI)

    Are there any plans to increase performance? I'm looking to have about 1k AI on my land (and it'll increase if the map gets bigger) but this doesn't seem feasible atm.
     
    dsilverthorn and ashishkushwaha like this.