Search Unity

  1. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  2. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  3. Unity 2017.1 is now released.
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  6. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    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. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,835
    Sounds good on the breeding. :) Looking forward to the dynamic but nice to know we will have option to do interactive breeding until then.

    And yeah, that was kind of the route I was thinking as far as the arrays. Maybe have something like a family/faction/species type field and then be able to select multiple enemies that look at that field. Look forward to what you come up with.

    A simple script that demonstrates the check into the EmeraldAI for death would be great, even if just put up to the Wiki. :)
     
  2. markfrancombe

    markfrancombe

    Joined:
    May 26, 2009
    Posts:
    149
    OK thanks for that explanation, Im not a coder Im afraid, but Im a hell of a code stealer, so I might be able to do this... I guess its not as simple as applying this damage.cs script to my player instead of the camera?
    Anyone done this before, that would be willing to share an example?
     
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    The Damage script uses the camera's position to make its raycast. You could alter it to just use your player's position.
     
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Hey everyone,

    We have been hard at work with Emerald 1.2 by rewriting and tweaking most of the algorithms to allow for improved decision making, dynamic waypoint generation, and improved performance.

    The fleeing algorithm needed some improvements. The fleeing algorithm now takes its chaser's position into its waypoint generation. Fleeing NPC/Animals will no longer, in some cases, run back into or at their chaser. Instead, they will continuously avoid predators/players generating waypoints in the opposite direction or away from their chaser or possible threats. A preventive measure has also been taken to regenerate waypoints if they lead to a position that is inaccessible or will get the AI stuck. This is all done allowing for more realistic AI fleeing, reliable dynamic waypoint generation, and is more efficient.

    We will be demonstrating the new improvements and features sometime next week. Emerald 1.2 is coming along nicely and shouldn't be too much longer.
     
    SpaceRay, kurotatsu and John-G like this.
  5. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    374
    Hi, can this work with fish or flying ai? Thanx -Jimbob
     
  6. TowerGuardian

    TowerGuardian

    Joined:
    Jun 9, 2013
    Posts:
    219
    Flying Ai would be nice!
     
  7. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    589
    Glad to hear it.
     
    BHS likes this.
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    We have never used it for flying AI but you could set the Y offset on the NavMesh to a high amount that would allow the AI to be far above the ground. However, this wouldn't allow the AI to be able to attack anything that's ground level.
     
  9. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    379
    Hi,

    I'm wondering how this would work with networking. Is it simply possible to sync the health and movement values and the AI system will do the rest? Or would I need to develop my own system based on the health and movement values?
    It looks really good so far and I hope you keep up the good work!

    Stormy102
     
  10. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    379
    Hi BHS,

    I have a few requests.
    1. Could you add support for fleeing from multiple tags?
    2. Could you potentially create a function so that clients can receive stats such as health and it controls the animations and AI state so it syncs across clients precisely.
    If you can add these, I will immediately buy this package, I just don't want to be modifying the code every time there is an update. This would also be good for adding multiplayer support, as a [SyncVar]/RPC would suffice for multiplayer syncing.

    Stormy102
     
  11. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    When I flee from a predator and try and come back it the ai does not attack player what so ever. It doesn't matter how close you are.
     
  12. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Multiple tag support is something that we are looking into. We weren't able to add it to 1.2 but the next version will most likely have some sort of multiple tag support.

    All variables are public so you can syncs them a cross clients as needed with an external script.


    I believe this may be the predator's cool down phase. When they are in the cool down phase, they will not attack. They use this time to return back to their starting point. This happens when their max chase time has been reached. This is also to help animals from chasing a prey for too long.

    The chase system will be done with distance as of 1.2. This will be the distance from either starting position or from the current target. These should make things more realistic. Either one can be enabled.
     
  13. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Is there a way to currently to change this and when will 1.2 be out? Is there also a way I can make animals automaticly spawn on the terrain in Packs and such.
     
  14. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    379
    Ok, thanks for the clear reply. Probably going to buy this within the next few weeks, just need multiple tag support as the active player is tagged PlayerActive and the non-active player is tagged Player. Maybe instead of tags you could have a custom component like EmeraldAITarget or something similar. Either way, I'm impressed with this asset. I'll post if I need anything. Cheers.

    Stormy102
     
    BHS likes this.
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Emerald 1.2 is very close to being done. We are making the final adjustments and polishes to the system and Editor. For those who were interested, or concerned, with the support of both Animal AI and NPC AI, a screenshot of the new Editor is below. This keeps animal specific features and NPC specific features separate. However, both types of AI are still able to interact with each other. You can use Emerald for just animals, just NPCs, or both.

    We have also added an AI Info area to see all the stats of the selected NPC or Animal. This makes it easy to see any useful information about the AI without having to look through the Editor. Suggestions and feedback are welcome.

    Note: This is only a portion of the Emerald Editor. We're demonstrating the different AI Types and how NPC and Animal AI can share the same system and Editor.
    Emerald Editor.png
     
    SpaceRay and Stormy102 like this.
  16. MahaGaming

    MahaGaming

    Joined:
    Feb 25, 2014
    Posts:
    80
    I can't wait 0_0
     
    Stormy102 likes this.
  17. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Looks sick!
     
  18. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    379
    I love the look of the new aggression system - this is exactly what I needed, especially coupled with the predator/prey system. Once I get this, I'll work on a multiplayer syncing script and PM it if you're interested.
     
    Tethys likes this.
  19. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,058
    Can't wait, digging the new menu system.
     
  20. jailbar

    jailbar

    Joined:
    Nov 21, 2012
    Posts:
    47
    I love quite of few of the assets you have on the asset store. I love Uni-Storm, it really is spectacular. I am waiting for 1.2 to make my purchase of Emerald, I really think it looks fantastic and will suit my ideas perfectly.

    I was just wondering how difficult it is to assign animations to the NPC's? Is it simply Drag and Drop, or is it a tad more complicated?
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Thanks everyone. Glad to hear you're liking the look of the new editor.


    Thanks, good to hear you like it. We would be interested in a multiplayer syncing script. That would be awesome and very appreciated.


    Thanks, I'm glad you like our other assets.

    Assigning animations is simple. You just find your model's animations and drag and drop them into the appropriate slots in the Emerald Editor. Everything is conveniently labeled making it easy to know which animations go where. Some animation slots support multiple animations so your NPC has more variety such as the idle animations and attack animations.
     
    SpaceRay and Stormy102 like this.
  22. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    While you are at it releasing a new update, can you make AI for like Elephants for example that are Friendly if you don't bother them?
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Yes, animals, as well as NPCs, have 2 different behavior types that fit this. Defensive, AI will only attack if they are attacked first and Passive, AI will never attack or flee, even if they are attacked.
     
    SpaceRay likes this.
  24. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Ok cool, Just what I am looking for! Thx!
     
  25. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    288
    Hello, I have bought Emerald AI and wonder when is going to be available the update for version 1.2, I mean if it will be this week, next week, or next month, or later.

    You say that AI will only attack if they are attacked, so I want to know what do mean with "will attack"? Is it only that it will trigger the attack animation?, What happens if the attacker runs away?, will the AI follow and run towards the attacker?

    Thanks
     
    Last edited: Jan 25, 2016
  26. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    379
    Hey BHS,

    Just wondering if you are going to add support for the AI "listening" and "seeing" targets with different ranges depending on player actions e.g. running, walking, crouching in a future update?
     
  27. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    288
    Can be a way that a Predator could ALSO be able to attack another Predator? Or maybe can a Predator be a prey of another Predator?

    Can the Emerald AI be used for vehicles too? I have tested it and seems it works right but they only wander around randomly. Maybe I am configuring them badly.

    Thanks
     
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    If an AI is Hostile, they will attack once an AI or Player enters their Attack Radius. If an AI is Defensive, they will only attack if attacked first (attack the attacker) or if the attacker has an enemy/predator tag.

    At this time an AI can be either Prey or Predators, not both. Multiple support will come after the 1.2 update.


    Yes, this is planned for Emerald 1.3.
     
    Stormy102 likes this.
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Emerald 1.2 should be submitted no later then the end of this week. We are working on making a more efficient and compact editor without sacrificing simplicity. What we have done is made tabs for each option. Selecting the tab will open up the the options for the selected tab. This makes it much easier to navigate through the editor. For those who like one solid editor with no tabs, you can use the Show All Options tab that will display everything as it did with the 1.1 update.

    The second image below shows multi-object editing support making it possible to edit many animals at one time, rather than having to edit one at a time. We have also added SerializedProperties to all variables allowing them to work with Undo and Redo. This also allows better support and proper use of prefabs.

    Gaia was used to place the animals.

    Feedback is always appreciated.

    Emerald 1.2 Editor Collage.png
    Emerald 1.2 Editor Multi-object Editing.png
     
    Last edited: Jan 26, 2016
  30. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Looks good, are you going to make like a animal spawner so they spawn in herds around the terrain?
     
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Yes, we plan on making a simple spawner for version 1.3. This will spawn random groups or single animals across a terrain. The spawner will also take the terrain's height into its spawning so objects can spawn on the terrain ground.
     
    Stormy102 likes this.
  32. TheSeawolf

    TheSeawolf

    Joined:
    Apr 10, 2015
    Posts:
    248
    Well your team has been busy with the updates for this and Unistorm. I still haven't gotten around to buying it as it has been in my wishlist all the time.

    Will the price remain the same for 1.2 at $34.95? Or is it likely to increase?
     
  33. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    We will not be increasing the price for this update.
     
    Stormy102 likes this.
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Quick screenshot of the improved Tag Options. Tag selection is now handled though a Tag Pulldown Menu. These will display all available tags, including custom ones. NPCs threat tags are listed as Enemy where as Animal's are listed as Predator/Prey

    Improved Tag Options.png
     
    SpaceRay, AdamGoodrich and Stormy102 like this.
  35. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    How to integrate this pack with Realistic FPS Prefabs ?
     
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    We have not tested Emerald with Realistic FPS, but I know some of our customers have.

    When attacking you need to call Damage(damage); after you have referenced Emerald (you can get this from collision, trigger, raycast, etc). "damage" would be the damage amount you are doing to the AI.

    You can use our PlayerWeapon script as an example. We will talk with the developers to see if we can get official support for Realistic FPS. Once we do, we will add it to the Emerald Wiki.
     
    John-G likes this.
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    We had a few delays with Emerald 1.2 due to the way the sound lists were handled, which was preventing them from being serializable. However, we found a great solution and the Sound Options tab is looking better than before. Serialization of the sound lists were important to allow for multi-object editing support as well as being able to use redo and undo. This allows multiple objects to be edited at a time so users don't have to add sounds one by one to each AI.

    We have also been able to greatly improve the fleeing algorithm to be more realistic. Animals that need to make sharp turns, or drop below a certain speed while calculating a waypoint, will now play their walking or idling animation depending on the speed they're going. This allows for greatly improved fleeing animals. A similar technique is used in Skyrim. We will be showing a small demonstration of this sometime tomorrow or Friday looking for feedback.

    With this, our submission date has been slightly delayed to Tuesday or Wednesday (of next week). Our goal is to have a polished system with no bugs. For that to happen, extra development time is sometimes needed. The good news is that 1.2 is closer than ever. We appreciate everyone's patients.

    The new and improved Sound Options:
    Emerald Improved Sound Options.png
     
  38. jailbar

    jailbar

    Joined:
    Nov 21, 2012
    Posts:
    47
    I have another simple, quick, question about the Emerald AI system. I am sure this has been answered several times, so I am sorry if it has been repeated.

    I have read that the AI and NPC's have behavioral presets, which I like, however....

    What if I wanted a deer to be 'huntable', but I wanted a horse to be 'unhuntable'. Is this possible or are all animals huntable regardless?

    If this is possible, is it as simple as checking a box, or is coding required?

    Thanks for reassuring my questions, regardless, when 1.2 comes out I am making my purchase. I just wanted to sort of understand the product a little better, as I am curious.

    Have a great day.
     
  39. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Hey there,

    That is quite alright. It's hard to keep track of everything that's been asked on the Emerald thread.

    Animals that you don't want to be huntable would simply be given a tag that no other AI is looking for. Each AI has a tag that they base their hunting off of. If the unhuntable tag isn't on an AI's hunt prey tag, it will never be hunted.

    If you have more questions, feel free to ask.
     
  40. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    288
    It seems that version 1.2 will be really great and better, and make it more awesome AI
     
  41. JustaGameDev

    JustaGameDev

    Joined:
    Jan 29, 2016
    Posts:
    41
    How can i get the AI to attack the player when he gets close ? I've set it to predator and everything but it shows the same object reference error and dosent chase the player.

    Also, how can i set the attack distance so when the player runs away it'll chase the player?
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    You need to make sure your player has a PlayerHealth script on it. This is most likely what's causing your error. You will also need to make sure that your player has a PlayerWeapon script attached if you want it to be able to attack.

    The attack distance is the Stopping Distance in the editor. This will control the distance that your AI attacks.
     
  43. jailbar

    jailbar

    Joined:
    Nov 21, 2012
    Posts:
    47
    I'd imagine the integration to UFPS wouldn't be too hard? I've read some comments saying it works out of the box, and I've also read that it takes a lot of work.

    I really think UFPS integration would be fantastic, if it is not currently included.

    Can't wait for 1.2 update, I check here everyday for updates!

    Thanks, as always!
     
  44. Aceego

    Aceego

    Joined:
    Apr 5, 2015
    Posts:
    21
    at first thx for this asset. i realy looking forward for the 1.2 update so it cames a bit closer to an big living habitat with breeding capabilities :)
    Are there any plans to integrate playmaker with it (or is there already an implementation or a way to get the varhealth into playmaker?)
     
  45. JustaGameDev

    JustaGameDev

    Joined:
    Jan 29, 2016
    Posts:
    41
    im actually not using UFPS. so the playerHealth script and playerWeapon script dont really apply to me.
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    I'm not entirely sure how Playmaker works, but we can talk with the developers to see what we can do. I know this has been asked quite a few times. We will do our best to make it happen.

    If Playmaker allows you to alter or call functions by name from within the system, it should work. You would just need a reference to the Emerald object.


    These scripts aren't specifically for UFPS, they are required to make the Emerald work. They need to be applied to your player and player camera in order for everything to work properly.

    It is all covered in the documentation. In Unity, go to Windows>Emerald>Documentation for information of setting up your player.
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Updated ETA
    Everything is looking great with Emerald 1.2. However, we have had some occasional snags that push our submission date back. This is why we tend to refrain from posting ETAs because, as developers, we can't always predict them. We always get them resolved, but they require time. It is our job to provide our customers with improved functionality and new features. With Emerald 1.2 we have done just that. We want a flawless bug free AI system. For that to happen, every portion of the system must be tested, thoroughly. I'd say it's safe to say that it shouldn't be too much longer until we submit Emerald 1.2, but we won't give an exact ETA. We can assure everyone it'll be worth the wait and we appreciate everyone's patience with the Emerald 1.2 update.


    Performance and Clarification about Animal and NPC
    To help with some clarification with the Animal and NPC portion of the system, we will explain. Emerald 1.2's animals will function the way they did with Emerald 1.1, with the addition of the improved editor, features, bug fixes, and improvements. NPC and Animals are separated using the Editor. The code from these 2 categories don't even run unless one or the other is selected. So, if your AI was set to Animal, none of the code for the NPC would be running in the script. This is to help ease the concerns of anyone thinking that extra features means less efficient. In fact, Emerald 1.2 performs better than Emerald 1.1 even with all the extra features we have added.


    New System Included with Emerald 1.3
    To show our appreciation, we will also be including a free copy of our new system with the Emerald 1.3 update. This new system will be a dynamic Animal/NPC spawner. We are currently taking feature requests for this. If you have questions regarding the details, just comment here.


    Example Loot System
    We will be including a simple example loot system with Emerald 1.2.


    Improved Fleeing Algorithm
    With that being said, we have a quick new video demonstrating Emerald 1.2's new fleeing algorithm. Animals, and NPCs, will no longer get stuck or generate waypoints they can't access. AI will continuously generate waypoints away from the target that is chasing them. AI will also no longer get stuck. Emerald can detect when an AI sets a waypoint that's inaccessible or will get them stuck and regenerate a new one.




    Improved Animal AI Functionality
    The Animal portion of Emerald has also been improved. The Alpha of a herd or pack will now better lead their group better and more intelligently than before. Part of this is due to the improved fleeing algorithm and dynamic waypoint generation.


    Turn Animation Support
    We have also added support for turning animation, as requested. This feature is completely optional. Turning animations will play when a an AI needs to take a turn that's sharper than ~60°. This also applies when an AI is attacking and chasing its opponent. The results are much better than they were with the Emerald 1.1.


    Improved Player Weapon and Health System
    We have been working on improving the player weapon and health system. The player weapon system now supports multiple hit and attack sounds. We have also added hit delays and receiving hit delays to help better match animations from the player and other AI. We will also be including a health and stamina system with bars for the new FPS system like below, minus the hand and weapon. UFPS was used below.


    Improved Fighting Algorithm
    Emerald 1.2 has also improved the way AI fight. AI will generate new targets, within range, after their current target has died. We will be demonstrating the below with a videos also, but here's some screenshots for now.
    Animal Fight.png

    We tested this with Guard AIs set to defensive. These guards guarded their area until the attackers were all dead.
    Defensive AI.png

    A Defensive AI attacking a player after they were hit by them. Defensive AI can generate targets to their attackers if they are attacked first.
    Defenive Attacking Player.png
     
    Last edited: Feb 5, 2016
    MahaGaming and Tethys like this.
  48. JustaGameDev

    JustaGameDev

    Joined:
    Jan 29, 2016
    Posts:
    41
    And how can we get the animal to take damage ? im currently using a sword so no guns.

    do i put the player weapon script on the sword ?
     
  49. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    The animal takes damage by calling the Damage(damageAmount) function. You put the PlayerWeapon script on your camera. This uses raycasts to detect your animal and send damage to it.
     
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,861
    Integration with UFPS is simple. We have code snippets so the AI will damage the UFPS health system and not Emeralds. When attacking, you would use Emerald's weapon system and match the animations that are generated with UFPS using the delays on Emerlad's weapon system.

    We will be completely redoing our Emerald Wiki site to better cover the ins and outs of our Emerlad system.
     
    Last edited: Feb 5, 2016
    Shawn67 likes this.