Search Unity

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

[RELEASED] Emerald AI 3.2 (New Sound Detection) - The Ultimate Universal AAA Quality AI Solution

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

  1. MahaGaming

    MahaGaming

    Joined:
    Feb 25, 2014
    Posts:
    82
    i made 5 rabbits hunt a Trext 10/10 best Asset ever!!
     
  2. MahaGaming

    MahaGaming

    Joined:
    Feb 25, 2014
    Posts:
    82
    I left you a review and recommend to friends.
     
  3. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Possible bug:
    If you set the option Prey or Predator to None, the animal doesn't move. Elephants are an example of an animal which are neither prey or predator. Other than that I'm still loving this asset, though I still can't get the UFPS to work :(
     
  4. MahaGaming

    MahaGaming

    Joined:
    Feb 25, 2014
    Posts:
    82
    How to do birds? since this uses nav mesh
     
  5. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    how to solve these null reference

    1.
    NullReferenceException: Object reference not set to an instance of an object
    Emerald_Animal_AI.OnTriggerExit (UnityEngine.Collider other) (at Assets/Emerald - Animal AI/Scripts/System/Emerald_Animal_AI.cs:1634)



    2.
    NullReferenceException: Object reference not set to an instance of an object
    Emerald_Animal_AI.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Emerald - Animal AI/Scripts/System/Emerald_Animal_AI.cs:1514)
     
  6. MahaGaming

    MahaGaming

    Joined:
    Feb 25, 2014
    Posts:
    82

    share the line of code please, cs:1514 and cs:1634
     
  7. MahaGaming

    MahaGaming

    Joined:
    Feb 25, 2014
    Posts:
    82
    works for me, have you tried making them other than predator see if the problem is with the model. Some of my animals dont move and I found problem was with model being on Generic..

    also try changing the animal walk radius etc
     
  8. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    I solve it

    I give the same tag name to 1) predator tag name and 2) flee tag name
     
  9. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    its also work for me when i set to none.
    check graze min and max length.
     
  10. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Thanks guys, it probably is that, I'm always forgetting to set the tag! But I'm still having problems with UFPS integration; according to the devs I need to deactivate the UFPS hit/damage system, however if I do this, surely it would result in not being able to shot any non-Emerald Animal Ai object (can't test it as I haven't been able to deactivate it yet)? Also, I like the damage and health system of UFPS, and think it would be better to have that system controlling the health.

    Also, has anybody used Time of Day asset with this to set the AI to act differently based on the time of day? I'm debating whether to buy UniStorm or Time of Day, UniStorm seems to offer this ability but Time of Day doesn't mention it. I'd prefer to get Time of Day because it has Realistic star constellations and Full longitude, latitude & time zone support which UniStorm doesn't seem to offer.

    On a final note, I'm very new to Unity and I have to be careful which assets to buy. 3D animal models are essential, however does anybody know if the 3D models are included in the 24-hour sales? I'm using cubes at the moment which work fine so I'm not in a rush to buy the models.

    Thanks
     
    Last edited: Aug 30, 2015
  11. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    Hurt animation is not playing when prey hurt. (when it take damage)
     
  12. MahaGaming

    MahaGaming

    Joined:
    Feb 25, 2014
    Posts:
    82

    Time of Day is the best because its easy to change the scripts.

    For Animals look at forest Animal pack on unity store or go to

    Time of Day is the best because its easy to use and simple to change any line of code, for example I made farm animals sleep during the night.
     
  13. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Great thanks Maha! I was hoping Time of Day would work.

    For those having problems with UFPS, I've finally managed to get it to work (although not well). Basically go into vp_HitscanBullet and comment out the DoHit(); in both the void Start() and void Enable(). You will then come across other error messages asking for sounds and animations from the PlayerWeapon script, which should be quite easy to fix (if not, find the lines in the code and comment them out). It works, but not well, as you can kill an object by shooting it without any ammo, plus GetHit animations aren't played (although this may be due to a specific problem with the free animated horse I'm using). Make sure you add the dead cube to the dead animal game object. Really hoping we can get 'out of the box' UFPS integration in the next update.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    The advantage of UniStorm is that it's written by the same developer as Emerald AI, so it may be easier to integrate and get support.

    This seems to work for me:

    1. Add a vp_DamageHandler to the animal. Set Max Health to a high value because we're not going to use it.

    2. In vp_HitscanBullet.cs, change line 165 to:
    Code (csharp):
    1. if(m_Source != null && (hit.collider.GetComponent<Emerald_Animal_AI>() == null))
     
  15. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Looking forward to using this. Bought it, but I'll probably wait for the next update if its within the next two weeks. Not sure if I saw that it support Unistorm out of the box, e.g animals that are set to graze/sleep when sun sets?
     
  16. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    wow works like a charm, cheers Tony! You still have other issues like killing the animal without ammo and the GetHit animations, and the player health, but hopefully they will get that fixed for the next update. I thought the same about better integration with UniStorm, but Time of Day seem to have gone with a 'real-world data' approach which I like the sound of, especially celestial stars. Thanks again for helping with this.
     
  17. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    It is really easy to add scripts to ToD. Even I can do it so that says a lot. :) It is also very light weight, as in it does not affect performance much at all. I do agree with Tony that you won't as much support from the ToD developer for plugging it into Emerald, but he does include some sample scripts so you can most likely figure it out.
     
    julianr likes this.
  18. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    We plan on adding full plugin support for Emerald and UniStorm. We plan on adding an example today on the wiki of how you can do so. We will also provide an example of how weather can affect animals. For example, fog could lower flee trigger distances due to the lack in sight or heat could make animals graze less often.

    We would be happy to help you out with any examples you may need with integrating UniStorm with Emerald.



    Yes, we plan on adding an example of using UniStorm and Emerald on the Emerald Wiki today.



    Yea, we will get this worked out with the next update. Everything is being added to our list of things to improve, fix, or tweak. We also have new features that we're working on.
     
    julianr likes this.
  19. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @BHS Good to know! One less task that I need to develop is a time saver for a single developer :)
     
  20. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Thanks Telia! Though what the devs just said about UniStorm integration still makes it a tricky decision, guess the winner will be the next one to be on sale :)
     
    Last edited: Aug 30, 2015
  21. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    I have saved and attached the Debug log for when using Animal AI and UFPS together.
    It stills works intermittently. I really hope you can work out the issues and get it working.
     
  22. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    I did browse through both the Animal AI and UFPS code to try and find where I could comment out UFPS hit damage and just use Animal AI. After two hours I am getting nowhere and I need to rely on the developer to create step-by-step instructions to get this working correctly.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    We will look through our system and see if we changed anything we didn't include with the tutorial. We will send you the updated tutorial when it's finished.
     
  24. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Locky, look at Tony's post above, his code seems to fix half the problem (shooting and killing animals).
     
  25. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    @BHS can you help me to figure out
    why hit animation not playing when animal hit.
     
  26. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    Thank you I will try what he suggested and report back what I find.
     
  27. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    First, let me say "Thank you." I appreciate your trying to help

    I ran two tests.
    The first test I used cubes in lieu of an animal model or any animation. The results were mostly good from the ability to kill. I had no problem killing as long as I didn't allow the "Dead Cube" to block the bullets. One very intermittent problem though; sometimes the Animals just didn't move. I would press Play and nothing would happen. They didn't do their AI thing and start wandering around. This occurred only two out of ten or so times that I tested.

    The second test I replaced the cubes with animal models and animation. This time it was much harder to kill the animal simply because I could not hit it despite aiming directly at it; the bullets went right through and hit the ground behind. The success of kill went way down. The second problem was with the AI again; the animations for walking would play, but the animal would most often stay in place as if walking on a treadmill. Once they started doing this they were just stuck and did not move or change animations. This happened with at least two out of the five animals in the pack.
     
  28. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    I had exactly these problems. The problem with the animal not moving was that I forgot to set the main tag just below the object name, which in fairness wasn't mentioned in the tutorials. Once I made sure I did this, both the predator chases prey and the objects move. I haven't tested it thoroughly, but I'm confident this was the problem. The fix Tony gave seemed to solve the problem with shooting through animals.

    Additions I would love to see introduced in Emerald Animal AI would be 'stalking', where a lion for example would circle it's prey before attacking, and also make the individual lions from the same pack attack the prey from different angles. Also, the ability to increase variables (such as the wander distance and herd size) above their maximum value. Not sure if this can be done in the script.
     
    Last edited: Sep 1, 2015
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Be sure that your min wait time isn't the cause of your animal not moving. This is called on start so animals will wait until their wait time is met before moving.

    Also make sure your tags are properly assigned both on the models and in the editor.

    Make sure your attack distance is high enough. This could be the cause of inconsistent hits. Also make sure UFPS hit system isn't conflicting with the Emerald PlayerWeapon script.
     
    Last edited: Sep 2, 2015
  30. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    The Stalking feature is a great idea. We will see what we can do.

    You can increase the max values of the distances by editing the Emerald Editor script. We can increase distances with our next update, if it's what is requested.
     
  31. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    OK great. I'm still in the planning stages of my game but what I hope to see in future versions of Emerald are:

    - Pack stalking system, where the animals would watch the player or prey and encircle it before attacking.
    - Animals retreat after a gun shot wound.
    - Animals flee after a gun shot sound (or any other loud sound)
    - Bird AI (similar to the Bird Flock asset)
    - More options for animations (including sleep)
    - Injured animals move slower.
    - The slowest (or injured) animal from a herd should be singled out by the predator, think about a herd of zebras being chased by lions.
    - After killing prey, the predator should stay and eat it. Dragging it to another location first would be even better.
    - Improved implementation with UFPS, or at least provide a demo scene
    - Get hit animations working properly
    - Pathfinding
    - Mating
     
    Last edited: Sep 5, 2015
  32. Pandur1982

    Pandur1982

    Joined:
    Jun 16, 2015
    Posts:
    275
    i hope it came a fish ai for it :D
     
  33. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    Minimum Wait Time
    I do not see this setting in the Animal AI interface; where is it? Or is it in one of the scripts; if so, which one?
    When I test I don't press play and stop right away, I let it play for 30 seconds to a minute. So I don't think that is the issue.

    Tags
    I set the tags of my animals to "Huntable" in the editor. I don't know what you mean by also setting them on the models; that isn't possible. Do you mean selecting the model in the Project window? Because tags cannot be set that way.

    Distance
    I have tried firing from a number of distances.

    UFPS
    I have looked into the UFPS for conflicts, and there may be some. But I am not a code expert; hence the reason I bought these in the first place; so that I did not have to concern myself with such problems.

    I am coming to the conclusion that Animal AI and UFPS simply do not work well together. I am not pointing fingers or assigning blame. Just pointing out that the claim that Animal AI "easily integrates" with UFPS is clearly not true. The video demos you have show that it CAN work and my own test bear this out as well; however inconsistently. But not easily; and not without some substantial problems that need to be addressed before it is a workable solution for a game. Whether those problems are on their end or yours I cannot say. I can only tell you that I have put a significant amount of time into reading documentation, building scenes, running tests, hunting down code, and reading posts. I have given this my best effort. If they really, truly do work together without issue then I would like to see a video tutorial that shows how a working scene is set up from start to finish. Don't take this as a slam; it is not meant to be. It is intended to be a reality check on what is possible given the current state of both of these tools. I am really impressed by what Animal AI does. But I tire of the seemingly never-ending "now check this setting" and "check that setting." I am of the belief that I must now make a choice between the two, and then find a different solution for the other. I do appreciate your help and responsiveness on this forum. At some point you have to cut your losses and make a decision so you can start to move forward again.
     
  34. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    At the very top of the inspector, there is a pull down tab called Tags. It probably is set as untagged for your animal models. Change that to Huntable or whatever you need it to be in Emerald.

    That is probably why it is not working for you and it has nothing to do with UFPS. It is a requirement for Emerald. Once tagged, it might work for you.
     
    Locky likes this.
  35. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    when dead body intantiate .it give me this error.
    how to solve this problem

    nassignedReferenceException: The variable fleeTarget of Emerald_Animal_AI has not been assigned.
    You probably need to assign the fleeTarget variable of the Emerald_Animal_AI script in the inspector.
    Emerald_Animal_AI.Flee () (at Assets/Emerald - Animal AI/Scripts/System/Emerald_Animal_AI.cs:480)
    Emerald_Animal_AI.MainSystem () (at Assets/Emerald - Animal AI/Scripts/System/Emerald_Animal_AI.cs:703)
    Emerald_Animal_AI.Update () (at Assets/Emerald - Animal AI/Scripts/System/Emerald_Animal_AI.cs:974)
     
  36. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    Thanks Teila,
    I have been tagging my animals as "Huntable". The problems I am having with animals not moving are intermittant. Nothing about the scene changes. Just sometimes when I press play it works, other times it doesn't. This is only when trying to integrate with UFPS though. By itself I have no issues with Animal AI. I had originally when I was using the free Horse. But once I started using my own models and animations, using Animal AI by itself has been a dream.
     
  37. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    I noticed in the tutorial section a new part has been added:

    Applying damage to an animal
    If you would like to apply damage to an animal from an external script, you can do the following. The variable "damage" is the amount of damage you'd like to be dealt to the animal. This can also be used for ranged damage. Be sure to have a reference of Emerald when you do this.

    GetComponent<Emerald_Animal_AI>().Damage(damage);


    Am I right in thinking this can mean we can use UFPS to inflict the damage? Should this code be placed in the vp_DamageHandler script?
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    BHS may have more info to provide, but I see that UFPS already sends the message "Damage(float)" to objects that get hit. This means you don't need to call it yourself. However, if the projectile was provided a reference to the thing that fired it (i.e., the player), it sends a vp_DamageInfo record instead of a float -- "Damage(vp_DamageInfo)". To get around this, I modified vp_HitscanBullet.cs:165 to use the float version of Damage when hitting an animal. Here's that line again:
    Code (csharp):
    1. if(m_Source !=null&&(hit.collider.GetComponent<Emerald_Animal_AI>()==null))
     
  39. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Thanks again Tony. I tried recreating the scene without using Emerald's weapon shooter but I can't seem to get it working. Do you happen to know a good tutorial describing how UFPS sends damage to a game object? BHS says Emerald has easy integration with UFPS, but it seems to be only when you use their attack and health system. Am I right in thinking if we use their system, this will cause more problems/more re-coding? Or would you say it's better to integrate UFPS into their system, rather than vice-versa?

    I found this tutorial
    which covers what I'm looking for. However here he adds a ForwardDamage script, which I don't believe should be needed because UFPS should cover this.
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    I think it's better to tie it into UFPS's shooting system so it correctly keeps track of ammo, etc. You can just borrow the relevant parts from Emerald's PlayerWeapons script. This works for me:

    1. Return UFPS's vp_HitscanBullet.cs to its original state.

    2. Add this script (Emerald_Animal_UFPSDamage.cs) to your animals:
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class Emerald_Animal_UFPSDamage : MonoBehaviour
    4. {
    5.  
    6.     public AudioClip[] impactHitAnimalSounds;
    7.  
    8.     private AudioSource m_audioSource;
    9.     private Emerald_Animal_AI m_animalAI;
    10.  
    11.     public void Awake()
    12.     {
    13.         m_audioSource = GetComponent<AudioSource>();
    14.         m_animalAI = GetComponent<Emerald_Animal_AI>();
    15.     }
    16.  
    17.     public void Damage(vp_DamageInfo damageInfo)
    18.     {
    19.         m_audioSource.PlayOneShot(impactHitAnimalSounds[Random.Range(0, impactHitAnimalSounds.Length)]);
    20.         m_animalAI.Damage(damageInfo.Damage);
    21.     }
    22. }
     
  41. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Thanks a lot Tony! Sure I'm doing something wrong, but after doing this, I'm getting this error message when I shoot the object:

    UnityEngine.Component:SendMessageUpwards(String, Object, SendMessageOptions)
    vp_HitscanBullet:DoHit() (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_HitscanBullet.cs:169)
    vp_HitscanBullet:Start() (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_HitscanBullet.cs:68)

    And am I right that you need to set up the gethit sound in the new component and not in the Emerald component?

    Thanks again for all this help
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    You can add the hit sound on both components. The script should still work, even with the error message. That message says that vp_HitscanBullet is trying to send "Damage(vp_DamageInfo)" to the animal, but one of the components has a Damage method that doesn't accept a vp_DamageInfo.

    The Emerald_AI_UFPSDamage script accepts a vp_DamageInfo. However, the original Emerald_Animal_AI script doesn't; it accepts a float instead. It'll still work, since only Emerald_AI_UFPSDamage needs to receive the message from UFPS, but it will throw this message.

    Perhaps the cleanest approach (although one that requires editing a UFPS source file) is my original suggestion: edit line 165 in vp_HitscanBullet.cs. If you want to add animal sounds (like what Emerald's PlayerWeapon plays), you could add this script to the animal (Emerald_Animal_DamageSound.cs):
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class Emerald_Animal_DamageSound : MonoBehaviour
    4. {
    5.  
    6.     public AudioClip[] impactHitAnimalSounds;
    7.  
    8.     private AudioSource m_audioSource;
    9.     private Emerald_Animal_AI m_animalAI;
    10.  
    11.     public void Awake()
    12.     {
    13.         m_audioSource = GetComponent<AudioSource>();
    14.         m_animalAI = GetComponent<Emerald_Animal_AI>();
    15.     }
    16.  
    17.     public void Damage(float amount)
    18.     {
    19.         m_audioSource.PlayOneShot(impactHitAnimalSounds[Random.Range(0, impactHitAnimalSounds.Length)]);
    20.     }
    21. }
     
  43. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Thanks Tony, though I'm still getting many of the same problems Locky was getting. I'm going to leave it a few weeks and then fingers crossed the devs would have created a full tutorial or update which addresses the issues.
     
  44. BHS

    BHS

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

    We're working on addressing the issue with UFPS. We still think it's a confliction with their script and ours. We will make a tutorial video when we get the time tomorrow to show how we got everything work. So far, we haven't had any issues and everything works fine.

    We will have a step by step guide which should help everyone get Emerald working flawlessly with UFPS.
     
    jonfinlay, 99thmonkey and John-G like this.
  45. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Hi, have you managed to look into this issue with UFPS? Is it possible to implement an UFPS Adapter like what Ice Creature Control have done?
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    UFPS does work with Emerald. We used it in all of our demo videos.

    We will explain below.
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    We have updated our Emerald Wiki UFPS tutorial and UFPS should now work properly with Emerald. We made a mistake in the setting up process that most likely resulted in Emerald not working with UFPS properly. This was due to assigning the script to the WeaponCamera and not the FPSCamera. As well as disabling the UFPS health script.

    We apologize for inconveniences, but the good thing is that everything should be working perfectly now.

    Here's a link to the updated tutorial. Let us know how it works.
    http://emerald-animal-ai.wikia.com/wiki/Tutorials
     
  48. VasyaCullin

    VasyaCullin

    Joined:
    Feb 17, 2014
    Posts:
    8
    It does not work: c

    PS: I would like to get video instructions
     
    jonfinlay likes this.
  49. TheSeawolf

    TheSeawolf

    Joined:
    Apr 10, 2015
    Posts:
    267
    I'm purchasing this tomorrow to add to my Unistorm asset, and was wondering about adding the ability for fire to be used to ward off predators, either a hand held torch or fire which could be set to protect the player overnight from wolves and bears?

    Any chance of adding this to a future version?
     
  50. MrGky93

    MrGky93

    Joined:
    Feb 27, 2014
    Posts:
    281
    Ok works perfect but its not mecanim only lagacy :(
    What time you will update mecanim ??
     
    Last edited: Sep 19, 2015