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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I've tested Emerald with Unity 5.5.0f3 and I can properly kill AI without any errors. Is Emerald attached to the parent of your model? If not, this is most likely what's causing your issue. Make sure the Emerald system is attached to the parent of the model and see if you still get the error.

    You can duplicate your walk animation and use it as a run animation. They just need to be different animations.

    As for altering the AI's startingPosition, it can be done like the below. I've tested it and it works. Attach this script to the zombie AI you want to wander around "Food" tags. The food tags will need to use OnTriggerEnter (you have to have IsTigger checked with the collider), but you can change it OnCollisionEnter, if needed. Feel free to use the example code as you'd like.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class MoveStartPosition : MonoBehaviour
    6. {
    7.     public string FoodTag = "Food";
    8.  
    9.     //If your AI hits the FoodTag trigger, move their startingPositionn to the FoodTag game object's position
    10.     void OnTriggerEnter(Collider other)
    11.     {
    12.         if (other.gameObject.tag == FoodTag)
    13.         {
    14.             gameObject.GetComponent<Emerald_Animal_AI>().startPosition = other.transform.position;
    15.         }
    16.     }
    17. }
    Emerald should be detecting the closest target. After a target dies, the AI will pick the next closest target.
     
  2. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Not yet, but we will be supporting runtime generated scenes with Unity 5.6 and their new NavMesh system. This update should come out sometime in March, which is when Unity 5.6 is being released.


    Hey there!

    Thanks, great to hear you're liking Emerald!

    This is because AI don't return to Defensive after their target is lost, which I wasn't aware of. We can fix this with our next update. However, if you need a quick fix, send us a PM and we can send you the updated code to do so.

    I'm not not, if it is working with the example players, it's most likely the settings. It could be the Attack Trigger range. If it's set high enough, the AI will still be trying to get the target even through they are off the NavMesh. We recommend that players don't have the ability to reach the end, or go off, the NavMesh.


    Line of sight is still something planned, hopefully for Emerald 1.4.

    Thanks for the suggestions! We will most likely be using Raycasts for the line of sight. Sound is also something that would be interesting.


    Hey there!

    This should allow you damage an AI with an arrow. Attach this to your arrow object and the name of your player in the PlayerName area.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class ProjectileDamage : MonoBehaviour {
    6.  
    7.     public int DamageAmount = 5;
    8.     public string PlayerName = "Player";
    9.     GameObject Player;
    10.  
    11.     void Start ()
    12.     {
    13.         //Get the player object by its name
    14.         Player = GameObject.Find(PlayerName);
    15.     }
    16.  
    17.     void OnCollisionEnter (Collider other)
    18.     {
    19.         if (other.gameObject.GetComponent<Emerald_Animal_AI>() != null)
    20.         {
    21.             Emerald_Animal_AI EmeraldSystem = other.gameObject.GetComponent<Emerald_Animal_AI>();
    22.             EmeraldSystem.Damage(DamageAmount);
    23.             EmeraldSystem.MakeAttack(Player);
    24.             EmeraldSystem.MakeFlee(Player);
    25.         }
    26.     }
    27. }
     
    HakJak likes this.
  3. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    I think you answered someone else's question, or misunderstood mine. Mine was - How can I get the AI to detect an item (the dropped item Unity-Tagged as "food") and graze on it? This will be the DeadReplacement object left after it has killed an NPC. I suspect it is wrapped up somewhere in Emerald_Animal_AI, line 3391:

    Code (CSharp):
    1.  
    2. //Find colliders within range using a Physics.OverlapSphere.  Mask the Physics.OverlapSphere to only 2 layers.
    3. //One for EmeraldAI objects and one for the Player. This will allow the Physics.OverlapSphere to only get relevant colliders.
    4. //Once found, use Emerald's custom tag system to find matches for potential targets. Once found, apply them to a list for potential targets.
    5. //Finally, search through each target in the list and set the nearest one as our current target.
    6. public void PickNewTarget()
    7. ...
    8. {
    If correct, how would I add code to a separate script (so as not to overwrite my changes on 1.4 release) and override this to detect the "food" UnityTag, then enter the Graze state (gnawing on the corpse) until some time when a bool called "Full" could be set (in Animator?), breaking the graze animation. A timer could increment on Time.deltaTime to make the AI hungry again.

    Yep, that looks like one of my questions. The AI does detect the closest NPC, but it never stops pursuing them. I thought that the MaxChaseDistance = 20 setting or the ChaseSeconds setting might make the AI stop chasing after it reaches a 20 unit range, or hits the 30 second mark, then look for another target. All 30 of my AI characters behave the same way, relentlessly pursuing. I have set the following "extreme" settings to try and get disengagement:
    Chase Seconds = 1
    Hunt Radius = 10
    Max Chase Distance = 12
    Cool Down = 10
    Wander Range = 20
    Still pursues until he catches the NPC with an off-mesh or unreachable waypoint, then kills her.

    Mark
     
    Mighto360 likes this.
  4. JustaGameDev

    JustaGameDev

    Joined:
    Jan 29, 2016
    Posts:
    50
    hey my AI doesnt chase after the player. Any fix for this ? upload_2017-2-2_14-18-47.png
     
    Last edited: Feb 4, 2017
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    If I remember correctly, you had asked for a script that can detect the tag "Food" and then graze around it. I was giving you an example of how to alter an AI's startingPosition, which is needed to do so.

    If you want to change an AI's tag after they die, you will either need to comment out, or alter, the code in the Die function. This is the function that changes the AI's tag after they have died. With the Emerald AI script open, press Ctrl+F to bring up the search tool. After doing this, search for line:
    Code (CSharp):
    1. this.gameObject.tag = "Untagged";
    Here, you will be able to change the AI's tag to the tag you need after they have died.

    If you wanted to have another script bypass Emerald's, you could disable Emerald when you'd like to have your custom script run. When it's finished, you would just enable Emerald again and it should pick up where it left off.

    Strange, we will look into AI continuously chasing players with your settings. If it's a bug, we will be sure to fix it with our next update.


    Hey there!

    It's most likely because you missed applying a needed component to Emerald, such as an Animation Component. I notice that there is an error in your console. Is this from Emerald? If so, can you please give me the information from it so I can find out what component you're missing.
     
    Last edited: Feb 5, 2017
  6. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Doesn't sound like a software problem, probably a wetware issue. It is really hard to tell, as the ghoul is shown, but not the player. Mine works, using 30 different custom models, the Emerald-Player, and the UFPS player.
    - Did you follow the instructions?
    - Did you double check that you followed the instructions?
    - Is the player's tag correctly set?
    - Is the Enemies' tag correctly set?
    - If player is on a separate layer from enemy AI, check the appropriate box under Tag Options.
    - Did you setup every animation slot? Even the ones that the character won't use? (worked for me!)

    If none of that identifies the problem, you might want to list all of the settings for both player and enemy. I keep my settings in a spreadsheet so that I can review it if any one of my AI's starts misbehaving.

    Probably should edit out your INVOICE#!!
    Mark
     
  7. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Aha, I see. Thanks.

    So I am using a Ragdoll prefab as the DeadReplacement that has a UnityTag of "food" (actually all of its children are tagged as such as well). Will it drop with a different tag?

    I will try that, however, I am currently trying to use a separate script, spherecasting for the ragdoll's tag, setting the startPosition with your snippet, and then calling a bool in the animator, which initiates "Graze 3" using EmeraldAI. (The AI has 2 Grazes enabled with 2 different IDLE animations. Only Graze 3 contains an actual eating animation.) Will this not work? IS there a less expensive method to find the food, move to its location, then "Graze 3"?

    Is there a list somewhere of all Emerald Settings for each type, and known working settings? I saw the tables on the wiki, but couldn't figure out how to derive a list of settings from those tables.

    Thanks,
    Mark
     
  8. Mighto360

    Mighto360

    Joined:
    Sep 15, 2016
    Posts:
    69
    Hello. I was wondering if there is a way (or will be) to set up AI for aquatic and flying creatures. You could choose if they could land or go on land and give them all the needed animations. Right now Emerald is amazing for land animals, but I haven't found a way to use it for birds and aquatic animals.
     
    Weblox likes this.
  9. JustaGameDev

    JustaGameDev

    Joined:
    Jan 29, 2016
    Posts:
    50
    Actually i fixed it myself with playMaker. i just set the NavMesh speed to go to the Speed i have set up in Emerald when the AI enters huntMode.
     
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    We do plan on adding support in the feature for flying and water based AI. For now, if you wanted water based AI, you could have their Base Offset height set to a higher value. This would allow AI in water to float above the terrain giving the appearance of them swimming through water.


    It sounds like your speed wasn't set properly. Great to hear you figured it out.
     
    Weblox likes this.
  11. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    @BHS You might want to remove the invoice# from your reply! Don't want your system to become warez.
     
  12. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    OK, for the time being I give up on detecting food items (back burner, really). Adding the functionality to a separate script appears to be above my skill level. Adding it Emerald is probably more likely to succeed, but again, I am just starting to pry the lid off of that very long script.
    I have knocked a number of items off my todo list though, and have a suggestion. Can you change the hard coded animations to be user settable? Not selectable, like the current drop down for attacks and grazes. Finding and adding additional animations was a real biotch of a chore. I currently have 9 grazing animations instead of 3. I use them for holding my 8 idle animations and one grazing animation, because the AI only seems to use its single idle animation once, at start up. From them on, it is either Combat-Idle, or Grazing 1, 2 or 3, then transitioning to walk/run.

    I found when adding the animations to code in Emerald_Animal_AI and Editor scripts, the code blocks were very repetitive, all that changed was a single number and the true/false statement. There were a lot of them, but it wasn't difficult. This is well suited to automation.
    I still need to figure out:
    1. [DONE! sort of] Food detection (someday).
    2. AI Line of Sight.
    3. AI Hearing range for footsteps, gunshots, etc.
    4. [WorkAround?] Break off the chase (time or distance based). If I run away from the AI, and don't keep them in my view, the will reset based on the fact that they get "culled". If I run backwards, keeping them in view, they will pursue relentlessly. To accelerate this, I set Pathfinding Update Speed to 0.5, and Deactivate Seconds to 20.
    5. When chasing, if another target becomes closer, maybe switch to that target. (Aggressive AI detects "prey" AI and chases it. They currently ignore and run past the Player while in pursuit. AI should not always be fixated on prey, and ignore the player. If one is closer, pursue that one. Might be fixed with #4.)
    6. AI doesn't detect direction of ranged fire when hit. Should maybe double its wander and detect range for a short time (alert state) and turn towards the attacker and pursue.
    7. [DONE] Play a specific sound when each graze animation fires.
    8. [DONE] Play random vocalizations as Aggressive AI wanders around. (Growls, moans, and snarls.)
    9. [DONE] Fix 3 models that don't detect or react, just wander. (Imported models required animation retargeting.)
    Mark
     
    Last edited: Feb 16, 2017
  13. BHS

    BHS

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

    Thanks for the suggestions and feedback. It is appreciated.

    We will be adding the option to have unlimited animations for things like attack and grazing. This is only possible for Legacy animations as Mecanim has to have set states and their animations cannot be changed through code.

    A lot of what you mentioned will be added/improved with Emerald 1.4. We plan on improving the code and rewriting some portions like we did with our last update.
     
  14. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Give it some thought, please. I only use Mecanim, am only a novice programmer, and I managed to expand it to support 9 graze and 5 attack animations. The assignment of animations to the animation slots is always going to be an exercise for the user. It's not much different from your current model, just more flexible. The only major difference would be an input box for number of graze and attack animations, and then setting up the code blocks with the Graze<x>Parameter, .IntValue==<x> and Graze<x>Animation parameters for the number selected.
    Code (CSharp):
    1.  
    2.     public string Graze1Parameter = "Graze 1";
    3.     public string Graze2Parameter = "Graze 2";
    4.     public string Graze3Parameter = "Graze 3";
    5.     public string Graze4Parameter = "Graze 4";
    6.     public string Graze5Parameter = "Graze 5";
    7.     public string Graze6Parameter = "Graze 6";
    8.     public string Graze7Parameter = "Graze 7";
    9.     public string Graze8Parameter = "Graze 8";
    10.     public string Graze9Parameter = "Graze 9";
    11. ...
    12. if(TotalGrazeAnimationsProp.intValue==4)
    13. {
    14. //boolgraze4Animation=!EditorUtility.IsPersistent(self);
    15. Graze4AnimationProp.objectReferenceValue=(AnimationClip)EditorGUILayout.ObjectField("Graze4Animation",Graze4AnimationProp.objectReferenceValue,typeof(AnimationClip),true);
    16. }
    17.  
    18. if(TotalGrazeAnimationsProp.intValue==5)
    19. {
    20. //boolgraze5Animation=!EditorUtility.IsPersistent(self);
    21. Graze5AnimationProp.objectReferenceValue=(AnimationClip)EditorGUILayout.ObjectField("Graze5Animation",Graze5AnimationProp.objectReferenceValue,typeof(AnimationClip),true);
    22. }
    23. ..., etc.
    24.  
    Excellent! I so hope Line of Sight is in the mix. Any rough estimate for 1.4? 2 weeks, 2 months, more? Gotta determine whether or not I keep hacking away at it, or grow some patience and wait it out.

    Mark
     
  15. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    I am trying to make use of the HealthBar script. If I have a bunch of AI's in the scene, everything works well. When I make prefabs of the AI's and spawn them, they lose the UI object assignments, as they are in scene objects. I figured, OK, I will make a prefab of that too, and assign the prefabs to the public fields!

    Before prefabbing the UI, the error was:
    NullReferenceException: Object reference not set to an instance of an object
    EnemyHealthBars.Update () (at Assets/Emerald AI/Scripts/Example Systems/EnemyHealthBars.cs:45)

    After prefabbing, No errors in the console, but nothing shows up in the UI.

    How can I set the Enemy Health Canvas, Enemy Health Bar (Slider), and Enemy Name elements (Text) in code so that I can spawn waves of enemies?

    Cheers!
    Mark
     
  16. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    @BHS
    You should add this feature. When an animal sees food in its range reaches it and eats it. For this should be added an "Eat" animation.
     
  17. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Can anyone tell me how I go about assigning the public Health Bar Canvas, Health Bar Slider, and Health Bar Text elements to a prefab AI, and not lose those assignments with the AI is spawned into the scene through script?

    Mark
     
  18. BHS

    BHS

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

    I understand it's possible to create more graze and attack animations with Mecanim manually. I thought you meant creating states and applying motions dynamically with an expandable slider, which isn't possible to my knowledge. We can certainly add more graze and attack animations with the next update.

    Emerald 1.4 will most likely be around a month. We are currently working on improving and rewriting code. After this is finished, we will start adding the features we have mentioned. Unity 5.6 is improving Unity's NavMesh allowing AI not to be tied down by baked NavMesh and have dynamic NavMesh. This is a decent portion for this update, as well as the Companion behavior type. Unity 5.6 is going to be released sometime next month so we need to make sure Emerald is fully supported with it. We will see what can be done with the line of sight feature. If we have the time, we can try and squeeze it in for the 1.4 update.


    You need so save the Enemy Health Bar Canvas as a prefab and assign it as well as all other the other needed components.

    Open up the EnemyHealthBars script.

    Right above this:
    Code (CSharp):
    1. public Camera PlayerCamera;
    Add this:
    Code (CSharp):
    1. public GameObject HealthBarCanvasPrefab;
    You will assign your Health Bar Prefab here.

    In the Start function, add this:
    Code (CSharp):
    1. HealthBarCanvas = Instantiate(HealthBarCanvasPrefab, new Vector3 (0,0,0), Quaternion.identity);
    2. healthBarSlider = HealthBarCanvas.GetComponentInChildren<Slider>();
    3. healthBarText = HealthBarCanvas.GetComponentInChildren<Text>();
    This assigns the health bar, health slider, and enemy text to the proper variables.


    We plan on adding features like this after the 1.4 update, thanks for the suggestion.
     
  19. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    @BHS One more feature request. I have successfully added multiplayer to my game using Photon. However, the Layer of the network player is RemotePlayer, local is LocalPlayer. It would be awesome if I could add TWO tags for the player Layer. (Or just a checkbox for multi-player, and have it handled auto-magically...

    By the way, if I haven't mentioned it, thanks again for this great tool!
     
  20. ebizcraftsman

    ebizcraftsman

    Joined:
    Dec 10, 2015
    Posts:
    20
    I have been looking for a solution to my question, but cant find it. Hopefully I am missing something simple. I followed the UFPS tutorial and it works great. AI attacks player, deals damage. Player attacks AI and deals damage.

    Problem is that when I kill the AI, I get the following error:

    MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    Emerald_Animal_AI.MainSystem () (at Assets/Emerald AI/Scripts/Emerald AI/Emerald_Animal_AI.cs:1393)
    Emerald_Animal_AI.Update () (at Assets/Emerald AI/Scripts/Emerald AI/Emerald_Animal_AI.cs:1705)

    It seems that when the AI is killed, the Emerald AI script is still trying to run the AI character. What do I need to do to disable the character upon death.

    Thanks
     
  21. BHS

    BHS

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

    Strange, Emerald disables itself on death automatically. Are you using Mecanim or Legacy?
     
  22. ebizcraftsman

    ebizcraftsman

    Joined:
    Dec 10, 2015
    Posts:
    20

    Mechanim ..
     
  23. Chris-Rowsell

    Chris-Rowsell

    Joined:
    Feb 3, 2017
    Posts:
    9
    Hey BHS,

    Firstly thank you, you are doing a fantastic job, you have made my life infinitely easier! :)

    Quick couple of questions :-

    1) How do I make the 'Hostile' predators only graze/eat on what they have just killed and prevent them from grazing randomly?

    2) Are you still planning to include breeding for all AI types in 1.4?

    Furthermore I too cant wait until you add flight and water based ai, I'm currently trying to get my ai eagle to swoop down on an unsuspecting ai rabbit...

    Anyway thanks again for all you do... bloody awesome!

    Chris
     
  24. Ankaman

    Ankaman

    Joined:
    Feb 14, 2014
    Posts:
    37
    Hello,
    Is the predator prey system implemented? are there any other animal life systems?
     
  25. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    @BHC
    I implement the Ai with RFPS kit.the problem is that the Enemy not chase me .when Player come near close
    to the enemy than Enemy Attack.other wise it stay on it position.please help me how to solve this issue
     
  26. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Have you generated a NavMesh? First place I would look. Open the Navigation Window, and select Bake.
    Mark
     
    Dawar likes this.
  27. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi every buddy,

    @BHS Hi, I have recently obtained Emarald AI together with Crux and I'M trying to integrate it into my RFPS Project. So far everything is working fine and the Tutos are very helpful. I am however having an Issue with my NPC Animal AI.

    I have made some Screenshots to illustrate the Issue:

    NPC is starting out just fine , idles and wanders around. Player detection and attacking also work fine until the NPC turns around after the first few attacks and from there on always attacks backwards on the Player (walk/run/attack will all be reverse). Any tipps how to solve this would be highly appreciated.

    bear 04_first attack.PNG bear 04_backwards attack.PNG

    Note: On import my models are facing in the wrong direction so I'm flipping the Child Objects around 180°
    to have the model face in the x - direction (See Thumbnails). NPC is working fine at startup (after this procedure), so I guess that is not the root of the Problem.

    bear 01_import.PNG bear 02_flipped around.PNG bear 03_final.PNG

    Thanks in advance,
    Weblox
     
    Last edited: Feb 27, 2017
  28. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    yes everything working fine except hostile enemy
     
  29. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    @Weblox Could still be the problem. It's important that the blue arrow points in the forward direction. Can you pull the model into Blender and orient it correctly to test? (Just remember that Blender's coordinates are off by 90 degrees)
    Another suggestion might be to create a Empty GameObject and set its orientation correctly, then move your model into it making it a child.

    Mark
     
  30. BHS

    BHS

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

    You're welcome! Please be sure to leave a review :)

    1) This isn't yet possible. However, it is something we would like to implement for a future feature.

    2) We're not entirely sure yet. This feature will come with either 1.4 or 1.5.

    Flying AI is on our top to do list. Eagles, and even dragons, would make an awesome addition to Emerald.


    Hey there!

    With the new tag system, you can make any AI attack any type of AI. You can have an AI hunt the tags Small and Medium or Passive. It's whatever you set within the AI's Tag Options.


    Hey there!

    If your AI's transform was modeled incorrectly, you may need to adjust the RotateTowards function.

    Find the line:
    Code (CSharp):
    1. Vector3 direction2 = currentAnimal.transform.position - transform.position;
    And change it to:
    Code (CSharp):
    1. Vector3 direction2 = currentAnimal.transform.position + transform.position;
    This should make the AI rotate in to opposite direction (180*) when getting near your target.


    It sounds like either your tag or layer is not setup correctly. Double check that everything is properly setup. You can see Emerald's documentation here for a guide: http://emerald-animal-ai.wikia.com/wiki/Documentation#Tag_Options
     
    Weblox likes this.
  31. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    @BHS thank you for reply.
    I reApply the same process again and again but same problem occur. :(
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    You're welcome.

    Have your tried testing out the demo AI? Also, are you using your own custom models? If you are using your own models, and they demo AI is working, then you must have missed something while setting up your custom model and Emerald.

    What exactly isn't working? Are you receiving any errors? Are you using a custom player other than Emerald? If you can, please post your setup and screenshots if you can.

    If you are using UFPS or RFPS, you will need to follow the quick tutorial here to get things working: http://emerald-animal-ai.wikia.com/wiki/Tutorials?useskin=oasis

    Also, make sure you have properly setup your NavMesh and that it was been baked to your scene.
     
  33. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi again,

    Thanks a lot for your quick support. I have tried the Code Fix, but that didn't resolve the Issue. I do get some change in Behavior, but not for the better.

    Please note that my NPC will act just fine with regular setup. However, after attacking and chasing the Player correctly for a few times , the NPC looses its orientation and turns reverse. Also if using a dead replacement the dead model will spawn correctly facing the Player. I am using Emerald with RFPS and I can make a quick troubleshoot video if that would be of any help.


    EDIT: While making the troubleshoot video I have been able to further track down the Issue and it seems it is caused by some of the animations that come with the models. Swapping out these animations has resolved the Problems and Emerald AI is working perfectly fine, also in combination with CRUX.

    Again, thnks for your support,
    Weblox
     
    Last edited: Feb 28, 2017
  34. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    Screen Shot 2017-02-28 at 9.45.51 PM.png Screen Shot 2017-02-28 at 9.45.51 PM.png Screen Shot 2017-02-28 at 9.46.05 PM.png Screen Shot 2017-02-28 at 9.46.15 PM.png Screen Shot 2017-02-28 at 9.46.35 PM.png @BHS I am using RFPS. the crowdly Ai work good.when I make hostile enemy AI than it not working.
    first problem is that its not chase the player when Enter Attack range.when player enter into wander range.Ai freeze on it position.when player enter to stoping distance of Ai.then Ai start Attacking.
    Ai working fine when Player is away from wander Range.
    I follow your Rfps Tutorial same as you stated.
    i tested on your models. as well as my models. for both same Issue.
     
  35. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    You're welcome.

    If the issue is from your animations, there is a solution to fix them by altering the offset of the animation. For a guide on how to do this, refer to the post here: https://forum.unity3d.com/threads/r...y-herds-npcs-more.336521/page-16#post-2872432

    This should allow you to still be able to use these animations without having to swap them out.


    Strange, thanks for the info. I will look into this right now to see if I can figure out what's going on. Emerald fully support RFPS so I'm not sure why it's not working for you.
     
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    So I just tested this and I got the RFPS player working in less than a minute using the exact setup as you and the tutorial. If your AI is not chasing your player, and you are receiving an error with getting the position, than you haven't properly setup your NavMesh. Your terrain needs to be marked as Static. You can make sure the NavMesh has been baked by viewing the Navigation tab in Unity. The portions that have been baked will be marked with a blue mesh.

    Is this happening in your own custom scene or Emerald's scene? Try testing this in Emerald's scene. If it works, there is something wrong with the way you setup your NavMesh in your custom scene.

    RFPS_Emerald.png
     
  37. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    I have plane not terrain.yes I know about navmesh.Every things are setup well.because I use the older version in many projects.it work good.
    the main problem is that its not only chase my player.it freeze on it position when player enter into wander ranger.no animation playing.when player away from wander range Ai work fine and Ai graze and animation is playing.
    when player enter into AI stoping distance then it start Attacking.
     
  38. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    @BHS I find an Error. it work with terrain good.
    when I use plane then I not working. you can check it also just use plane instead of terrain.
     
  39. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks for narrowing down the issue. Now that we know this, we can figure out what's going on. I will look into this and see if I can get things working for you.
     
    Dawar likes this.
  40. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    thank you so much.I am waiting for your good news.
     
  41. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    676
    Are manually set waypoints (with looping) supported? Have an NPC I need to patrol 4 points, then loop it.

    A > B > C > D > A (etc.)

    Please advise. Fingers crossed ;)
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Emerald dynamically generates waypoints within the AI's radius. However, if enough people find it useful, we can add a patrol generator with the next update that will allow users to generate waypoints that the AI will use instead of dynamically generating them.
     
  43. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    676
    Oh, okay. That's too bad. Thanks anyway!
     
  44. HellPatrol

    HellPatrol

    Joined:
    Jun 29, 2014
    Posts:
    38
    Weblox likes this.
  45. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    @BHS I find an Error.
    Method
    HuntMode ()
    line:2328
    I change it from because this condition is always false.
    Code (CSharp):
    1. if (DistanceFromTarget > maxChaseDistance)
    to
    Code (CSharp):
    1. if (DistanceFromTarget > maxChaseDistance/10f)
    and I also comment
    line 2477 and Line 2490
    now its Working for me
     
    Last edited: Mar 6, 2017
  46. lezan_

    lezan_

    Joined:
    Nov 27, 2016
    Posts:
    50
    Hello,
    do you think an integration with TPC (Third Person Controller) could be done easy? Any suggestion?

    Thanks!
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks, we will look into this.


    Hey there!

    It should be pretty straight forward. We haven't had a chance to test this out ourselves, but I believe some of our customers have.

    It should be a similar process to integration with UFPS and RFPS as shown here: http://emerald-animal-ai.wikia.com/wiki/Tutorials

    You would just use TPC's functions for applying and receiving damage.
     
  48. Houp

    Houp

    Joined:
    Sep 8, 2014
    Posts:
    6
    Hi,

    I am looking for "quadruped character controller". Does Emerald AI work with kinematic rigid bodies? It is the main feature I need from "AI framework". (I cannot use physic rigid bodies and character controller shape is not suitable for animals like wolfs and goats)
     
  49. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm curious if anyone here has also used ICE and what kind of comparison you would make. I have ICE, but I've never been happy with the level of complexity to get AI doing anything. This looks to be an easier to use system, but it would be helpful to hear the experiences of those that might have used both.
     
  50. Raptorixx

    Raptorixx

    Joined:
    Mar 4, 2015
    Posts:
    23
    Hi,

    I updated to Unity 5.5.2 and now gets the following error when importing your asset:

    Assets/Emerald AI/Scripts/Emerald AI/Emerald_Animal_AI.cs(1145,23): error CS0246: The type or namespace name `NavMeshPath' could not be found. Are you missing `UnityEngine.AI' using directive?

    Changing it to UnityEngine.AI leads to alot of other errors. Any idea on how to progress?