Search Unity

[RELEASED] Emerald AI 2.3 - The Ultimate Universal AAA Quality AI Solution

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

  1. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    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
    MorpheusXI and julianr like this.
  2. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    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.
     
  3. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    @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
  4. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    @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...
     
  5. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    But that turning animation...damn, i imagine its based on basic turning animation (turn left, turn right, etc.), most of my models/animation doesnt include that, but easy enough to add in, god bless Blender, lol
     
  6. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    all updates free or will their be addition charges in future once the asset gets more advanced?
     
  7. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    Invector integration went fine, no console errors, etc., UFPS, not so good (shame, i love that controller), ive narrowed it down to the Last code injection, which ive tried the official tutorial instructions/code, and etc. and video shown code (as its different) but no go. Looks like Invector integration won the race, will test it out to see if its a viable alt..

    Either way, im using EmeraldAI for all my projects, very versitile, and ill work things out...
     
  8. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    @unity_7UFP4-iCkwsgjg Im sure updates are no charge, once you buy the product all updates are free...im tellin ya, grab this now, as the support and added functions are great, and can be applied to ANY project...
     
  9. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    I can’t send you the updated UFPS script directly, but I can send you the updated EmeraldAIPlayerDamage script and walk you through modifying the UFPS script. I would recommend using Visual Studio as it has many useful features and can tell you real-time syntax errors, plus it’s free. :)
     
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Yes, that’s the blend tree seamlessly blending the walking and turn animations. It can really help turning feel believable.
     
  11. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    All updates are free and will always be free. I’ve never charged for updates. :)
     
    gearedgeek likes this.
  12. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    Right that's me sold just brought this on the asset store :)
     
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Awesome! Also, I just sent you the AI Needs System. :)
     
  14. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    I used Emerald Animal AI since it was released, and that system never failed me ever, and i know Emerald AI will be the same, ill be using it in all my projects, i trust it and love the features.

    Im just now getting deeper into it, ill be updating all animations with all my species of dinos all weekend long, so sould be fun, i know the results will be great. :)
     
  15. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    if we make a game can we sell on steam if it has this asset in or is it only personal use ?
     
  16. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    Yes you can... :)
     
  17. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    @BHS got everything in the script working all syntax errors corrected now accept 1 line... If i put DamageUFPSPlayer(DamageAmount); anywhere within the SendPlayerDamage function, i get 1 error:
    Assets\Emerald AI\Scripts\Components\EmeraldAIPlayerDamage.cs(26,4): error CS0103: The name 'DamageUFPSPlayer' does not exist in the current context.
    All other code i have working nicely.
     
    Last edited: Aug 23, 2019
  18. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Awesome, that's great to hear! Feel free to let me know if you need any help with figuring out Emerald AI and its capabilities. :)
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Yes, you are able to use Emerald AI and sell your game on Steam. It is not a personal use system.
     
  20. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    ah brilliant :) only issue so far is my animations when walking and running are doing a half quick turn then turning back if that makes sense? like they are shaking and want to turn but can't even when not required to turn such as head on attack
     
  21. pccross

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    87
    Hopefully basic question here. I have a gunscript that when raycast hits rigidbody on character, it will cause a positional transform of the character based on force:
    i.e. = hit.rigidbody.AddForce(-hit.normal * impactForce);

    This works fine if Emerald AI isn't attached to the character, however, when I attach Emerald, the character no longer reacts to that. I'm assuming Emerald AI is over-riding any other potential physics interactions?
     
  22. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    @BHS might need some help later, but heres a vid of emeraldAI with flight animation (base right now), i also have much more animation to add (offset, dive attack, etc.), and havent added foliage etc. to the area yet loving it, lol:

     
    Last edited: Aug 23, 2019
    MorpheusXI likes this.
  23. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    wow warthos mate that is incredible!
     
  24. huntersteeger

    huntersteeger

    Joined:
    Dec 27, 2017
    Posts:
    13
    The gathering system looks awesome! I'm trying to find a way I could position a character somewhere accurately such as a chair or bed. Any suggestions on how to achieve this? I'm using the AI Schedule script you sent with Unistorm, It works great I just need help adjusting the exact position.
     
  25. drcfrx

    drcfrx

    Joined:
    Jan 26, 2013
    Posts:
    36
    @BHS Just a quick follow up to ease your mind (just in case...), so yes I use Ootii Motion Controller along Inventory Pro in the same scene where I had problem. But I did a reinstall of Emerald and all is fine now, I must have messed a file somewhere. Line of Sight is working nicely now and AIs are kicking my butt just fine, thank you. Apologies for the troubles, your asset rocks =)
     
    Last edited: Aug 23, 2019
  26. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    can we use other layers or only water for detection?
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Nice, that's looking great!
     
  28. Karmate

    Karmate

    Joined:
    Aug 30, 2014
    Posts:
    40
    is 2.3 version completed ?
     
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Thanks!

    For now, it could be done with setting the AI's destination to the object and playing an emote animation when the AI arrives at its destination. This can even be done by using an Reached Destination event and using the Emerald AI Events Manager script to play the needed emote animation.

    With version 2.3, the turning mechanics have been improved quite a bit that should make positioning a character at an object destination easier since the AI will properly rotate to their destination. After 2.3, I will begin working on making an external tool specifically for positioning and rotating an AI to intractable objects, such as chairs and beds.
     
    huntersteeger and SickaGamer like this.
  30. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Great to hear everything is working correctly now and thanks!
     
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    There is a minor bug with the 2.2. version and some turning animation, but it has been fixed with version 2.3 and AI will now turn much better. An example of this can be seen in the last gif of my post here, if you're interested: https://forum.unity.com/threads/rel...lls-blocking-more.336521/page-73#post-4882796

    However, what you are explaining may be different. It sounds like you may be using the incorrect animations for turning. If your AI are using Root Motion, ensure that you have them enabled through the Movement Settings. Also, try adjusting your rotation speeds and angles.
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    What may be happening is that Emerald AI's Box Collider might be interfering with the raycast. You can add a layer mask to your raycast to have it ignore the Emerald AI layer so this no longer happens. You can also try better positioning the Box Collider so it's not bigger than it has to be.
     
  33. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Almost, shouldn't be more than a week until it's submitted.
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Yes, you can use whichever layer and as many layers as needed. The only reason water is used is because it's an included default layer.
     
  35. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    when my cows go to attack each other they go half way through each and don't demonstrate the actually attack clip ( have already done the event SendEmeraldDamage on the animation ?
     
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Yes, make sure you have a SendEmeraldDamage animation event setup on the attack animations. Also, increase your AI's Attack Distance. It sounds like they are getting to close to properly initialize an attack.
     
  37. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    736
    This tool wouldn't also be the same one for Flying AIs would it?
     
  38. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    that worked BHS but now that are half spinning really past when the play button is pressed not sure why?
     
  39. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Try increasing their Stopping Distance. It sounds like it's too small for them to properly reach it.
     
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Do you mean that it will also work for flying AI that use Emerald AI?
     
  41. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    736
    Yoy were talking about making a Flying AI system like that in Skyrim
     
  42. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    yep worked thank you :) i does the headbutt animation but only at the start is their anyway to make it headbutt only when colliding with other AI? So that they basically lock horns and headbutt each other?
     
    Last edited: Aug 24, 2019
  43. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    @SickaGamer As you can see in my above video, EAI works great for flying agents, havent seen Skyrims in action, but your only limitation is your agents animations. EAI can do alot from the base, but im sure you could add more with custom code/scripts.
     
  44. Darrkbeast

    Darrkbeast

    Joined:
    Mar 26, 2013
    Posts:
    74
    Hi, I have a weird issue with my ranged enemies. They seem to get stuck in the turn animation (the Turn Parameter) stays on and the enemies facing the player but continues that animation and wont attack. If I run away the enemies will then follow and as long as I run strait and it doesn't need to turn it will attack like normal, but the second I turn its back in the turn loop. Only happens on my ranged enemies and I use the same animations on the melee as I do on ranged.
     
  45. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Oh, the other flying system. I wasn’t sure which you were referring to. The tool I was talking about on the other post is not the same as the other flying system’s.
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    I’m not sure how you would go about that, but you could have them both attack each other while using their headbutt animation as an attack animation. You could also make their detection radii small so they only do this when they’re really close to each other, if that’s along the direction of what you are trying to accomplish.
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,955
    Make sure your AI’s Combat Turn Angle amount isn’t set too low. This can make it difficult for the AI to rotate to its target without over rotating causing it to go back and forth like you’ve explained. Also, make sure the Combat Rotate Speed isn’t set too high because this can also cause over rotating.
     
  48. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    i tried the radius but because its small they don't approach each other :/ can get them doing the animation to resemble it fine just can't seem to get them touching or almost touching. This is what i am trying to accomplish but through game upload_2019-8-24_5-13-17.jpeg
     
    MorpheusXI likes this.
  49. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    259
    Try placing the models (starting point) closer together, then set radius. Remember, your setting a "close combat" situation...
     
  50. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    248
    tried that :( they either go to far together so it looks like they are eating other lol or to far apart :(