Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[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:
    4,001
    Hey everyone!

    First off, my apologies this update is taking so long. The switchable melee and ranged combat feature required quite a bit of rewriting to several major sections of the system in order for everything to function smoothly. I don't believe this update will require Emerald AI to be removed and reimported. For those who don't want to read everything, the spells and abilities system will be available with the next version. This update also includes the switchable range and melee combat as well as the addition to Animation Profiles.



    I will discuss everything regarding this updated in-depth below:

    When adding the additional animations, this took to the total animation count to nearly 70 animations. Apply animations manually every time took way too long. So, I designed an Animation Profile system that allows users to export all of an AI's animations to a scriptable object (called an Animation Profile) which can then be imported to another AI that is compatible with said animations. This includes all animation settings including speeds and mirroring.

    When an Animation Profile is created, it copies all of an AI's animations and animation settings. These objects simply store all the information to be copied to other AI so the animations don't have to be applied manually. Animation Profiles can be modified manually, if desired. They will just need to be imported for the changes to be applied.
    AnimationProfileImporting.gif

    The next issue was the way the projectiles were designed. They were dependent on individual AI and needed to be edited within the Emerald AI editor. It also required having to manually update the projectile each time you made a change which made it difficult to share projectiles between multiple AI.

    To fix this, I went back to my initial concept the of spells and abilities system I designed last year. This allowed all of a projectile's information to be stored using a scriptable object and could be shared between multiple AI. It also allowed for much more complex options and functionality because the projectiles weren't confined to the Emerald AI editor.

    How the new spells/ability system works is, each AI has 3 sets of lists; one for Offensive abilities (projectiles such as spells, arrows, bullets, etc), one for Support abilities (healing and healing overtime), and Summoning abilities (the ability to summon other AI to help the caster fight). The logic in which these abilities are picked is handled internally to maximize an AI's ability to survive such as choosing to heal over casting an offensive ability when the AI's health is low, given the AI has support abilities. Each ability category has settings to specify which abilities are in said categories. Users can share abilities between other AI. Each Ability Object can be customized with effects, sounds, timers, amounts, and more. These will be expanded over time with future updates to include area effects, shields and protection abilities, and more. I'm more than happy to take requests and suggestions to improve and build upon this.

    Healing
    HealingAbilityCompressed.gif

    Summoning
    SummoningOffensiveAbilities.gif

    AbilitiesCategories.png
    AbilitiesEditors.gif

    The projectile system's calculations have all be redone to function properly. Previously, projectiles would sometimes not explode on collision, fly in a random direction if a target was killed before it met its target's destination, and more. Now, if an AI's target happens to die or be out of the AI's ranged firing angle, the projectile will continue to travel toward the last visible/available position until it times out or collides with another object. Projectiles with the 2.3 version now function perfectly.

    I'm hoping to have this update submitted as soon as possible. Future updates will include breeding functionality, improved faction system, and more spells and abilities. Like always, this, and future updates, are free.

    Updated: More information regarding the upcoming animal needs system available with version 2.3 that allows AI to generate waypoints to resources/food sources: https://forum.unity.com/threads/rel...lls-blocking-more.336521/page-73#post-4882796
     
    Last edited: Aug 22, 2019
  2. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,632
    @BHS The update looks fantastic. The Animation Profile is one I am really happy about. Great job.
     
    BHS and julianr like this.
  3. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    386
    Oh baby. I hope Unity reviews this fast. It looks awesome. I don't use magic in my current project but I can see how these can be used to add functionality that I was trying to build manually, like AI calling for backup and AI using medkits to heal. Good job!

    @BHS Is there any easy way to integrate Tony Li's LoveHate for use within or as a replacement for factions? Dox maybe?

    Mark
     
  4. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    787
    Nice job @BHS now for 2.3 with boss fights AI. Cant wait!
     
    BHS and julianr like this.
  5. kuru61

    kuru61

    Joined:
    Oct 17, 2016
    Posts:
    3
    When will Astar-Pathfinding (Aron Granberg) be implemented?
     
    wood333 likes this.
  6. Mafutta

    Mafutta

    Joined:
    Sep 30, 2014
    Posts:
    29
    Any specials instructions for upgrading required? (Other than making a project backup) Looks promising.
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    Thanks!

    I haven't had a chance to look into using LoveHate's factions system with Emerald AI so I'm not entirely sure how to go about this at the moment. I do plan on redoing/improving Emerald AI's faction system with the update after 2.3 and I will keep support for LoveHate's faction system in mind when doing so.
     
    Akshara likes this.
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    I plan on looking into support for Astar-Pathfinding, but there are a few portions of Emerald AI I'd like to improve before doing so.
     
  9. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    The 2.3 update shouldn't require removing the system from projects before updating. However, users will need to re-create their Animator Controllers so they can be updated and redo their AI's projectiles using the spells and abilities system.
     
    SickaGamer likes this.
  10. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    787
    Wahoo! Thanks @BHS! The long awaited for 2.3 :) Did you ever decide if you were going to do the new Flyer AI asset?
     
    Last edited: Jul 29, 2019
  11. Mafutta

    Mafutta

    Joined:
    Sep 30, 2014
    Posts:
    29
    I see. So does all animations and speed settings for each character have to be re-applied manually as well?
    I also use Crux. Any issues with Crux during upgrade ie Do I have to re-make crux objects? Thanks.
     
  12. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    787
    @BHS How hard would it be to add some type of Lua type code (think Tony's dialogue system) to make AI do a series of abilities based on health and or fight time? Basically you could have a fight mechanics section that would do a set of animations and/or scripted abilities based on a logical Lua script.
     
    Last edited: Jul 30, 2019
  13. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    139
    I only just noticed this.

    Awesome. Works perfectly again. Thanks for that. :)
     
    BHS likes this.
  14. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    94
    Is there a way to incorporate text mesh to the UI elements?
     
  15. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    94
    I'm all of a sudden getting this repeating error when I add UI Elements:
    NullReferenceException: Object reference not set to an instance of an object
    EmeraldAI.Utility.EmeraldAIHealthBar.Update () (at Assets/Emerald AI/Scripts/UI/EmeraldAIHealthBar.cs:56)

    Th UI Displays however it is rotated 180 degrees.
     
    Last edited: Jul 31, 2019
  16. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    94
    Sorry for the ton of questions but I'm really enjoying Emerald AI. Here's another:

    The AI Warrior's Hit Effect has been modified, but not updated. To update, go to the AI's Settings tab under the Combat section, in its Emerald Editor, and press the 'Update Hit Effect' button.
    UnityEngine.Debug:Log(Object)
    EmeraldAI.Utility.EmeraldAIInitializer:CheckEditorUpdateButtons() (at Assets/Emerald AI/Scripts/Components/EmeraldAIInitializer.cs:68)
    EmeraldAI.Utility.EmeraldAIInitializer:Initialize() (at Assets/Emerald AI/Scripts/Components/EmeraldAIInitializer.cs:26)
    EmeraldAI.EmeraldAISystem:Awake() (at Assets/Emerald AI/Scripts/System/EmeraldAISystem.cs:773)

    What is this and I can't seem to find the "Update Hit Effect" button.
     
    SickaGamer likes this.
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    You're welcome!

    Yes and I will finish it when I have the time. :)
     
  18. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    No, not all of them. The new animation system works by splitting melee animations and ranged animations into two different categories. So all ranged animations will need to be reapplied, as well as ranged animation speed settings, because they're being added with the 2.3 version. Crux object should be fine and Crux will work better because I fixed a bug that didn't allow AI to reset properly.
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    Emerald AI's combat text system uses text mesh. Other than that, all of the built-in UI systems use the newer UI method. You can certainly create a custom system that uses text mesh though.

    Make sure you have your camera's Tag set to MainCamera. I will be fixing this with version 2.3.

    No worries!

    Press the Update button at the bottom of the Hit Effect tab found under AI's Settings>Combat>Hit Effect. This will be improved with version 2.3 by using Scriptable Objects.
     
  20. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    94
    Thanks for your responses. That answers the first round of questions. The Update button wasn't visible because I was experimenting with the Hit Effects and left the field blank despite clearly saying "This field cannot be left blank".:rolleyes:
     
  21. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    94
    So here are my next questions. I am using Opsive TPC and have made Emerald AI and TPC work together (many thanks to Magique for the clear and updated code). I'm having trouble with being able to avoid the AI by simply walking though it. I know the solution should be simple like mismatched collider tags or layers. But when I start messing with the layers or tags the hits stop registering or the AI stops responding. Question 1: How do I get the colliders to work without effecting the AI?

    Question 2: I have duplicated the my AI agent and both work fine except the second agent, who is using the same animation as the original one is getting the following error:

    'Warrior (1)' AnimationEvent 'ExecuteEvent' has no receiver! Are you missing a component?

    Why is this?
     
  22. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,632
    For this you are probably using an animation that already has its own animation event. I had that issue when I was using animations from Sword & Shield Animset Pro. You can just change the name of the event to SendEmeraldDamage or delete the event if it's not needed.
     
    SickaGamer likes this.
  23. huntersteeger

    huntersteeger

    Joined:
    Dec 27, 2017
    Posts:
    17
    I could use some help setting up EAI with Unistorm. I am trying to get my AI to have daily activities at certain times using emote animations and such.
     
  24. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    63
    Has 2.3 been submitted for review to the Unity store yet?
     
  25. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    787
    Usually @BHS says when it has. I would venture to say no right now. It should be live soon... Sometimes little things do come up.

    @BHS
    How hard would it be to add some type of Lua type code (think Tony's dialogue system) to make AI do a series of abilities based on health and or fight time? Basically you could have a fight mechanics section that would do a set of animations and/or scripted abilities based on a logical Lua script.
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,766
    That's probably outside the scope of where BHS wants to take Emerald AI. But it's certainly possible to use the Dialogue System's Lua and its Emerald AI integration's Lua functions to add this on top of Emerald AI yourself to make your AI do scripted sequences of actions.

    For example, you could hook up Emerald AI's DamageEvent() to call a Dialogue System Trigger that barks "Now I'm angry! Time to draw my big weapon!" and uses a Lua function to enable a special weapon. I'll add some more Lua functions to allow you to check more information about the Emerald AI in the next update.

    That said, a "detected another entity" event would be a handy addition to Emerald AI. Similar to the OnStartCombatEvent() but that gets triggered before combat starts, at the point when the AI first detects something else.
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    Sure thing! This is how I would code a schedule system. It uses idle animations and the OverrideIdleAnimation function to allow you to control which animation is played while the AI is in its current time of day activity. It also allow you to set a destination for morning, day, evening, and night each with the ability 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, and others, an example of how to accomplish this.

    I've created 2 systems; one for UniStorm and a general one for users who want to update the time of day with their own custom system.

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

    UniStorm Time of Day Schedules:
    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 UniStormAISchedule : MonoBehaviour
    9. {
    10.     public WanderType MorningWanderType = WanderType.Stationary;
    11.     public Transform MorningLocation;
    12.     public int IdleAnimationMorning = 1; //Idle animations are 1 through 3
    13.  
    14.     public WanderType DayWanderType = WanderType.Dynamic;
    15.     public Transform DayLocation;
    16.     public int IdleAnimationDay = 1; //Idle animations are 1 through 3
    17.  
    18.     public WanderType EveningWanderType = WanderType.Stationary;
    19.     public Transform EveningLocation;
    20.     public int IdleAnimationEvening = 1; //Idle animations are 1 through 3
    21.  
    22.     public WanderType NightWanderType = WanderType.Stationary;
    23.     public Transform NightLocation;
    24.     public int IdleAnimationNight = 1; //Idle animations are 1 through 3
    25.  
    26.     public enum WanderType { Dynamic = 0, Stationary = 3 };
    27.  
    28.     public CurrentScheduleEneum CurrentSchedule = CurrentScheduleEneum.Morning;
    29.     public enum CurrentScheduleEneum { Morning = 0, Day = 1, Evening = 2, Night = 3 };
    30.  
    31.     EmeraldAISystem m_EmeraldAISystem;
    32.     EmeraldAIEventsManager m_EmeraldAIEventsManager;
    33.  
    34.     void Start ()
    35.     {
    36.         m_EmeraldAISystem = GetComponent<EmeraldAISystem>();
    37.         m_EmeraldAIEventsManager = GetComponent<EmeraldAIEventsManager>();
    38.         InvokeRepeating("UpdateAISchedule", 0.1f, 1);
    39.     }
    40.  
    41.     void UpdateAISchedule ()
    42.     {
    43.         if (!m_EmeraldAISystem.IsDead)
    44.         {
    45.             if (CurrentSchedule != CurrentScheduleEneum.Morning && UniStormSystem.Instance.CurrentTimeOfDay == UniStormSystem.CurrentTimeOfDayEnum.Morning)
    46.             {
    47.                 m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)MorningWanderType); //Set our AI's Wandering Type for this time of day
    48.                 m_EmeraldAISystem.m_NavMeshAgent.ResetPath(); //Reset our path so the previous destination doesn't interfere with the new one
    49.                 m_EmeraldAIEventsManager.SetDestination(MorningLocation); //Set our destination for this time of day
    50.                 m_EmeraldAISystem.StartingDestination = MorningLocation.position; //Set our dynamic wandering destination for this time of day
    51.                 m_EmeraldAIEventsManager.OverrideIdleAnimation(IdleAnimationMorning - 1); //Set our Idle Animation Index for this time of day
    52.                 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
    53.                 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
    54.                 CurrentSchedule = CurrentScheduleEneum.Morning; //Update our current time of day so this only updates once
    55.             }
    56.             else if (CurrentSchedule != CurrentScheduleEneum.Day && UniStormSystem.Instance.CurrentTimeOfDay == UniStormSystem.CurrentTimeOfDayEnum.Day)
    57.             {
    58.                 m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)DayWanderType);
    59.                 m_EmeraldAISystem.m_NavMeshAgent.ResetPath();
    60.                 m_EmeraldAIEventsManager.SetDestination(DayLocation);
    61.                 m_EmeraldAISystem.StartingDestination = DayLocation.position;              
    62.                 m_EmeraldAIEventsManager.OverrideIdleAnimation(IdleAnimationDay);
    63.                 m_EmeraldAISystem.WaitTime = 2;
    64.                 m_EmeraldAISystem.StationaryIdleSeconds = 2;                        
    65.                 CurrentSchedule = CurrentScheduleEneum.Day;
    66.             }
    67.             else if (CurrentSchedule != CurrentScheduleEneum.Evening && UniStormSystem.Instance.CurrentTimeOfDay == UniStormSystem.CurrentTimeOfDayEnum.Evening)
    68.             {
    69.                 m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)EveningWanderType);
    70.                 m_EmeraldAISystem.m_NavMeshAgent.ResetPath();
    71.                 m_EmeraldAIEventsManager.SetDestination(EveningLocation);
    72.                 m_EmeraldAISystem.StartingDestination = EveningLocation.position;
    73.                 m_EmeraldAIEventsManager.OverrideIdleAnimation(IdleAnimationEvening);
    74.                 m_EmeraldAISystem.WaitTime = 2;
    75.                 m_EmeraldAISystem.StationaryIdleSeconds = 2;
    76.                 CurrentSchedule = CurrentScheduleEneum.Evening;
    77.             }
    78.             else if (CurrentSchedule != CurrentScheduleEneum.Night && UniStormSystem.Instance.CurrentTimeOfDay == UniStormSystem.CurrentTimeOfDayEnum.Night)
    79.             {
    80.                 m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)NightWanderType);
    81.                 m_EmeraldAISystem.m_NavMeshAgent.ResetPath();
    82.                 m_EmeraldAIEventsManager.SetDestination(NightLocation);
    83.                 m_EmeraldAISystem.StartingDestination = NightLocation.position;
    84.                 m_EmeraldAIEventsManager.OverrideIdleAnimation(IdleAnimationNight);
    85.                 m_EmeraldAISystem.WaitTime = 2;
    86.                 m_EmeraldAISystem.StationaryIdleSeconds = 2;
    87.                 CurrentSchedule = CurrentScheduleEneum.Night;
    88.             }
    89.         }
    90.     }
    91. }
    92.  
    93.  

    General Time of Day Schedules:
    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using EmeraldAI;
    6.  
    7. public class AISchedule : MonoBehaviour
    8. {
    9.     public WanderType MorningWanderType = WanderType.Stationary;
    10.     public Transform MorningLocation;
    11.     public int IdleAnimationMorning = 1; //Idle animations are 1 through 3
    12.  
    13.     public WanderType DayWanderType = WanderType.Dynamic;
    14.     public Transform DayLocation;
    15.     public int IdleAnimationDay = 1; //Idle animations are 1 through 3
    16.  
    17.     public WanderType EveningWanderType = WanderType.Stationary;
    18.     public Transform EveningLocation;
    19.     public int IdleAnimationEvening = 1; //Idle animations are 1 through 3
    20.  
    21.     public WanderType NightWanderType = WanderType.Stationary;
    22.     public Transform NightLocation;
    23.     public int IdleAnimationNight = 1; //Idle animations are 1 through 3
    24.  
    25.     public enum WanderType { Dynamic = 0, Stationary = 2 };
    26.  
    27.     public CurrentScheduleEneum CurrentSchedule = CurrentScheduleEneum.Morning;
    28.     public enum CurrentScheduleEneum { Morning = 0, Day = 1, Evening = 2, Night = 3 };
    29.  
    30.     EmeraldAISystem m_EmeraldAISystem;
    31.     EmeraldAIEventsManager m_EmeraldAIEventsManager;
    32.  
    33.     void Start ()
    34.     {
    35.         m_EmeraldAISystem = GetComponent<EmeraldAISystem>();
    36.         m_EmeraldAIEventsManager = GetComponent<EmeraldAIEventsManager>();
    37.         InvokeRepeating("UpdateAISchedule", 0.1f, 1);
    38.     }
    39.  
    40.     void UpdateAISchedule ()
    41.     {
    42.         if (!m_EmeraldAISystem.IsDead)
    43.         {
    44.             if (CurrentSchedule == CurrentScheduleEneum.Morning && m_EmeraldAISystem.StartingDestination.x != MorningLocation.position.x)
    45.             {
    46.                 m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)MorningWanderType); //Set our AI's Wandering Type for this time of day
    47.                 m_EmeraldAISystem.m_NavMeshAgent.ResetPath(); //Reset our path so the previous destination doesn't interfere with the new one
    48.                 m_EmeraldAIEventsManager.SetDestination(MorningLocation); //Set our destination for this time of day
    49.                 m_EmeraldAISystem.StartingDestination = MorningLocation.position; //Set our dynamic wandering destination for this time of day
    50.                 m_EmeraldAIEventsManager.OverrideIdleAnimation(IdleAnimationMorning); //Set our Idle Animation Index for this time of day
    51.                 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
    52.                 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
    53.             }
    54.             else if (CurrentSchedule == CurrentScheduleEneum.Day && m_EmeraldAISystem.StartingDestination.x != DayLocation.position.x)
    55.             {
    56.                 m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)DayWanderType);
    57.                 m_EmeraldAISystem.m_NavMeshAgent.ResetPath();
    58.                 m_EmeraldAIEventsManager.SetDestination(DayLocation);
    59.                 m_EmeraldAISystem.StartingDestination = DayLocation.position;            
    60.                 m_EmeraldAIEventsManager.OverrideIdleAnimation(IdleAnimationDay);
    61.                 m_EmeraldAISystem.WaitTime = 2;
    62.                 m_EmeraldAISystem.StationaryIdleSeconds = 2;
    63.             }
    64.             else if (CurrentSchedule == CurrentScheduleEneum.Evening && m_EmeraldAISystem.StartingDestination.x != EveningLocation.position.x)
    65.             {
    66.                 m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)EveningWanderType);
    67.                 m_EmeraldAISystem.m_NavMeshAgent.ResetPath();
    68.                 m_EmeraldAIEventsManager.SetDestination(EveningLocation);
    69.                 m_EmeraldAISystem.StartingDestination = EveningLocation.position;
    70.                 m_EmeraldAIEventsManager.OverrideIdleAnimation(IdleAnimationEvening);
    71.                 m_EmeraldAISystem.WaitTime = 2;
    72.                 m_EmeraldAISystem.StationaryIdleSeconds = 2;
    73.             }
    74.             else if (CurrentSchedule == CurrentScheduleEneum.Night && m_EmeraldAISystem.StartingDestination.x != NightLocation.position.x)
    75.             {
    76.                 m_EmeraldAIEventsManager.ChangeWanderType((EmeraldAISystem.WanderType)NightWanderType);
    77.                 m_EmeraldAISystem.m_NavMeshAgent.ResetPath();
    78.                 m_EmeraldAIEventsManager.SetDestination(NightLocation);
    79.                 m_EmeraldAISystem.StartingDestination = NightLocation.position;
    80.                 m_EmeraldAIEventsManager.OverrideIdleAnimation(IdleAnimationNight);
    81.                 m_EmeraldAISystem.WaitTime = 2;
    82.                 m_EmeraldAISystem.StationaryIdleSeconds = 2;
    83.             }
    84.         }
    85.     }
    86. }
    87.  
    88.  
     

    Attached Files:

    Last edited: Sep 19, 2019
    huntersteeger likes this.
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    Not yet. I'm still working on it, but it's really close. I'll announcer here when I've submitted it. :)
     
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    I'm already working on adding this to the upcoming version 2.3. It could offer some really cool functionality.
     
  30. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    512
    Hi, are you aware of GPU Instancer that support skinned animation?
    https://www.assetstore.unity3d.com/en/?stay#!/content/145114|

    Looking at their API, it doesn't seem that complicated (assuming that it uses Animator) I would love to see the integration and we can probably have massive AI.

    If you haven't looked at it, please check it out and let us know what you think.
    Thanks.
     
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    Hey there,

    I haven't yet seen GPU Instancer. It looks very interesting and could possibly benefit Emerald AI. I will reach out to the developer to see if proper support could be added after the 2.3 update.
     
    chrisk and SickaGamer like this.
  32. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    787
    @BHS How is 2.3 going? Any ETA?
     
  33. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    512
    Awesome! It might be a good idea to ECS'fy the agent after the integration, then we can have swarm of AI agents in a single scene. ^^
    Cheers!
     
  34. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    642
    I was working on my project, and looking at the health bar and AI name, and I was thinking wouldn't it be nice if the color could change with the combat status, for instance color green for non-combat, and red, during combat. How about that?
     
  35. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    787
    Kind of like WoW. Make it so Will!
     
    BHS likes this.
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    Great, I'm doing a lot of testing and quality checking to ensure everything is functioning as it should as it is a pretty complex update. I've also improved quite a few animation blending sections such as blocking, turning, and switching between ranged and melee combat.

    I've also just finished the new target detection system so AI no longer use a trigger collider. The new system only searches for the appropriate layers and offers a huge performance boost for users with lots of colliders in their scenes. This had to be done as the performance boost was important. I was able to get 200+ fps with over 50 AI on screen and all active. This also doesn't require any alterations to an AI on the user's end either.

    As for ETA, I'm fairly confident I can submit the 2.3 update within within the next two weeks.

    I will have a playable demo ready within the next day or two so users who are interested can try out 2.3 and some of its new features and many improvements.
     
    Last edited: Aug 14, 2019
    K4rha, SickaGamer and magique like this.
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    I can certainly look into ECS. :)
     
  38. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    That's a great idea. I will definitely add this to a future update.
     
  39. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    787
    Yeah. You can keep it the way it is now and make it Non-combat color and In-Combat color! That would be a minor but really nice to have feature!
     
  40. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    272
    Is it possible to create a trigger so that your AI will stop wandering to drink water from a river with this asset ?
     
  41. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    I totally agree! :)
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    Yes, this can be done using the following code. To use it, just attach it to an object with a collider set to Is Trigger and the AI will stop and play its emote animation when it collides with said collider.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using EmeraldAI;
    5.  
    6. public class AIDrinkWater : MonoBehaviour
    7. {
    8.     void OnTriggerEnter(Collider collider)
    9.     {
    10.         if (collider.GetComponent<EmeraldAISystem>() != null)
    11.         {
    12.             //Get a reference to the Emerald AI system that was collided with
    13.             EmeraldAISystem m_EmeraldAISystem = collider.GetComponent<EmeraldAISystem>();
    14.  
    15.             //Plays an AI's emote animation according to the Animation ID which for this example is 1.
    16.             m_EmeraldAISystem.EmeraldEventsManagerComponent.PlayEmoteAnimation(1);
    17.         }
    18.     }
    19. }
     

    Attached Files:

    Akshara likes this.
  43. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    272
    ah right is that only for the new emerald?
     
  44. burakdatlife

    burakdatlife

    Joined:
    Apr 20, 2016
    Posts:
    21
    Are there any updates for Mirror networking or uSurvival integration?
     
  45. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    New as in the current version 2.2, yes.
     
  46. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    272
    ah right, so you can add to separate triggers one for eating grass and another for water?
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    I will get to these as soon as the 2.3 version has been submitted which should be in two weeks.
     
    burakdatlife and SickaGamer like this.
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    That is correct. If you want more than 1 animation to be used, simply replace the 1 with a variable that allows you to customize the number used like below. This will allow you to use different animation for each object. Currently, a total of 3 emote animations can be used.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using EmeraldAI;
    5. public class AIActionWater : MonoBehaviour
    6. {
    7.     public int AnimationID = 1;
    8.  
    9.     void OnTriggerEnter(Collider collider)
    10.     {
    11.         if (collider.GetComponent<EmeraldAISystem>() != null)
    12.         {
    13.             //Get a reference to the Emerald AI system that was collided with
    14.             EmeraldAISystem m_EmeraldAISystem = collider.GetComponent<EmeraldAISystem>();
    15.             //Plays an AI's emote animation according to the Animation ID which for this example is 1.
    16.             m_EmeraldAISystem.EmeraldEventsManagerComponent.PlayEmoteAnimation(AnimationID);
    17.         }
    18.     }
    19. }
     
    Last edited: Aug 16, 2019
  49. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    272
    ah right so i would need to use a water tag for water and a food tag for food both with a default layer?
     
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,001
    You don’t need to actually use tags or layers. You just need to use the emote animation ID where the AnimationIndex variable is (I probably should have called the variable name AnimationID so let’s call it that) :).

    When you’re in the emote animation tab, you have a list of animations each with an ID to identify them. If your water animation has an ID of 1 then you would use 1 for the AnimationID in the script I provided and if your eating animation ID is 2 then you would use 2 for the AnimationID.

    When your AI hits the collider, it will play the emote animation according to the AnimationID within the script that is read from the AI and its emote animation list.