Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] Emerald AI 2.4.1 - 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:
    3,828
    I really like the red outline on the enemy being targeted. Nice.
     
    BHS likes this.
  2. Musonica

    Musonica

    Joined:
    Jul 25, 2017
    Posts:
    5
    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!
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,828
    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.
     
  4. wood333

    wood333

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

    magique

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

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    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
     
  7. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    994
    @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..?
     
  8. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

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

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    315
    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?
     
  10. gearedgeek

    gearedgeek

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

    bholland

    Joined:
    Mar 24, 2017
    Posts:
    17
    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:

  12. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    128
    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
     
  13. 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!
     
  14. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    760
    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:

     
  15. julianr

    julianr

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

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    760
    @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.
  17. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,131
    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.
  18. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    760
    @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.
     
  19. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,259
    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.
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,259
    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.
     
  22. BHS

    BHS

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

    BHS

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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,259
    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?
     
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,259
    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.
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,259
    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.
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,259
    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.
     
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,259
    Awesome :) Looking great!
     
  29. BHS

    BHS

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

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    315
    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 ?
     
  31. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    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.
     
  32. Nitrox32

    Nitrox32

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

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    128
    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?
     
  34. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    760
    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 :)
     
  35. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    280
    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.
  36. AaronVictoria

    AaronVictoria

    Joined:
    Aug 21, 2010
    Posts:
    149
    @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.
     
  37. magique

    magique

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

    AaronVictoria

    Joined:
    Aug 21, 2010
    Posts:
    149
    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.
     
  39. magique

    magique

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

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    315
    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)?
     
  41. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    682
    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
  42. magique

    magique

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

    unity_7UFP4-iCkwsgjg

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

    magique

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

    unity_7UFP4-iCkwsgjg

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

    magique

    Joined:
    May 2, 2014
    Posts:
    3,828
    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.
     
  47. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

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

    magique

    Joined:
    May 2, 2014
    Posts:
    3,828
  49. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

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

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    128
    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.
     
unityunity