Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[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. dl290485

    dl290485

    Joined:
    Feb 4, 2018
    Posts:
    160
    I'm going to be annoying and ask again for a Play Maker tutorial.
     
  2. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    I cant get AI to damage the player, using Ultimate Survivals Player Prefab. I also cannot damage the Enemy.

    I managed to get the AI to chase and attack, but attack deals no damage. Literally stuck on last hurdle.

    Looking for Help.
     
  3. halo_of_the_sun

    halo_of_the_sun

    Joined:
    Sep 17, 2017
    Posts:
    64
    Just picked this up to integrate with RFPS and it seems to working well. One thing I've noticed though is that the Arrows that are fired into the NPCs positions itself at their feet, as in I fire and hit them in the head but the 'stuck arrow' is repositioned at their feet, any ideas?

    Also: is there anyway to add multiple hits (the animation throws 3 swings so apply damage 3 times) and also grabs (freezing the Player during a mauling animation)?
     
    Last edited: Apr 9, 2018
  4. MarceloASG

    MarceloASG

    Joined:
    Jun 15, 2017
    Posts:
    23
    How I solve this error?
    Capturar.PNG
     
    Last edited: Apr 9, 2018
  5. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I've yet to find out what has changed on invector namespace recently? this may be why you are getting the error. look for where damage is done on invector, this may help
     
  6. MarceloASG

    MarceloASG

    Joined:
    Jun 15, 2017
    Posts:
    23
    I changed the vCharacterController but I can not find the vDamage
     
  7. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Is your level made with lot of 3D tiles ? This could be physics collisions volumes checking.
    Do you use in Temperament , Wander Type "dynamic" ? Perhaps random position most of the time fail because of indoor walls.
    You could give to @BHS a small indoor scene test, only models and no textures, or make a similar scene with cubes.
    Did you use melee or ranged AI ? i'll give a try at some indoor level.
     
  8. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Not really complicated at all. I did a test with my own simple AI using NavMesh and trigger collider to detect player and it runs perfectly smooth with barely any frame drop at all. I've decided to write my own AI system from scratch.
     
  9. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    From scratch you mean using behaviour tree plugin ? There is Invector AI coming also in case you would be interested.
    Anyway, i'll make some test in indoor and perhaps it will help to identify what is wrong.
     
    Last edited: Apr 9, 2018
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Hey there!

    I will personally look into your performance issues with indoor scenes. My guess is that it's because of the AI's Detection Radius. This controls how large the AI's sphere collider is. This sphere collider is used for detecting when an appropriate target is near. When this happens, the AI's line of sight and more advanced settings are enabled.

    I believe the root cause of the issue is the sphere collider having too many on trigger enter events happening because of all the other colliders in the indoor scene. To confirm that this is correct, try giving your AI a much smaller Detection Radius. Try testing this with both the Trigger and Line of Sight Detection Types.



    1) Emerald AI agents don't currently look for cover.
    2) The team/herd functionality will come with the next main update.
    3) Hearing will also be coming at a later time, however, this functionality can be handled with custom scripts.
    4) AI have a line of sight feature allowing players to hide from AI. However, shadows do not affect visibility.


    Hey there!

    I'm trying my hardest to find the time to make a PlayMaker tutorial. I have 2 other popular assets that also require my attention. I should certainly have the time to make a tutorial sometime this week. Is there something specifically you are trying to accomplish with Emerald AI and PlayMaker?


    Ultimate Survival is hard to work with as there are so many dependencies. The developers are also supposedly working on a huge rewrite, however, I'm not entirely sure if the asset is still supported. When I get the chance, I will see how difficult it would be to add support for it. If it's relatively simple, I will add an integration tutorial.


    I believe this is because of the newest Invector update. I will be updating the tutorial to reflect the changes as soon as I can.
     
    Last edited: Apr 10, 2018
  11. GWStudio

    GWStudio

    Joined:
    Sep 27, 2016
    Posts:
    109
    how to make ai take cover ??!!
     
  12. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I sent you PM.
     
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    AI don't currently have the ability to take cover while in battle. However, it's something I can certainly add with one of the upcoming updates.
     
  14. halo_of_the_sun

    halo_of_the_sun

    Joined:
    Sep 17, 2017
    Posts:
    64
    Quick note: I'm playing with the melee options and having an issue where the enemy runs up to the player to attack, but all the player has to do is take one step backward to dodge the attack. I've played with the Attack Distance and Stopping Distance but it still only needs one step backward for the enemy to miss. Anyway to boast the attack radius?
     
  15. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    I've spent the last 2 days playing around and made my own debug script which shows me what the current target is and how far away the target is, also if the target is obstructive... what i've found is no matter what you set the attack distance the ai will stop just a little bit more that the attack distance meaning it justs stays in one place and does nothing, but once i set the attack distance a bit more then it will start attacking. Also the if the target is obstructed the ai won't change target or give up and start searching for new targets.
    Say i spawn an ai and then build a base the ai will still try to target the player and won't attack the non ai target which is the building. But if i build first and spawn and ai the will try to damage the building sometimes but sometimes because the ai stops before the attack distance it will just stay still. and if i break a wall and move in front of the ai, it will just stand there and wont switch to target the player.
    My ai is set to aggressive, has player and building layers set to targets, the targets work as my debug tells me what targettype the current target is and the target.
    I've made custom functions in my debug script where i can make the ai search for new targets and this sometimes works and the ai can attack the player or try to damage the building.
    I feel its 90% there but need to be able to switch targets if the the ai can't get to the target.

    Code (CSharp):
    1. Emerald_AI AI;
    2.     public float WaitTimeTillFindNewTarget = 5f;
    3.     public float timeElapsed = 0f;
    4.  
    5.     public float CurrentTargetDistance = 0f;
    6.     public string CurrentTargetType;
    7.     public bool IsObstructed;
    8.     public Transform CurrentTarget;
    9.  
    10.     public bool UPDATE_DistanceIsMoreAttackDist = false;
    11.     public bool UPDATE_Obstructed = false;
    12.  
    13.  
    14.     void OnEnable ()
    15.     {
    16.         if (AI == null)
    17.             AI = GetComponent<Emerald_AI> ();
    18.     }
    19.  
    20.     void Update ()
    21.     {
    22.         currentTarget ();
    23.         currentTargetType ();
    24.         currentTargetDistance ();
    25.  
    26.         if (AI.CurrentTarget != null) {
    27.            
    28.             checkObstruction ();
    29.  
    30.             // IF DISTANCE FROM TARGET IS MORE ATTACK DISTANCE
    31.             if (UPDATE_DistanceIsMoreAttackDist) {
    32.                 if (AI.DistanceFromTarget >= AI.AttackDistance) {
    33.                     timeElapsed += 1f * Time.deltaTime;
    34.                     if (timeElapsed >= WaitTimeTillFindNewTarget) {
    35.                         PickNewTarget ();
    36.                         timeElapsed = 0f;
    37.                     }
    38.                 }
    39.             }
    40.  
    41.             // IF OBSTRUCTED AND TIME HAS REACHED WAITING TIME
    42.             if (UPDATE_Obstructed) {
    43.                 if (AI.TargetObstructed) {
    44.                     timeElapsed += 1f * Time.deltaTime;
    45.                     if (timeElapsed >= WaitTimeTillFindNewTarget) {
    46.                         PickNewTarget ();
    47.                         timeElapsed = 0f;
    48.                     }
    49.                 }
    50.             }
    51.         }
    52.     }
    53.  
    54.     void PickNewTarget ()
    55.     {
    56.         AI.CurrentTarget = null;
    57.         AI.ClearTargets ();
    58.         AI.SearchForTarget ();
    59.     }
    60.  
    61.     void checkObstruction ()
    62.     {
    63.         IsObstructed = AI.TargetObstructed;
    64.     }
    65.  
    66.     void currentTarget ()
    67.     {
    68.         CurrentTarget = AI.CurrentTarget;
    69.     }
    70.  
    71.     void currentTargetDistance ()
    72.     {
    73.         CurrentTargetDistance = AI.DistanceFromTarget;
    74.     }
    75.  
    76.     void currentTargetType ()
    77.     {
    78.         switch (AI.TargetTypeRef) {
    79.         case Emerald_AI.TargetType.AI:
    80.             {
    81.                 CurrentTargetType = "AI";
    82.             }
    83.             break;
    84.         case Emerald_AI.TargetType.Player:
    85.             {
    86.                 CurrentTargetType = "PLAYER";
    87.             }
    88.             break;
    89.         case Emerald_AI.TargetType.NonAITarget:
    90.             {
    91.                 CurrentTargetType = "NON AI";
    92.             }
    93.             break;
    94.         }
    95.     }
     
  16. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Hi @magique
    I did a test with some indoor like walls, with 10 AI what seems an average number for Skyrim scenario like battles, frame rate stays around 60fps, and jumps to 100fps when some AI gets in front of the player.


    Emerald performance is good, i'm not sure BD would get more speed because Emerald has all it's AI coded in one same class.

    Anyway i'm strongly interested in your AI system indeed.


    Give AI faster attack speed and longer attack distance;
    or decrease player step back speed and distance.
     
    Last edited: Apr 11, 2018
  17. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Mine works fine on the PC as well. It's on the Wii U that I see the problem. A PC test won't reveal the problem unless you have a PC with specs equivalent to the Wii U.
     
  18. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Yep on lower hardware, any additional physics calls can make a difference.
    Emerald is mainly designed for Desktop, for mobile you are on your own.
     
  19. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    The AI follow the player anywhere on the map, AI doesn't have any origin location, while AI should stay in their own zones. It's typical in most rpg or mmo.

    It's not great for performance if your 100 level AI all follow your player at same time, because the player just run around.


    I hope a home location feature will be available and each AI will be able to choose one.
     
  20. dl290485

    dl290485

    Joined:
    Feb 4, 2018
    Posts:
    160
    1) To have my weapons deliver damage to the AI
    2) To have the AI weapons deliver damage to the player
     
  21. GWStudio

    GWStudio

    Joined:
    Sep 27, 2016
    Posts:
    109
    i hope u do in next update ☺
     
  22. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Hi @BHS,
    Will you integrate modern,Sci Fi weapons for ranged AI ?
    I posted code modification that works as Raycast weapons for ranged AI, it only needs some modifications to allow ranged attack to play during some time doing several raycast hits and some reload action.
    Or is modern weapons for ranged AI not a priority ?
     
    ChillyMcChill likes this.
  23. ChillyMcChill

    ChillyMcChill

    Joined:
    Nov 17, 2016
    Posts:
    57
    How can I get Invector explosives/grenades to damage my EM AI?
     
  24. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    I am trying really hard to find the stuff in the US code that relates to ApplyDamage or Damage Player, but it is hard. I hope you have better luck than me. I have managed to do other stuff within US in which to effect player health, but struggling to see where they have hidden it.


    Any help with this I would be very grateful
     
  25. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    Hi all
    I am just starting with emarald ai.
    I am using it with unity free survival shooter template for testing. I notice that the enemy setup with AI is moving todards the player and stoping at a distance. I want him to go and touch the player or atleast go very close to the player.

    What can i do to achieve this. below is the image. I want him to go much close to player than that. The Players collider has small e=radius and Ai enemy only has the collider created by emerald ai which also has small radius.

    https://drive.google.com/file/d/1SQqmsWi3ElFNBLfMLeeN7fyclOkExlL5/view?usp=sharing
     
    Last edited: Apr 17, 2018
  26. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    You may find it under UltimateSurvival\Damage System ... DamageArea.cs or HitBox.cs - noticed some damage elements in there.
     
  27. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    Thanks Julian. I have seen these files, and it seems it wants a hitbox or something.

    Have you managed to do this before? There is an old tutorial that doesn't work in current version of emerald, but it seemed at one point in time it was possible to use both.
     
  28. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I've not, sorry! I just use the inventory, albeit heavily modified as my gui skills are not that great yet. I'll be working Invector and Emerald/ICE so I can't imagine it will be that much different.
     
  29. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    Fixed. In case someone is interested, the min weapon attack distance option can be tweaked to set hiw close the ai can get to player.
     
  30. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    Ranged attack delay too long.
    how to increase the frequency of ranged attack by AI. Lets say i have a boss who should keep continually attacking with ranged weapon. How do i set it. Currently i can see considerable dealy between ranged attacks by AI
     
  31. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    @BHS it’s just this kind of things that makes not wanna buy any of this assets. ICE have the same issues. I ”fixed” it by making a upperbody layer in the animator that handeld the attack and lower body walk forward. I made them blend and the monster walked forward at the same time it attacked (this i made in ice) however it still looked stupid tough likebthe monster walked on slippery ice (lol) ... So this must be fixed somehow, no monster stops to attack, drop one aaa game name that does that? @BHS how can you fix this? It should be very hard to dodge attacks, not just step back everytime he attacks....



    thats me playing doom in vr. Look at the monster movements , thats something we want to achieve..
     
  32. HalDevOne

    HalDevOne

    Joined:
    Apr 12, 2014
    Posts:
    67
    @mattis89 That is why this asset NEEDS to have collision based attacks and not time based. You can then tweek your hit colliders the way it suits you. We will se if there will be an update on that part soon.
     
  33. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    no not really. It need to handle and blend walk and attack and not walk - stop - attack... Animation event to deal damage is the way to go.. faster and no messy colliders.. and easy if an attack have combos..
     
    karmik likes this.
  34. HalDevOne

    HalDevOne

    Joined:
    Apr 12, 2014
    Posts:
    67
    @mattis89 well maybe it depends then on what kind of game you are building. Cant see why the colliders are so messy. How can you precise an timebased attack at the exact point when the enemy swords/punch is hitting/touching the player. Or if an specific body part is being hit. Or avoid an incoming swinging sword with a roll/strafe. Colliderattacks should be as an option anyways.
     
  35. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    Guys has anyone implemented integration betweek core game kit and EAI
    I mean using the CGK killable script on player / weapon objects to send /receive damage for AI creqted using Emarald AI

    Any help on what code and where to change will be helpfull. I am vey bad at coding.
     
  36. dl290485

    dl290485

    Joined:
    Feb 4, 2018
    Posts:
    160
    Still waiting for a Playmaker tutorial. Even just any indication as to what I should be looking into myself. I mean if I can figure out how to use Playmaker to jerry-rig the emerald system to create my own damage and death sequence for AI and players, surely you can say something to point me in the right direction to set it up properly. I still can't properly use the asset which I only bought because the description promised that no programming is required.

    On a different note; I have three questions related to AI becoming alert

    1) Is there a way to create an alarm system, so all AI (or within an area) become alert to a location if the player is seen by one AI? So for example if one AI spots you, they can alert the others to respond to the location.

    2) Can AI become alert by seeing one of their own faction dead?

    3) Can AI be alerted by sound within a radius? So if the player or an AI start shooting, other AI will respond like the zone was a player sighting of their own?

    I'm considering making a stealth game, but all of the above are major considerations as to how it would work, like if I even allow the player to attack AI or not, etc.


    Edit: I can see someone asked pretty much the same questions already. Coming soon. I'll just say then that this would be very good.
     
  37. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    So the solution i found is create an oncolissionenter check with EAI tag and then send damage. And the use death event to do damage to CGK killable script.

    If anyone has a better solution please suggest me. Will post the code later.
     
  38. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    yea, well int that case yes..
     
  39. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    I made a script and made a new public function with emerald damage code, removed the damage part from emerald script. and on the animation add a event where the damage should apply and call your script function keeping the in range part too, so only can damage if in range .

    Trying to adjust each ai attack animation to the correct timing is very long process, animation event is very quick and very accurate
     
  40. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    I have the same problem. Can you please share it with me. I am looking at workarounds to this as it looked too complicated. Didnt want to break EAI in a working prj. Lazy :)
     
    llJIMBOBll likes this.
  41. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    If you have monsters that bite and hit and scratch jump on you swipe with tail, then animation event is the way to go. but ofc you need a descent damage radius so it dosent look stupid. Different damage radius for all attack would be awesome..
     
    llJIMBOBll likes this.
  42. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Hey,

    Is possible to increase the dynamic wander radius more than 300?same question for the detection distance?

    thanks
     
  43. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    I won't post all the code but a couple lines and line number start and end.

    Copy from around line 2344
    Code (CSharp):
    1. if (TargetInRange && WeaponTypeRef == WeaponType.Melee){
    2.                 if (TargetTypeRef == TargetType.Player){
    To around Line 2370
    Code (CSharp):
    1.                     //Custom code can be added here.
    2.                 }
    3.             }
    Copy to a new script and custom function. Then in Emerald script in the lines you just copied, where it says DamagePlayer(); and TargetEmerald.Damage....... also if you have custom damage part in NonAITarget.
    Blank these lines out from Emerald code. //DamagePlayer();
     
    karmik likes this.
  44. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    You could make a couple different function with different TargetInRange ranges, just add a multiplier in your custom script.. something like. Then for the different animations call a different function with the range you want for that animation.

    Code (CSharp):
    1.  
    2. public float SomeMultiplier1 = 1f;
    3. public float SomeMultiplier2 = 0.5f;
    4. public float SomeMultiplier3 = 2f;
    5.  
    6. // NORMAL RANGE
    7. if (TargetInRange * SomeMultiplier1 && WeaponTypeRef == WeaponType.Melee){
    8.                 if (TargetTypeRef == TargetType.Player)
    9.  
    10. // HALF RANGE
    11. if (TargetInRange * SomeMultiplier2 && WeaponTypeRef == WeaponType.Melee){
    12.                 if (TargetTypeRef == TargetType.Player)
    13.  
    14. // DOUBLE RANGE
    15. if (TargetInRange * SomeMultiplier3 && WeaponTypeRef == WeaponType.Melee){
    16.                 if (TargetTypeRef == TargetType.Player)
    17.  
    18. {
     
  45. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Hey everyone!

    I have update the Invector Integration Tutorial with the new Invector API. There is also an additional step in the Ranged section (Step 13) so make sure you don't miss it.


    You can remove the attack delay by setting your AI's min and max Attack Speed to 0.


    You can have AI use a Run Attack animation that will allow the AI to attack while the player is moving. Even if the attacks were collision based, if the player moves out of the collision area, the attack would be missed. If you wanted to remove the code that stops a player from being able to miss an attack, I would be more than happy to show you what code to remove.


    I can certainly look into collision based attacks when I get the chance.


    Hey there!

    Yes, you will need to edit the line below in the Emerald_AI_Editor script where 300 is the max wandering distance.
    Code (CSharp):
    1. CustomIntSlider(new Rect(), new GUIContent(), WanderRadiusProp, "Dynamic Wander Radius", 1, 300);
     
    Last edited: Apr 25, 2018
    julianr, HalDevOne and mattis89 like this.
  46. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Was the dead replacement option removed from Emerald A.I? I can't see to find it in the 2.0 update.
     
  47. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    @BHS can you please add a on collision event trigger to AI projectiles so i can add player gameobject and trigger the method to change health similar to events that we have on AI
    It would be a oot easier thisway than manually add my own script to AI projectiles for damage
     
  48. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    has anybody had luck making this work with uma? if not may i request support for it?
     
  49. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    How can I make Emerald AI enemies make attack faster.
    In the actual usage, the Emerald AI attack then wait some time to attack again. I want to reduce that time. Is it possible?
     
  50. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    @BHS i too have similar issue. I want the enemy ai to find the player. Stayput in his position and start shooting projectiles as long as the player is in range. If the player goes out of range then act based on configured behaviour. Can we currently achieve this.