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
    Great to hear and you're welcome. I think it was due to the Final IK components not being disabled when the AI dies.
     
  2. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    @BHS Hi again, sorry for spamming the forum but I have a feature request: "On End Combat Event ()"
    Basically, when Emerald AI ends combat for whatever reason, specify an event to trigger.

    Reason for this is, in my game, I have the music change when Emerald AI starts it's combat mode. Since the player can outrun the AI and become undetected again, I need to be able to change the music back to how it was before combat. Currently the only way I can find to do that is to kill the AI.
     
    Dawar likes this.
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    No worries, that's a good idea. I can see how an On End Combat Event could be useful. I can certainly add this to the 2.2.2 update.
     
    Deckard_89 and Weblox like this.
  4. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    26
    @BHS
    Weirdest thing is that without any intervention from me, this seems to have fixed itself.
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Interesting, it's good to hear the issue is resolved. Is there a difference with whether or not Animate Physics is enabled?
     
  6. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    26
    Good morning, actually without intervention, the problem seems to be back D:

    So, here are two videos showing the problem better. One with Animate Physics, one without. Both Mixamo only, notice the difference between my passive and aggressive.

    With Animate Physics


    Without Animate Physics
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    That’s weird. I have tested a lot of animated models and haven’t encountered this. What are your animations speeds set to? What are the Animator Controller Blend Tree thresholds set on these?
     
  8. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    26
    Screen Shot 2019-05-03 at 9.52.56 AM.png
    Looks standard, the preview window in the bottom right works fine, she walks as I'd hoped she would
     
  9. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    26
    Is there currently any ability to raise the Y position of where the enemy AIs raycast hits my player? Its currently pointing towards his knees. My player has the ability to crouch and move through bushes, this works well in that the enemy can't see my player, but when I stand up in the bushes they still can't see my player (ray is pointing toward his knees).

    If it was pointing toward my player head or chest, my cover system would work perfectly. Cheers.
     
  10. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    26
    Sorry to double up on requests @BHS, but is attack distance checking on for distance on the X/Z plane only? As you can see in the video below, even though attack distance is set to 1.5, they're able to register hits when I'm far above them in distance, but They likely are 1.5 units close to me on X/Z.

     
  11. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    @BHS were you able to get 2.2.2 out ?
     
  12. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    Hi @BHS how i will do companion Ai with commands like
    1.follow me
    2.Go there,
    3.stay there,
    4.defence me or cover me ,
    5.attack

    it will be more better that you provide us demos as shown in video to clearly understand every things
     
  13. Tandinos

    Tandinos

    Joined:
    Jan 10, 2015
    Posts:
    6
    Trying to set up AI to flee from player without being damaged but doesn't seem to be working can anyone show me an upto date solution for it
     
  14. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    you should check flee when health is less than bar
     
  15. Ramulos

    Ramulos

    Joined:
    Feb 19, 2017
    Posts:
    57
    How can I copy a group of waypoints I created in one emeraldAI agent to another ai agent without having to manually recreate all the waypoints?
     
  16. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    26
    This probably won't help but if the agent is otherwise all the same could you copy component and then paste as values?
     
  17. Ramulos

    Ramulos

    Joined:
    Feb 19, 2017
    Posts:
    57
    That does indeed copy over the waypoints created but in this case the agents are not the same. Very different settings. I could copy the component and then change the settings but I plan on doing this quite a few times with different agents so hoping that theres a simpler way, maybe a file or an array saved somewhere I can just copy paste.
     
  18. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    @BHS A suggestion or feature request. I have finished Alpha and Beta testing my zombie shooter, and am setting about building my first release candidate. As I do, I am moving away from the EmeraldAI Duplicator. It served me well for quickly building up the Alpha/Beta versions (over 30 version. Ech!), but it has a tendency to make the characters' eyes bulge out of their heads. I also need to exercise some rigor into ensuring that each character has some uniqueness in its animations and sound FX. That being said, it is incredibly tedious to setup an EmeraldAI from scratch, model by model.

    What I would like to see is an EmeraldAI "template" that I can create and apply to each of my characters by type.
    • The rifle carrying characters will all have the same weapon.
      • They will all have the same attack distance.
      • They will all have the same attack sounds.
      • They will all have the same bullet spawn position.
    • They will all use the same bullet prefab.
    • They will all use the same animations.
    • They will be virtually identical, except for the mesh renderer.
    • The pistol carrying characters will all have the same weapon.
    • They will all have the same attack distance.
    • They will all have the same attack sounds.
    • They will all have the same bullet spawn position.
    • They will all use the same bullet prefab.
    • They will all use the same animations.
    • They will be virtually identical, except for the mesh renderer.
    • The melee characters will all have the same attacks.
    • They will all have the same attack distance.
    • They will all have the same attack sounds.
    • They will all have the same idle sounds (30 each! an array would make populating that so much faster than hitting "+" 30 times and drag/drop!).
    • They will all use the same animations.
    • They will be virtually identical, except for the mesh renderer.
    If I had a template for each that can be built once and applied many times, and then individually customized as required, the work involved in initial setup would be reduced significantly. I estimate that it takes me about 30-40 minutes per character to set them up exactly the same. This is based on my 4 main companion characters and one zombie protagonist built manually so far.

    I have over 100 characters in my arsenal divided evenly between male/female, including a few more companions, 30 x soldiers, 30 x police, 50 x general citizens, 10 x gang members, and others. With a template-based system, I would have to invest roughly 4 hours in building the templates, and then maybe another hour tweaking them individually for uniqueness.

    Without templates, it is necessary to spend 1000 hours to get the same results.

    Is there something in the works that might expedite the process, or a fix for the eye-bug in the duplicator?

    Thanks again for this great product,
    Mark
     
  19. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    26

    If they will all be the same except for the mesh rendered, couldnt you use copy and “paste as values” ?
     
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks for providing a screenshot, but I'll need to see the actual Movement Blend Tree like this:
    Movement.png

    There is, but it currently only works for ranged attacks and if an AI's Use Head Look is enabled. Is your AI using melee or ranged attacks when this happens? I can pinpoint the code where it's detecting the obstruction and give you an altered version until version 2.2.2 is released.


    No worries. I double checked this and the AI I tested just stay put while a player is out of reach, even if it's above them like in your video. Is the player object physically moving when it's climbing? The distance is calculated using the Y axis as well so everything should be working correctly.
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    UniStorm 4.0 is taking a little longer than expected so it'll be another week until I'll be able to submit it. This is why it's hard to give ETAs :)
     
    julianr likes this.
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I can certainly provide more demos and examples.

    1)
    Code (CSharp):
    1. //Assign the follower target
    2. YourEmeraldAIComponent.EmeraldAIEventManager.SetFollowerTarget(Transform Target);
    Code (CSharp):
    1. //Follow the current target
    2. YourEmeraldAIComponent.EmeraldAIEventManager.ResumeFollowing();
    2)
    Code (CSharp):
    1. //Has the AI guard the assigned position
    2. YourEmeraldAIComponent.EmeraldAIEventManager.CompanionGuardPosition();
    3)
    Code (CSharp):
    1. //Stops the AI from following its current target
    2. YourEmeraldAIComponent.EmeraldAIEventManager.StopFollowing();
    4) The AI will continue to defend you as long as it's following you.

    5) The AI will continue to attack as long as it's following you.
    Code (CSharp):
    1. //You can also assign a target using the following
    2. YourEmeraldAIComponent.EmeraldAIEventManager.SetCombatTarget(Transform Target);
     
    llJIMBOBll likes this.
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    You should be able to call the damage function to trigger an AI to flee from the player, but you don't have to deal any damage. Something like this works, assuming you AI is a Cautious Cowardly AI.
    Code (CSharp):
    1. YourEmeraldAIComponent.Damage(0, EmeraldAI.EmeraldAISystem.TargetType.Player, ObjectToFleeFrom);
    If you need to change the AI's behavior and confidence, it can be done using the following:
    Code (CSharp):
    1. //Changes the AI's behavior
    2. YourEmeraldAIComponent.EmeraldAIEventManager.ChangeBehavior(EmeraldAISystem.CurrentBehavior NewBehavior);
    3.  
    4. //Changes the AI's confidence
    5. YourEmeraldAIComponent.EmeraldAIEventManager.ChangeConfidence(EmeraldAISystem.ConfidenceType NewConfidence);
     
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    There currently isn't a straightforward way to do this, but I'll try to add a solution to the 2.2.2 update.
     
  25. BHS

    BHS

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

    Thanks for the suggestions and feedback. I am always willing to improve the workflow of Emerald AI.

    A template system would be a great addition to Emerald AI and I have already thought of one to handle large amounts of AI. Thanks for the suggestions on what would be helpful and beneficial.

    The AI duplicator was meant to be a temporary solution until a more permanent solution could be designed, like a template based one. I haven't encountered any issues with the AI's meshes being altered when using it though. What is the model asset you are using?

    As soon as UniStorm 4.0 and Emerald AI 2.2.2 are submitted (figure at least a week), I will work on getting this figured out.
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    That's essentially what the AI duplicator does, except it pastes it to a list of AI that all use the same mesh, animations, and Animator Controller.
     
  27. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Hi Kyle,

    If you mean copy the working EmeraldAI and paste it onto another model, no that doesn't appear to work. That's why BHS made the EmeraldAI Duplicator.

    Cheers,
    Mark
     
  28. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Anything is possible, but it is those little things that can make your game different. For hiding, you might try using Line of Sight in the Detection settings. I have not yet tried this, I just use the Trigger method so far, but it might do what you need. I think you would have to tag or layer the things that obstruct your LoS.

    This might require another trigger collider on hearing AI, and a "makingNoise" boolean whenever your player did something noisy. Another way would be to set a maxRange for noisy actions, and then compare that distance with the distance from the player. You'd have to give some thought as to what would make noise. Ranged attacks generally make noise, melee not so much, but the struggle might with a shorter range. If you want to get complicated, you could try and factor in acoustics and bounces, and mimic how sound actually travels, but that is a bit too precise for me.

    Just my 2¢
    Mark
     
    snan likes this.
  29. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    No problem, if ideas were dollars, I'd be a really rich man...

    It's really just those repetitive tasks, like clicking on "+" 30 times for idle sound files, then drag/dropping the same sounds and animations over and over again.

    I'm not sure how others do it, but I try to keep my related assets grouped together. So for my Abigail character, I have a \Models\Characters\Main\Abigail directory. In that directory are subdirs for Animations, SoundFX, Voices, Materials, etc. Rather than drag/drop, why not ask the user where the files are, read the directory and fill the list? Or more flexibly, ask the user to select the individual sound/animation files. If there are a few that need to be excluded or removed after, it would be quicker than adding them one-by-one.

    I did send you a complete scene that I believe demonstrated the eye-popping. It seems related to a difference (very slight) in character height. My Jacob character is 2 units tall. His younger brother Jonah is 1.8 units tall. Their skeletons and hierarchy are identical, but duplicating from either to the other causes the eye meshes to mis-align. For the shorter model, the yes bulge out of the skull. For the taller, they eyes are lower and look like they are rolling back in the head.

    No worries, until then I will continue to setup my models one-by-one. The companions are the most unique. They have the most animations, and need to be varied. NPC's can be more "stock".

    Cheers!
    Mark
     
  30. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    133
    Thanks, BHS!
    It works completely.
    Now, I can switch follow/unfollow the player to AI.:)
     
  31. micuccio

    micuccio

    Joined:
    Jan 26, 2014
    Posts:
    143
    Hi,
    First of all thanks for the amazing tool!
    I do have a quick question concerning the avoidance of the AIs.
    I can manage to make the AI units avoid themselves but I could not obtain the same with the player.
    I specify in the detection the Player Layer, but It does have no effect.
    Could you help me?

    Thanks in advance,

    Dom
     
  32. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    197
    For those that want to change factions at runtime with the older 2.0, you can do that with a custom function. You just have to look at the debug settings in the editor to get the integers for the factions and relations, etc. In the case below, I have two factions and turn one enemy against the other :)

    Code (CSharp):
    1.    public void ChangeFaction()
    2.     {
    3.         AIFactionsList.Clear();
    4.         FactionRelations.Clear();
    5.         FactionRelation1 = 0;
    6.         CurrentFaction = 4;
    7.         AIFactionsList.Add(OpposingFaction1);
    8.         AIFactionsList.Add(OpposingFaction2);
    9.         FactionRelations.Add(FactionRelation1);
    10.         FactionRelations.Add(FactionRelation2);
    11.         //optional if you want to make the enemy AI ignore player, etc
    12.         AIAttacksPlayerRef = AIAttacksPlayer.Never;
    13.         SearchForTarget();
    14.     }
     
  33. UDN_449900de-7c34-4a67-83eb-fa8501bf0413

    UDN_449900de-7c34-4a67-83eb-fa8501bf0413

    Joined:
    Jun 16, 2017
    Posts:
    17
    hello :D is there someone in here that can help me integration emerald ai with mmorpg?? I would be very thankfull if that could be posible :D
     
  34. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    26

    Hey mate, regarding the Movement Blend Tree, just leave this to me to try and resetup another AI and see what happens, don't want to bother you with this more if I haven't tried more stuff.

    Regarding the raycast hitting my players knees, I'd love to see the option to set the Y position of this in the next release, I appreciate that its super edge case and for that reason if it doesn't eventuate in the next release then lets look at a mod only then.

    That being said, regarding the Y position issue, my player is legitimately moving as he climbs. A couple screenshots here of the enemy attacking my player from a far distance.

    Attacking Distance 2f
    Too close distance 1.5f

    Would you mind providing the variable name (if any) that returns the distance from entity to target? I'd like to print it out to be sure that its not conflicting somehow with my climbing system.

    Screen Shot 2019-05-12 at 1.32.31 PM.png Screen Shot 2019-05-12 at 1.31.50 PM.png
     
  35. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi, i'm wondering if anyone has encountered this problem. My ai are attacking from a far distance, and it looks like this happens if there is obstacles in the way. But if I move closer or move so they can see me they will move closer to me and attack normally. My ai dont use root motion as i couldn't get it working.

    I can post my settings for an ai, but making a build atm.

    Cheers Jim
     
  36. IceLab_Game

    IceLab_Game

    Joined:
    Dec 18, 2015
    Posts:
    17
    hi, is it possible to link the damage to an external script that varies the value based on the level of the enemy?
    thanks
     
  37. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Quick, question. I'm considering purchasing this asset but the Asset Store says it's v. 2.0. Since 2.2 is not compatible with 2.0, what am I actually getting from the Asset Store and should I look elsewhere for 2.2?
     
  38. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Hi, BHS, I just picked up Emerald AI and testing it.
    I think Emerald AI supports many cool features and it's really easy to use, however it's rather difficult if I were to extend its functionalities. It is pretty much a monolithic system.

    I was hoping that Emerald AI provides the functionalities though APIs so that I can derive AI from external source such as Node Canvas behavior system.
    I think Node Canvas by far the best behavior system and it is really good solution for making a flexible behavior but it knows nothing about AI agent, thus it requires quite a bit of setup.

    I think it will be the best if Emerald AI provides basic AI agent functionalities and behavior system such as Node Canvas, or PlayMaker to drive the behavior.

    Is this something you are going to support in the near future? It will be really great if you do and I'm looking forward to work with Eliot AI.

    Cheers!
     
  39. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Really easy question. @BHS
     
  40. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    Is there any way to get an AI to move along all three main axes? I am trying to develop an underwater based game and cannot figure out how to get fish to move up and down as well as moving on a flat plane.
     
    jnbbender likes this.
  41. claudius_I

    claudius_I

    Joined:
    May 28, 2017
    Posts:
    254
    Hello
    maybe this isn't directed related, but where i can found this plowing texture?
    i looked in Emerald, but i don't found
    thanks
     
  42. jaytwist28

    jaytwist28

    Joined:
    Jul 18, 2017
    Posts:
    50
    Hey BHS, do you plan on updating the integration with Game Kit Controller for Emerald 2.2? Or any ideas on what might need to be changed from the old integration?
     
  43. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    2.3...2.3...2.3! @BHS
     
  44. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    I figured out some weird problems if you use YourEmeraldAIComponent.EmeraldAIEventManager.SetCombatTarget(Transform Target);
    The AI can attack you from far away and sometimes causes the ai to just stop for 2 or 3 secs before moving again.

    What it is i'm trying to do is tell my ai where the player is when they spawn. I'm using emerald for wave based gamemode and need them to know where the player is from spawn and start to hunt them down asap.

    I set the detection and chase distance to 1000 but they still seem to do there own thing.. :D

    I'm wondering if you could suggest any way I can achieve this, if possible would be a real big help.

    Cheers Jim
     
  45. BHS

    BHS

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

    Each AI has a line of sight option with a field of view. As long as you stay out of the AI's line of sight, even behind objects, you will not be visible to the AI. Once an AI has begun chasing you, the only way to stop them from chasing you is to go out of their chase distance. There currently isn't a hearing feature, however, I have plans to add one with a future update.
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I totally get that and I will get a solution figure out.

    My plan is to have an AI profile using scriptable objects that users can export from one AI and then import it into another AI as well as being able to apply them to the AI profile directly. There will be options to choose what is imported and what isn't. So, if you only wanted sounds and animations imported, you would only choose these options within the importer.

    That's right, I will be sure to take a look at it when I get the chance. The recent sale has kept me quite busy.
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    You're welcome! :)

    That's strange, it should be working. The avoidance option only works if they AI is not in combat. Also, try enabling all of the debug options to ensure nothing is obstructing the AI's raycast. These options should help pinpoint the issue.
     
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I can add an option to adjust this with the 2.2.2 update. The variable needed to detect the distance form an AI's target is with YourEmeraldAIComponent.DistanceFromTarget. I have not been able to recreate this issue so I'm curious as to why the AI is still able to attack your player even though it is out of range. You can also try enabling the Debug options, located under the Docs tab, to see if this helps pinpoint the cause of the issue.
     
  49. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks, I will look into this before I submit version 2.2.2.


    I think this is just a limitation to the SetCombatTarget function as it only sets the chase distance to 2,000. If you have a much larger terrain, you will need to set it higher. I also noticed that the movement is never set to Run within this function so the AI only walks to its target. You can fix this by replacing what's in the SetCombatTarget with the following code. If 8,000 isn't enough, set the value higher. I tested this with a large terrain and everything worked correctly.

    Code (CSharp):
    1. EmeraldComponent.CurrentTarget = Target;
    2. EmeraldComponent.m_NavMeshAgent.stoppingDistance = EmeraldComponent.AttackDistance;
    3. EmeraldComponent.m_NavMeshAgent.destination = Target.position;
    4. EmeraldComponent.EmeraldDetectionComponent.PreviousTarget = Target;
    5. EmeraldComponent.CurrentMovementState = EmeraldAISystem.MovementState.Run;
    6. EmeraldComponent.CombatStateRef = EmeraldAISystem.CombatState.Active;
    7. EmeraldComponent.AIAnimator.SetBool("Idle Active", false);
    8. EmeraldComponent.AIAnimator.SetBool("Combat State Active", true);
    9. EmeraldComponent.MaxChaseDistance = 8000; //Can increase this value if you need to
     
    llJIMBOBll likes this.
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, all damage is sent to the EmeraldAIPlayerDamage script. Within this script, you call your own functions for custom player damage. Here's a simple example function that will take in account an AI's level and use it as a multiplier. Just use this instead of the DamagePlayerStandard function within the EmeraldAIPlayerDamage script.

    To use it, call the code below within the SendPlayerDamage function:
    Code (CSharp):
    1. DamagePlayerByLevel(DamageAmount, EmeraldComponent);
    Code (CSharp):
    1. void DamagePlayerByLevel(int DamageAmount, EmeraldAISystem EmeraldComponent)
    2.         {
    3.             if (GetComponent<EmeraldAIPlayerHealth>() != null)
    4.             {
    5.                 float LevelMultiplier = EmeraldComponent.AILevel * 0.25f;
    6.                 DamageAmount = (int)(DamageAmount * LevelMultiplier);
    7.                 DamageAmount = Mathf.Max(1, DamageAmount);
    8.                 GetComponent<EmeraldAIPlayerHealth>().DamagePlayer(DamageAmount);
    9.             }
    10.         }