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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    Also, who would be interested in the implementation of some type of sound system with Emerald. This would allow animals to make sounds during certain animation types. We also would like to implement some type of footstep system also.

    Thanks, we will look into the animals getting stuck. I think the solution with the min andax steepness should fix the issue.

    Yes, we will be adding the Freeze Flee with the next update. It will be an optional feature that can be enabled or disabled. If enabled, it would have a min and max randomized freeze time.


    We will make the generator be possible within the editor or on start.

    Yes, we can add a min and max terrain height to wander range. I think it's a great idea.

    We will think it over with the birds and fish. Right now, we're focusing on all the previous discussed features and implementing the predator and prey system.
     
    Shawn67 likes this.
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    6,785
    Great idea! Random or contextual sounds and animations would be really good. Random examples: a wolf howling at the moon (e.g, if Unistorm says it's nighttime), or sitting and scratching fleas while panting. Contextual: sheep bleating as they flee wolves. Terrain-based: crunchy footsteps on gravel, whooshy footsteps in grass.
     
    Teila, BHS and Shawn67 like this.
  3. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    This sounds great. One request though.. I know UniStorm is also a BHS product but I would hope if something like time or weather options are there that they aren't tied specifically to UniStorm. Maybe have UniStorm used in examples but provide the api hooks so we can do the same with whatever time/weather we are using.
     
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    Thanks, these are great ideas.


    Yes, all time systems within Emerald will not be tied to UniStorm. These will be customizable real-time seconds. We will add some type of support to UniStorm to demonstrate accessing things like time and weather for something like AI.

    For one of our demos, we will probably show how UniStorm and Emerald can work together. I think it would be very interesting seeing dynamic wildlife AI reacting to weather and the time of day.
     
    Shawn67 likes this.
  5. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    5,752
    Oh, and please be mindful of performance. Unistorm is much too much for our game so we don't use it for that reason, even though it is beautiful. If you make this complex, please allow us to turn on and off what we need. Too many assets these days seem to get bogged down in doing too much, making them hard to use with multiplayer games.
     
    siblingrivalry, hopeful and Shawn67 like this.
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    We will be mindful of performance.

    When was the last time you used UniStorm? Since version 2.0, we have completely rewritten the system. We have trimmed off about 4,000 lines of code and greatly increased performance. We have had many users report a nice boost in performance since our new update. If you haven't tried out the UniStorm since the 2.0 update I would highly recommend it. With UniStorm, we also allow users to adjust all particle effect amounts to help with balancing performance and quality.
     
    Teila likes this.
  7. Maksoudbeast

    Maksoudbeast

    Joined:
    Sep 22, 2013
    Posts:
    30
    When do you guys think you'll be putting in the predators? This looks promising.
     
  8. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    3,667
    For some reason that comment made me think of adding this ... ;)

    [​IMG]
     
    rosor, Teila and TonyLi like this.
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    6,785
    Right on. Who says it has to be boring sheep and wolves?
     
  10. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    5,752
    Oooo, that would be so cool. I am scaring myself with the crocodiles in my game while making videos. Those would be soooo much worse!
     
  11. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    I grabbed those to try.. They look pretty good for free models...
     
  12. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    We're currently implementing it. We don't have a set release date, but when we are close to submitting, we will post it here. I'd say it's safe to say a few weeks.


    Cool models, maybe we will use these for one of the Emerald demonstration videos.
     
    Shawn67 likes this.
  13. Maksoudbeast

    Maksoudbeast

    Joined:
    Sep 22, 2013
    Posts:
    30
    Thanks for the quick response! I'll hold off on buying it until I see that feature in but I'm glad that you responded quite quickly!
     
  14. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    163
    Hello,
    Nice kit, i think to make it more realistic we should be able to set the awareness time range ? for example if the animal is not looking at the "flee tag" there is no need to flee, this will allow predators/players to "sneak" in order to hunt the animal.
    Also can we use mecanim with the kit ?
    Thanks
     
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    You're welcome.


    This is something that we have on our list to add to the system. Right now, we're focused on implementing the predator and prey system, which is coming along quite nicely. After we have implemented it, we can start adding more features such as look angle.

    Mecanim support is also being worked on. We are working as hard as we can to get all highly requested features added, as well as the new features we'd like to add.
     
  16. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    163
    Ok thanks, and good luck :)
     
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    You're welcome.
     
  18. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Any chance of a non-unity pathfinding support? Namely aron granbergs a* but also apex support would be nice (maybe there are others?) my terrain is generated at runtime and im more familiar with aron's a* for this kind of pathfinding (using recast)
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    We are making great progress with Emerald and adding support for the Predator and Prey system. Below is what we have done so far. We also have a video demonstrating (Test Battle #1) player vs. predator. Keep in mind this is a work in progress.

    Feedback is always appreciated.

    Here's what we have done so far:
    • Predators will attack/chase Prey. This is according to Prey Size (Predators can only attack Prey that are less than or equal to in size)
    • A basic health system (we are working on including one with the next update that will allow the hunting and killing of animals for both players and predators)
    • Randomized Attack Animations (Choose from up to 6 animation clips for your Predator to attack with.)
    • Prey and Predator pull-down option (This allows you to choose whether your animal is a prey, predator, or none)
    • Prey and Predator pull-down option (This allows you to pick your Prey and Predator's size which is either Small, Medium, or Large)
    • Attack sound support to play sounds when animals attack (We are in the process of also adding support of up to 6. These will also be randomly picked)
    • Dead GameObject replacement for after the animal's health has reached 0
    • Attack Speed Option (This allows animals to attack based on their customizeable attack speed based on seconds)
    • Behavior Types have been tweaked and categorized as (Farm [Never Flees], Cowardly [Will always Flee], Aggressive [Will always attack]) We are also working on another behavior type that will allow animals to be territorial (This will allow them to only attack when their passive seconds have been exceeded)
    • Hunt Seconds (This allows Predators to only hunt within their hunt seconds. Once they have been exceeded, they will give up on the Prey they were chasing)

     
    Teila likes this.
  20. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    Some suggestions/requests:

    Maybe add pack behavior where if two or more predators are in a pack, they may choose to attack prey equal or larger in size based on pack size. Prey attacks would be aimed randomly towards members of the predator pack.

    Can we have a both? Or is both assumed if the animal is a predator and a larger predator is around. Is there a species option where the same species doesn't normally attack each other? Maybe a flag to set the alpha of a pack and have a very low chance of a same species animal challenging for alpha status?

    Overall, sounds AWESOME! Would love to see above suggestions added at some point, if possible! :)
     
  21. Damien-Delmarle

    Damien-Delmarle

    Joined:
    Dec 26, 2012
    Posts:
    1,091
    seems that the bear run at player is not updated if player is strafing, on your video the bear seems to keep the position of player when it started to run only.
    • what happen if player outrun the bear?
    • what happen if bear dont see player ( behind a rock) but player attack him with a grenade, does damage event switch bear to aggressive ?
    • what happen if two npcs attack bear in same time?
    also what you could do is a function for predator to evaluate their prey like :

    bool CanIAttackThis(collider target)
    {
    return mycolliderHeight > target.ColliderHeight /2;
    }

    like you dont want a fox attack an elephant:eek:
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    Thanks for the suggestions. We will look over every to see what we can implement. Right now, we're focused on the prey and predator system. After this is finished we will work the pack/here system in with everything. The prey and predator system will most likely come as one update (along with everything else we said in update status) followed by the pack system in the update after that.


    A predator will chase a prey for a editor set amount of chase time. Once the bear's chase time is exceeded, it will go back to grazing.

    The bear will still attack the player, even while strafing. We will demonstrate this, and the other stuff you've mentioned, in another video. Like we stated, this is a work in progress.

    The predator will examine they prey before attacking. It will only attack it if its size is less than or equal to itself. This will stop foxes from killing deer, as one example, or an elephant as another. However, we might work in some feature support packs taking down bigger prey.
     
    Last edited: Jul 8, 2015
  23. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    5,752
    Hi! I have a question that just came to me today. :)

    Will the animals walk in the water? What if I don't want my animals to walk into the river or ocean. I mean, I imagine they would walk on the floor of the river/ocean which would be rather odd. Any way to mark areas you do not want the animal to go? I also have crocodiles and hippos that I want to walk into the water.

    Thanks.
     
    Shawn67 likes this.
  24. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    My boars flee into my ocean and then look funky roaming around under water.. Definitely would like some way to either avoid by layer and/or setup avoidance areas.
     
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    You can do this now by selecting the object you don't want the AI to walk on, in your case the water. Then open the Navigation tab and select Not Walkable. You will have to rebake the NavMesh, but it will bake it so that the AI will not walk on it.

    NavMesh.png
     
    Shawn67 and Teila like this.
  26. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    5,752
    Fabulous! Thank you. I am learning new things every day. :)
     
    BHS likes this.
  27. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    Ditto! Awesome! Thanks @BHS!

    EDIT: Ok.. This doesn't exactly work though as there will be some species that WILL be underwater or be able to go through the water. This solution is great if an all or nothing approach works. But a selective approach, this wont work. If your terrain is like mine and is an island, you are going to have wildlife that is both land based and water based. Land based shouldn't wander and stay in the ocean while sea based may wander but not stay on land. Or some species will totally avoid water while some will solely live within the water.. Hope that makes sense.. :)
     
    Last edited: Jul 8, 2015
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    I have a solution that should work, you can do the following:

    1) Create new Area and call it lets say Don't walk on Water

    Custom Area.png

    2) Set your water object to the area Don't walk on Water that you just created

    Set Water.png

    3) Go to your AI's NavMeshAgent, that you don't want walking on/in the water, and uncheck Don't walk on Water from the Area Mask

    Set Custom Area.png

    4) Rebake your scene.

    The AI you don't want walking on the water will have the water area marked as unwalkable and the ones that can walk on/in the water will be able to.

    We will see what we can do to better implement zones for AI from within the Editor for our next update. This will including something like Mountain, Water, etc.

    We will add this to the Emerald Wiki.
     
    Teila and Shawn67 like this.
  29. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    Ok.. That will work! I haven't dove into Navmesh much yet and was assuming it was all or nothing.. Guess that is what I get for assuming. Having something like this on the Wiki would probably be good enough. Anything to keep from bogging down the editor too much is a plus. With that said, if it doesn't add a ton to the Editor, that might be a great option!
     
  30. Tasmeem

    Tasmeem

    Joined:
    Jan 14, 2010
    Posts:
    102
    Hi,

    Would it be possible to use this system without the unity nav mesh?

    Our game has infinite procedural terrains (we don't use any nave mesh). What alternatives would work in our case?
     
  31. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749

    I'm in a similar position - id quite like alternative pathfinding options (as said i use arn granbergs astar with recast but ive read that apex is good too) so then i dont need to faff around with it when it comes to using it. I have this ai and quite like it but can't really use it as-is
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    We will look into other options other than NavMesh after we have implemented our upcoming features.
     
    Shawn67 likes this.
  33. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    Another status update, for those who are curious as to what we have gotten done since our last status update. We didn't get a chance to make a video showing these new additions. We will post one tomorrow. The new update should be submitted next week sometime.

    Here's what we got done since our last status update:
    • Predators can now hunt and kill Prey (so far wolfs do the best on our 13 square mile test terrain)
    • All animals now use a custom health system
    • A custom player weapon damage system has been implemented that can be used to kill Prey and Predators. This is based off customizable timers, distances, and delays to perfectly match any custom animations customers may have. It also uses RayCast so all attacks are properly registered which then spawns a customizable blood effect right on the hit point of attack.
    • Animals can now attack while running
    • We have also added support for Run Attack animations for those models that have it (this is an optional feature)
    • Hit animation support, if desired (this will play a hit animation when an animal is hit by a player or other animal)
    • Customizable Hunt Time that controls when a predator will give up on a chase
    • Predators will no longer chase a prey that is already being chased by another predator
    • We have tested this with 120 animals on a 13 square mile terrain with no performance issues
     
  34. siblingrivalry

    siblingrivalry

    Joined:
    Nov 25, 2014
    Posts:
    384
    My hand is hovering over the buy button. Can it work alongside HerdSim or do we have to stop using HerdSim if using Emerald Animal AI?

    Thanks
     
  35. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    5,752
    Siblingrivalry, it can work alongside herdsims. We also have it in a scene with UnLuck's bird flocks. :)
     
    siblingrivalry likes this.
  36. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    Ditto what Teila said... I have it in a scene alongside animals/birds/fish using Unluck's HerdSim, Bird Flock, and Fish School tools. Would be nice to have one tool to rule them all though... *hint* *hint* *hint* :p
     
    siblingrivalry likes this.
  37. siblingrivalry

    siblingrivalry

    Joined:
    Nov 25, 2014
    Posts:
    384
    thanks guys. hope you both are well.
     
  38. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    We will see what we can do.
     
    Shawn67 likes this.
  39. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    5,752
    Please, if you go that route, make the separate. I like Herdsims and don't want to have to take it out of my scenes because something in Emerald will conflict with it.

    I don't want to have to make a choice between the two...and it seems a little unfair when we bought this because it works with Herdsims. :)
     
  40. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    Wouldn't think it would conflict unless you try to put Emerald and Herdsim on same creature. Personally, I'd prefer to simply my project and just have one system I could use instead of a bunch of pieces. But that's just me.. heheh I've invested in all three of the Unluck packages too, but if I could get one system that could take care of all of that functionality, I'd ditch them in a heartbeat... lol
     
  41. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    5,752
    That is why we need options. I like the idea of a pack in Emerald because of the prey flee stuff. But for my sheep and chickens, I want Herdsims. I won't be pleased if there is a conflict. I will blame you, Shawn. ;)

    Packs and herds operate very differently. Much more AI will be needed for packs. In some scenes I just don't want that overhead.
     
  42. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    That it true.. Maybe it could be done as optional plug-in packs.. That way those who want everything to be ran through Emerald, we could upgrade Emerald to include them.. If they are eventually done..
     
  43. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    You don't have to worry about anything conflicting. That isn't the direction we're taking. We meant that we want the both systems to work side by side, which it sounds like they already do.

    We plan on designing API that can allow users to call functions like Damage(damageAmount) or TakeDamage(attackAmount) which will handle all damage related functions. This could then, optionally be applied to other scripts if needed. If we were to offer some type of support between multiple systems, it would be through our wiki where we would show examples of how to make the 2 systems work together, for those who want it. This wouldn't be included with Emerald.

    We don't plan on including any outside dependencies with Emerald.
     
    John-G and Teila like this.
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    To help with optimization and still offer fully customizing Emerald, we're adding a new feature that controls the max amount of animals that can be active at a time. This controls how many animals are aloud to interact at a given time. So, for example, if you have a setting of 50, then any animals that that are within trigger range, while the current active animals is equal to the max, will not interact (flee/hunt) from that animal and will skip that trigger interaction until the current active animals in below the max. However, to keep player immersion from being broken, animals can skip this option for players. So even if the max active animals has been reached, if a player enters a prey's/predator's trigger radius they will still flee/attack.

    Any suggestions/feedback on this would be great.
     
  45. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    5,752
    Can we still use the animation only for rendered animals? So...set a culling distance and not have animals outside that animate. I really see no need to have animals wandering around if no one is there to see them. I know some disagree with me....lol...but as I always say, it is the perception more than the reality when it comes to games.
     
    Shawn67 likes this.
  46. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    1,830
    If I'm understanding what you are saying correctly, this only effects their interaction with other animals and not the players? When I first started reading I was thinking trigger range was for players and was concerned how it would effect multiplayer game play. But further down it sounds like this isn't the case. Can you please confirm?
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    Culling should be setup with Unity's LOD system. You don't even have to have LODs. If the animal is out of range (it has met its culling/LOD distance) Unity will automatically cull it. We are currently working if we can implement this to enable or disable Emerald depending on if the animal is culled or not. If it's culled we will also disable animations. If it is not culled, everything will be enabled and work as it should. This will be an optional feature for those who wish to have it running in the back ground. For the customers who want it running in the background, they will have the option of the max amount of active animals.


    Yes, it will only affect their interaction with other animals, not the player.
     
    Shawn67 likes this.
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    Alright, so I just did a stress test using the LOD system's culling as explained above. Setting up an animal to use the LOD literally takes about 15 seconds (then you just save it as a prefab). I used over 3,100 animals spread across 13 square miles of terrain while keeping great frame rate. Animals will simply start grazing, hunting, fleeing, etc all when they are within the rendered view of their LOD distance. I don't think anyone would use 3,100 animals at one time, on one map, but it is possible and it does so pretty fast. This is done by disabling what isn't needed unless within view. I don't think there is a need for 3,000 animals to wander around and hunt when not in view. However, we will keep an option to keep animals from being disabled when not in view.
     
    Last edited: Jul 15, 2015
    John-G, Tethys and Shawn67 like this.
  49. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    5,752
    Yay!! Sounds great! I can't wait for the next update. :) I love playing with your system.

    I keep having to tell myself...Teila, you cannot play now, work on website. lol
     
    BHS likes this.
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    2,853
    Good to hear you're liking the system.

    We have another status update we're posting soon. We also managed to implement the herd and pack system based on an alpha. It's very cool so far.

    We should be submitting the new update possibly tomorrow, but most likely Monday. We have a lot of testing to make sure everything is perfect.
     
    AdamGoodrich and Teila like this.