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

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    My Emerald AI deer roams until encountering a couple of benches around a campfire, where it gets stuck. I placed a capsule nav obstacle around the area, but the deer still gets stuck attempting to reach a point inside the nav mesh obstacle. Can I create an AI exclusion zone or something to solve this?
     
  2. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Hello! @BHS Is Astar A* pathfinding project supported?
     
    wood333 likes this.
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    Hey there! There isn't currently a built-in way to do this, but I plan on adding some API soon that will allow you to do so.
     
    huntersteeger likes this.
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    I'm working on one more update that will fix the remaining minor issues and add a new character controller system. After this, I will work on the update that will add more animations.
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    I totally agree. I'll be sure to add this with the next update.
     
    huntersteeger likes this.
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    I haven't tested it, but it sounds like you should be able to add footprints with an Animation Event on your AI's walking or running animations.
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    The AI shouldn't pick waypoints that it can't reach because it uses the same position API to ensure the generated point is on NavMesh before assigning it. Try searching for the line NavMesh.SamplePosition(NewDestination, out hit, 4, 1) in the EmeraldAISystem script. Try adjusting the 4 value higher to see if it allows the generated waypoint to be better placed.
     
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    Not yet, but I plan on adding support at some point.
     
    hoodoo and mattis89 like this.
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    If you're using the Dialogue System for Unity, try this in the Sequence field of the NPC's first node:
    {{default}}; LookAt(listener)
     
  10. dejoshua1

    dejoshua1

    Joined:
    May 22, 2018
    Posts:
    18
    Hi, im usin urpg and I got the emerald ai to damage the player by following the docs but I cant get the player to damage the ai. I tried

    if (other.gameObject.tag == ("Enemy"))
    {

    other.gameObject.GetComponent<EmeraldAISystem>().Damage(damage, EmeraldAISystem.TargetType.Player, transform);
    }
    but no luck
     
  11. dejoshua1

    dejoshua1

    Joined:
    May 22, 2018
    Posts:
    18
    Nevemind this helped

    Oh, well try using the PlayerWeapon3rdPerson instead, but attach it to your main player object. Have you tried using the included example player to see if everything is working correctly? I plan on adding an improved weapon/damage script to work universally with first or third person. I'm hoping to have this update submitted sometime next week.
     
  12. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Right, but what I was referring to is other events for example the one I have to put on the animation for cast spell such as: EmeraldAttackEvent

    What other events are there.
     
  13. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Same issue here.
     
  14. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    If anyone is interested in Playmaker integration, here is my initial set of Playmaker actions for EmeraldAI. I haven't fully tested this so please consider it an Alpha version. I don't know yet if I'll do any more work on this. It depends on if anyone uses it and if there are more requested actions.

    I recommend extracting the files into the EmeraldAI folder, but you can put it anywhere in your project if you want.
     

    Attached Files:

  15. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Thank you
     
    Wolf-Heart and magique like this.
  16. pjccccc

    pjccccc

    Joined:
    Oct 7, 2015
    Posts:
    43
    My characters fight each other even they have same faction value.
    The faction values are controlled by script, please see code below.

    Did I miss something?

    upload_2019-11-3_21-27-3.png
    upload_2019-11-3_21-27-39.png
     
  17. bholland

    bholland

    Joined:
    Mar 24, 2017
    Posts:
    28
    First of all, great asset, I've been making my through it and getting it to work with the Opsive UCC. So far I have gotten everything to work, I can damage the EmeraldAI, they can damage me, and they can damage each other. But, when I set the Emerald AI "characters" up for ranged, it is like they are shooting into a wall, none of there projectiles moves past the transform, whether they are shooting at the Opsive character or each other, the projectile acts like it hits some kind of collider. I'm using Emerald 2.3. I've tried removing everything in the scene but it doesn't seem to help. Any ideas?
     
  18. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    I have an AI character that is not attacking my player. The AI detects the player, turns, then runs toward the player but when he reaches the player it goes out of combat mode and continues walking and pushing my player as if it were simply blocking its path to the the next way point. I have other AI characters that are set up the same way and they are attacking the player. This is just a different model.
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    Most of the events listed in the docs can be called with an Animation Event. They aren't just limited to calling them through code.

    Relevant animation specific events are the follow:

    Plays a idle sound when called (This can also be done automatically within the Sounds tab)
    PlayIdleSound

    Plays a walk sound when called

    WalkFootstepSound

    Plays a run sound when called
    RunFootstepSound

    Plays an attack sound when called
    PlayAttackSound

    Plays a warning sound when called
    PlayWarningSound

    Enables the AI's Weapon Object
    EnableWeapon(string WeaponTypeToEnable)

    Disables the AI's Weapon Object
    DisableWeapon(string WeaponTypeToDisable)
     
    zKici likes this.
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    I'll look into the issue with the projectiles firing too low.
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    When is this being called? Is there enough time for the Emerald AI system to be initialized? There's a possibility that Emerald AI is overriding the faction modifications, if your script is called first.
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    Very strange, this is the first time I've heard of this issue. My guess is that the AI's Box Colliders on your AI may been generated too big. Try adjusting them to fit within your AI's mesh. Also, ensure that your Ranged Transform is properly assigned to where you want the projectiles to spawn from.

    If you're still having issues, a video of the problem would better help me understand what's happening.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    What's this AI's Distance Type (Located under the Detection Options) set to? If it's set to Starting Distance, the max distance may be being exceeded making the AI return to its starting position and exiting out of combat mode. Try using the Target Distance or increasing the Chase Distance to see if it resolves the problem.
     
  24. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,269
    Since you stated that your updates are not going to be as huge but smaller and more often, any idea when the next update comes out?
     
  25. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    Actually, after observing the behavior, it's not that it isn't finding the player. It is actually finding the player and attacking and will continue attacking and locking onto my player as expected. It's only after I land a successful attack that the enemy will simply ignore me and just keep walking and pushing me to where ever it wants to go.
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    I'm hoping no more than a couple of weeks.

    I'm just about finished with a new demo character controller system for a much more polished player combat example. The current one is a bit..dated. I'm also working on a brand new "Combat Text System" that will work globally for all AI and even players with customizable text colors, fonts, animation types, and more all controllable through the Combat Text Manager. Best of all, it uses Unity's UI system and no longer uses the outdated Text Mesh component. I'll be making a status update on all of this sometime tomorrow. :)
     
    SickaGames1 likes this.
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    What parameters are you passing when damaging the AI? If you are using:
    Code (CSharp):
    1. Damage (int DamageAmount, TargetType? TypeOfTarget = null, Transform AttackerTransform = null, int RagdollForce = 100)
    Ensure that you are also passing the AttackerTransform or the AI may be getting a null target which could make it lose its reference to your player.
     
  28. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    Honestly, I'm not sure. I'm not much of a coder, I just used the steps provided by the Invector AI integration tutorial by BHS. Where would I find the code you referenced and how would I check?
     
  29. MattyZuZu

    MattyZuZu

    Joined:
    Jun 2, 2019
    Posts:
    7
    I’m encountering 2 problems with an AI agent in my game - possibly related:

    1. I have an enemy using waypoints and he works fine until he sees the player Once the player is detected, the AI has omniscience and is able to find the player no matter where he hides. Is this a layer issue? Is the agent seeing through walls, etc. because they’re on a different layer? I selected "water" for the layer as that is what is in the tutorial video.

    2. The second issue is that the enemy will follow the player for a while and then stop moving apart from to face the player (no matter where the player is on the level, the AI will turn to face him).

    (You guys need a proper forum instead of an 89 page thread!)
     
  30. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    Indeed!
     
  31. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Or Discord
     
  32. Low_on_Mana

    Low_on_Mana

    Joined:
    Jun 18, 2018
    Posts:
    37
    I'm sorry if this has been brought up before, but I'm experiencing an issue in which when given a destination, the AI moves to it, but stops close by. Is there a stop distance number I can set programmatically so that they stop exactly at the destination in certain scenarios?

    I also noticed something similar for combat. AI will go only as close as they need to be to reach with melee, but if something is walking away from them, they will have issues keeping up because they'll approach it, attack as it walks away, and repeat the process until the target stops long enough to be hit. Can the attack range be set to a distance larger than the "combat range" as it were?
     
    Last edited: Nov 5, 2019
  33. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I have a sound issue. I set up an Emerald Ai animal with an idle sound. The sound plays, but it doesn't come from the animal, it sounds the same whether I am near the animal or far away.
     
  34. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Make sure the AudioSource is set to 3D spatial blend. And set your Max distance as well.
     
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BHS I have a request for next update. I'm working on integrating EmeraldAI with ORK and am planning to have EmeraldAI handle all the locomotion, enemy detection, etc, but have ORK drive the actual attacks so that I can be more specific in having the AI attack a certain way or cast a spell, or use an item, etc.

    The problem I have is that even though I removed all Attack animations from Emerald, it still tries to initiate an attack. The code randomizes attack index so that it is never less than 1 no matter what. Even if I change TotalAttackAnimations to 0 in code, the attack randomizer still runs and tries to perform an attack.

    At a minimum, I would like to see a fix where if TotalAttackAnimations is set to 0 in code that the attacking code would not run. Ideally, this would still work even if there are actually 5 attack animations in the list. That way, I could duplicate the attacking code and pick specific attacks and drive them from my own code. Another possibility is to simply have some flag that specifies whether attacks are driven by Emerald AI and instead of checking the TotalAttackAnimations it would check to see if EmeraldAI is in charge or not. Maybe call the flag something like EmeraldControlsAttacks and default to true.
     
  36. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Spacial Blend is full 3D and I am adjusting the Max distance, etc. It's getting better. Thanks for the tips.:)
     
    magique likes this.
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    The Invector integration tutorial passes the Invector player when damaging an AI so I'm not sure why the AI would lose the target reference. Did you setup your layers and tags correctly?

    API and a damage example can be found here: https://docs.google.com/document/d/...2njM7Jx9pYlqgbtM8/edit#heading=h.ocdxmxz2k2sx
     
  38. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    1) Are you using the Trigger or Line of Sight Detection Type (located under the Detection Options)? The Line of Sight feature will only target a target if it is unobstructed, whereas the Trigger type ignores this. Ensure that you are using the Line of Sight Detection Type.
    2) Are you receiving any errors when this happens? This is the first time I've heard of this issue.

    If you want an additional support method, Discord is a great alternative: https://discord.gg/XpWYzjp
     
  39. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    If you want to manually set the stopping distance for an AI, you can use:
    Code (CSharp):
    1. YourEmeraldAISystemReference.StoppingDistance
    However, setting the AI's Stopping Distance to the minimum amount of 0.25 should allow the AI to stop right on its destination.

    As for the combat stopping distance, this is needed or the AI would walk right on their target's position. The reason the AI attacks right when it arrives to the target's position is working as intended, but this depends on the game and combat type. To remove this feature, find the following line and comment it out (located in the EmeraldAIBehavior script). I will add an option to enable or disable this with the next version.
    Code (CSharp):
    1. EmeraldComponent.AttackTimer = EmeraldComponent.AttackSpeed-0.25f
     
    Last edited: Nov 6, 2019
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    Have you tried stopping the AttackState function from being called in the EmeraldAIBehavior script? AttackState(); is located twice within said script and handles the is responsible for triggered all attacks. Commenting them out should work. I can look into a better solution for this as you've mentioned though.
     
  41. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Oh, yeah, I had no problem fixing the code to do it myself. I just thought a solution on your end would be best so future updates wouldn't need code changes again.
     
  42. pccross

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    106
    Has anyone used Final IK with EAI, and if so how difficult was it to integrate the two?
    I can't seem to get the EAI ranged gun combat on my enemy character to look realistic. This is a VR project, so may be more glaring when there are small offsets, but I find my enemy always seems to be aiming its gun a bit too far left or right of the player.
    It seems Final IK has AIMIK which appears to streamline this aiming aspect greatly, but given its steep price tag, want to make sure it won't cause issues on my existing EAI setup.
     
  43. MattyZuZu

    MattyZuZu

    Joined:
    Jun 2, 2019
    Posts:
    7
    Thanks for the reply. Yes, I have detection set to "Line of Sight." The Obstruction Ignore Layers is set to "Ignore Raycast" and under Tag Options the detection layer are set to "Default" and "TransparentFX."
     
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    Gotcha. It shouldn't be a problem to add something like this. My only concern is it possibly confusing other users. Maybe I will make it more of a hidden option.
     
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Yeah, I was going to suggest that as well. If you make it public, but don't expose in the editor than it can be accessed in code, but no one will even know it's there and they can't accidentally turn it off.
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    If your AI's aiming is off (which I'm assuming you are using the Head Look feature), try using a "dummy" object as the player instead of the actual VR player to ensure the AI are aiming at the right position.

    Final IK is supported and I've made an integration tutorial for it. However, this only covers the foot IK and not the aiming.
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,762
    Hey everyone,

    Emerald AI 2.3.1 should be submitted within the next week or two. This update fixes quite a few bugs and includes quite a few improvements as well as some new systems.



    New Combat Text System
    The old combat text system is being replaced with the new Combat Text System. This new system works globally for all AI and can even be called for player damage and is handled through the Combat Text Manager. It uses Unity UI system and no longer uses the outdated Text Mesh component. The decision for a global combat text system was made because adjusting individual AI could be tedious, since most AI use the same settings anyways. The combat text system is optional and can be disabled through the Combat Text Manager.

    The combat text's color supports customizable colors for the following:
    • Player's Damage Text Color
    • Player's Take Damage Text Color
    • Player's Critical Hit Text Color (The new Emerald AI player controller has critical hits and is explained below)
    • AI's Damage Text Color
    • AI's Critical Hit Text Color (Melee AI can now deal critical hits too. All damage is sent to the EmeraldAIPlayerDamage script where it is automatically displayed on the player)
    • Healing Text Color (AI can now display their healing done)
    In addition to colors, there are all sorts of settings that can be adjusted for the combat text system such as its animation type (Bounce, Upwards, Outwards v1 (demonstrated in the demo video and my personal favorite), Outwards v2, and Stationary), font size, font type, and more. Users should be customize their settings and find a style that suits their game's needs. I'm always willing to take suggestions on this to add more settings and animation types with future updates. As for what the types of games the combat text system supports, it supports 3rd person, top-down, and even first person shooters (similar to Destiny).

    CombatTextManager1.png

    CombatTextManager2.png

    New Player Controller System
    The current player controller is a bit dated. It's never really received an update. While Emerald AI is not character controller system, I feel having a solid example for rapid prototyping is important. It allows users to have a high quality example system for running through their scene to damage other AI. The code itself is also useful for users who want examples with implementing their own character controllers.

    The new player controller is a top-down style and is controlled via the mouse's position (similar to Diablo). It has adjustable damage amounts, critical hit support, active target indicators (both shader based and projector shader based), tons of sounds support, and more. Everything you see in the above demo video is included with the next update.

    New HUD Health System, Sounds, and Bug Fixes
    As shown in the video above, everything you see is included with the 2.3.1 version of Emerald AI. There's also a new HUD health system, new sounds, particle effects, and of course bug fixes. I will post a list of these when the 2.3.1 update has been submitted. The issue with AI's projectiles firing too low at players has been found and resolved.
     
  48. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,269
    Looks great! Thanks for the quick update!
     
    BHS likes this.
  49. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I really like the red outline on the enemy being targeted. Nice.
     
    BHS likes this.
  50. Musonica

    Musonica

    Joined:
    Jul 25, 2017
    Posts:
    8
    Hey I'm implementing a turn based combat system. What i'd like to do is have a squad of say 5 AI entities with behaviour states (melee attacker, range attacker, healer / support, wizard etc.)

    At the start of your turn you issue attack or move waypoint commands, when the orders for all 5 are issued, the AI fight mode activates

    Basic logic: entity move to position, if in melee range do melee attacks else if at range do range attacks and spells

    Each AI entity will do say 2-3 attacks or special abilities then go into combat idle animation in a particular turn order.

    I would be most grateful for some advice on how to Emerald AI could be used to help accomplish this!