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

    A2GStudios

    Joined:
    Nov 21, 2016
    Posts:
    52
    Is there an integration for uRPG yet?
     
  2. AaronVictoria

    AaronVictoria

    Joined:
    Aug 21, 2010
    Posts:
    176
    @BHS I have a small suggestion to toss into the hat for upcoming updates. Allowing the user to input their own animator location would be incredibly useful. I've hacked one in on a project I'm working on, but it would have been so much easier to just integrate that into the setup process for those less "programming-capable". In this project the animator is on a "base" component that is an immediate child of the main NPC object.
     
  3. mikemuk01

    mikemuk01

    Joined:
    Dec 1, 2016
    Posts:
    53
    I want to use Emerald AI in a RPG game using a first person player for melee combat. Does Emerald support first person?
     
  4. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Your player solution being third or first person is irrelevant. The only requirement is that your player solution can integrate with Emerald and vice versa. Most systems already have integration such as RFPS, but integration is fairly easy even if your chosen player controller doesn't already have it.
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    - Realistic herd mechanics are coming with the 2.4 update, but animals can still wander around with various animations and avoid predators animals.
    - I do plan on adding more emote animations after the 2.3 update.
    - AI cannot currently swim, but I also plan on adding this at some point. With the example code I posted previously, it is possible for AI to play drinking animations if the collide with the trigger collider. However, the will not seek out said collider. It is only if they happen to come in contact with it.
    - Yes, you can place as many waypoints as needed to trigger colliders that can then play needed emote animations using the script I posted. If you setup your factions, you can have certain animals chase and kill other AI. The opposing AI will flee, if you've setup your AI's factions and AI's settings to do so.
    - The included character controller is a simple example that allows users to receive damage and inflict damage to AI.
    - There's currently no needs system.
     
    julianr likes this.
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Not yet. I will begin working on this as soon as the 2.3 update is finished.
     
    julianr likes this.
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I can certainly look into this feature for a future update.
     
    AaronVictoria and julianr like this.
  8. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right brilliant how would it be possible to make predators chase prey in radius? or is this a future thing?
     
  9. drcfrx

    drcfrx

    Joined:
    Jan 26, 2013
    Posts:
    53
    My Player doesn't seem to be detected as a Player by EmeraldAISystem, but as an AI, though the AI creatures detect the Player and attack it as it's supposed. The Player is tagged Player, and on Player layer. The problem is when the creatures attack, their damage isn't sent to the Player. Apparently EmeraldAISystem consider my player as an AI (TargetTypeRef == TargetType.AI and not .Player, I know because I added a bunch of debug.log ). There's probably something wrong with my Player but I can't find what. What could be causing this?
     
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, every AI has its own Detection Radius that it uses to either flee from or attack targets.
     
  11. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I did notice something similar while developing the version I'm currently working on and managed to fix it, but it didn't happen very often. I believe the issue was related to the aggro system so try disabling that to see if it resolves the problem for now.

    You can also try look at these line in the EmeraldAISystem script as they may be mislabeling your player.
    Code (CSharp):
    1. TargetTypeRef = (TargetType)TypeOfTarget;
     
  12. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right so it is possible to create a predator prey relationship ?
     
  13. drcfrx

    drcfrx

    Joined:
    Jan 26, 2013
    Posts:
    53
    @BHS Hi, thank you for the answer. I pinpointed the issue with the Line of Sight detection method. With the Trigger one it work as intented, they deliver damage.
    In EmeraldAIDetection line 302+ the Player is identified, but after that the TargetType.Player is lost somehow. I'm super beginner at scripting and cannot figure this out :/

    Also in Trigger detection mode, once my Player is killed by the AI, they continue to attack as if the Target isn't cleared. Is there some parameter I missed somewhere for that?

    Edit: Deactivating the aggro on AIs didn't change the issue.
     
    Last edited: Aug 20, 2019
  14. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    2.3 going to have NPC logic ie at 25% health, cast this spell and do these series of animations?
     
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, you would just customize the Faction System. For example, a wolf could be apart of the Predator faction and will see the Prey faction as targets. The Prey faction will see the Predator faction as threats and will flee whenever they enter their detection radius.
     
  16. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Are you using a custom character controller? Have you tried testing the included demo scenes to see if this problem is still present?

    You also need to make sure that you set your Player layer within the Emerald AI editor as by default the only layer that's detected is the Water:
    PlayerLayer.png

    You need to handle your own logic when the player dies. I've updated the included EmeraldAIPlayerDamage script with the new version to stop AI from attacking once the player's health has reached 0. Since all damage is sent through this script, you just need to apply some code to tell the AI when the player is dead or their health reaches 0, if you are using a custom health system.
     
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, the Support abilities will only trigger when the health percentage threshold has been met. The logic for this will be expanded with future versions as well as additional support abilities other than healing.
     
  18. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    For those who are interested, I've updated the Emerald AI Demo to version 2.3 to showcase some, but not all, of what's possible with the 2.3 version of Emerald AI.

    Emerald AI 2.3 Demo (1GB)
     
    Last edited: Aug 21, 2019
  19. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    What an incredible AI system this is, i started out using Emerald Animal AI a while back, and really loved it (still do), but after upgrading to EmeraldAI 2.2, its been great, im developing a jurassic type game called Jurassic Extinction (posted in the WIP section) and i couldnt be happier. I do miss the "grazing" and maybe it will be added in, at a future date.

    Its worked out great for dino AI, and the integration with UFPS and Invector 3rd Person Controller, is just great. Ive had no console errors to correct, or any probs so far. Thnx guys, great work on this asset :)
     
  20. CHACHINOI

    CHACHINOI

    Joined:
    Aug 21, 2019
    Posts:
    2
    hello, i start coding and i use vrtk with emerald but i only find integrarions ufps or invector, i want to use the system of shooting the gun vrtk simple to damage the AI but i can not find any script ... could you m help for setting up a script? thank you
     
  21. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    Is their a health system for AI?
     
  22. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    Well health can be set in a few ways:
    You can set base health ( min and max)
    You can set at what point a agent "flees" by percentage of health
    and can set a health "bar" above an agents body (option)
    I wish it had Grazing, and Thirst system that Emerald Animal AI had...
    Right now im just getting used to the system, and mods can be made to the code, but base functions are really good :)

    @CHACHINOI you wont find a script for that integration, unless BHS can dev one, thats a tough integration.
     
    Last edited: Aug 21, 2019
  23. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right will the health work for the AI ? and how would i go about implementing the health to the AI?
     
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Very cool game! Thanks, it's great to hear you're enjoying Emerald AI and that it's working for your project. I would appreciate if you left a quick review on the Asset Store, if you have the time. :)

    Also, AI can play grazing animations. You just use gazing animations in place of idling animations. I have a few ideas of how to improve this after version 2.3 is released by generating waypoints according to objects such as food sources. This way AI can go to food objects and play eating animations.
     
    warthos3399 likes this.
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    In order to damage an AI, you just need a reference to the object that was hit with something like this:
    Code (CSharp):
    1. if (YourTargetReference.GetComponent<EmeraldAI.EmeraldAISystem>() != null)
    2. {
    3.    YourTargetReference.GetComponent<EmeraldAI.EmeraldAISystem>().Damage(YourDamageAmount, EmeraldAI.EmeraldAISystem.TargetType.Player, YourPlayerTransform, 400);
    4. }
    5.  
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Each AI has its own health variable built into the Emerald AI system. Users can set the total health an AI has, as well as how quickly it regenerates after receiving damage, all from within the Emerald AI editor.
     
  27. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah brilliant would an additional collider or a damage script be needed so that it recognizes when it has been hit?
     
  28. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    @BHS That demo is actually really good.

    Anybody on the fence should try out that demo.
     
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    A collider is applied automatically so there's no need to apply any additional ones. An AI can be damaged by having a reference to the hit AI object and using something like below. This will automatically damage the hit AI according to the YourDamageAmount parameter.
    Code (CSharp):
    1. YourTargetReference.GetComponent<EmeraldAI.EmeraldAISystem>().Damage(YourDamageAmount, EmeraldAI.EmeraldAISystem.TargetType.Player, YourPlayerTransform, 400);
     
  30. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah brilliant would i need to put this reference in my create damage script?
     
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, that is correct.
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks! I feel like the previous demo did not show Emerald AI's versatility very well. I'm glad you like it.
     
  33. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    and does the dead animation require anything to work or will it just display the animation once dead?
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Nope, all you need to do is apply a death animation to the death animation list (you can use up to 3) and one of them will play once your AI's health reaches 0.
     
  35. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Any chance that you can add stats to the AIs like mana, stam, armor?
     
  36. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    Im going to leave a review on asset store for sure. Yes, that what ive done is use grazing animations instead of idle, and it works great, also to be noted is EmeradAI works well with flyers, as it can use any animation, but seems to work really well with my Pteranodons, flying up, dive attacks, etc. they look very realistic.

    Great idea with the waypoints/food sources, would be a good addition.
     
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I wanted to add these features in with the 2.3 update, but I didn't want it to delay the update any further. I have plans to add these, as optional features, after the 2.3 update.
     
    warthos3399 likes this.
  38. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks! That's great to hear Emerald AI has worked so well for you. A really cool improvement with version 2.3 is the significant improvements to AI turning so AI will fully utilize their blend tree turning animations like below, which should look great with your dinosaur models. Cool looking game btw!

    TurnAnimationImprovements.gif
     
    warthos3399 likes this.
  39. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah awesome but i do require a damage script or can i just use this asset?
     
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Are you referring to player damage or AI damage?

    A simple player controller is included that will damage an AI and receive damage from an AI.

    If you are using a custom solution for a character controller/player health, you would need to add calls to your custom health system to Emerald AI's EmeraldAIPlayerDamage script. Then, with your custom weapon system, you would add the damage code I posted above to the object that your weapon system hits.
     
  41. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    That looks awesome! :)
     
  42. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Another question, if i wanted an AI ti stay stationary or can only move in x radius, how would i do that?
     
  43. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    @BHS Went to integrate with UFPS and got 9 console errors..sent you a conversation request, un less you want me to post here... I even tried the code that was in the tutorial video, as it was different...
     
    Last edited: Aug 22, 2019
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    The Stationary wander type allows an AI to stay in one place and the Dynamic wander type allows the AI to generate random waypoints within its wandering radius. Or do you want the ability for the AI to switch between the two?
     
  45. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, I was able to read you message. It looks like there may be syntax errors. Also, what version of UFPS are you using? The tutorial covers version 1.7.5 and not the newer version.
     
  46. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right no what i'm trying to do atm is have AI animals attack and kill other animals. Also have an AI fight back or flee on low health when being hunted by other AI
     
  47. BHS

    BHS

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

    Since there have been numerous request for awhile now with a proper AI's needs/grazing system, I thought I'd write one up real quick, I was also curious of the versatility of Emerald AI. :)

    The AI Needs System will be included with the 2.3 update. For those who want it early, send me a private message via a Conversation, along with your Invoice Number, and I would be more than happy to send it to you early. It should work with the current 2.2 version.

    As for the needs system, it works by efficiently searching for nearby objects of the appropriate layer, when an AI's Current Resource amount reaches 0 (aka it's hungry, thirsty, etc). When this happens, an AI will generate waypoints to the detected resource objects, up to the Max Resource Waypoints amount. When an AI reaches a resource object, users can specify which idle animation will be played based off of the index of their Idle Animation List such as an eating animation. The AI will then refill their resources at a rate of 1 resource per second according to the AI's Wait Time seconds.

    After an AI has reached its full limit, it will switch to the Dynamic Wander Type and wander around its new area until its Current Resources reaches 0 again. It will then repeat the process, but most likely getting new resource objects with each time it generates new waypoints. There is also an option for an AI to die if it doesn't get to resources quick enough.

    Lastly, there is a Gathering Event that is triggered each time an AI successfully collects a resource. This can be used to run custom code to add items to custom inventories or add values to custom variables

    I wanted to keep the system very general so any kind of AI can use it. It could allow an AI to collect resources for a town, allow an animal AI to look for food and water sources, and tons more. AI will also still react to or fight off potential threats. All in all, it should allow for some very cool added functionality. I'm looking forward to seeing what users can create with. Keep in mind, I consider it still in beta stage at this point. :)

    An AI generating waypoints to resource objects when its Low Resources amount is reached.
    DynamicGrazingGeneration.gif

    An AI refilling its resources at a generated resource destination.
    GrazingArrivalOptimized2.gif

    EmeradAINeedsSystem.png
     
    Last edited: Aug 22, 2019
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    This is handled through the faction system. It's what allows other AI to see who is a target or not. An AI will fight back if they are of the appropriate Behavior Type. For more information on the faction system, see the documentation here: https://docs.google.com/document/d/...2njM7Jx9pYlqgbtM8/edit#heading=h.asmf5b22etw8

    An AI will flee when their health is low and if they have the Confidence Type of Brave. You can then customize the amount of health needed for the AI to flee.
     
  49. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    @BHS I agree, its most likely syntax, and im using UFPS 1.7.5, its looking like its the way i inject the code into the script, any chance i can get a working copy of the EmeraldAIPlayerDamage script? (just send if possible in our Conversation) In the mean time, ill try and figure out whats going on, as this hasnt happened before, could be my Notepad++ which i use for coding, and just updated, could be a few different things, lol
     
    Last edited: Aug 22, 2019
  50. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    @BHS i like that, AI refilling its resources at a generated resource destination, that would be a killer addition, as no other AI i know of does that, and i can think of quite a few applications for that...depending on options...