Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

[RELEASED] Emerald - AI (Dynamic Wildlife, Breeding, Predators & Prey, Herds, NPCs & more!)

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

?

Which (in development) feature would you like to see the most implemented with Emerald Animal AI

Poll closed Oct 1, 2015.
  1. Predator and Prey system support (allows animals to hunt and flee from each other)

    12 vote(s)
    17.4%
  2. Pack/Herd Support (allows for animals to stay together and hunt or graze)

    5 vote(s)
    7.2%
  3. Mating Support (allows animal to reproduce Minecraft style to help keep populations balanced)

    5 vote(s)
    7.2%
  4. Combat Support (will include a working example system of fightable and huntable animals)

    10 vote(s)
    14.5%
  5. All of the above (they are all equally as awesome and they all need to be implemented)

    37 vote(s)
    53.6%
  1. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey Mark!

    My post below will explain everything.
     
  2. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey everyone!

    To clarify why a rewrite was needed for Emerald 2.0, I wrote this post. It's also a status update on version 2.0 with details regarding its development.

    While the current version of Emerald works well, it has some drawbacks. When Emerald 1.4 was originally started, it was supposed to be a modification to the current version. However, there were too many factors that makes it difficult to add new features and make improvements. Instead of spending the time to fix everything, it was decided to start from scratch. This is allowing us to do things better the first time and implement features that would've been too difficult with the current version of Emerald.

    For example, Emerald's current Attack mechanics are comprised of two functions, one for running attacks and one for stationary attacks, each consisting of 200+ lines. Emerald 2.0's new attack function currently has just 42 lines and this handles running and stationary attacks. It also looks a lot better than Emerald's current version does.

    One of the best things about Emerald 2.0 is the huge performance increase. AI that are not in view of the camera are automatically disabled, with an option to add a delay. This new technique is miles better than how the current version of Emerald and allows AI to seamlessly be enable and disable. When AI are in their inactive state, they use 0 performance, according to the Unity profiler. A mild stress test was done with 45 AI active at one time, and the results greatly outdid Emerald's current version. A video demonstrating this will be coming within the next few days.

    A full feature list is in the works. Everything that has been mentioned in previous posts will be added. However, the main focus right now has been redoing Emerald's core, which is nearly finished.

    Now, I'm sure Emerald users are eager to see some new videos demonstrating Emerald 2.0. So, I've put this video together demonstrating Emerald 2.0's new Line of Sight feature!

    The new line of sight feature works by making an efficient field of view raycast to detect targets when a target is within its "trigger range". This is to help make the line of sight feature as efficient as possible by only turning on while a target is within range. The length of the raycast is controlled by the AI's trigger range. Once a target is within the AI's field of view, the raycast is disable, the detected object is marked as a target, and the AI will react according to its behavior, which were explained in the post above.

    This works for both the Hostile and Cautious behaviors. The AI's detection state is public and can be accessed via script which can allow for some interesting player and game mechanics. The best thing about the line of sight feature is that it allows players to be hidden when behind walls or other obstructions. No more AI being able to magically detect you through walls! The eye position of this feature can also be customized for added accuracy for each specific model.



    Feedback on the video would be appreciated. We are looking forward to further demonstrating Emerald 2.0 and we appreciate everyone's patience. The new Companion behavior feature will be demonstrated next which will show an AI to follow the player around and help them fight other AI. As for a release date, it's hard to say. The development of version 2.0 has been coming along quite nicely. As long as there are no unforeseen issues, and the beta tests go well, Emerald 2.0 should be submitted by the end of September, but possibly sooner.
     
    mattis89, julianr, micuccio and 4 others like this.
  3. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    147
    Hi @BHS ,

    Awesome Video - Thumbs up !! I tried to setup a similar Project inspired by Skyrim Beast Gameplay. :p

    It has been a while since I last used Emerald AI for my RFPS Project but it has always been one of the best AI packages for a beginner like myself. I do appreciate all the efforts going into the package and the Line of Sight features presented in the video are a great improvement. Also less Code and better Performance is greatly welcome.

    What I am eagerly awaiting is Integration of Unity Event.System. You have already done a great Job with Integrating them into Unistorm with Time Events (I am not sure if I am up to date with the latest Version - do we have Weather Events already? ) and I am hoping for a similar Event System in Emerald. ;)

    I have added some Unity System.Events to an older Emerald Version in my RFPS Project and I am using them a lot throughout my Setup to trigger all sorts of different actions.

    events 1.PNG events 2.PNG

    However adding up to a Solution like Emerald makes the upgrade process a pain and I always try to avoid it. I have already skipped the last Version update. Maybe the Event.System is already there? If not I am having high hopes that you will add those to Emerald 2.0, in a much more professional way that is ...:D

    Thanks for all your efforts and keep up the good work!
     
    Last edited: Aug 12, 2017
    magique likes this.
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey there!

    Thanks, I feel a real testing environment is important for development. :)

    The current version of Emerald doesn't have a built-in event system. The plan is to implement some type of event system with Emerald 2.0 similar to the one that was done with UniStorm.

    You are welcome and thanks!
     
    CraftingPixelLab and Weblox like this.
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey everyone!

    One of the most anticipated new features for Emerald has been the Companion AI feature. The video below demonstrates Emerald 2.0's new Companion behavior type.

    The companion behavior type give AI the ability to follow around a player and protect them from other AI. Two additional settings have been added called Combat Type.

    The Combat Type allows Companion AI to either fight defensively or offensively. If set to defensively, a Companion AI will only fight other AI that are actively trying to attack them player. This gives players the ability to sneak up on other AI without their Companion AI giving them away. If set to offensively, a Companion AI will fight any aggressive AI that is within their line of right or trigger radius, depending on which Detection Type is used.

    Animations, timings, sounds, and more can be customized. If enabled, Companion AI also have the ability to regenerate their health.The health bar shown is optional. Emerald 2.0 has a new health bar system that automatically creates, positions, and sets up health bars for all AI, if enabled. The health bar feature will be demonstrated with the next Emerald 2.0 video.

     
    Mighto360, llJIMBOBll and magique like this.
  6. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    837
    Looks good. Nice work on 2.0. Will there be an API call, or something that would enable and disable the companion feature, so you'd go up to an AI character and you could make them become a companion, or let them go and they would become normal AI or an NPC. Would you be able to have more than one companion? So if you wanted to have a small army for instance follow and help you - that would be cool!
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Thanks! There will be an API call to make an AI be a companion. All AI behaviors can be changed in realtime and they will react accordingly.

    The Companion AI feature supports multiple AI so you can have multiple AI following your player at once.
     
    julianr likes this.
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey everyone!

    Another feature that has been requested is some type of position based health bar system. While this isn't much of a feature for first person, this is important for users who use 3rd person controllers. With Emerald 2.0, the ability to have built-in health bars has been added. This feature is completely optional and does not have to be used.

    This built-in health bar feature allows users to custom the images, colors, and position that the health bar will use. Emerald will then automatically create the health bar according to your settings. To help with performance, the health bar will be enabled and disabled when needed. The health bar will reference its AI and update its health when the AI receives damage.

    The next feature that will be demonstrated is the Cautious (Territorial) Behavior Type.

     
    llJIMBOBll, wwg and magique like this.
  9. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    212
    Does this work with invector tpc?
     
  10. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    155
    will Emerald 2.0 Support ootii Motion Controller ?
     
  11. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    75
    This asset looks amazing and its what we need for our project, so I am going to buy it now and give it a try then write a feedback after a couple of days, hope it will work as expected !

    Just a couple of questions :

    1. When 2.0 comes out?
    2. What if the navmesh also bakes part of the sea and you dont want the animals to go there? I have already set up collisions so the player cant reach that spot but what if the AI picks a point thats in the sea?
    3. I have a problem with baking the area around the trees with the new navmesh system, so if the animal picks a random spot on the navmesh that happens to be inside that tree, can you somehow set the minimal distance where the goal is considered to be "reached" even if its not exactly on that spot but a few units away from it?
    4. This is kinda related to #2, but can you somehow make the animal not able to go in the village without messing up the baked navmesh area because my NPCs are lurking around the village ?

    If that is not implemented, I think those issues can be fixed if you have a max distance that each animal can reach (starting from its original position).
     
    Last edited: Aug 18, 2017
  12. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey there!

    It can, but you have to code in the calls to damage AI from Invector like Emerald.Damage(DamageAmount). If Invector's player damage function has a 1 parameter call, you can use Emerald's built-in player damage call. It's a string that allows you to call a 1 parameter function. If it requires multiple parameters, you would need to code this in yourself where the AI damages a player. We have a tutorial here that shows how to do it with RFPS. The steps should be similar, but just with Invector. http://emerald-animal-ai.wikia.com/wiki/Tutorials#Implementing_RFPS_with_Emerald_AI

    Emerald 2.0 will make things easier. If a system has custom defines, like #Using_Invector, we will be adding built-in support.


    Hey there!

    It should, if it has its own damage call function, you will need to add them to Emerald and the weapon source. I can reach out to the developer to see if we can get proper support to make a tutorial for the process.


    Hey there!

    Great to hear. Emerald 2.0 will have quite a few improvements to that of the current version of Emerald. The videos we have shown are showing Emerald 2.0 only features.

    1) Emerald 2.0 should be submitted by the end of September.
    2) We have a guide that covers this situation. You would just mark your water with an Area Mask that has an unwakable layer. The tutorial can be found here: http://emerald-animal-ai.wikia.com/...separate_areas_for_different_kinds_of_animals
    3) Yes, this is handled with the AI's Stopping Distance. This controls the distance an AI stops from its destination.
    4) An AI has the option to only wander within its wander area. It uses its Starting Position to generate new waypoints so it won't wander outside of it.
     
  13. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    75
    Amazing ! I am going to get it tomorrow and start working with it :)

    Hope you can also post some video tutorials when the v2.0 comes out.
    Also, does this plugin support root motion?
     
    Last edited: Aug 18, 2017
  14. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Sounds great!

    Yes, tutorial videos will certainly be made covering everything.

    Movement is dependent on Emerald's speed, not the animation itself. When using the Animator Controller, Apply Root Motion is check, if that's what you are referring to.
     
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey everyone!

    The video below demonstrates Emerald 2.0's new Cautious AI behavior type that allows AI to be territorial. This allows AI to warn their target before they attack. If a target leaves before the AI feels threatened, the AI will not attack and continue to wander..The warning animation and the time that's needed before a territorial AI can attack can be customized.

    For those who are wondering, the Emerald 2.0 beta is being pushed back a few days as the new editor isn't quite ready. It should be ready by Wednesday. Everything that has been demonstrated, and more, will be available in the beta. If you'd like to sign up for the beta and you haven't already done so, private message us your Emerald AI invoice number to become a tester.

     
    Mighto360, julianr and llJIMBOBll like this.
  16. hammerdown56

    hammerdown56

    Joined:
    Aug 18, 2017
    Posts:
    9
    I've had Emerald for quite some time and used it with UFPS and works great. I just purchased RFPS a couple of days ago and changed the scripts with the instructions. There isn't any errors and the AI works like it is supposed to but the Player doesn't inflict any damage to the AI. I don't know what I'm doing wrong. I'm using Unity 5.6.03b. Could someone please help?
     
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey there!

    I just tested the newest version and everything is working fine. Did you edit the WeaponBehavior script to add the if statement to case 13 as it said in the tutorial? This is what allows the AI to inflict damage. What type of weapon are you trying to use to inflict damage?
     
  18. hammerdown56

    hammerdown56

    Joined:
    Aug 18, 2017
    Posts:
    9
    Thank you for the reply. I did everything as the instructions said. the AI will attack the player and inflict damage. The problem that I'm having is the player won't do damage to the AI. I have tried every weapon, when back through the instructions several times, tried different models and downloaded both packages several times. When I shoot the AI I get the blood splatter but no damage. I have used Emerald with UFPS and it works great, far most the best and easiest AI package that I've used. I don't know what I'm missing With RFPS. I'm using Mixamo models and animations if that helps.
     
  19. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    2,282
    One thing I remember being tricky was whether or not you set the AI to the Flesh tag and NPCs layer.
     
  20. hammerdown56

    hammerdown56

    Joined:
    Aug 18, 2017
    Posts:
    9
    Yes I set the Tag to Flesh and The Layer to NPCs. Thanks for your response.
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Strange, it sounds like the function is not being called. You are positive you followed the steps in the section below and added the code to case 13?

    http://emerald-animal-ai.wikia.com/wiki/Tutorials#Setting_up_the_RFPS_Player_with_Emerald_AI
     
    Last edited: Aug 21, 2017
  22. hammerdown56

    hammerdown56

    Joined:
    Aug 18, 2017
    Posts:
    9
    I copied and pasted the first code under the second if statement in the Weaponbehavior script, and in the ArrowObject script I put that code under the second If statement as well.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    This was under the second if statement within case 13? case 13 is the layer responsible for the NPC layer.
     
  24. hammerdown56

    hammerdown56

    Joined:
    Aug 18, 2017
    Posts:
    9
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    I'll double check, but I've used the most recent version of RFPS and Emerald AI 1.3.5 and have had no issue. There haven't been any other users with this issue either.

    What version of Emerald AI are you using and what version of Unity are you using?
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey everyone!

    The new Emerald 2.0 Editor is turning out great. I feel it's a significant improvement to the current Emerald Editor. The Editor feels more clean and it's much easier to navigate through. The goal of the redesign is to make editing AI as easy as possible. The new Editor is taking a little longer than expected (due to the amount of work that needed to be done to add multi-object editing support) so the start of the beta will be pushed back 3 or 4 days. Users who are beta testers can expect to receive the beta access sometime this weekend. Thanks in advance for your patience and understanding. Below, I'll cover some of the new additions and improvements made to the Emerald Editor.

    Visual Field of View and Detection Radius
    Emerald's Field of View and Detection Radius are visually represented according your AI's settings. This setting also shows and AI's Field of View distance. For users who are not using the Field of View feature, there is still a visually represented circle showing the AI's trigger radius, but this isn't shown in the gif below.

    Multi-Object Editing Support
    One of the drawbacks to the current Emerald Editor is that it doesn't support multi-object editing which can make editing similar AI time consuming, or make you rely on prefabs. With Emerald 2.0, multi-object editing support has been added. This allows you to edit multiple AI at once. Custom EditorGUILayout have been added to improve Editor functionality. If multiple AI are selected at once, and their values differ from each other, the Editor will show that the values are not equal. This stops the values from being overwritten and will only update the said value if the value is manipulated, similar to how default Unity inspectors work.

    Undo and Redo Support
    Undo and redo support has also been added, which also works with multiple objects. All of Emerald's Editor variables are now serialized.

    Emerald_LineOfSight.gif
    Improved Editor Design and Help Boxes
    The new Emerald Editor will have foldouts to make using the Editor easier by being able to hide options that you are not using. The help boxes' colors have also been improved. These improvements help the Editor feel more sleek and less clunky than previously.

    If you have any feedback regarding the editor, just post them here.

    Keep in mind this is a work in progress

    AI's_Settings.png
    AI's_Settings_2.png
     
    Mighto360 and julianr like this.
  27. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    837
    Keep up the good work on this, Emerald is turning out to be one of the top AI assets (I use two AI systems in my game - Emerald is a close 2nd, but I can see it being use as a core 1st choice AI system for many of my future projects due to what I'm seeing in the 2.0 version) - loving the new updates so far and can't wait to use them . Happy to alpha or BETA test any update if you want.

    One thing I did notice in the videos, is the delay before the AI attacks you ... giving you time to move out of the way. I take it that when the AI reaches the player you can speed this time up for the AI to attack?
     
    Last edited: Aug 23, 2017
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Thanks for the kind words! Emerald 2.0 has been a lot of hard work, but when it's finished, it will be a solid AI system. You're more than welcome to be apart of the beta. I'll add you to the list.

    The delay you see is intentional and can be customized (if you're talking about the delay before the AI attempts to move to its target). It's there so AI don't immediately chase the targets in between attacks and attempt to reach their target's destination. It allows the player to plan a little bit of strategy such as healing, getting to a better position, summoning an AI companion, etc. The delay doesn't change when an AI reaches their target. However, an option could be considered for users who want that option. During Emerald 2.0's development, a few games have been studied that use a similar technique.

    If you're talking about the delay between the AI's attacks, this is an AI's attack speed and it can also be adjusted. An AI's attack speed is a randomized float between two constants that the user can customize. This float is regenerated after each attack and is then rounded to give a nice subtle variety in an AI's attack speed.
     
    julianr likes this.
  29. hammerdown56

    hammerdown56

    Joined:
    Aug 18, 2017
    Posts:
    9
    I'M using RFPS 1.27, Emerald AI 1.3.5., and Unity 5.6.ob3. I am sure nothings wrong with your asset. I loaded UFPS and everything works. I thank you for the time and patience's, but due to the lack of support from the other asset I think I will stick with UFPS. I can't wait for the release of 2.0, very excited.
     
  30. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    837
    Great thanks! Sorry I should have been clearer, at that point I think I had two hours sleep :) I was more referring to the first AI attack after the AI reaches the player (stopping distance?) or attacking zone. It seems like he was waiting for something for 1-2 seconds before attacking the player. Maybe the next event tick.
     
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    You're welcome and great to hear!


    You're welcome and it's all good. The chase delay may still be triggering when the AI approaches its target causing that initial delay before the AI attacks, or it could just be its attack speed. I can certainly double check though.
     
    julianr likes this.
  32. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    837
    No worries, If its a setting that can be changed then its all good. In addition to line of sight, are you doing noise and hearing? This could be done three ways;

    Radius around the AI, so if a player comes into range of that hearing radius the AI gets detected if a certain noise level is reached which is a bit basic, or the other way is to detect the noise for the duration of the player making a noise when within the radius, if the player remains motionless for a set duration then the AI will resume its idle or wandering event. The third way is to detect a player based on the noise level, so if the player is within that hearing radius the noise level will go up in a counter until it reaches a value, if that value is reached or exceeded then the AI detects the player.

    There could be a fourth way to make it a bit more sophisticated, that's to recognise the players sounds as they get nearer the AI, the noise level based on the sound properties could be used.
     
  33. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    75
    This is the error that I am getting after I select animation type Mecanim and then hit "Create Animator Controller".
    I haven't touched the other settings or anything on the asset except that I moved it in Assets/Plugins/Ai/Emerald AI folder.
    I have also tried restarting Unity.

    http://i.imgur.com/G8FpZqY.png
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Thanks for the suggestions.

    Hearing and sound detection is something I would like implemented. Your suggestions are very similar to what I have been envisioning. In order to keep things as user friendly as possible, it will most likely be a movement based counter. The faster the player moves towards the AI, when within range, the faster the counter will go up. The counter will great more sensitive as the player gets near the AI making it more difficult to control. If the counter is exceeds its max value at any time while the player is within its trigger radius, the AI will become aware of the player and it will become an active target.

    I'm not entirely sure if the sound detection will make it into the initial release of Emerald 2.0. It all depends on how long the rest of the system takes. So far, everything is on schedule though so it might.

    Hey there!

    This is happening because the Animator Controller Creator is dependent on the folder structure. In order to resolve this, put the Emerald folder back in the main Asset folder of the project. If you need to have the folder structure this way, open the Emerald Editor script and change the file path to your new file path for the created Animator Controller to be saved to.
     
    julianr likes this.
  35. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    75
    I ended up changing the script. I have a few problems though:
    1. My idle animations are twitching(using generic rigs Mecanim), I think that issue is not there when playing a walk animation.
    2. Can I somehow make it to go from idle > walk once the idle animation has finished ?
     
    Last edited: Aug 25, 2017
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    1) I haven't encountered any twitching idle animations. Have you ensured that the idle animation is set to loop and it loops properly?

    2) It should automatically transition between walking and idling depending on if the AI is moving or stationary.
     
  37. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    75
    Yes the idle animation is looping smoothly before I add the Emerald AI component, its like the model is going left and right a bit and it causes that "lagging" motion.
     
  38. Zelre

    Zelre

    Joined:
    Dec 3, 2016
    Posts:
    39
    Emerald AI 1.3.5 and Ultimate Survival 0.13

    Making the Ultimate Survival player damage Emerald AI

    Step 1
    Option A: Make your AI's rig a humanoid.
    Select your AI in the scene and run it through the Ultimate Survival ragdoll in the Ultimate Survival menu.
    Once ragdoll is created set your AI's rig back to what ever you need it to be (if you don't want it to be a humanoid.)

    Option B: Set up your ragdoll manually without changing it to a humanoid, or use what ever auto ragdoll assets you might have.

    Overall, you want to create a ragdoll for your AI. How you do it is up to you.

    Step 2
    Set your Emerald AI onto the "Entity" Layer

    Step 3
    Change your Emerald AI's layer to "Entity" in the AI Config

    Step 4
    Add the Ultimate Survival "Ragdoll" Script to the game object on your AI that's holding the rig, not the first bone like the hip but the one that's usually the parent of first bone. (Where you put this might not really matter too much though.)

    Step 5
    Setup the Ragdoll script as follows:
    Pelvis = AI's pelvis bone
    Normal Layer = HitBox
    Ragdoll Layer = Default
    Surface = Assign one. (You can select the Ultimate Survival "boar" texture if you're too lazy to set your AI's texture up in US.)
    Auto Assign HitBoxes = Yes (ticked)

    Step 6
    Add the HitBox script to all the bones in your AI that have a collider on them.

    Step 7
    Set your Emerald AI's tag to "Respawn" or what ever you need your AI to be on (make sure to adjust the code if you make it different though.)
    You could also make this a public option that can be set in the script through your editor if you have AI with different unity tags.

    THEN

    Add this script to line 33 of your Ultimate Survival HitBox script:
    Code (CSharp):
    1.  
    2. if (m_ParentEntity.tag == "Respawn") {
    3. m_Collider.GetComponentInParent<Emerald_Animal_AI>().SendMessage ("Damage", -damageData.Delta);
    4. }
    5.  
    Step 8
    Add Ultimate Survival's AI Event Handler script to your AI (important.)

    Making Emerald AI damage the Ultimate Survival player

    Step 9
    Add the following to the top of your Emerald Animal AI script (some might not be needed but I was too lazy to figure out which so you can remove them one by one and see which ones affect the code in step 10.)

    Code (CSharp):
    1. using UltimateSurvival;
    2. using UltimateSurvival.AI;
    3. using UltimateSurvival.Building;
    4. using UltimateSurvival.Debugging;
    5. using UltimateSurvival.GUISystem;
    6. using UltimateSurvival.InputSystem;
    7. using UltimateSurvival.StandardAssets;
    Step 10
    Add this to line 3301 in the Emerald Animal AI code

    Code (CSharp):
    1. currentAnimal.GetComponent<PlayerVitals> ().Entity.ChangeHealth.Try (new HealthEventData (-attackDamage));
    2. var col = currentAnimal.GetComponent<Collider>();
    3. if(col != null)
    4. {
    5. var data = SurfaceDatabase.Instance.GetSurfaceData(col, currentAnimal.transform.position + Vector3.up, 0);
    6. if(data != null)
    7. data.PlaySound(ItemSelectionMethod.RandomlyButExcludeLast, SoundType.Hit, 1f, currentAnimal.transform.position + Vector3.up * 1.5f);
    8. }
    This should integrate Emerald and US just fine. If there's any minor bugs they should be easy to fix and would just be from my lack of coding knowledge. I have run into some bugs and the above instructions have fixed them.

    Enjoy.

    *Edit: Considering that both Ultimate Survival 0.2 and Emerald AI 2.0 are going to be completely rewritten versions of their previous versions, these steps are probably not going to work when either of them updates... Though they might still be similar. :)
     
    Last edited: Aug 26, 2017
    julianr likes this.
  39. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    It sounds like your model's animations need to be adjusted. You can try a possible solution below.

    Find your model source, go to the Animation tab, and check these three checkboxes (You can also try a combination of the tree depending on what's off with your animations). You can also try this with individual animations if the option is available. What this does is attempts to better center your model's animations to the model's center. If the animations are off and not properly centered with your model, it can through off the AI's position making it not look right. This is not an Emerald issue, but more of an animation issue.

    MecanimAnimationPositionAdjustments.png


    Hey there!

    Thanks so much for this, it is greatly appreciated! I'm sure it will help quite a few users out.

    When Emerald 2.0 comes out, I'll be sure to reach out to the developer of US to get integration started, as soon as their new version is out that is.
     
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Hey everyone!

    Time for another video showcasing some of Emerald 2.0's new features.

    This new feature is the built-in combat text system. This allows users who have 3rd person games to have Emerald automatically create combat text for all AI that have it enabled so users don't have to implement their own system. The system allows you to customize the text color, position, animating style, size, and font to be used. This of course is all done efficiently and is completely optional. Users who don't use this feature will not be affected by it or even have its features visible.

    Feedback regarding these new feature would be appreciated.

    Combat_Text_Settings.png

     
    Last edited: Aug 26, 2017
    magique and julianr like this.
  41. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    75

    I found where is the problem, but I have no idea how to fix it. Basically if the animal is on a very smooth terrain that laggy motion is not happening, but my game's terrain has slopes and when the AI is there, its animations are glitchy. Also this is only happening when Align AI is checked. I would send you the model + the animations if you want.

    I have also found something else - if the AI is attacking you and you run away, then that AI starts going back to its starting position and you are following it very closely, so it's not attacking you while moving,then it's back to its default position and you are inside its attack radius but its not detecting you, unless you leave that radius and enter it again.

    The AI has an option for Chase Seconds, do you have something like chase radius so if the player leaves that radius (starting from the NPC's position before the attack) then the NPC stops following? Right now you can walk in a circle around the AI, it will chase you until you cross those chase seconds and then will stop chasing even if you are really close to its starting position.
     
    Last edited: Aug 26, 2017
  42. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,060
    I need a video tutorial how to setup enemy npc with emerald. I this I made all, enter animations in slots but npc does not animate while moving :(
     
  43. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    Strange, I've never had an issue with Emerald aligning AI improperly. I can look into it though. Keep in mind that Emerald is being completely rewritten with version 2.0 and everything you mentioned has been fixed with the new version, which should be out in about a month.

    I would recommend not using chase seconds for that exact reason. It isn't going to be an option with Emerald 2.0. There is an option to use chase distance so the target has to get out of certain distance before the AI gives up on its target.


    Hey there!

    Did you use the Create Animator Controller when creating your AI? If you didn't, this would be why it's not working. This system assigns the Animator Controller and Animator Component when you use it. I would recommend using it and then applying your animations. Also, make sure your Animator Component has an Avatar attached to it.
     
  44. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    75
    Okay, I hope that version will be out after 2 or 3 weeks, because we have to publish monthly updates and our plan for September is to work on the combat system and AI.
     
  45. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    My apologies if this doesn't work for your schedule, but Emerald 2.0 is being worked on full time. The new version is a huge improvement, if you've been watching and reading the development updates. The new version should help make your Emerald AI related updates quicker, but it won't be ready in 2 or 3 weeks. However, it should be done at the end of September.

    As for your align AI issue, is your AI on any non-terrain objects when this issue happens? The current version only supports terrain aligning. The new version will support both.
     
  46. micuccio

    micuccio

    Joined:
    Jan 26, 2014
    Posts:
    105
    Any news about the Beta? :)
     
  47. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    837
    Nice feature. What would be good is if this can be adopted for the player also. This way its consistent.
     
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    The beta is being pushed back just a little bit longer, which is why ETAs aren't normally given. I will let everyone know when the beta is ready to be sent out.

    The beta needs to have the majority of the new features so they can all be thoroughly tested. Some of the new features are taking longer than expected.

    I can assure you that it will be well worth the wait though. :)


    Thanks! There will be an option to have a combat text system created for the player. This just hasn't be implemented yet.
     
    julianr likes this.
  49. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    837
    Great! Also the Health HUD would also be beneficial. I know its probably down to what player controller (stats) system the player is using, but if its generic for health depletion this should be easy enough to cross reference with their own to reduce the health bar based on each hit, in addition to the combat text being displayed.
     
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,973
    I'm not entirely sure how a generic health bar would work and how it would fit in with Emerald. Most users are going to have their own health systems that their character controller systems use.The combat text is easy because it doesn't require tracking any custom variables on the user's end. It's just displaying the damage that the AI dealt. There will probably be an example health bar system for the 3rd person example that will be included with Emerald 2.0. Users can simply modify this to suit their character controller system as needed.
     
    CraftingPixelLab likes this.