Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[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,760
    Interesting, I’ll take a look and see if I can recreate this. You said this was only happening when you were off the NavMesh or is it always happening when the target gets out of range?
     
  2. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Death sounds need to be created with a PlayDeathSound animation event. Please see the documentation’s Animation Events section for a tutorial on creating one.
     
  3. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    Having issues with the switching from melee/ranged. sometimes when the target gets into melee range, the AI doesn't switch and vice versa
     
  4. DonYep

    DonYep

    Joined:
    Jan 23, 2019
    Posts:
    7
    Hi,
    I need an example of how to use Range & Melee switching functionality. I have been trying hard to get this to work with no success.
    Thanks.
     
  5. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Ouch, there are much more animation events then i have thought. I must read the docs better, sorry :oops:, works fine now.
    Thank you.
     
    Last edited: Sep 22, 2019
  6. lazyfly75

    lazyfly75

    Joined:
    Oct 5, 2018
    Posts:
    5
    Hi,
    maybe I've overseen something. but is it possible, that my animals only walk around over water level?
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Everything is working correctly. What you are seeing the switch delay. By default, it’s set to 5 seconds, which means it will take 5 seconds before the AI will attempt to switch between ranged or melee. This is to prevent the AI from switching weapon types too often. You can disable this by setting the delay seconds to 0.
     
  8. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    I am having issues with the weapon switch as well. Is there a field to assign the weapon to switch to/from? My editor does not show it, so if I use the En/DisableWeapon event in an animation, they play the anim, but there is no weapon object.

    If I add an En/DisableItem event with the correct integer in the event, it works, but bitches about not having a weapon enable / disable event on the animation.


    upload_2019-9-22_12-48-35.png

    Am I missing something, or is there a field missing in the editor? The tutorial link takes me to the general Google doc, but there isn't specific info for weapon switching. The Ranged section in the docs (below) shows the transform for the weapon.

    upload_2019-9-22_12-51-23.png
     
  9. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    When is the update to fix the bugs?
     
  10. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Other observations:
    • I typically use a "Weapon Holder" empty game object to keep my weapon selection in. Keeps the player hierarchy organized. Seems a good place to put weapon switching code, like an array of melee & ranged weapons to choose randomly from when going to each mode.
    • I would also like to be able to have NO weapon when going melee, so I have duplicated a "Draw Weapon" anim, shortened it to 40 frames, and tell it to enable or disable weapon 99, so it won't actually enable or disable anything. I _THINK_ it works (no errors), but the en/dis able doesn't seem to pass the int at the moment...
    • I have taken out the enable/disable item event, as errors were still propagating regarding no en/dis weapon. I have enabled the weapon object, so melee switching, the AI still has the weapon out. Not attractive, but OK while I work on other things.
    @SickaGamer BHS has been positive and supportive. He needs the feedback first. Do you have any bugs to report, or solutions to offer? Bug fixes will be along as they are completed.

    Mark
     
  11. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Also, when playing idle sounds, the volume starts right, but midway through the clip drops to about half. Very odd.
     
  12. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    @BHS Where is this switch state that you speak of? Is this the "SwitchWeaponTypesCooldown"?
     
  13. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    its not the delay. something else aint working. I find if I don't use a equip/unequip animation, the AI is stuck using Ranged animations regardless of distance. and if I use those animations, then he does use ranged animation at all? ive tried numerous configurations with the settings this last hour to no avail. he stands at ranged, in the ranged Idle animation state, and does nothing. if I Move in close, he switches to melee and attacks.
     
  14. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    OK, I am pretty sure that it is an unexposed field.
    I added an empty WeaponZero script to my ranged weapons and added:
    Code (CSharp):
    1.  
    2.             RangedWeaponObject = GetComponentInChildren<WeaponZero>().gameObject;
    3.             Debug.Log("RangeWeaponobject set to: " + RangedWeaponObject);
    4.             //WeaponObject.SetActive(false);
    5.             RangedWeaponObject.SetActive(false); // Disable it after it is assigned.
    6.  
    to the Awake function in EmeraldAISystem.

    I then changed my EnableWeapon and DisableWeapon events on each equip/unequip animation to use a string.
    "Ranged"
    That seems to fix it.
    I also added a Muzzle object to each weapon and moved that forward a bit to avoid collisions, rotated it so blue is forward. It now enables and disables the weapons, and shoots the projectile in the right direction.

    I am pretty sure tha is all the mod I did to get it working, but I tinkered a lot, hope I didn't miss anything...
    Mark
     
  15. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Take videos of your project and settings so @BHS can see it in action. Bandicam is great for that
     
  16. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    There's not much to see from a troubleshooting perspective on this Melee/Ranged enabling issue. The magic is in the code provided. The two variables WeaponObject and RangedWeaponObject were already there, just not being assigned to anything. Once I set that up, and removed all my other code from many, many unfruitful attempts, it all just works.

    The AI Companions start with no weapon, when an enemy approaches, they play their equip animations, and when the EnableWeapon fires, their weapons become visible. When they kill the bad guy, or get within melee range, they run their unequip anim and when the disable weapon event fires, weapons are gone.

    Mark
     
  17. metaldc4life

    metaldc4life

    Joined:
    Sep 26, 2014
    Posts:
    179
    @BHS Have you hear anything as to getting the bow to work from the dev???

    Thank You.
    Still having a lot of trouble..
     
  18. AdminArdagor

    AdminArdagor

    Joined:
    Feb 6, 2018
    Posts:
    42
    Hi @BHS! please can I get help, how and where in the Emerald code (cs scripts) can I correctly increase the number of attack animations, combat attacks and hit animations?

    An excellent version 2.3 has already been released, but the limited number of available animations does not allow it to be fully used :(:(:(:(:(:(:(:(:(:(:(:(
     
    Last edited: Sep 23, 2019
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Strange, it looks like your Damage Settings are not updated to the current version, but the Animation Settings are. The below screenshot is what it should look like. Maybe this is part of the problem.
    UpdatedDamageSettings.png

    As for enabling and disabling the AI's weapon, you need to use an Enable/DisableWeapon event. The system checks for this Animation Event on the Equip and Unequip Animations when the Use Equip Animations is enabled. The Enable/DisableWeapon has been updated to state what weapon state you are enabling or disabling with the string parameter. I had planned on updating this on the documentation so my apologies for the confusion.

    UpdatedEnableWeaponAnimationEvent.png

    While checking this, I noticed there's a bug when using the Both Weapon Type option as the Melee and Ranged Weapon Objects are not visible within the Emerald AI Editor so this is in fact a bug. I will get an update out asap to address it.
     
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Thanks for the added information.

    When using the Equip and Unequip animations, you need to need to use an EnableWeapon or DisableWeapon Animation Event. The weapons that are enabled or disabled are based on the Weapon Objects set within the editor. However, I noticed there was a bug when using both weapon types, as mentioned above.

    It was assumed that when an AI is enabling or disabling their weapon, it would be constant, which is why there is only an option or 1 melee weapon and 1 ranged weapon. I can improve this by allowing users to use the Item list to choose which item they would like enabled.

    The system adjusts the volume based on the current animation event being called. There are 2 AudioSources so in the instance that one is being used, it will fallback on the secondary AudioSource. It sounds like too many sounds may be happening at once. How many Animation Events do you have going when this is happening?

    It should be here, when using Both Weapon Types.

    SwitchWeaponCooldown.png
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I look into this to see if I can recreate your issue. I'll fix it with the next update if something isn't working correctly.
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I haven't heard back from the developer yet, sorry.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    There is a cap of 3 for now, but I will be increasing this with an update very soon. Unity's code with Animators is very limited which makes it not possible to programmatically build additional states/sub-states. This has to be done manually and then added to several different portions of different scripts. I'll working on increasing the total amount of animations per sub-state after the bug fix update.
     
  24. Alex3333

    Alex3333

    Joined:
    Dec 29, 2014
    Posts:
    342
  25. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    So after seeing one of the Posts above, I never had the string value with the enable/disable animation events for Melee/Ranged. just the enable and disable events. once I put in those string values, its not working correctly. still if I don't use the equip animations, (which isn't the end of the world) the system doesn't seem to recognize the switch
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    What feature specifically? Emerald AI has adjustable field of view and allows targets to be obstructed from an AI's line of sight and fire. The object detection you see of targets that are visible and hidden is happening under the hood of the Emerald AI system and an AI will pick targets accordingly. I'm more than happy to have feedback on where these features can be improved.
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I have been able to recreate the switchable ranged and melee combat not working when not using Equip and Unequip animations. To fix this now, you will need to have the following transitions between the Combat Movement and Combat Movement (Ranged states) on the Emerald AI>Resources>Emerald Animator Controller Animator so all you have to do is regenerate your Animator Controllers instead of having to do this to all of your AI's Animator Controllers. I will fix this with the 2.3.0.2 update.

    Create a Transition from Combat Movement to Combat Movement (Ranged) with the following settings:
    FixForAnimatorControllerMelee1.png

    FixForAnimatorControllerMelee2.png

    Create a Transition from Combat Movement (Ranged) to Combat Movement with the following settings:
    FixForAnimatorControllerRanged1.png

    FixForAnimatorControllerRanged2.png
     
  28. Alex3333

    Alex3333

    Joined:
    Dec 29, 2014
    Posts:
    342
    [QUOTE = "BHS, сообщение: 4992821, участник: 13696"] Какая особенность конкретно? Изумрудный ИИ имеет настраиваемое поле зрения и позволяет целям быть заблокированными с линии обзора ИИ и огня. Обнаружение видимых и скрытых целей происходит под капотом Изумрудного ИИ-системы, и ИИ соответственно выбирает цели. Я очень рад получить отзывы о том, где можно улучшить эти функции. [/ QUOTE]
    As I understand it, reading the comments. Your system currently uses Nav mesh or Root Motion. However, there is no dynamic search path you do not have. So that the creature avoids obstacles without using Nav Mesh. This is what I meant. ))) sorry for my english))
     
  29. Karmate

    Karmate

    Joined:
    Aug 30, 2014
    Posts:
    45
    I have 3 questions:
    -What is "Neutral" Faction is for or "Friendly" ?
    -Can i make this? graminivorous small, graminivorous big, carnivorous small, carnivorous big. 4 factions.
    graminivorous big enemy run from carnivorous big but attack to carnivorous small.
    -Companion ai don't attack to coward enemies, how to solve this ?
     
    Last edited: Sep 24, 2019
  30. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    right on thx BHS, for the time being, I took a idle animation, duplicated, then cut it down to 3 frames, and used that for the switch.
     
  31. pccross

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    106
    I must be missing something obvious with ranged combat. I've used Melee combat in past projects and didn't have any issues with inflicting Player damage, but I can't figure out how to do it with Ranged combat.
    Is there a tutorial on inflicting Player damage with Ranged Combat?

    I've created the bullet Projectile Ability object (setting it to Damage) and attached it to my AI's gun object.
    This seems to work well as the animation fires correctly during attack event on target of Player, but I'm not clear on how I can then translate that into Player Damage. Do I need to add custom code in the 'SendEmeraldDamage' method within EmeraldAISystem?
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    That is correct. Emerald AI uses Unity's NavMesh for its navigation, however, I do plan on looking into additional solutions. The asset you posted is simply obstacle avoidance and not pathfinding. Emerald AI can use obstacle avoidance by attaching a NavMesh Obstacle (which does not require baking) to the dynamic objects you would like it to avoid.
     
  33. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    @BHS Do you have an idea of what 2.4 is going to consist of? :)
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    You need to create an EmeraldAttackEvent (used to be CreateEmeraldProjectile which still works) at the moment you want the projectile fired using the desired animation. A guide for this can be found here: https://docs.google.com/document/d/...s2njM7Jx9pYlqgbtM8/edit#heading=h.ifb2ybkoddb

    There's an entire guide for setting up an AI projectile/ability here: https://docs.google.com/document/d/1DJ8sc96Q3DqANYkAwDhtR5JlmhkgrcLoD92bSA5FYdQ/edit The Abilities System applies all needed scripts and components for you. All you have to do is customize the ability. There is no programming needed.
     
  35. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    1) Neutral and Friendly are the same. Their purpose is for custom functionality such as allowing an AI to be a companion, but only if the AI's faction is at the Friendly level.
    2) Not currently, but I plan on redoing the faction system soon to be a lot more versatile. I will keep functionality like this in mind while I'm redoing it.
    3) This is a bug and I was able to recreate it. I'll get it fixed with the 2.3.0.2 update I've been working on.
     
    Karmate likes this.
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Not tons of new information regarding 2.4, but for now I plan on rewriting the faction system. I'm going to focus on smaller more frequent "new features" updates.
     
    iChuy and SickaGames1 like this.
  37. Karmate

    Karmate

    Joined:
    Aug 30, 2014
    Posts:
    45
    I have another problem with companion ai. If companion ai starts fighting, it stops following until death or kill. Is this bug too ?
     
  38. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    Ive noticed, if you create a melee or a ranged AI. There is a slot to submit the weapon (to be used for the enable/disable events). But if you switch the AI to both, those slots are not available anymore. You can still access them by switching to melee ai, then insert the weapon, then switch it to ranged ai, insert the ranged weapon. Then put it back to both and it works fine. Are you able to tidy that up for next patch?
    Also, for projectiles, they run in a straight line, giving perfect accuracy to a stationary target. Ive added scripts to randomize their trajectory a bit, gives it a much more real feel. Maybe something to think about for future too.

    Also. Would be nice to have certain animations play for specific ranged attacks. Right now you can specify specific animations for each spell type (attack, support ect). But not. Say 2 different animations for the attack line. Would also be a nice feature
     
  39. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    This is not a bug, but by design. I can add an option to have the companion AI stop attacking and follow their follower if they exceeds a certain distance.
     
    SickaGames1 likes this.
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    The missing melee and ranged weapon slots are a bug. I will have a fix for it with the next update.

    I like the idea of randomized trajectory. I’ll add an option enable it, as well as the intensity, to the Ability Objects.

    I’ve thought about being able to customize the animation for each ability as well, but I didn’t have the time with the 2.3 update. I’ll see if I can add this in sometime soon.
     
  41. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    I made 2 different ai. Duplicated both of them 5 times. Let them fight. When a ai kills a target, some of them arent retargeting, they just stand there in combat stance, but some do retarget. But since they are just duplicates of each other, im confused on what could be causing it. I must have some setting just set a little wrong, anyone have any ideas where i should look?
    if I set detection mode to trigger over Los, they seem to work fine, so im guessing I have collider issues or something.
     
    Last edited: Sep 25, 2019
  42. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,726
    @BHS just wanted to show you my latest post in the Jurassic Extinction thread, no offence meant, love EAI and will continue to use it (2.0) and promote it, but im very sad that i just cant justify using the 2.3 update:

    "Well the EAI update didnt go good at all, heres why:

    Its now set up where you MUST set up all non-combat AND combat animations, but also animation events for all attack animations. If you dont the console LOADS up with ALOT of red errors, and we all know if you have ANY red errors, your not play testing your game at all. The update also breaks the integration with other previous set up integrations, UFPS for one (which i can fix). But If i were to use the update id be working on it for many days to get it all set up. I just spent 2 hours squashing errors and setting things up, and i didnt touch a 1/4 of the dinos, and i also have soldiers on top of that.

    The version i use (2.0) you can set up combat animations and attack animation events later, without it throwing errors and having to completely set it up.

    Now i love EAI, and still going to use it, its great. But at this point in the project if i was to update, id be going backwards, and loose ALOT of time. So im going to think about it and debate wether i want to use the update, right now i dont think so, but we will see.

    Opinions are very welcome, please, lol."

    The 2.3 update would be better suited as a complete "start from the begining" of anyones project, as so much has changed. Great work, love the progress, but some things need to be addressed. But we all chalk it up to growing pains :)
     
    Last edited: Sep 25, 2019
  43. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    If you are duplicating the AI, are you setting up their factions correctly? An AI needs to have an opposing faction in order to fight. Also, ensure that you have setup the layers and tags correctly. You can also check out the documentation to get more info regarding this.
     
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I’m more than happy to assist you and help clarify someone of your issues. I’m sure it can be a little frustrating when you just want things to update smoothly. :)

    There console messages you see and not error messages. They are more of alert messages to tell you that you have not assigned all needed animations. The same goes for the missing Animation Events.

    These are intended for users who are not fully familiar with the system and to help guide them with the setup process. For someone who is quite familiar with Emerald AI, these might seem unnecessary, but they’re there to assist users who need help. These messages do not affect anything if you are just doing testing (I do it all the time :)). You can ignore the ones, such as the missing combat movement animations and attack animation events, if your AI is not engaging in combat. I understand that when you’re prototyping, it might seem tedious to have to apply all needed components to get the messages to go away though.

    What I can do is make the console messages optional so users can disable them if they are just trying to do quick testing or prototyping.

    As for UFPS, nothing with version 2.3 should have changed that other than possibly overwriting your altered EmeraldAIPlayerDamage script when you imported the update. All you have to do here is uncomment the UFPS code as it is now included with the script.

    Other than that, please let me know if you have any other feedback or suggestions you have. I want to make the workflow for Emerald AI as easy as possible and I’m always more than happy to make improvements where they’re needed.
     
    warthos3399 likes this.
  45. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    @warthos3399 Also, if you wanted to get rid of the console messages right now, you can comment out the the functions
    CheckAnimationEvents(); and CheckForMissingAnimations(); in the EmeraldAIInitializer script.
     
    warthos3399 likes this.
  46. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,726
    Thnx, i will get into this tomorrow, and adjust things accordingly, totally understand, but as you said, for others unlike ourselves, the console red errors, prevent play testing and add confusion, maybe changing them to a yellow alert may help, instead of a red alert (non-play testing) may help. I will how ever take care of the EmeraldAIPlayerDamage script, not a prob, and thnx for the exclusion (CheckAnimationEvents(); and CheckForMissingAnimations(); in the EmeraldAIInitializer script) function.

    You know i support you and your work 100%, and ive done things with EAI that are just incredible, ill sort it all out, and my main focus is to showcase as much of EAI as possible, sorry if i seem impatient, im just on such a "time frame schedule" that it sometimes gets the best of me :)
     
    metaldc4life likes this.
  47. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,726
    I think we need to have a open convo on discord, so i will set it up and see you tomorrow :)
     
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Alright, sounds good. :)
     
    SickaGames1 likes this.
  49. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    is it possible to have emerald AI health working with a created damage script that damages based on what the AI is tagged as?
     
    Last edited: Sep 26, 2019
  50. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    @BHS is there a way to get this integrated with Unreal FPS? (Not the engine, the FPS game template for Unity.)