Search Unity

[SALE 50% OFF] Emerald AI 3.0 (New HUGE Update) - The Ultimate Universal AAA Quality AI Solution

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

?

Which main feature would you like to see in the upcoming 2.6 Emerald AI update?

  1. Strafing - Allow AI to strafe in circles around their targets within a customizable distance.

    21.8%
  2. Stats - Allow AI to have additional stats, such as stamina and mana, usable by an AI's abilities.

    22.8%
  3. Sound Detection - Allow AI to detect sounds within a certain distance of their position.

    55.4%
  1. trojant

    trojant

    Joined:
    May 8, 2015
    Posts:
    65
    Hi,@BHS
    I'm making a flying bird, but the BaseOffset of the NavMeshAgent is locked. Mathf.Lerp has no interpolation animation.I can't dynamically modify its height at run time.the bird is a dynamic high-low change.what may I do it? Thank you.

    Animator _animator;
    NavMeshAgent _navMeshAgent;

    void Awake()
    {
    _animator = GetComponent<Animator>();
    _navMeshAgent = GetComponent<NavMeshAgent>();
    }


    protected void Update()
    {
    SetFly();
    }

    void SetFly()
    {
    if (_animator.GetFloat("Speed")<=0.1)
    {
    _navMeshAgent.baseOffset = Mathf.Lerp(10f,0f,3f);
    }
    else
    {
    _navMeshAgent.baseOffset = Mathf.Lerp(0f,10f,3f);
    }
    }
     
  2. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    36
    @BHS i guess next update should bring flying agents like dragons
     
  3. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    96
    hey guys if i have a floating emerald AI (agent base offset) how do i make it so that the float bug or creature falls to the ground. Currently when i use an animation death they just float in the air after they die
     
  4. trojant

    trojant

    Joined:
    May 8, 2015
    Posts:
    65
  5. Darrkbeast

    Darrkbeast

    Joined:
    Mar 26, 2013
    Posts:
    119
    Hi, @BHS I noticed some conversations around emotes being used in combat state, perhaps in 3.0.

    I was wondering more about that. I want one of my AI's to at half health stop attacking, play an emote, then run to get health. I have all of it working besides the emote. I know emotes only work in non-combat states, so was wondering if at some point it would be.

    Now I was able to change the AI's state to default which then let me fire the emote, but that only worked sometimes and then the AI would walk away instead of run.
     
  6. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    471
    Once again I am puzzled. Still working on that Zombie game for my grandkids. Still working on getting the eating animation to work. I appreciate the Needs System. That ought to just do it for me.

    So, what I have done:
    1) Placed the NeedsSystem script on my zombie.
    2) In the void Start section, I place:
    Code (CSharp):
    1.  original_Stopping_Distance = m_EmeraldAISystem.StoppingDistance;
    2.  
    The purpose is to copy the original stopping distance into a temporary variable and set the stopping distance to 1 unit for eating.
    3) In Update, after checking that Combatstate is not active, I have placed:
    m_EmeraldAISystem.StoppingDistance = 1.0f;
    4) I have a corpse in the scene for testing. Eventually, these will be disabled invisible gameobjects on each human AI that will be activated at death.
    5) I have set the second Idle animation of the zombie to the drop down to the ground and start eating animation and make the GatherResourceAnimationIndex = 2;
    6) After the final IF statement in Update, I add:
    m_EmeraldAISystem.StoppingDistance = original_Stopping_Distance;
    to restore the stopping distance back to 4 units.

    What I am experiencing is the stopping distance APPEARS as 1 in the EmeraldAI system foldout at runtime, but the actual stopping distance that the AI uses remains 4 units. The AI is not close enough, so Idle1 plays instead of Idle2. If I go into the animator it shows Movement is still active. If I check the is_Idle box, the AI drops down and starts eating 4 units away from the corpse. If I uncheck the Is_Idle box, and manually drag the AI onto the corpse, he drops down and starts eating.

    Do I need to refresh the EmeraldAI system somehow when I change one of these variables at runtime?

    Mark
     
  7. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,143
    Yeah he is working on that... Not sure if it is in 3.0 or not. Maybe with him taking longer he is putting more features in? 3.0 already seems awesome but have this ability will add a ton of options to this. If he adds in ABC compatibility, it will even further enhance his AI
     
    Last edited: Aug 31, 2021
  8. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    471
    @BHS Is there a way to change the Needs System to use the Emote animations rather than the Idle animations?

    I have the eating function working with a compromise of stopping distance set to 2 instead of changing it from its normal value of 4 to 1 when eating, and back again when done. What I am trying to fix now is the occasional move to Idle2 (eating) when the AI switches to its normal idle mode.

    Is there a way to not allow the AI to use idle2, or switch the Needs System to use emote1 animation?
    Mark
     
  9. goldwyn11

    goldwyn11

    Joined:
    Apr 8, 2019
    Posts:
    12
    @BHS Got a bit of an odd one. I'm trying to give a melee monster a poison attack, so I tried setting it as both a ranged/melee character and created a DOT ranged attack for it. But whenever I try to set the attack distance for ranged to short range it keeps redefaulting back to a minimum of 10 distance. Is there a way to override that? Using Emerald AI 2.0
     
  10. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    471
    @BHS seems busy these days, I hope everything is OK there. I will try to help if I can.

    What do you mean by "poison attack"? Is it a spitting type of attack, or a bite attack with poison?
    Does the poison do a single damage event, or are you trying to do something time related with the damage?

    Mark
     
  11. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,143
    @BHS Patiently waiting on 3.0!!!
     
  12. wohoyefe

    wohoyefe

    Joined:
    Apr 25, 2020
    Posts:
    10
    Hi everyone. My character has amongst others animations for sleeping, getting up, roaring, walking and idle. What I have desperately been trying to create, is a sequence where the character is in its "sleeping" animation when the game starts. Upon detection of a player, it then goes into the "getting up" animation, then "roaring" animation and then the combat mode should kick in, where the animal chases the player. Here's the twist: I don't know scripting. I have first tried to create a script for an OnStartEvent with a getcomponent animation clip and added my sleeping animation. It didn't work. Then I tried the same with getcomponent animation controller where I had all 3 animations in sequence. It didn't work. Lastly, I tried adding the animations to the Emerald AI Emotes and use the AI Animations API codes to get them to play on pressing a key (just to see if I manage to do it like this). It didn't work. My problem is that I don't have a working example of a full script. I've found individual code snippets on the pages below that are supposed to work. I even know which code snippets to pick, but I don't know how to piece them together into a single coherent script that actually works.

    OnStartEvents: Using Emerald AI Unity Events · Black-Horizon-Studios/Emerald-AI Wiki · GitHub
    Animation API: Emerald AI API · Black-Horizon-Studios/Emerald-AI Wiki · GitHub

    If anyone has a finished script that does something like this, I would appreciate it very much. Once a script exists, I will likely be able to adjust it if needed, but puzzling something together from individual code snippets without having a full working script in front of me (or to follow) is something I still don't know how to do. Thank you so much
     
    Last edited: Sep 7, 2021
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,514
    The baseOffset is set once within the EmeraldAIInitializer script with the line below so it shouldn't interfere with anything during rutime.
    Code (CSharp):
    1. EmeraldComponent.m_NavMeshAgent.baseOffset = EmeraldComponent.AgentBaseOffset;
    When you are adjusting the height, you are not quite using Mathf.Lerp correctly. Something like this should work:
    Code (CSharp):
    1. _navMeshAgent.baseOffset = Mathf.Lerp(_navMeshAgent.baseOffset,10f,Time.deltaTime);
     
    trojant likes this.
  14. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,514
    You don't have your stationary turn animations set correctly. It looks like you are using moving turn animations. Stationary turn animations must only rotate and not move forwards.
     
  15. SeymourGutz

    SeymourGutz

    Joined:
    Aug 9, 2019
    Posts:
    15
    Please check out this group surround the target trick (code included):

    It would be great to have this in Emerald.
     
  16. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,196
    This would be cool, but to add in emote animations at any state. It could be conditional based (If Health reaches a certain level, if a certain body part is attacked for hit based reactions, if (external script) variable (condition).
     
  17. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,143
    Whoa! a 3.0 video? How much longer @BHS ?!

     
    ajf412 and julianr like this.
  18. goldwyn11

    goldwyn11

    Joined:
    Apr 8, 2019
    Posts:
    12
    Thanks for the reply c:

    I'm trying to make a close range melee attack that does Over Time damage. This is a setting for ranged attacks. I have the ability object made and set up and all that, and I have the monster set as both a melee and ranged monster. The only issue is this variable screened below. I need it to be a small number like 1, but the lowest it will go is 10. Even when I manually type in 1 instead of using the slide, it resets itself back to 10. I'm guessing I'll have to alter the base script to make this work, but usually tweaking one thing throws off one thing which throws off another, and my coding skill is pretty minimal, so I was hoping to get someone a bit more knowledgeable than me to chime in. Screenshot_1.png
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,514
    Looks interesting. I'll definitely consider adding something like this with a future update.
     
    julianr likes this.
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,514
    Version 3.0 is just about finished. It shouldn't be too much longer :)
     
    julianr likes this.
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,514
    This is because with the current version, a cap on the ranged attack is required. This is fixed with version 3.0.
     
  22. aggaton

    aggaton

    Joined:
    Jul 3, 2021
    Posts:
    82
    Just bought this package and it seem pretty cool so far, taking out a lot of tedious work in the animation controller that normally would take hours. I was able to set up a spider mob fairly quickly moving around nicely. I have a question though, throughout the little area I created, some random props are being spawned, which all have a mesh collider and are static (barrels, boxes and other kind of barriers), and gave the spider a rigid body. How do I prevent the mob from walking straight through those. They are randomly generated, so they were not present when the navmesh got baked, do I need to bake again after these are placed during game start? Or is it a matter of tagging/layering these or modify the colliders? I poked through your documentation and didn't seem to find anything related to this. I wouldn't think though obstacles would need to be baked in, unity should handle these collisions and not make objects pass each other if they have a collider, and they are not set to trigger, right?
     
    Last edited: Sep 10, 2021
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,514
    If you have dynamic objects that you would like to be avoided, you need to use a NavMesh Obstacle on said objects with Carve enabled: https://docs.unity3d.com/Manual/class-NavMeshObstacle.html
     
  24. aggaton

    aggaton

    Joined:
    Jul 3, 2021
    Posts:
    82
  25. aggaton

    aggaton

    Joined:
    Jul 3, 2021
    Posts:
    82
    Hi, I've setup Combat Text to display for both player and ai. I see the text just fine for when the player receive damage, however when the ai takes damage I don't see any floating damage values, the health bar goes down alright. Any idea what I am missing or what could be wrong?

    I am using opasive UCC and have an event handler set up like below, do I need to call anything else for the damage text to display?

    Code (CSharp):
    1. using Opsive.Shared.Events;
    2. using UnityEngine;
    3. using Opsive.UltimateCharacterController.Events;
    4. using EmeraldAI;
    5. public class OpsiveBridge : MonoBehaviour
    6. {
    7.     private EmeraldAISystem _emeraldAI;
    8.     private void Awake()
    9.     {
    10.         _emeraldAI = GetComponent<EmeraldAISystem>();
    11.         EventHandler.RegisterEvent<float, Vector3, Vector3, GameObject, object, Collider>(gameObject, "OnObjectImpact", OnImpact);
    12.     }
    13.    
    14.     private void OnImpact(float amount, Vector3 position, Vector3 forceDirection, GameObject attacker, object attackerObject, Collider hitCollider)
    15.     {
    16.         if (_emeraldAI != null)
    17.         {
    18.             _emeraldAI.Damage((int)amount, EmeraldAISystem.TargetType.Player);
    19.         }
    20.     }
    21.  
    22.     /// <summary>
    23.     /// The GameObject has been destroyed.
    24.     /// </summary>
    25.     public void OnDestroy()
    26.     {
    27.         EventHandler.UnregisterEvent<float, Vector3, Vector3, GameObject, object, Collider>(gameObject, "OnObjectImpact", OnImpact);
    28.     }
    29.  
    30. }
     
  26. aggaton

    aggaton

    Joined:
    Jul 3, 2021
    Posts:
    82
    Nevermind turns out if I pass in null instead of player type I get the combat text to show.
     
  27. kokakee

    kokakee

    Joined:
    Jun 8, 2015
    Posts:
    8
    Any plan to integrate with game creator 2
     
    zKici likes this.
  28. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    129
    Hi @BHS, Any more thoughts about Photon support for Emerald and Crux?
     
  29. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,143
    There are tutorials out there for Emerald and how to make it multiplayer...
     
  30. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    129
    @SickaGamer - I would love to see those tutorials, but I'm not finding any "out there"...and I've been periodically looking for a long time. :) Do you have any links?

    This is about the most I ever found and it didn't seem as trivial as this post would suggest. I think I even sent a DM to @pjccccc for additional information (or to see if they wanted to freelance the work for me) and got no response.
     
    Last edited: Sep 12, 2021
  31. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    79
    It honestly doesn't take that much to have it working using Pun.
     
  32. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    129
    @Bioman75 - Well, I'd like more info (especially if someone has done it before). Let me know if you think you can knock it out quickly, or provide guidance.
     
  33. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    679
    You need to be learning multiplayer in general, so I recommend to look at any tutorial related to Pun, Mirror etc as the concept, is the same anyways, this will get you going as if you are going to make a multiplayer game, there is no way to have a line by line code, to your game....

    But you will learn how to do multi player by looking at tutorials, there is NO QUICK way.. when it comes to multi-player..

    Sorry to sound harsh, this is the reality, there are hundreds online for Mirror and many PUN related ones as well.

    You won't find tuts, related to this asset, as it won't matter anyways... look for AI related...ones so you understand and can learn from them...
     
  34. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    129
    @Recon03 - Hi. I don't think you sound harsh, just not very helpful. I've already done a fair bit of work with PUN and a multi-player demo of my game is playable in beta. That said, I'm not a multi-player expert and I don't want to be. If I wanted to learn every single aspect of Unity programming I wouldn't buy assets like Emerald AI. I simply don't have time to reinvent the wheel, so I check with the community for tips and/or someone who might be interested in doing some freelance work. I'll tear into the Emerald code and attempt to make it work with PUN if I have to, but I'd really rather not. My guess is that @BHS would have done it a long time ago, if it were trivial...but, I really don't know. :D
     
  35. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    679

    well as someone who ALSO was not a networking expert, YOU MUST be harsh, if helpful is what your looking for, then yes I may not be the person to HAND FEED YOU..

    After I ACTUALLY took the time to learn the networking side, I become a near expect in a matter of months... and knew what I was doing in the matter of weeks.. So, again NETWORKING is , its own BEAST, so its nearly like starting in another field....

    I will tell you sir like it is.... NETWORKING is a beast of itself.... this SHOULD be helpful to you as it as help myself, who was also weak at networking UNTIL, I don't follow SPOON feeding methods, which is what you sound like your after...


    YOU sir need to understand NETWORKING, there is NO EASY way out of it...Sorry, again to be harsh... But this is reality... So again, you have two choices...

    Like I said the first time, if that isn't helpful, then HIRE a netcoder... You need to watch Mirror, Pun, tutorials to get you rolling on the basics, and some even give you more.

    You need to understand how to Sync, Animations.. for some networking solutions, where others, you don't.. Pun you will..

    Now second way, is to learn on your own by reading Puns docs, and understanding the basics right from Pun.

    if you understand AI, Emerld on already then great...

    If not learn it with out Networking first..... you don't need to be a master, or anything but like any tool/asset, software you still need to understand how it works... Also watch BASIC AI and also watch BASIC AI and networking ....

    It don't NEED to be PUN and this asset or any asset, as the PROCESS is the same.. Is THIS is not helpful... Then I wish you luck on FINDING someone who WILL HAND FEED you all of the code you may or may not be looking for....Which in reality is impossible..


    I hope you find what your looking for.
     
  36. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    679

    Sorry but you still need to know what your DOING and no you don't need to be an expert, but if you spent enough time, then AI, should be easy.....with working with Pun..... the AI side of things are ALREADY done mostly in the asset itself, from there, its mainly Syncing the animations.... but this can depend on your game as well...and its GAME PLAY mechanics... So no one can answer every question, since we know NOTHING about your current game..

    This guy shares the most with PUN and if you are used to Pun, then you may have seen these before.. https://www.youtube.com/channel/UCyoayn_uVt2I55ZCUuBVRcQ/videos


    google :


    So my point learn Emerld, and how it works.... adding Multi player isn't much more work, but this can depend on your game.... and mechanics, type etc.

    Sync animations but you should know this from using Pun before...
    Google again:
     
    Last edited: Sep 13, 2021
    wwg likes this.
  37. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    220
    Given that Unity is pushing MLAPI it would be cool if @BHS coule look into adding support for it when it becomes stable.
     
  38. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,514
    Here's a video showcasing some of the ranged weapon aiming improvements made with version 3.0. A new built-in hand IK system for ranged AI's weapons has also been added. Version 3.0 should be live within the next day or so!

     
    Bioman75, iChuy, wwg and 1 other person like this.
  39. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,143
    @BHS Can't wait!
     
  40. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    420
    That's fantastic. Maybe I'll hold off a bit. I do have a question though. When my AI detects my Player, it will fire its ranged object when the Player is in the line of sight. Good. Then when the Player goes behind an obstruction, the AI does not fire but tries to move around the obstruction which is also great. But if the Player moves when behind the obstruction, the AI will move accordingly, almost as if it can still see through the obstruction.
    Here's what I'm seeing:
     
  41. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    420
    Have you thought about starting a Discord channel so the users could support each other better?
     
  42. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,143
    There is one lol
     
  43. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,143
    https://discord.gg/yCzfPvZg
     
  44. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    420
  45. MonstaManly

    MonstaManly

    Joined:
    Apr 18, 2020
    Posts:
    5
    Hey, I was wondering if it's possible to change the spatial blend and sound space (2d to 3d) of idle sounds and the like, as they use audio clips and not audio sources.
     
  46. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
    Hi,
    Was wondering how to create damage to Ai's using a vehicle.
    I want to also add vehicles in my game, so player can drive vehicles around, and if they hit an ai, the ai will die.
    Im pretty dumb sometimes, and can't figure out how to do it...
    If anyone could direct me in the right direction that would be awesome, thanks!!!

    Edit- Found it, damage ai by collision script.
     
    Last edited: Sep 20, 2021
    MonstaManly likes this.
  47. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    781
    I am inside detection range. I rely on the Invector integration to pass the AttackerTransform paramater. I am certain the integration code for range damage is working, because the target does take damage as evidenced by diminished health bar. Target just does not recognize me as attacker. Ignores me after being shot. Melee works fine.
     
  48. cangcloud2015

    cangcloud2015

    Joined:
    Apr 9, 2018
    Posts:
    50
    When will emerald AI 3.0 be released? I want to know the current development progress of emerald AI 3.0.
     
    trojant and ajf412 like this.
  49. adifrank

    adifrank

    Joined:
    Dec 11, 2017
    Posts:
    11
    Purchased new version 3.0. Hope you will include hearing(Sound Reaction) to AI soon.
     
    SickaGamer likes this.
  50. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    3,053
unityunity