Search Unity

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

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

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

  1. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    573
    i have the model walking around but no animations, those are set to legacy and all slots are full.
    any ideias
     
  2. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    Is the model walking or sliding? If it is walking then that indicates that you have the Animation component. Does the animation component have all the animations in it?
     
  3. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    573
    my bad i was missing the animation component ... Thank you!
     
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Great to hear!

    Yes, you must have animations on all enabled slots if you are using animations. We can add some code to bypass this in a future update to avoid some confusion.


    1) Enemies can stay stationary if their Wander Radius is set to 1.
    2) The object would need to have already been there and have been backed with Unity's NavMesh. What you could do is add a NavMesh Obstacle in the area of the bridge, have the bridge baked with the NavMesh, but disabled. When you want to "spawn your bridge" you would enable the bridge and disable the NavMesh Obstacle.


    We tested Emerald up to Unity 5.2.2 and submitted it with Unity 5.0.2. Everything worked fine on our end. The system places the trigger on the skinned mesh renderer at a position of (0,0,0) so there shouldn't be any issues with it being off. The only thing I can of is the model's skinned mesh renderer being off.

    Try testing our demo AI characters to see if you are still having this issue. If you aren't, it may be something with the model you are using. We tested Emerald with many different models from different artists with different sizes. They all worked. We are determined to resolve your issue and I'm sure we will figure out what's happening.


    Hey there!

    Make sure you have an animation component on your AI and that it has all of its animations on the animation component. You will also need to make sure you have an animation for each slot in the Emerald editor. The animations can be found under the Animation Options. Make sure there is an animation assigned for each animation slot that is enabled.



    You found something very cool!

    I'll explain:

    Animals can be damaged by calling the DamageFromPlayer function.

    The reason it was working was because with Emerald 1.1 our damage function was called Damage. UFPS has a SendMessage on the bullet that was sending a message to the function to Damage. Emerald was picking this up and applying it as damage.

    The reason it isn't working anymore is because damage from the player is handled slightly different now. You can damage your Emerald AI (from your player) by changing your Damage Method Name on your bullet (that's using vp_HitscanBullet) to DamageFromPlayer.

    This is working and UFPS bullets are damaging Emerald AI. I tested it out in one of our demo scenes and killed a deer!

    This setup allows you to damage Emerald AI with UFPS bullets. However, you must have a PlayerHealth script on the UFPS parent object for this to work. The PlayerHealth script doesn't even need to be active so it won't interfere with UFPS. I hope this helps and it's a very interesting discovery.

    UFPS Support.png


    As of right now there is only 1 turn animation support. We will add support for left and right turn animation support with 1.3.
     
    Last edited: Mar 9, 2016
    Stormy102 likes this.
  5. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Ok. I imported Emerald into a new project in Unity 5.2.4f1. The fleeing worked perfectly. I don't know what's wrong with my project :(
     
  6. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Ok this is weird. OnTriggerEnter doesn't get called in my project, but it does in a fresh project. Think I need some Unity Support.
     
  7. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Ok @BHS The sphere collider isn't being setup correctly, on the mesh renderer. It's not setting the radius correctly, but assigning the sphere collider.
     
  8. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Ok, using the Fleeing example shows how my project is going weird. (Think the upgrade to 5.2.4f1 messed everything up). The Zombunny's sphere collider is being set up correctly, as shown in the below image.
    ZomBearSphereTrigger.png
    However, when I try to do it for a custom object (Horse)

    Horse.png
    HorseSphereTrigger.png
    I just don't know what's happening. It's working for some and not others. I'm really confused.
     
  9. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    That's strange, every model we have tested has worked. So, it must be something specifically with the model you are using. Is it a free model on the Asset Store? If so, we will grab it and test it ourselves to see what's going on.

    Also, what other components do you have on and attached to your model?
     
    Stormy102 likes this.
  10. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    I started a new project and used the setting you provided but when I applied the Vp_HitscanBullet script the ZomBear dissapears! If I disable this component the Zombear reapears but of course he cannot be shot.

    I just wanted to try your solution because it is slightly less effort to set up than a solution that I came up with which involved modifying the code. After more than three days messing with this single problem, I think I will stick with what works so I can move on.

    I appreciate that you have the Zombear and Zombunny examples; they do help. But some real documentation is needed for this asset on how to set things up, things to watch for and gotchas to avoid. Even better would be videos that show that the various set up procedures actually work. It is becoming increasingly frustrating to pay money for a solution that then requires days of trial and error to achieve the most basic results. I am beginning to see why some developers steer away from purchasing assets and just develop their own. Yes it takes time, but then you understand how to integrate it into your game as a whole instead of these constant battles. Again, clear procedures would go a LONG way to improving this. More comments in the code would also help.
     
  11. BHS

    BHS

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

    You don't assign the Vp_HitscanBullet script to the AI or anything. You just modify the UFPS bullet's Vp_HitscanBullet and change its Method Name to DamageFromPlayer.

    I understand your frustration and I apologize for the delay. It has been a busy week. We are working on finishing the documentation and supplying some much needed video tutorials that will cover setting up, creating AI using custom models, setting up UFPS with Emerald, and more.

    More comments in the code can certainly be done with our next update.

    Thanks for the feedback, it's appreciated!
     
  12. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Ok, so the issue with the incorrect animation names in the demo scenes appears to be to do with me forcing text serialisation to use Unity with Version Control (Git). However, it doesn't stop the issue with the sphere collider or no OnTriggerEnter. It's the free horse animal on the unity asset store: prototyping before we use proper assets. Link here https://www.assetstore.unity3d.com/en/#!/content/16687
    I may need to create a new project and re-import everything. Some UT support would be nice and I've opened another thread regarding some other issues I've had since upgrading.
     
  13. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    I used my turn animation, but when the animal turn he use his normal walk animation. Why?
     
  14. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    When an animal/NPC is walking, digging, eating or playing any animation and is shot, it doesn't play the Hit animation. Only when the animal is still or between animations does the Hit animation play. I am trying different things in the code to interrupt any animations that are playing and play the hit animation. Of course most Hit animations are very short; less than one second, so when I call CrossFade I use only 0.1 seconds for the transition.

    anim.CrossFade(hitAnimation.name, 0.1f);

    But it still doesn't work.
     
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I tested the same model with Emerald and everything worked fine using Unity 5.3.3 . The horse flee triggered and it played the proper animation. The trigger collider was also properly placed and working. I'm not sure if the issue you had was only related to Unity 5.2.4.


    The reason the animal has to be still to play a hit animation is because most hit animations are minimum of a second. If this animation were to play while the animal was running or moving, it would be running while playing a standing hit animation. What we can do is add support for a moving hit animation. I'll see if it's something that can be added with the next version.
     
    Stormy102 likes this.
  16. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    I have a sneaking suspicion that our project is somehow corrupted. I'll see what I can do about importing our stuff into another project but I'm not sure why the radius isn't being assigned correctly and OnTriggerEnter isn't being called. I'll see what I can do and I'll get back to you on this. Emerald works perfectly in new projects so it's not an issue with the system.
     
  17. jailbar

    jailbar

    Joined:
    Nov 21, 2012
    Posts:
    49
    Now that 1.2 is out, I purchased my 2nd asset from BlackHorizonStudios, the other one being UniStorm, and again I am very pleased with what I have experienced. I will be leaving a positive review later tonight, but I really think this AI system is something that I can really work with, especially after already seeing how you guys format your code with UniStorm (after a few months of positive experiences there as well).

    I can already imagine the several types of AI that is now possible with a system like this. The only downside is the massively large bake-process for my massive terrain, but I just leave my computer on when I go run quick errands, and usually it gets done in an hour or two.

    I did have one small suggestion for Defensive AI, it seems that when I attack a 'Defensive AI', and then they give up and return to their starting point.. I noticed that if I return to their area later, they still feel threatened from my previous attack, which is fine for now. My suggestion is a feature that allows them to 'forget and forgive' me after a set amount of seconds of me being away and peaceful. For example, lets say I attack a villager but don't kill him, then I leave the area for a few minutes and come back, I would think a set amount of time to have an AI forgive you would be cool.

    Heck, I just bought it, it may already be a feature, but maybe I haven't found it yet. Either way, really pleased so far. Two for two in my positive purchases from you. I was worried about getting that Onyx Ranking System, but I might just have to get that as well... Probably one of my most trusted developers on the asset store.

    Thanks so much for providing us with this great asset at a great price.
     
    BHS and Stormy102 like this.
  18. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    Why when an animal kill another, he continue to attack the death animal?
    And, how to bring back an animal alive?
     
    Last edited: Mar 12, 2016
  19. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    How about an audio cue, like, "Hey! Not you again!" or "Say.... I remember you!"
     
  20. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    461
    Hi,
    Just bought this. Does the included demo include animals that roam? Is it easy to implement Unistorm into this? Thanks.
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Thank you for your kind words! We're happy to hear you that you are enjoying our systems.

    If I remember correctly, there was some code added that allowed an AI to forgive an opponent after they have given up. I will double check and let you know what it is.

    With Unity 5.5, you will be able to bake NavMesh during Runtime. As soon as this feature is available, we will be implementing it into Emerald.


    If an animal is dies, the AI will stop attacking. If there is another opponent or player within their radius, they will continue to attack. An animal cannot be brought back to life at this time. However, what you can do is spawn an animal in place of the dead one and destroy the dead one once the new animal is spawned.


    Yes, the Fleeing Animals Demo has wandering animals that flee when an animal gets near. If you don't want them to flee from player, change their Behavior Type to Passive.
     
  22. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    This is just a question.

    If I make Sims like Game .. Is This Emerald AI a good choice?
     
  23. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    It has good wandering functions and flexibility. You would need to write your own script that allows for naming and different AI stuff (I don't play sims games, so idk what it involves) but its very flexible so you can adapt it to pretty much any situation.
     
  24. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    the sim game use HTN planner Assign task e.g
    1. task .find axe
    2. 2nd task find tree
    3.task cut the tree.
    if Ai not find axe than he cannot able to cut the tree.
    please see more in detail about GOAP and HTN planer . HTN Planner is more faster than GOAP
     
  25. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    How to make most accurate the collider for a FPS?
     
  26. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    You can have a series of capsule, sphere and box colliders to have a hitbox and then depending on the collider hit, deal a certain amount of damage. That's how we do it for variable damage.
     
    Marcirazzo likes this.
  27. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    @BHS Upgrade to Unity 5.3.4f1 fixed most of the issues but the sphere collider's radius isn't correctly being assigned still. Also, could you implement mecanim support as the current animations are generic, but converting to legacy creates some humorous, albeit annoying, graphical glitches.
     
  28. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    How to make the animal run away when I shot him?
     
  29. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    Isn't possible to use mesh collider or concave collider?
     
  30. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    physic Animation with rag doll
     
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Emerald has been tested with the latest version of Unity and we are not seeing any issues regarding the collider's scale. Everything works perfectly on our end. Is this happening with a custom model or with the models we supplied? Can you post a screenshot of your issue?


    You would need a reference to the animal that's hit "gameObjectReference" then call the below code. You would also need to set the player as your flee target.

    Code (CSharp):
    1. gameObjectReference.GetComponent<Emerald_Animal_AI>().isPlayer = false;
    2. gameObjectReference.GetComponent<Emerald_Animal_AI>().isGrazing = false;
    3. gameObjectReference.GetComponent<Emerald_Animal_AI>().calculateFlee = true;
    4. gameObjectReference.GetComponent<Emerald_Animal_AI>().fleeTarget = playerObject;
    5. gameObjectReference.GetComponent<Emerald_Animal_AI>().isFleeing = true;

    Yes, mesh colliders work. However, the mesh collider does not take animation into its collision shape.
     
    Last edited: Mar 25, 2016
    Marcirazzo and Stormy102 like this.
  32. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Its the radius of the sphere collider as seen in this image:
    the radius is set to 60, however it doesnt work for some weird reason. works perfectly with your models though... At least the Unity 5.3.4f1 upgrade fixed pretty much all of the other problems, like image effects flipping the camera horizontally and OnTriggerEnter not being called :cool: I'll try using your model in the scene and see if it doesn't work then.

    Mesh colliders are calculated on the CPU. its a very expensive action to do every frame and its more performance friendly to do it with hitboxes. However, you do get the rare occasion of sometimes not hitting the object. It depends on how many of the AI's you have in one scene. If its just one, then maybe you could get away with it, but 10 or more will start to drain performance. To quote the manual "However, this precision comes with a higher processing overhead than collisions involving primitive colliders (sphere, box, capsule) and so it is best to use Mesh Colliders sparingly." See this manual entry for more info: http://docs.unity3d.com/Manual/class-MeshCollider.html
     
  33. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    I'm having various problems. Sometimes the cowardly animal not run away from me, or he run away and then remain stationary in some corner.
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    It looks like you're having a console error. This could be affecting the scripted setup process. If you can successfully get Emerald working in a new project, it's something within your project causing your issue.

    What other assets are you using?


    If a cowardly animal gets exhausted, it will not be able to run. If you want an animal to flee for a longer period of time, you will need to increase it's flee seconds. Alternatively, you can change the Flee Type to Distance so the animal will always flee when its flee trigger is triggered. An animal with a Distance setting will not get exhausted.
     
  35. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    Is 2D Support planned?
     
  36. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    Yes but my animal, sometimes, does not begin to run away. When it starts, it stops after 3 seconds. The flee distance is maxinum.
     
  37. jailbar

    jailbar

    Joined:
    Nov 21, 2012
    Posts:
    49
    I notice that sometimes my characters chase me, and they glide through the air instead of animating. It's typically after I hit them and then run away, they'll glide towards me as they chase me. This also happens sometimes when I'm far away from them.

    I tried messing with animation settings and nothing seemed to fix it. Not a major issue, but it looks bizarre sometimes.

    Thanks.
     
  38. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    That console error is with Console Enhanced (https://www.assetstore.unity3d.com/en/#!/content/42381): nothing to do with Emerald. As it works perfectly with all the examples in Emerald, it's probably a issue with me setting it up wrong. As we've got a lot of features to implement in a short space of time, we'll probably get round to our polishing phase in about 2 weeks or so: we'll keep you posted with any changes.

    Stormy102
     
  39. vertigostudios

    vertigostudios

    Joined:
    Oct 1, 2012
    Posts:
    101
    Hi BHS,

    This might have been asked or it may already be implemented, but here goes. Is there a pose / animation that would allow the player to go in a stealthy kind of mode to get close to the animals before they flee. I guess you could call it another fleeing radius so that the Hunter could get closer to use a longbow.

    Scenario "The player would crouch towards the animal so to not frighten the animal away, just to allow him to get close enough to fire off an arrow. If the Hunter got within say another 8 meters the new fleeing radius would come into play and the Prey would flee away"

    I do hope more attention is given towards the animal system as its unique and deserves attention.

    I must say that the system your currently offering is absolute quality and for the price, well.. its a steal at that. Well done!
     
    Last edited: Mar 31, 2016
    Dawar likes this.
  40. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    I'm having a lot of problems with the asset.
    First error, hostile animals use walk speed when they run.
    Then, the cowardly animals have problems with navmesh. Often, they remain stuck to the corners without finding a way out to escape to.
    Last, I have two question. Why the box collider does not follow the animal in animation?
    And, is possible to move animals on water?
     
  41. BHS

    BHS

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

    Great to hear you are enjoying Emerald.

    We plan on adding field of view and sound detection so players and animals can sneak up on animals and NPCs. Our attention is being kept on animals.

    As of right now, we do not have this feature implemented, but we are working on it for our next update.

    Implementing your own way is possible. You can adjust any animal's variables so you could have an animal stay passive or reduce its flee radius while a player is in sneak mode.


    1) It sounds like you may be using the same walk/run animations for both your walk and run animations. If so, you will need to make a duplicate of one of your animations so they are separate. Emerald needs to adjust the animation's speed so if you are using the same animations for walk/run, it would be assigning the wrong speeds.

    2) In the games Skyrim and Oblivion, they have boundaries where AI can run to, but players cannot. I believe this is used to eliminate the same problem. Ensure that you give your AI boundaries to flee to. If your NavMesh has jagged dead ends, increase your NavMesh values to have more smoothly generated NavMesh and less dead ends.

    3) Box colliders do not follow the players because this is a limitation to Unity's box colliders. We can see if we can add support for having colliders on an AI's root transforms. This would allow a collider to follow an AI's animation.

    4) Animals don't have any special function for moving over water. However, I think it would be a nice addition to add water/swim animation support for our next update.
     
  42. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    No, I don't have the same animation for walk and run.
    For the rest, thanks for your help. Emerald has some lack, but I'm sure that with the next update, it will be the top.
     
  43. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    On paper they look to be the same so I am surprised with that, do you have links or benchmarks you ran?
    I have a GOAP running 600 agents at 25ms on an old laptop, not the most optimized code.
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Just clearing up a couple points.

    The Sims uses utility-based AI and not HTN planners or STRIPS (GOAP), unless something has changed recently that I'm not aware of. You can read Will Wright's description of the original Sims AI here. Although later Sims games are bigger, they still employ the same utility-based approach to AI.

    GOAP is often "slower" than HTN planning because it has a much broader search space. The structure of a hierarchical task network inherently pares down the search space. But GOAP can be designed to be more flexible. HTN planners can appear smarter and faster, but STRIPS planners can appear more creative. In a way, it doesn't make sense to run benchmark comparisons because they're algorithmically different. Ultimately, speed and results depend as much on specific implementation as much as anything else.

    I don't know what Emerald AI uses under the hood, but I'm looking forward to using it in my next project! :)
     
  45. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    I read more about HTN and it seems that GOAP can be turned into HTN by pre baking the solutions found for each goal. Correct?

    Regarding performance it is common to benchmark different algorithm that produce similar result.
    For example benchmarking raytracing vs path tracing vs <insert favorite renderer>, all produce image, look different, have different set of constraints and have different speed.
    BT, HTN, GOAP, stochastic etc... all produce a behavior, that behavior is different, have a different set of constraints, benchmarking them (knowing those contraints and differences) is useful. For example I wouldn't simulate 1M animals ecosystem using GOAP even though GOAP looks organic, I'd use some array, which is harder to design or at least requires a different way of converting seemingly intelligent behavior into machine stuff.
     
  46. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    here is the great plugin for HTN planer and goal but expensive
    https://www.assetstore.unity3d.com/en/#!/content/57817
     
  47. Noah492

    Noah492

    Joined:
    Jul 2, 2014
    Posts:
    44
    Still not quite sure how to damage the AI using UFPS. I can get AI to damage the player but can’t damage them. I have the PlayerHealth script deactivated on my AdvancedPlayer Prefab. All the bullets have the damage method name as DamageFromPlayer. Unlike the image shown in your wiki, there is no checkmark to uncheck for requiring the damage handler script. That may be the problem. Do I have to edit any code?

    Here is the error it gives me:

    MissingMethodException: The best match for method DamageFromPlayer has some invalid parameter.
     
  48. BHS

    BHS

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

    Good to hear updating UFPS worked and that we were able to resolve this via email.
     
  49. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
  50. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    you can make AI with it