Search Unity

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

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    When an target is detected, the GetTargetPositionModifier function is called, which updates the Target Position Modifier based on the current target. This is within the EmeraldAIDetection script.

    Is this issue happening when you enter an AI's detection radius or when you attack it before it has detected you?
     
  2. mario_code4ever

    mario_code4ever

    Joined:
    Jan 9, 2020
    Posts:
    36
    It heppends after i shoot him and he didnt detect me yet.
     
  3. grionseengel

    grionseengel

    Joined:
    Sep 2, 2017
    Posts:
    32
    Hello, I have now been able to set up my opponent so that he can also damage the player. However, this only works if I have not shot the opponent before. If I have shot the opponent, then no more attack takes place. Only if I have shot before. Can anyone help me? What have I done wrong?
    I heard from the NEOFPS developer that this is due to a bug in Emerald.
     
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    That's helpful info. Try this this:

    Go to the EmeraldAIDetection script and find the following function:
    Code (CSharp):
    1. void GetTargetPositionModifier(Transform Target)
    Set it to public like this:
    Code (CSharp):
    1. public void GetTargetPositionModifier(Transform Target)
    Next, go to the EmeraldAISystem within the Damage function. Find the following if statement:
    Code (CSharp):
    1. if (AttackerTransform && NonCombatAI == YesOrNo.No)
    Within this (underneath it), add the following code:
    Code (CSharp):
    1. //Get the attacker's TargetPositionModifier, if the AI is attacked without a current target.
    2. EmeraldDetectionComponent.GetTargetPositionModifier(AttackerTransform);
    Also, how are you damaging the AI? Are you passing the AttackerTransform? If not, the AI has no way of knowing who attacked it if it's attacked from outside of its Detection Radius.
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    There was a bug, but it has been fixed. How are you damaging the AI? Are you passing the AttackerTransform when calling the Damage function?
     
  6. grionseengel

    grionseengel

    Joined:
    Sep 2, 2017
    Posts:
    32
    I have not changed anything in the scripts. How can I tell how the AttackerTransform is passed?

    With which version of Emerald was the bug fixed? I have the version 3.2.0 in use.
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    It was fixed a few updates back. I would have to see the NEOFPS integration code to see if the AttackTransform is passed. I’ll have time to take a look at it tomorrow.
     
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Strange, it should be working. If the AI detects the player, it should assign the Target Position Modifier.

    Try adding this in the GetTargetPositionModifier function of EmeraldAIDetection to ensure it's being called and that the proper target is being detected. This should debug log the current target to the Unity Console.
    Code (CSharp):
    1. Debug.Log(Target);
     
  9. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    177
    @BHS should add assembly definitions & addressables support to all your assets as it speed up compile time for unity in huge projects. Addressables are very important for memory usage i added different types of animals with emerald ai & it occupy whole memory even few animals are spawned with crux, if crux had addressables support it will load only those game objects which are spawned.
     
  10. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    177
    I added assembly definitions myself but null references started to popup without any reason, so i removed assembly def to remove null references
     
  11. grionseengel

    grionseengel

    Joined:
    Sep 2, 2017
    Posts:
    32
    Hello, have you had time to look at the problem?

    "It was fixed a few updates back. I would have to see the NEOFPS integration code to see if the AttackTransform is passed. I’ll have time to take a look at it tomorrow."
     
  12. mario_code4ever

    mario_code4ever

    Joined:
    Jan 9, 2020
    Posts:
    36
    <asset code removed>

    Did I add it on wrong place as you can see
     
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    <asset code removed>
    Did I add it on wrong place as you can see[/QUOTE]

    Yes, that’s in the right spot. This is for when an AI is damaged though, not when it detects an enemy. Did you add the debug log code I posted previously?

    Also, can you please remove the code you posted? You’re not supposed to post large portions of an asset’s code.
     
  14. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there. My apologies, I’ll have time by the end of today. The recent sale has been keeping me busy.
     
  15. SHSA

    SHSA

    Joined:
    Apr 26, 2013
    Posts:
    5
    Hello, tell me how I could implement the behavior of ghosts as Phasmophobia (hide and hunt to interact with objects) using Emerald AI3. not found information
     
  16. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there. I looked into this and you need to add a Target Position Modifier to the main NEOFPS prefab.

    If the example AI from the NeoFpsEmeraldAI_Demo scene are not reacting to the player, it's because they need to be using the NavMesh Driven Movement Type (located under AI's Settings>Movement).
     
  17. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    Is there a discord?
     
  18. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
  19. angelsm85

    angelsm85

    Joined:
    Oct 27, 2015
    Posts:
    63
    Hi! Is it possible to enable ui healthbars only when ai character is a certain distance from the player? And how can we hide the healthbars behind 3d objects in scene? In screenshot attached you can view healthbars don't dissapear when ai characters are behind a stone.
     

    Attached Files:

    Last edited: Dec 25, 2022
    iChuy likes this.
  20. grionseengel

    grionseengel

    Joined:
    Sep 2, 2017
    Posts:
    32
    Hello,
    thank you very much for your tips and information. However, the problem is not solved even with the Target Position Modifier.

    I will describe again exactly what my problem is. It is about a newly created opponent.

    Variant a:
    I approach the opponent and he attacks me. Even if I shoot at him, he continues to attack me.

    Variant b:
    I shoot at the opponent and he runs towards me. However, he does not attack me, but stops in front of me. When I shoot at him, he hits me exactly once and then stays in idle. When I shoot again, he attacks me once more, and so on.
    Do you have any idea what I am doing wrong? Can I possibly send you my model.
     
  21. BaoBao55

    BaoBao55

    Joined:
    Apr 8, 2016
    Posts:
    13
    How can I set the Offensive Ability Object to not collide with the character that is not the target?
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    The health bars are enabled when the player enters an AI's Detection Radius and disables when they leave it.

    You can make the health bars be hidden by mesh by changing the Emerald AI UI material from UI>Default +1 to just UI>Default.

    UI Shader.png
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there. Is this with the included integration scene for NEOFPS? I didn't have any issues with this.

    The AI sounds like the AI's line of sight is being blocked by something. Enable the Debugging Tools to see if there's any object obstructing the AI's line of sight.

    Emailing me a barebones project with a scene and the issue present is the best way for me to see what's going on.
     
  24. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    When is your new roadmap coming out?! Also how rapidly are you going this year on updates? I know some years you used to pump them out every other month and now it seems a couple times a year.
     
    Last edited: Dec 28, 2022
  25. Fren2y

    Fren2y

    Joined:
    May 24, 2013
    Posts:
    5
    Hey there.

    Started to deal with Emerald Ai, great asset.

    But I didn't understand one thing. Enemies behind the walls, if the player is in their line of sight, turn in their direction and blunt. The debug shows that the line is red and there is an obstacle between them. How can he spot the player behind the wall?

    Maybe I'm using the wrong layers for the walls?

    And i have error
    NullReferenceException: Object reference not set to an instance of an object
    EmeraldAI.EmeraldAISystem.Update () (at Assets/Emerald AI/Scripts/System/EmeraldAISystem.cs:1173)
     
  26. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
    Has this question ever been answered?
     
  27. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    An AI healing another AI or player? I have a healer AI that heals my main player. Emerald is not something at this point where I would have multiple companions trying to heal each other.
     
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    That error looks like it's because you have something that's not an Emerald AI agent using your Emerald AI Tag.

    That's the purpose of line of sight, to stop an AI from being able to see through objects. If you want the AI to ignore a certain object, you can add its layer to the Obstruction Ignore Layers.

    ObstructionIgnoreLayers.png
     
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I will be adding this feature with the upcoming update for Emerald AI. It will allow an AI to heal any nearby AI with a Faction Relation of Friendly.
     
    SickaGames1 likes this.
  30. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I'm still working on the roadmap and the information regarding the next update. It's the biggest update to date so there's a lot of information to cover.

    As for update times, I do plan on having smaller more feature focused updates that will happen more frequently.
     
    iChuy and SickaGames1 like this.
  31. Fren2y

    Fren2y

    Joined:
    May 24, 2013
    Posts:
    5
    Thanks. I got it =)
    The error was due to the wrong tag on the wall.
    And the fact that the player was on the wall because the enemies had the Player tag
     
  32. grionseengel

    grionseengel

    Joined:
    Sep 2, 2017
    Posts:
    32
    Hello,
    they had offered to look at my level to possibly find the error. I created my own character in the NeoFpsEmeraldAI_Master demo and put it in the demo map. When I approach him, he attacks me. If I shoot him from a distance, he receives damage but stops and does not attack me. Do you have any idea what this could be?
    To which mail address should I mail the level?
    Thanks in advance.
    Andreas Betge
     
  33. Nikodemus

    Nikodemus

    Joined:
    Nov 28, 2014
    Posts:
    32
    Will u allow melee AI to use magic, without switching to ranged?
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey there. I had this issue if the Expanded Case Distance wasn't set high enough. AI would detect the player, but then ignore them because they were too far away. Setting the Expanded Case Distance (located under the Detection Options tab) to 300 fixed this issue.
     
  35. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yes, this is already implemented with the new update I've been working on.
     
  36. grionseengel

    grionseengel

    Joined:
    Sep 2, 2017
    Posts:
    32

    Thanks for the tip. Unfortunately, that did not fix the error. I have no idea why the opponent runs towards me when I shoot at him, but he does not attack me but stops in front of me. Only if I then also shoot him, he strikes exactly once.
     
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Did you add a Target Position Modifier? I tested this exact scene and the AI are attacking continuously. You can also try enabling the Debugging Tools to see if there’s any obstructions, which will be shown in the Unity Console.
     
  38. timerace

    timerace

    Joined:
    Feb 27, 2019
    Posts:
    27
    Hello @BHS
    Can you add dismemberment (connected with location based damage) and a parry state for the ai, it becomes quite annoying unable to add these things.

    Thanks.
     
    iChuy likes this.
  39. grionseengel

    grionseengel

    Joined:
    Sep 2, 2017
    Posts:
    32

    Hello, I have now run the debugging tool and got the following info.

    When I shoot the opponent I get the following LOG:



    If I don't shoot at the opponent and just run towards him I get the following LOG:



    It seems that it does not recognize the player when I shoot. How can I fix this error?
     
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Actual dismemberment is a bit outside the scope of Emerald AI, but I'm more than happy to make integration of dismemberment systems easier. What kind of improvements would make this easier for you? I can also look into parrying support for the next update. It's been added to the roadmap.
     
    iChuy likes this.
  41. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Strange, I'm not having that issue with the demo scene.

    Is this how your AI's Detection Layers are set?
    DetectionLayers.png
     
  42. grionseengel

    grionseengel

    Joined:
    Sep 2, 2017
    Posts:
    32
    Yes, these are exactly the settings I have made.
     
  43. timerace

    timerace

    Joined:
    Feb 27, 2019
    Posts:
    27
    Hello, can you add parry integration with the gkc kit he just released parry system in the latest beta, if you can check will it work or not, It will help a lot.
    Thanks
     
    Last edited: Jan 3, 2023
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I looked at the NEOFPS integration code and it looks like the wrong target may be being assigned.

    Try doing the following. Within the NeoFpsEmeraldAI_DamageHandler script, change the two attacker sources from source.damageSourceTransform to source.controller.currentCharacter.transform
     
  45. grionseengel

    grionseengel

    Joined:
    Sep 2, 2017
    Posts:
    32
    Hello, thank you very much for the help. Now it works error free. Thanks again.
     
  46. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    eta?
     
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    You're welcome, it's great to hear that resolved the issue.
     
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I don't have an ETA at the moment, but it shouldn't be more than 2 months from now.
     
  49. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I have plans to add support for this around the release of the next update through a separate component/system. For now, you can make a simple version by switching between Cautious and Aggressive behaviors.

    You could have the AI ignore targets by switching its behavior to Passive with: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#ChangeBehavior. Then set a random destination with: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#SetDestinationPosition

    You could then switch back to the Aggressive behavior with the same ChangeBehavior code to make the AI attack.
     
  50. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    177
    Spawning max 15 emerald agent with crux on map magic 2, Mostly they wonder as expected but rarely they start rotating in circle. What could be the reason for it