Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

[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. bml

    bml

    Joined:
    Jun 5, 2013
    Posts:
    15
    @uberwiggett Thanks for this post. I've been trying to figure out if Emerald AI and Invector's Third Person Controller compliment each other enough to get both. I have neither but have been thinking I should use both. Nice to see someone go this route.
     
  2. uberwiggett

    uberwiggett

    Joined:
    Jun 26, 2015
    Posts:
    105
    @bml yeah mate, I've been developing with Invector's templates for a while. Currently working on an RPG using Invector and an add-on, but I'm looking for decent AI solutions and I'm really impressed by what Emerald has to offer in 2.0. I have a youtube series where I show my progress, hit me up in a pm if you want the link. I think it's a worth while investment as both Emerald and Invector developers seem to want to work together on integration.
     
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    If an AI has the ability to attack while it’s returning to its starting position, a player could exploit this by intentionally getting the AI to their return distance and attacking them each time the AI tries to return. This would not allow the AI to attack so the player would always kill them. An immunity option can certainly be added as this would resolve the issue.

    I think the reason your UI isn’t working isn’t because your UI size is too big so the it’s probably exceeding the UI canvas. Try a smaller range of around 1 to 2. Durning tests, nothing bigger that was ever needed. Are your AI scaled at?


    Great to hear! I’m currently working on the tutorial for implementing Invector with Emerald AI. The plan is to have full integrated support soon.
     
  4. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I agree both options should be possible when AI returns home or initial position:
    1) AI return to home position with run animation and doesn't care if player is coming back or near
    2) AI invulnerable during home return action
     
    BHS likes this.
  5. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    507
    The UI problem was becuase I didnt import all of the Emerald AI assets from the package, now it's working fine.

    In WOW what happens is you attack an AI then you start running and when you reach its max distance it starts going back and regenerating its health, but if you hit it, you don't deal any damage to it unless its back to its starting position. When the AI returns to its starting position then it "notices" you if you are close and it attack you, what happens with Emerald AI (as far as I know from my little testing) if you walk very closely to the AI while its going back and it reaches the starting position it wont attack you unless you leave and re-enter it's attack radius.

    Are we going to have support for RootMotion? All of my animations use RootMotion.

    I also found a bug while playing the Territorial AI Example scene, because I still can't set up my AI to not attack you if you leave its detection radius (it always starts chasing even if you are on the other end of the map). The bug can be reproduced if you get close enough to the animal and while it's playing the warning animation you move back, it's a nullpointer exception in the emrald ai script on line 3261

    Code (CSharp):
    1. Destination(CurrentTarget.position);
    Maybe just add and if (WeaponTypeRef == WeaponType.Melee && CurrentTarget != null){ ...
     
    Last edited: Dec 19, 2017
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    Thanks for the suggestions, this can certainly be added with the very next update.

    RootMotion support will come soon in a future update. The focus right now is getting ready for Emerald 2.0’s release and getting the integration tutorials made covering top character controllers. After that, RootMotion support can certainly be added.

    I have tested the Territorial AI Example scene and cannot not recreate the bug you’ve mentioned. The AI will look at the player, play its warning animation, and when the player leaves its attack radius, the AI resumes wandering. How can I recreate the issue you’ve had? Did you alter any of the settings? Are you receiving any errors?
     
  7. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    507
    It is a null pointer exception on the line I mentioned, if you have Resharper it will hint you that there can be a nullpointer exception there. I tried a couple of times and sometimes I cannot reproduce it, but I remember getting that error often if I get close to the animal, stay for like 1 or 2 seconds then start running holding down shift leaving a big distance gap between me and the animal. I haven't changed any of the settings, but after this error shows the whole navigation is messed up, it starts running backwards when I get close to it instead of chasing me.

    I can probably help with implementing RootMotion, all of my humanoid AI's are using RM + NM Agent (to predict where the npc should move) + Character Controller (to move the NPC with RM) and if we disable the RootMotion on an animal the movement looks really bad and unrealistic.
     
  8. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    353
    Hey has 2.0 now ootii Support?
     
  9. jrackley

    jrackley

    Joined:
    Jan 26, 2017
    Posts:
    55
    Time to change that [SUBMITTED] to [RELEASED] or [UPDATED]!
     
    Last edited: Dec 20, 2017
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    Strange, I’ll look into seeing how I can recreating your issue so I can find a solution.

    Alright! I understand RootMotion support is an important feature. I can work on getting it implemented as soon as possible.


    Ootii assets are in the process of being integrated. There’s a lot of assets that users want integrated. This will be done with a tutorial. When it’s available, I’ll be sure to let everyone know.


    Yup! It’s been updated!
     
    Last edited: Dec 20, 2017
  11. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    Hey everyone!

    Emerald AI 2.0 has been accepted and is now live! :)

    Get it here: https://www.assetstore.unity3d.com/en/#!/content/40199

    I’m still in the process of getting the written tutorials, tutorial videos, and documentation put together. Version 2.0 got accepted faster than I was expecting. Thanks for your understanding!

    If you need any help, you can get support here on the forums or via email at: Support@BlackHorizonStudios.com

    I hope you all enjoy the update!
     
    Last edited: Dec 20, 2017
    zenGarden and 99thmonkey like this.
  12. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Awesome :)


    1 ) There is already a limitation, type of attack is only melee or ranged. While some AI could use both based on distance or preference-priority-random choice.

    2) why does AI generates a rigid body if it uses navmesh ? Until AI can jump or or slide down along a slope it's useless if movement is driven by navmesh.

    3) Clicking on generate Animator, it does not bind it to the character. Running the game it says an error saying the Animator is missing.

    4) There is two animators created.One listing all animations , and one with animations graph.
    Is this necessary ? The animation list could be contained in some list object ?

    5) Detection is Trigger or los ?
    Field of View is missing.
    We should be able to define multiple detection triggers :
    - Close distance simulating sound detection : priority 1
    - Long distance + optionnal Fov + optionnal los : priority 2
    It very very lightweight detection lol
    Anyway, i will implement them mysefl if that doesn't come in some update.

    6) Why a box collider is generated and is mandatory ?
    Capsule is lot better and better for npc collisions sliding between them.
    Also the default generated box si too big and out of bounds


    Create a new collider button menu perhaps ? And let users generated capsule or box.

    I thaught it was a bug until i realized there was two colliders, capsule one i created and Emerald biog cube lol

    7) Health level to flee option can't be adjusted to 0 ?
    If we want some creatures to always fight and never flee, how do we do ?

    8) Why there is redefinition of Navmesh variables ?
    I don't think this is necessary ? What are the ones valid ?


    10) Tag system is not clear, it looks like it is target only tags ?
    Why there is a layer system for tags ?

    Anyway keeping tags only for AI you could do it in a simple and flexible way by defining firendly and ennemies tags as some creatures could cooperate with others or with player.
    For example you create a new Berserk faction AI like that :
    - Target tags list : Player , player friendly factions , orc faction
    - Friendly tags list : Player ennemies factions , Moutain golems

    11) Companion AI is everywhere and making it confusing, while not needed most of the time.
    Just hide all Companion options until user checks "Companion" in the plugin.
    Or make a specific "Companion" menu.

    Emerald ranged combat against player scene is wrong.
    The character is melee, and it even deosn't react to player or when attacked :eek:
    Are scene demos tested and finalized or work in progress ?

    Another scene test :
    - this is a demo scene, but it could have been as polished with a character instead of capsule object. AI doesn't detect and react to player ?



    Overall it looks like some 1.2 version.
    There is companions, some patrol pathways. But for combat there is not so much new, the AI looks somewhat as limited as previous version in possibilities( no priority, randomness, chain custom actions sequences, field of view , los and fov combined etc ...)
    I think there is many things to fix for this new update, and best features about some advanced AI , faction tags and others interesting stuff are yet to come with future updates :rolleyes:


    Despite some needs, and new features coming later, congrats on release :)
    The plugin is easy to understand, clear and easy to use, that's really big winner points.
     
    Last edited: Dec 21, 2017
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    Almost everything you have asked is explained in the Documentation. However, I would be more than happy to answer each of your questions.

    As stated previously, AI with the ability to switch between melee and ranged combat will come soon.


    AI need to have a RigidBody Component in order to detect collisions. This is how collisions work in Unity. Without them, collisions wouldn't work.

    The Generate Animator Controller button does attach the created Animator Controller to the Animator. That error you are seeing is most likely because you have no Avatar attached to your Animator Controller. Emerald can't do this because that is specific to each AI and their animations. I have tested this many times with many different models. Also, ensure that you are not dragging the Emerald_AI script onto the AI to initially create one. You need to use the Emerald Setup Manager, as stated in the Documentation.

    4) What you are seeing is an Animator Controller and an Animator Override Controller. This is needed in oder to dynamically alter animations within an Animator Controller. Without it, alerting animations is not possible with Mecanim.


    Line of sight is Field of View. You can adjust the Line of Sight's Field of View in the Editor. This is also covered in the documentation: Line of Sight Documentation


    When Emerald creates an AI, it does use a model's bounds. It seems like your model's bounds are usually large. Sometimes, adjustments need to be made to make it better fit your AI's model. A capsule collider can certainly be used instead. This can be added with the next update. The reason a box collider is used is because it better allows it to fix an AI. A capsule collider sometimes gets too round when trying to get it to fit an AI's model.


    Because you need to use the Foolhardy Confidence Level. This allows an AI to always fight and never flee. This is also covered in the documentation: Documentation Confidence Level

    This was done because many users were not able to find the NavMesh component and had trouble adjusting the settings. So, they were made available right within the Emerald Editor so users can easily adjust them. This was request many times in the past.


    This is also explained in the setting up your own AI section of the documentation Documentation Setting up your own AI

    The plan is to be able to define friendly and enemy tags in a future update.

    The Companion Behavior Type can be assigned at runtime, along with an Behavior Type. A lot of users wanted the ability to be able to change an AI's Behavior Type at runtime. An AI's settings need to all be in a logical place within the Emerald Editor or it would be even more confusing. This allows users to set Companion specific settings so when an AI is switched to Companion, it can act accordingly. Users are notified what settings are only available to a specific Behavior Types, it's as simple as that. An option could be added to disable this if users want. :)

    Not sure what you mean by this. I just checked and all AI are set to ranged attack and they are fire their projectiles correctly. They were tested, very well in fact. The reason it isn't working is because Unity removed the default Player layer so the player doesn't have an assigned layer. Simply adding the Player layer, and assigning it to the player, will allow the AI to properly react to your player.:) I have already submitted an update to address this.

    There is Field of View and there are 2 different types of priorities. Your other suggestions (no priority, randomness, chain custom actions sequences) have already been stated, several times, that they are coming with a future update. :) Emerald 2.0 has so much more to offer than previously. Reading the documentation, and using Emerald 2.0 more, will help you see all that it has to offer.

    Emerald AI is an AI system, not a character controller system. With that being said, I would be more than happy to add a demo character controller system in a future update. As stated in above, Unity removed the default Player layer so the character has no assigned layer. Simply adding the Player layer to your project and assigning it to your player will allow your AI to react to the player. I have already submitted an update to address this.
     
    Last edited: Dec 21, 2017
  14. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    Hey everyone!

    This portion only applies to those who didn't already have the Player layer in their projects when importing Emerald AI 2.0. In order for Emerald's example scenes to work properly, you will need to add the Player layer and assign it to your Emerald Player. Without it, the example AI will not recognize your Emerald Player. I have already submitted an update to fix this. The new layer for the player will be the Water layer as it is one of the default layers included with all Unity projects. This is all to avoid users having to do a complete project import when importing Emerald into their projects. @zenGarden

    This update also fixes an issue that made Territorial AI sometimes not give up on their target after they have exited their trigger radius, before they engaged in combat, resulting in an error. @skinwalker

    I'll be sure to let everyone know when the 2.0.1 update has been accepted.
     
    zenGarden likes this.
  15. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    The docs are blocks of text without return or empty lines :rolleyes: .
    Videos will be so much simple to follow.

    The animation controller is created by Emerald, should the avatar been created by Emerald also ?Or can the plugin detect it is missing and send some alert ?

    I see, FOV is combined with LOS.
    Why is 45° angle hard coded ? ( i will dig code later and see how it is going)

    Code (CSharp):
    1.     //Check for obstructions and incrementally lower our AI's stopping distance until one is found. If none are found when the distance has reached 5 or below, search for a new target to see if there is a better option
    2.             if (Physics.Raycast(new Vector3(transform.position.x, transform.position.y+EyeHeight, transform.position.z)+transform.forward, (direction), out hit, (AttackDistance+RunAttackDistance))){
    3.                 if (angle > 45 && hit.collider.gameObject != this.gameObject && hit.collider.gameObject != CurrentTarget.gameObject || hit.collider.gameObject != CurrentTarget.gameObject && hit.collider.gameObject != this.gameObject){
    4.                     TargetObstructed = true;


    Is this optionnal ? Can we delete the component and keep only our navmesh component for advanced users ?


    Better woule be defining some neutral-friendly-ennemy tags lists would define archetype clan usable by player, friendly, or ennemies npc.

    Why layers ? because let users keep tags for their own stuff ?


    Cool for users neeeding it.
    However some general option to disable and hide it in plugin when it's not needed for some AI would be welcome :)

    Well most of the time capsule is better, and beeing round is better sliding.
    Add some new "Collisions" menu with those options ? And able to evolve if plugin will support multiple collision volumes for character, weapons, shield.


    Can you detect Layer is not assigned for player or AI and send alert message in the plugin ?

    Yep randomness for many stuff or to trigger actions , and action sequences are welcome :)

    Playing the download preview, i thaugh you already had the player controller ready lol
    A free controller :
    https://www.assetstore.unity3d.com/en/#!/content/65284
    Anyway it doesn't matter.

    Now some other testing review :

    1) Testing the two "companion" scenes, the companion is never attacking the ennemies ?

    2) Testing "destination" scene, the character attack some character that will interrupt it's travel.

    But it can't stop attacking even when other character is down ?



    3) Scene "Pet AI" is useless, this is the same as "Companion" and also unable to attack ennemy.

    4) Scene "ranged combat against player" :
    -The ennemy has some seconds delay before choosing a direction to flee away from player close melee.
    -Sometimes the ennemy stays in front of the player and keep attacking.


    5) Copy paste 10 ranged ennemies in scene "Ragend against player".
    It's fine when only some 5 units detected and attack the player.

    But if player moves and more AI detects the player an error occurs



    6) Tps demo scene, i duplicated 10 melee with FOV detection.

    After playing some time and getting many detecting the player an error occured



    7)With lot of AI around the player using LOS :
    Some in range with player will stop attacking and wander around. I must test some more to see if it is some distance or Los issue ?

    -Should be an option to have FOV turned off once AI detects the player ?
    -Rectivate FOV detection only when player is far away again ?


    Must we do it ourselves or other users must buy Invector melee for example ?
    I'm fine with both options.

    8) Can't you use layer names instead of index in code ?
    Code (CSharp):
    1. //Setup our AI's projectile once on Awake
    2.     void Awake (){
    3.         gameObject.layer = 2;
    If someone would like to integrate Emerald in their existing project already having layers, it will not work until they move their existing layers to new index.

    9) It looks like attack damage is counted at attack animation start.
    Emerald is more towards simple RPG or hack n slash, less Skyrim combat.
    Would it evolve to more Skyrim like combat ?
    - Multiple collision volumes for characters
    - Melee damage working with melee weapon collision
    - damage only applied if collision occurs during some attack animation time intervall


    10) Emerald AI is one Class 3200 lines , it's not very object coding friendly.
    I would have split it in Class categories instead (like plugin buttons menus categories).
    It's better to maintain and make it evolve that way.
    Not sure if performance impact using only one Class is noticeable instead of using some 5 or 10 classes.


    You should really add me to help you in Beta phase test for some next V3 ;)
    Another great point, source code is very clear and well presented and documented :)
     
    Last edited: Dec 21, 2017
  16. GenPhi

    GenPhi

    Joined:
    Dec 27, 2014
    Posts:
    12
    Running 2017.2.1f1. Every time I click to setup my character, Unity crashes. Anyone else seeing this? This is in a fresh project with only Emerald AI 2.0 and a model we created and rigged using Mixamo.
     
    Last edited: Dec 21, 2017
  17. BHS

    BHS

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

    Sorry to hear about that. I’ll import Emerald AI 2.0 into a fresh project, with Unity 2017.2.1f1, and find out what’s going on right now.
     
    julianr likes this.
  18. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    2017.3 has some changes to the animator. Not tested Emerald with that release yet though - had a few issues with a player controller. So reverted back to 2017.2.1f1 for now until assets catch up with updates. Just making you aware (lighting and animator, possibly particles) seem to be the key issues.
     
    zenGarden likes this.
  19. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Seems to work fine here in 2017.3 .
     
    julianr likes this.
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    Unfortunately, I have not been able to recreate this issue. I have tried several times, even with several Mixamo characters and the exact same version of Unity. Are you receiving any errors when this happens? Are you creating an Animator Controller with the Setup Manager?
     
  21. Mythran

    Mythran

    Joined:
    Feb 26, 2013
    Posts:
    85
    So won't it be possible to set the ai go to specific waypoints at specific hours?
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    This is currently possible with modifying an AI's destination at runtime with a custom script. An AI must currently have the Destination Wander Type. When the AI's AIReachedDestination variable has been set to true, they have successfully reached their set destination. This can be updated and modified as many times as needed by using the SetDestination(Vector3 AIDestination) function. An AI's Wander Type and Behavior Type can also be modified at runtime allowing users to change them when the AI has arrived at their destination.

    Built-in schedules will come in a future update and be integrated with UniStorm. This will allow users to set schedules based for morning, day, evening, and night all from within the Emerald Editor.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    @zenGarden The Online Documentation which is recommended, can be found within the Emerald Editor or at the title of the offline version. The formatting for the offline version isn't perfect because it was ported from Google Docs. I would highly recommend using the online version to receive the most up-to-date documentation. The offline version is required by Unity. :)

    The 45° portion you mentioned is so AI have obstruction detection and so they cannot attack past 45° to either side. If you want to customize the Field of View, use the Field of View setting int the Detection Options. This 45° does not affect your custom set field of view.

    Emerald cannot create an Avatar as it is created specifically for each model and their rigging. This usually done when models are imported and they are using Mecanim animations.

    Layers are used because of the way Emerald AI agents detect their targets. This allows AI to only pick up and search for relevant targets. It's method used is efficient and works very well.

    The issues you are having is because the Player layer needs to be added to your project and assigned to your Emerald Player, as mentioned above. There is already an update submitted to resolve this. If your AI are not detecting your player properly, it's because you need to make sure your AI have the proper player layer and tag. Please try following the Setting Up your own AI portion of the documentation to see if it helps get things working for you. :)

    The default layer of 2 is used because it is always the Ignore Raycasts layer. Unity always has this and doesn't allow you to alter the first 8 layers.
     
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    The UFPS integration tutorial is finished for implementing Emerald AI with UFPS. Please let me know if any users have issues with the tutorials. If you need any help, just ask here or via email.

    Setting up UFPS with Emerald AI Tutorial
     
    Mark_01 and AGregori like this.
  25. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    303
    My most wanted feature: UNET/uMMORPG Integration.

    Do you plan on integrating them? uMMORPG currently has poor AI and this would make it oh so much better.
     
    BryanO likes this.
  26. RoyaleJoons

    RoyaleJoons

    Joined:
    Jul 28, 2016
    Posts:
    13
    Congratulations on releasing 2.0, looks amazing! Looking forward to tutorial on how to integrate with Invectors template.
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    UNET support is planned for a future update. I can certainly look into adding support for uMMORPG as well.


    Thanks! The Invector tutorial should be finished within the next couple of days. I’ll be sure to let everyone know when it’s finished. :)
     
    RoyaleJoons and julianr like this.
  28. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I use demo scene , so AI is setup correctly.
    Layer "Player" already existing and assigned to Player (otherwise AI would never attack it).


    There is a real bug.

    Steps to reproduce :
    1) Setup AI character with Line Of SIght and some 45°
    2) Duplicate it 10 times close around
    3) Launch game
    4) Immediatly after pressing "Play", with player RUN to them quickly

    Each time it crashes.



    EDIT :
    To avoid the issue i tried checking EmeraldAI finished initialising and variables not null.
    But it still crashes, it's like Unity components initialisation issue or Emerald code ?

    It always crashed here :
    Code (CSharp):
    1. ReceivedEmeraldTag = hit.collider.GetComponent<Emerald_AI>().AITag;
    With new code checks, it crashes here for example : " if (hit.collider != null) { "

    Code (CSharp):
    1.                     if ( hit.collider.tag == EmeraldTag && hit.collider.GetComponent<Emerald_AI>() !=null && hit.collider.GetComponent<Emerald_AI>().AITag !=null && hit.collider.GetComponent<Emerald_AI>().initialized ){
    2.                                 if (hit.collider != null) {
    3.                                     if (hit.collider.GetComponent<Emerald_AI> () != null) {
    4.                                         if(hit.collider.GetComponent<Emerald_AI>().AITag !=null)
    5.                                             ReceivedEmeraldTag = hit.collider.GetComponent<Emerald_AI>().AITag;
    6.                                     }
    7.                                 }
    8.                             }


    To avoid this, never get many AI using Line of sight close to character at game start.

    This bug could potential happen if people load many AI prefabs (with Los on) around the player without using a pool system.
     
    Last edited: Dec 22, 2017
  29. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I will post bugs individually, so you can check them.

    "Destination" scene, player ally doesn't attack the ennemy when it walks inside detection area.
    (My player has the right layer "Player")
     
    Last edited: Dec 22, 2017
  30. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Ranged tps scene :
    If you test with only one AI character default scene, it will never crash. Using many AI it crashes.

    1) duplicate the AI 10 times
    2) press play, wait some seconds
    3) run towards Ai characters


    EDIT :
    After some seconds playing around it crashes again.


    Please do testing with realistic plugin usage :rolleyes:
    This means many AI on the scene, not one or three.
     
    Last edited: Dec 22, 2017
  31. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    526
    My UFPS player can damage Emerald AI (hit animation is OK), but AI does not seem to detect & chase player. Tags/Layers are done according to tutorial (LocalPlayer etc.) with no spaces. And I get this message:

    Failed to call function Damage of class Emerald_AI
    Calling function Damage with 1 parameter but the function requires 2.
    UnityEngine.Component:SendMessage(Component, String, Object, SendMessageOptions)
    vp_Bullet:TryDamage() (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Bullet.cs:263)
    vp_Bullet DoHit() (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Bullet.cs:183)
    vp_Bullet:TryHit() (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Bullet.cs:157)
    <TryHitOnEndOfFrame>c__Iterator0:MoveNext() (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Bullet.cs:340)


    And this too:

    NullReferenceException: Object reference not set to an instance of an object
    Emerald_AI.OnTriggerExit (UnityEngine.Collider C) (at Assets/Emerald AI 2.0/Scripts/System/Emerald_AI.cs:1243)



     
    Last edited: Dec 22, 2017
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,027
    I can't get enemies to attack the player either. I'm just running the demo scenes and I have the Player tagged as Player and the AI are set to detect the Player layer and always attack, but they are just ignoring the player completely.
     
  33. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    The plugin uses Layers , setup "Player" layer for player object and it should work.
     
  34. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,027
    Ahh, thanks. I thought I already had it on Player layer, but my mistake. It's working now.
     
  35. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    526
    Still got the same issue. Can it be UFPS related?
    Worked like a breeze before v2.0.
     
  36. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I got other issues when i have many AI around the character, a bug can happen, not sure if it is related ?
    Anyway the plugin is not ready and needs more bug fixes and testing.

    @BHS
    With lot of Ranged AI , they quickly stack behind others without beeing able to move to get a line of sight to player.
    This would really need real game level testing with many AI and some improvment.

    I share some cheap trick i used and working pretty good for positionning.
    When some enemy los(line of sight) is blocked by others :
    1)Calculate direction enemy to player
    2) From that direction, get normals left and right (it could be 45° directions or any other angle)
    3)Define a random point along normals with min max value distance to player
    It will be the center circle , rectangle or eclipse positionning
    4) Using random values around that center determine where the AI can move to
    Or using Navmesh.raycast from that center position to different directions to determine
    valid positions.


    Anyway , this is one way to get ranged AI able to move around and not stay stuck because many other AI would be blocking it's line of sight.
    There is many other ways like using EQS grids and some other methods, but this one could be sufficient enough and fit the simplicity of the plugin.
     
    Last edited: Dec 22, 2017
    BHS likes this.
  37. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,027
    I
    For Ootii, do the following:

    In Emerald_AI.cs add the following using statements:

    Code (CSharp):
    1.  
    2. using com.ootii.Actors.LifeCores;
    3. using com.ootii.Actors.Combat;
    4.  
    In the Emerald_AI function DamagePlayer, add the following code:

    Code (CSharp):
    1.         if (CurrentTarget != null && CurrentTarget.GetComponent<ActorCore>() != null)
    2.         {
    3.             DamageMessage dmgMsg = new DamageMessage();
    4.             dmgMsg.Damage = CurrentDamageAmount;
    5.             CurrentTarget.GetComponent<ActorCore>().OnDamaged(dmgMsg);
    6.         }
    7.  
    Then in Ootii's SwordCore.cs, add the following code in the OnImpactComplete function above the hit sound code:

    Code (CSharp):
    1.                 Emerald_AI target = rCombatMessage.Defender.GetComponent<Emerald_AI>();
    2.                 if (target != null)
    3.                 {
    4.                     target.Damage((int)rCombatMessage.Damage, Emerald_AI.TargetType.Player);
    5.                 }
    6.  
    I'm not sure the weapon core function is the best place for this, but it does work. You'd have to do the same thing for ArrowCore.cs and ProjectileCore.cs.

    [EDIT]
    I forgot one thing. The Emerald AI isn't checking if Ootii character is dead or not and will continue to attack after player is dead. Once I figure that out, I'll post an update.
     
    Last edited: Dec 22, 2017
    BHS likes this.
  38. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    @zenGarden
    Update 2: I was able to find a solution to the error caused by 10 AI on start with the line of sight set to 45 degrees.

    Change the line that gave you the error from this:
    Code (CSharp):
    1. if (angle <= 45 && hit.collider.gameObject == CurrentTarget.gameObject && !IsTurning){
    2.                     TargetObstructed = false;
    3.                 }
    To this:
    Code (CSharp):
    1. if (angle <= 45 && CurrentTarget != null && hit.collider.gameObject == CurrentTarget.gameObject && !IsTurning){
    2.                     TargetObstructed = false;
    3.                 }
    Checking if the CurrentTarget is not null seems to fix this issue.

    I'm aware of your other issues and suggestions and will get started fixing and implementing them after the holidays, the 26th. :)

    Update 1: I was able to successfully recreate your issue regarding the line of sight and the 45 degrees portion of code. Now that I have the error, I will find a solution for it.

    Thanks for the bug reports, they are appreciated. I have been unable to recreate the ones you have mentioned, even using your exact settings and setup you specified. However, I will keep testing to see if I can recreate your issues.

    Once I have been able to successfully recreate them, I will have an update submitted that fixes them as soon as possible. If you'd like, you can email your bug reports to Support@BlackHorizonStudios.com so they can be tracked better, unless you prefer to post them here.


    Hey there!

    It seems like you are having this issue because you have your UFPS Player set as the Emerald AI tag and not a Player tag. Ensure that your UFPS Player is using the Player Unity tag. I was able to recreate your exact error. I was able to fix it by having the Player tag on the UFPS Player. Also, ensure that you have Has collision trigger set to false.

    Emerald 2.0 UFPS.png
     
    Last edited: Dec 22, 2017
    AGregori likes this.
  39. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,027
    Further Ootii integration. So the AI won't consider a dead player as a target, change SearchForTarget function in Emerald_AI.cs. Change the if clause that checks for attacking player and change to:

    Code (CSharp):
    1.                         if (CurrentTarget.tag == PlayerTag && AIAttacksPlayerRef == AIAttacksPlayer.Always)
    2.                         {
    3.                             if (CurrentTarget.GetComponent<ActorCore>() != null)
    4.                             {
    5.                                 if (CurrentTarget.GetComponent<ActorCore>().IsAlive)
    6.                                     TargetTypeRef = TargetType.Player;
    7.                                 else
    8.                                 {
    9.                                     CurrentTarget = null;
    10.                                     continue;
    11.                                 }
    12.                             }
    13.                         }
    14.  
    Also, add additional code in the DamagePlayer function so that it clears the current target when it's dead.

    Code (CSharp):
    1.         if (CurrentTarget != null && CurrentTarget.GetComponent<ActorCore>() != null)
    2.         {
    3.             DamageMessage dmgMsg = new DamageMessage();
    4.             dmgMsg.Damage = CurrentDamageAmount;
    5.             CurrentTarget.GetComponent<ActorCore>().OnDamaged(dmgMsg);
    6.  
    7.             if (!CurrentTarget.GetComponent<ActorCore>().IsAlive)
    8.             {
    9.                 CurrentTarget = null;
    10.             }
    11.         }
    12.  
     
  40. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    526
    @BHS Thanks, but I already have Player tag set and Collision trigger unchecked, as described in the new manual.
    I just tried again, and it's the same: AI doesn't detect Player with Player tag. It worked with previous Emerald versions.

    2017-12-22_23-09-24.png Unity_2017-12-22_23-10-01.png
     
  41. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,027
    Looks like I found a bug in the TooClose function. You have the following code:

    Code (CSharp):
    1.         if (CurrentTarget != null){
    2.             Destination(CurrentTarget.position);
    3.         }
    4.         if (WeaponTypeRef == WeaponType.Melee){
    5.             Destination(CurrentTarget.position);
    6.             ChaseWaitTime = 2;
    7.             StartCoroutine("ChaseDelay");
    8.         }
    9.  
    The first check is whether CurrentTarget is null, which is fine, but then the next check for WeaponTypeRef then proceeds to use CurrentTarget outside of the scope of the CurrentTarget check for !null. The code should probably be as follows:

    Code (CSharp):
    1.         if (CurrentTarget != null)
    2.         {
    3.             Destination(CurrentTarget.position);
    4.             if (WeaponTypeRef == WeaponType.Melee)
    5.             {
    6.                 ChaseWaitTime = 2;
    7.                 StartCoroutine("ChaseDelay");
    8.             }
    9.         }
    10.  
    Btw, just wanting to express my dislike to the antiquated k&r style coding you use. It makes code so much harder to read and most professional organizations do not use this style. I am surprised so many asset store developers still utilize it. I work professionally as a programmer for a very big company and no one promotes k&r style coding anymore.
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,748
    Very strange, I have tested this several times in multiple projects. Sorry for the inconveniences, I will try to figure out what's going on.

    What version of UFPS are you using?
    What behavior type is your AI?
    What detection type is your AI using?


    Thanks, I have already fixed this with the update I submitted.

    I totally agree, but I had a lot of users complain about using the method you suggested I use. They said it added too many extra lines and that it was harder to read as well. So, I guess I can't win either way. :)
     
  43. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,027
    Well, they're probably not professional programmers either. At least I hope not.
     
  44. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    526
    1.71, latest.
    Cycled through all the behavior types and there is no player detection.

    Just tried the demos (Passive AI, Aggressive AI) in a new clean project, and they're flawless. So I have to conclude it's a UFPS conflict of some sort.
     
  45. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    526
    I got it, I think: Pick Target Method Closest doesn't work at all on my rig, results no detection. FirstDetected works as intended. Not sure if it's a bug, or UFPS related.
     
  46. uberwiggett

    uberwiggett

    Joined:
    Jun 26, 2015
    Posts:
    105
    So far rejigging the layers and detections hasn't given me any issues, I have ranged enemies and melee ones targeting each other fine. However I haven't set up the player targeting, waiting to get the invector integration tutorial for that, I'm assuming this tute will cover damage handling between the two systems??

    so excited! once I can get them to pass the damage my AI dreams will be sorted!!
     
    jrackley likes this.
  47. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    Congratulations for the new version of Emerald AI, I see this new version has support for ranged attacks, it possible to use it for create enemy soldiers with UFPS?
     
  48. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Testing the new modification with many ranged AI , there is still null object error happening here after running 30 seconds throught AI that is attacking.
    Code (CSharp):
    1.  
    2.     if (angle <= 45 && CurrentTarget != null && hit.collider.gameObject == CurrentTarget.gameObject && !IsTurning){
    3.                     TargetObstructed = false;
    4.                 }


    I can install a new Unity version , make a new empty project , import Emerald plugin and retry.

    Also do you plan to include in the plugin a better AI positioning around player as the example i posted before ? Or should we consider coding it ourselves ?
     
    Last edited: Dec 23, 2017
  49. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    526
    I have another issue with the UFPS player:
    I'm testing a Passive+Brave+Stationary NPC as I'm trying to create a bouncer type character: standing by the door, passive until provoked. This NPC doesn't seem to detect the player and doesn't fight back when attacked and killed.
    Damage handling and layers are OK.
     
  50. GenPhi

    GenPhi

    Joined:
    Dec 27, 2014
    Posts:
    12
    I created one with an Animator Controller and one without. But both immediately crash Unity. The only error I get is Unity quit unexpectedly problem report from my Mac. I updated Unity to 2017.3.0f3 to see if that would fix it, but still getting the same results. Here is a snipit of the error report.... maybe it will help? I've submitted it to Unity as well.

    *** Terminating app due to uncaught exception 'NSGenericException', reason: '-[NSApplication runModalSession:] may not be invoked inside of transaction begin/commit pair, or inside of transaction commit (usually this means it was invoked inside of a view's -drawRect: method.)'
    abort() called
    terminating with uncaught exception of type NSException

    Application Specific Backtrace 1:
    0 CoreFoundation 0x00007fff537eb00b __exceptionPreprocess + 171
    1 libobjc.A.dylib 0x00007fff7a3c9c76 objc_exception_throw + 48
    2 CoreFoundation 0x00007fff5387cc9d +[NSException raise:format:] + 205
    3 AppKit 0x00007fff5160d0fe _NSRunModal + 484
    4 AppKit 0x00007fff5115fdd2 -[NSApplication runModalSession:] + 253
    5 Unity 0x00000001006c1d89 -[GlobalProgressbarController setProgressbar:andText:andTitle:canCancel:] + 1737
    6 Unity 0x00000001006c218b _Z18DisplayProgressbarRKN4core12basic_stringIcNS_20StringStorageDefaultIcEEEES5_fb + 395
    7 Unity 0x000000010255bf14 _Z39EditorUtility_CUSTOM_DisplayProgressBarP10MonoStringS0_f + 132
    8 ??? 0x000000013ddd7821 0x0 + 5332891681
    9 ??? 0x00000001451998dd 0x0 + 5454272733
    10 ??? 0x000000011d6838da 0x0 + 4788336858
    11 libmono.0.dylib 0x000000013bf071ce mono_get_runtime_build_info + 3654
    12 libmono.0.dylib 0x000000013c033ab6 mono_runtime_invoke + 117
    13 libmono.0.dylib 0x000000013c03985c mono_runtime_invoke_array + 946
    14 libmono.0.dylib 0x000000013bff81e3 mono_register_jit_icall + 37377
     
    Last edited: Dec 24, 2017