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
    Tween might be easier to understand for you. You can get DOTween free.

    https://assetstore.unity.com/packages/tools/animation/dotween-hotween-v2-27676

    [EDIT]
    Then you can do a generic tween as follows:

    DOTween.To(x => someProperty = x, startValue, endValue, duration);

    Where someProperty is the thing you want to tween such as the navmesh offset. I haven't done that specifically, but it should work.
     
    Last edited: Aug 28, 2019
  2. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    says Possible incompatibility with Unity 5
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    If you mean DOTween, no it's fine. It works with 5, 2017, and more. I use in 2017 all the time and I've used in 5 before as well. Here is a script that does the tweening to simulate a bird flying from the ground and then landing. It cycles over and over again just for test purposes:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.AI;
    5.  
    6. using DG.Tweening;
    7.  
    8. public class FlyAndLand : MonoBehaviour
    9. {
    10.     private NavMeshAgent agent;
    11.  
    12.     // Use this for initialization
    13.     void Start()
    14.     {
    15.         agent = GetComponent<NavMeshAgent>();
    16.         DOTween.To(x => agent.baseOffset = x, 0.5f, 5f, 3f).OnComplete(DoneFlying);
    17.     }
    18.    
    19.     private void DoneFlying()
    20.     {
    21.         DOTween.To(x => agent.baseOffset = x, 5f, 0.5f, 3f).OnComplete(DoneLanding);
    22.     }
    23.  
    24.     private void DoneLanding()
    25.     {
    26.         DOTween.To(x => agent.baseOffset = x, 0.5f, 5f, 3f).OnComplete(DoneFlying);
    27.     }
    28. }
     
    zKici likes this.
  4. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    okies will give it a try thanks :)
     
  5. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    Hi
    Hey warthos3399- Like the T-Rex but his left leg tow nail doesn't cut into the grass properly.. lol kidding - looks awesome. Question - What version of Unity are you working in?
     
    warthos3399 likes this.
  6. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    20184.2f (LTS), for me EAI works perfect, right now im working on the Pteranodons animations, lol looking real good..
     
  7. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    Coolness- Downloading 2018.4.3f1 (LTS) to work in EAI. Awesome on the P-Dons Animations! pop a vid up when done
     
    warthos3399 likes this.
  8. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    Quick question does emerald character controller work with quadrupeds ?
     
  9. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    Yes it does, and after the 2.3 update, they gonna look awesome :) BHS posted a video of the new turning on the previous page or 2, check it out, i cant wait, that is gonna look great with my dinos :)
     
  10. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah brill okay got it working but the animations aren't played any ideas? (got the animator as emerald animator controller)
     
  11. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    We need more details, like what animal are you setting up, what are you looking to make it do, etc.
     
  12. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah sorry. I am doing a playable cow. I want the player(cow in Third Person) to be able to walk and run with the controls normally used in the standard assets (Ethan). I am using emerald ai character controller to try get my cow to do what ethan would do. (not sure if you have used standard assets third person controller.
     
  13. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    UPDATE: Manager works fine. NOT Emerald AI Issue: Apologize - Downloaded older version of Unity and still same issue so had to be local problem. Dev System has 6 LCD's and a small decommissioned 7th LCD with Elgato card for video recording that was displaying Emerald manger. All good :)
     
    warthos3399 likes this.
  14. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    New Pteranodon footage, non-combat mind you (turning needs to be slower), still needs to be refined, but lookin good, the offset is right,m and the combat animations will be great :)

     
  15. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
  16. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
  17. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    OK, to be honest, you can use the "Ethan" 3rd person controller, but is not advised. You need to set up a FPS (3rd person) type solution for your 3rd person controller, if you use the standard assets controller, you will have to write custom code or at least Mods to get what you want.

    This is what i do... for enemies/etc. you use EAI, for your main character you use a FPS system, then you have 2 seperate systems for character and enemies, much easier to control, and much more functionality/options.
     
  18. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    i got the cow moving with key controls just not sure why it's not display the walking animation on the w key it's just sliding. Any recommendations for assets for this FPS ?
     
  19. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    Yep, what im using right now UFPS or Invector, no better out there, and they integrate with EAI... always check the software (EAI) integrations support, so you know what you can use...
     
    Last edited: Aug 28, 2019
  20. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    would it be possible to get a horse animset pro integration?
     
  21. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    sorry meant to put any recommendations for third person controller for 4 leg animals?
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I have plans to make an integration tutorial for Horse Animset Pro after version 2.3 is submitted.
     
  23. Darrkbeast

    Darrkbeast

    Joined:
    Mar 26, 2013
    Posts:
    125
    I did play around with those settings and it didn't help. They were default first and I thought they needed to be faster, but the ai still gets stuck in the loop.
     
  24. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    YES!!!!!!!!!!!!!!!!! I'm excited
     
  25. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    I want WoW level Boss fights. Do you think you can make this?
     
  26. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    Hi All - Just getting into EAI today, I couldn't get a companion to follow me (Just sat in Idle Animation). Had created Controller active, Player/Respawn Tags setup, Animations assigned, Head Transform setup, Behavior on Companion-No go. So I just dropped the EAI fallen Guardian in with EAI Player and he does turn in circles as he follows me when I circle him and if I walk up to him all way he starts walking (but cant move because Im Blocking him). Gotta be missing something simple? lol Any help would be appreciated.
     
  27. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    Make sure your animations are "looped", any animations that are repeated like walking, running, need to be looped. otherwise they will only play once, then stop.
     
    Last edited: Aug 28, 2019
  28. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    my emerald AI Character controller is just sliding along on key press (Like W) does anyone know how to get the animations to play?
     
  29. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    Yep- I have them on loop, Companion will continue to remain at idle forever. Should I choose NavMesh or RootMotion? This is a console error about NavMesh. Thoughts? :)
     

    Attached Files:

  30. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Try lowering your Agent Turn Speed located under AI Setting>NavMesh Settings. Start off with a value of 25 to see if it helps.
     
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    With the new abilities system, it should make boss fights a lot easier. I plan on adding more dynamic movement to fights after 2.3 so that will help even further.
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    You need to bake your scene with Unity's NavMesh. A tutorial on this can be found here: https://docs.unity3d.com/Manual/nav-BuildingNavMesh.html
     
  33. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Sweet! I would like to see a complex example
     
  34. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    Thanks bhs- Using MapMagic with large terrain. Didn't think of it. :) Baked and now my AI moves!! :) but just does a random run in a square but does come at me as companion or if switched to "Aggressive" . Wander Type on "Dynamic"- thoughts? :)
     
  35. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    Correction: AI does "not" come at me or follow me in companion mode.
     
  36. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    All good bhs- Clean scene and working great. Appreciate the help.
     
    warthos3399 likes this.
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    No problem. It’s great to hear you got it all figured out.
     
  38. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Hi there. Can I use Emerald AI just for the Enemy Detection/Shooting part? I have my own flying logic for an enemy so it's not using a NavMesh.

    Thanks
     
  39. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    Not exactly sure what your trying to do but, EAI requires NavMesh for enemy/agent movement, so yes, for any other, besides your custom scripted flyer, yes.
     
    Last edited: Aug 30, 2019
    iddqd likes this.
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there. I’m not entirely sure how the system would behave without an active NavMesh Agent component. It is currently used for some of the mechanics such as the attack distance and stopping distance.
     
    iddqd likes this.
  41. YondernautsGames

    YondernautsGames

    Joined:
    Nov 24, 2014
    Posts:
    353
    Hey @BHS. I've put together an integration repo with my asset NeoFPS on GitHub if you want to take a look?

    The readme runs through what I did to get it working (was pretty simple tbh). I also emailed your support email with a few minor issues I encountered that would be great to get fixed.
     
    BHS and warthos3399 like this.
  42. ellisthemiracle

    ellisthemiracle

    Joined:
    Jul 4, 2018
    Posts:
    27
    Hi, I have another question.
    I have UniStorm and wanted to ask I could create a simple goal like: enemies only spawn at a specific time and despawn after a certain amount of time. Or a complex daily goal like NPC wake up and go to work in the morning and go home and sleep at night.
     
  43. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
    @BHS When you release Emerald AI 2.3 will you have to start fresh or can you just update to it from 2.2? Also any idea for the release time of 2.3?
     
    Last edited: Aug 30, 2019
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there. Thanks for making an integration repo for Emerald AI. NeoFPS looks like a very well-done asset! I've responded to your email as well. :)
     
  45. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    Hi Team - I see some previous threads on UFPS integration. Been working a lot with EAI - Very well done BHS! Amazing Asset. Before I bring UFPS 2.0 into the loop is there anything I should know? I know about the EAI, enemy, etc tags and the EmeraldAIPlayerDamage edit's. Thanks!
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    You should be able to import it as an update, but I still need to test this. I plan on having version 2.3 submitted next week.
     
    warthos3399 likes this.
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there. For spawning, if you already own Crux Spawner, I have built-in weather, time of day, and seasonal spawning for UniStorm. Spawning is a bit more complicated than a schedule system as there are many mechanics that would need to be written. I can't provide an in-depth example, but if you are looking for a small example for API to use, you could do something like this. Despawning could be handled similarly.

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UniStorm;
    6.  
    7. public class UniStormTimeSpawning : MonoBehaviour {
    8.  
    9.     public float SpawnInterval = 5;
    10.     public List<GameObject> DaySpawnObjects;
    11.     public List<GameObject> NightSpawnObjects;
    12.  
    13.     private void Start()
    14.     {
    15.         InvokeRepeating("TimeSpawning", 0.1f, SpawnInterval);
    16.     }
    17.  
    18.     void TimeSpawning ()
    19.     {
    20.         if (UniStormSystem.Instance.CurrentTimeOfDay == UniStormSystem.CurrentTimeOfDayEnum.Day)
    21.         {
    22.             Instantiate(DaySpawnObjects[Random.Range(0,DaySpawnObjects.Count)], transform.position, Quaternion.identity);
    23.         }
    24.         else if (UniStormSystem.Instance.CurrentTimeOfDay == UniStormSystem.CurrentTimeOfDayEnum.Night)
    25.         {
    26.             Instantiate(NightSpawnObjects[Random.Range(0, NightSpawnObjects.Count)], transform.position, Quaternion.identity);
    27.         }
    28.     }
    29. }
    30.  
    31.  

    As for schedules, here's an improved example schedule system based off of the one I wrote a couple of weeks ago. It uses idle animations and the OverrideIdleAnimation function to allow you to control which animation is played while the AI is in its current schedule. It allow you to create a list of schedules each with the ability to set the hour the event will happen, the idle animation used, and being able to set the Wandering Type to Stationary or Dynamic. I plan on expanding this with built-in API the 2.4 update, but this should give you a general idea of how to accomplish this for now.

    How to use - Just attach it to your AI you would like to have a schedule and assign a transform for each schedule location.

    UniStorm Hourly Time of Day Schedules (Updated to be compatible with v2.3):
    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using EmeraldAI;
    6. using UniStorm;
    7.  
    8. public class UniStormAIScheduleByHour : MonoBehaviour
    9. {
    10.     public int StartingEventIndex = 1;
    11.     public List<ScheduleEvent> ScheduleEvents = new List<ScheduleEvent>();
    12.  
    13.     [System.Serializable]
    14.     public class ScheduleEvent
    15.     {
    16.         public int HourOfEvent = 12;
    17.         public enum WanderType { Dynamic = 0, Stationary = 3 };
    18.         public WanderType ScheduleWanderType = WanderType.Stationary;
    19.         public Transform ScheduleLocation;
    20.         public int IdleAnimationIndex = 1; //Idle animations are 1 through 3
    21.     }
    22.  
    23.     EmeraldAISystem m_EmeraldAISystem;
    24.     EmeraldAIEventsManager m_EmeraldAIEventsManager;
    25.  
    26.     void Start ()
    27.     {
    28.         m_EmeraldAISystem = GetComponent<EmeraldAISystem>();
    29.         m_EmeraldAIEventsManager = GetComponent<EmeraldAIEventsManager>();
    30.         UniStormSystem.Instance.OnHourChangeEvent.AddListener(() => UpdateAISchedule());
    31.         GetComponent<EmeraldAISystem>().ReachedDestinationEvent.AddListener(() => ActivateIdleAnimation());
    32.         StartCoroutine(InitializeSchedule());
    33.     }
    34.  
    35.     //Initialize our schedules, but only when UniStorm is initialized.
    36.     //Because the events are based on the hour, the starting schedule will be based off of the StartingEventIndex.
    37.     IEnumerator InitializeSchedule ()
    38.     {
    39.         yield return new WaitUntil(() => UniStormSystem.Instance.UniStormInitialized);
    40.  
    41.         m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)ScheduleEvents[StartingEventIndex].ScheduleWanderType); //Set our AI's Wandering Type using the StartingEventIndex
    42.         m_EmeraldAISystem.m_NavMeshAgent.ResetPath(); //Reset our path so the previous destination doesn't interfere with the new one
    43.         m_EmeraldAIEventsManager.SetDestination(ScheduleEvents[StartingEventIndex].ScheduleLocation); //Set our destination using the StartingEventIndex
    44.         m_EmeraldAISystem.StartingDestination = ScheduleEvents[StartingEventIndex].ScheduleLocation.position; //Set our dynamic wandering destination using the StartingEventIndex
    45.         m_EmeraldAIEventsManager.OverrideIdleAnimation(ScheduleEvents[StartingEventIndex].IdleAnimationIndex); //Set our Idle Animation Index using the StartingEventIndex
    46.         m_EmeraldAISystem.WaitTime = 2; //Dynamic - Set our Wait Time to 2 so the AI starts its animation 2 seconds after arrive to its new destination
    47.         m_EmeraldAISystem.StationaryIdleSeconds = 2; //Stationary - Set our Wait Time to 2 so the AI starts its animation 2 seconds after arrive to its new destination
    48.     }
    49.  
    50.     //This is called once every UniStorm hour usuing a UniStorm OnHourChangeEvent.
    51.     void UpdateAISchedule ()
    52.     {
    53.         if (!m_EmeraldAISystem.IsDead)
    54.         {
    55.             for (int i = 0; i < ScheduleEvents.Count; i++)
    56.             {
    57.                 if (UniStormSystem.Instance.Hour == ScheduleEvents[i].HourOfEvent)
    58.                 {
    59.                     m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)ScheduleEvents[i].ScheduleWanderType); //Set our AI's Wandering Type for this time of day
    60.                     m_EmeraldAISystem.m_NavMeshAgent.ResetPath(); //Reset our path so the previous destination doesn't interfere with the new one
    61.                     m_EmeraldAIEventsManager.SetDestination(ScheduleEvents[i].ScheduleLocation); //Set our destination for this time of day
    62.                     m_EmeraldAISystem.StartingDestination = ScheduleEvents[i].ScheduleLocation.position; //Set our dynamic wandering destination for this time of day
    63.                     m_EmeraldAIEventsManager.OverrideIdleAnimation(ScheduleEvents[i].IdleAnimationIndex); //Set our Idle Animation Index for this time of day
    64.                     m_EmeraldAISystem.WaitTime = 2; //Dynamic - Set our Wait Time to 2 so the AI starts its animation 2 seconds after arrive to its new destination
    65.                     m_EmeraldAISystem.StationaryIdleSeconds = 2; //Stationary - Set our Wait Time to 2 so the AI starts its animation 2 seconds after arrive to its new destination
    66.                 }
    67.             }
    68.         }
    69.     }
    70.  
    71.     //Sets our Idle Active to true when our AI arrives at its schedule destination.
    72.     void ActivateIdleAnimation ()
    73.     {
    74.         GetComponent<EmeraldAISystem>().AIAnimator.SetBool("Idle Active", true);
    75.     }
    76. }
    77.  
     

    Attached Files:

    Last edited: Sep 19, 2019
    ellisthemiracle likes this.
  48. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,749
    @MagiSoftworks im sure BHS will comment on this, but i use UFPS v1.7.5 (as the documentation lists), not sure about v2.0, it might not be that different.
     
  49. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there. Thanks! The integration tutorial covers UFPS version 1.7.5. I don't know exactly what's different with version 2.0 so the integration may not work correctly. The setup process should be the same, but the variable and script names might be a little different.
     
  50. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    Hi Again - :) I went ahead and integrated Invector which seems to be working great with the script mod's. Problem is My EAI character will start walking or running and after 5 or so steps continues to move and turn but the walk or run animation are not longer working (Ice Skate mode).-When he detect me same thing but the attack animations kick in fine, If he Starts to move back - Again 5 steps then the ice skating begins. I checked all animations on Loop- Agent Turn speeds, Baked NavMesh is on simple small test terrain. FYI - He even does this while doing Idle with wander type on dynamic - 5 steps then skating. Gotta be missing something stupid. lol