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

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    This possible if you use some higher level control logic to manage your AI units. I wrote a bunch of Playmaker actions for just this sort of thing. It will also require one small code change, which @BHS is looking to add to the next update, which relinquishes attack control from EmeraldAI and lets another script dictate that. As it is out of the box, though, you won't be able to accomplish it.
     
  2. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Is the Invector Integration tutorial/video still valid for Emerald 2.0 - 2.3.0.2 ?
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    The tutorial docs get you a working integration, yes.
     
    wood333 likes this.
  4. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    I have a couple of issues with raindeer AI's.

    My character approaches them and they are setup as cowards but they just keep walking in a straight line regardless.

    So...

    First: I want to get the AI's to run away when within a certain distance or when seen. Like a coward would.
    Second: Is there anything that can be done about a group of say 4 raindeer spawned with crux walking in a straight line all together in unison?
    Third: the deer don't seem to pay attention to steepnes and walk up and down slight cliffs/hills without changing from their straight line path.

    Unity 2019.2.11

    Thanks
     
  5. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    @BHS what are the chance you do a little bit of a visual script piece to make the AI do more complex movements/attacks ect..?
     
  6. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    is this still implemented with emerald ai?
     
    Hawk0077 likes this.
  7. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    my ai companions i've also notice when following the player if i stop they carry on walking any ideas how to make them follow and stop when my player stops but also wander around?
     
  8. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
    @BHS I can't wait for the update. I'm really looking forward to the combat text. ;)
     
  9. bholland

    bholland

    Joined:
    Mar 24, 2017
    Posts:
    28
    BHS, thanks for the reply, I took a video of it happening and have a screenshot of the only collider on the AI. The transform for the projectile is well in front of the weapon. I have set the ranged projectile to many different prefabs, I'm using this one, cause it shows what is happening the best. I'm using the Opsive UCC if that makes any difference. The same thing happens when the AI's are shooting at each other. The video is here https://twitter.com/brion_holland/status/1193237590217900034?s=20
     

    Attached Files:

  10. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    This is an example of what I am talking about. The character sometimes acquires the target and attacks, sometimes (more often than not) the AI just pushes the character around. This is using the Invector integration. I set it up exactly as directed in the tutorial. The tags and layers are correct otherwise I could not damage (or take damage) the enemy.

    AI Pushing Player
     
  11. F0GZ

    F0GZ

    Joined:
    Feb 22, 2018
    Posts:
    33
    I cant play hit animation on my "zombies". They recieve damage, with that all ok. But they just walking to player, dont play any hit animations. Help me please!
     
  12. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,745
    Cant wait for the update, looks great, mostly for the new sounds/particle effects :) Wanted to show a short vid of a fight with Dilophosarus, EAI has been a god send to the project:

     
  13. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Increase the mass of the player, on the rigid body?
     
  14. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,745
    @Nitrox32 please check your "stopping distance" (Ai Settings/Movement), it sets the distance that an agent will stop before waypoints or a target (or complete a attack animation).
     
    julianr likes this.
  15. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    that'll help too. I use invector, and had to increase the characters mass or the AIs to match as sometimes the AI slide into you and push you, or vice versa. this may be fixed now though. Not updated to the latest Emerald yet.
     
    warthos3399 likes this.
  16. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,745
    @julianr yea ive run into that prob before, my dinos were pushin the player around while attacking, and no damage dealt. So i adjusted the Stopping Distance (the attacks were actually behind me, and i could see inside the dinos body).

    As soon as i set the dino farther away during attacks, damage was done, and the close up look was great.
     
  17. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    whats the max amount of companions you can have ?
     
  18. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    This should be possible with some custom modifications. The only limitation currently is that there's no way to manually trigger an attack. I plan on adding the ability to do this through code with the next update.
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Make sure you have your tags and layers setup correctly. These are what allow AI to tell what is a target and what isn't. Also, if you want your AI to flee from the player, make sure you have AI Flees From Player set to Always. This is located under the Tag Options.

    Herd functionality isn't yet added, but a work around could be to assign one of the 4 reindeer a the companion behavior type so the other 3 reindeer follow the 4th.

    Use the Dynamic Wander Type. It allows you to control the max allowed steepness that waypoints can be generated.
     
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I've considered this for a future update, but it wouldn't be for at least a few updates.
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Not currently, but herd and breeding mechanics are what I have planned for the 2.4 update.
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    What animation is being used for firing? The AI seems to drop near the ground before or while firing. Unity colliders, when attached to the parent of the AI, do not follow animations. This may be why your projectiles are having issues (they may even be hitting the ground because of the AI dropping to the ground).

    You also have a few errors in your Unity console, are these related to Emerald AI? If so, what are they?
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    They should stop where your player is according to their following stopping distance. If you are using Root Motion animations, ensure you have the Movement Type set to Root Motion in the Movement Settings.
     
    julianr likes this.
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Make sure your attack stopping distance is set high enough. I'll see if I can recreate this, but I've never encountered it with Invector.
     
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    AI will only play hit animations when not attacking or moving. This is to avoid player exploits where players can continuously trigger the hit animation and never allowing the AI to properly attack or move. If your hit animations are not working entirely, make sure they are enabled under the Animation settings and that you have applied hit animations to the hit animations list.
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Awesome :) Looking great!
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    There's no cap. Each follower that a companion has is independent to that AI.
     
  28. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    bhs i am using navmesh but i notice the companions get to close to my player and then walking into them and don't stop when my player does ?
     
  29. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    Thanks Not sure about the tags as I set them up whilst setting the AI to attack. But they are set to Always Flee (but they dont) and steepness is set to dynamic and steepness setup also.
     
  30. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    Thanks. I tried that already. Increasing the mass of either the player or the enemy had no effect.
     
  31. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    I was able to make it work although I think I need more testing. I found that my stopping distance was high enough because my enemy would attack. If I stood there and didn't respond to the enemy attacks, the enemy would not try to push me around. However after I attacked the enemy would simply push me around. Changing the mass of the player had no effect. This is what I had to do to make it work. First, I had to disable the box collider that Emerald AI uses. I tried to remove this component but Emerald AI won't let me. I added a capsule collider to the AI and made its radius larger than the obstacle avoidance radius in the nav mesh agent. I'm not sure why it works now but I can say that if I turn on the box collider that Emerald AI needs, after the first player attack the AI just pushes my player around. A bug perhaps?
     
  32. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,745
    Stopping Distance is a big thing in that situation, and no, you cant remove the EAI box collider, but you can shut it off. Honestly changing/increasing the Mass wouldnt work in that senario, you think it would, but it doesnt. Glad you got it figured out, but just make sure that by increasing the capsule collider radius fits and doesnt cause any other probs down the line. Just as a side note, have you also tried decreasing the obstacle avoidance radius?

    Best of luck bro :)
     
  33. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    Maybe the hit animations should be put on another layer, like an "upper body" layer, so they can still play without having to stop general movement.
     
    warthos3399 likes this.
  34. AaronVictoria

    AaronVictoria

    Joined:
    Aug 21, 2010
    Posts:
    176
    @BHS Another suggestion for something I hacked into my project for the time being. We have passive NPCs that required "Line of Sight" to allow the player to sneak up behind them to pick their pockets or steal from them. So I had to remove the restriction that forces passive AI entities to use the trigger detection type. I also had to hack in support for passive AIs to detecting the player without always require the " && EmeraldComponent.AIAttacksPlayerRef == EmeraldAISystem.AIAttacksPlayer.Always", as once again these are non-combat NPCs that we can sneak around. In our case, they aren't required to always attack the player.
     
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    You can also use Playmaker and have your AI start as Passive and then when some event happens change their Temperament so they attack.
     
  36. AaronVictoria

    AaronVictoria

    Joined:
    Aug 21, 2010
    Posts:
    176
    Yea that's how I have it coded now, but I need Line of Sight always to ensure that the NPCs always have their native blindspots.
     
  37. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Yea, that's strange that he forces Trigger detect on Passive AI. That restriction should be removed.
     
  38. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    would their be a way to say have the ai on aggressive or passive then when the player gets within distance make the ai change to a companion (like a taming method)?
     
  39. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    The EmeraldAIPlayerDamage script has changed in the latest version, and I am not able to use the Integration video to get it correct for Invector Integration, damage to the player. I had it working in the previous version when the YouTube tutorial matched the script. The other scripts in the integration still match, and are working fine. What should the EmeeraldAiPlayerDamage script look like for the integration, now?

    EDIT: I have damage Ai to Player working now, but I am only using part of the Integration tutorial, and completely ignoring the code segment the tutorial instructs me to insert.
     
    Last edited: Nov 12, 2019
  40. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Yes, you can do this in code. Or you could use my Playmaker actions, which have those actions coded for you.
     
  41. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right how would i go about doing this in code? :)
     
  42. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Well, you can download my Playmaker actions and just look at the code and copy and paste into your own scripts.
     
  43. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    don't have playmaker :( would work without ?
     
  44. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Playmaker actions are just a way of wrapping up code to be used in Playmaker. So, you can just strip out the code from the Playmaker action and put into a regular script.
     
  45. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right brilliant :) where can i download ?
     
  46. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
  47. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    thank you :) is it the tame ai i need to integrate into mine ?
     
    magique likes this.
  48. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    I did decrease the obstacle avoidance as well. That also seemed to help. It's now working about 90% of the time. I've got more tweaking to do but I on the right track. I'll post what I find out in case anyone else has this issue.
     
  49. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Unity 2018.3 and Emerald 2.3. This Stag gets stuck like this. What do I adjust to prevent this? Tipped Deer.PNG
     
  50. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BHS I have another request for the next release. After testing my Playmaker action for TameAI, I discovered that an AI can only be tamed if it is set to Cautious and either Brave or Foolhardy. It also won't work if it is set to Always Attack Player. I understand the logic behind this, but I don't think you should put any hard-coded restrictions on when and how an AI can be tamed. It would be nice to have at least a parameter to this function such as follows:

    public void TameAI(Transform target, bool force = false);

    If the force flag is on then it should just ignore any hard-coded conditions and Tame the AI anyway. That might include auto changing the temperament and other required values. That way, we could use it under any circumstances we want. Of course, I can always change the temperament and other parameters before calling TameAI as well, but this way it can be done with a single function call. Then I could have a spell attack that if successful could Tame an AI no matter what state it's in.

    Thanks.
     
    unity_7UFP4-iCkwsgjg likes this.