Search Unity

Tactical Shooter AI - Asset Store Pack

Discussion in 'Works In Progress - Archive' started by squared55, Mar 2, 2015.

  1. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Which idle behaviour are you using? If it's set to search, it may give the illusion that they always know where the player is. Try using wander.
     
  2. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    such an idiot. thanks. solved.

    Biggest problem is that I have a character set up to melee only however the melee animation doesnt play. what is the best way of setting up a melee character? I also tried giving him a gun and just replacing the fire animation with my melee one and making the projectile only shoot 1 metre, in both instances the ai just runs to the player and then stands idle but the projectile works at least. I'm using a UFPS character so i' also not sure how the melee damage will be applied.
     
  3. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    and thanks for being so quick to get back
     
  4. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Just to be sure... you did enable canMelee in the BaseScript? Although it sounds like you could just make a controller and replace the fire animation with your melee animation and it should work. Not sure why that's not working.
     
    Last edited: Jan 18, 2016
  5. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    yes but I didn't understand anything!
    I just need a little help - how to detect cover and enemy ! it's enough for my project
     
  6. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    In order to allow your agents to identify an object as an enemy, it should be enough to simply place a targetScript on the object in question.

    For cover, you'll need to make sure that your scene's Paragon AI Controller's layermask includes the layers that make up the level. Afterwards, you'll need to either enable dynamic cover or place cover nodes on the map.
     
    Last edited: Jan 18, 2016
  7. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    Hi yes that's what I've tried on both. I've tried giving the melee anims an exit time so it will play in full but no dice. All the animations work fine within the animation controller but the agent doesnt ever seem to access it. they always have canMelee active too yes.
     
  8. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Have you tried increasing the melee range?
     
  9. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    can you explain more or make a short video?
    tnx
     
  10. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    ok, progress; after upping the melee range to 10 from 2 he kills me, but all i see is a quick twist of the upper body whether full body melee animation is checked or not. (this is on the melee only character without any gun component)

    nearly there! thanks for the help so far. doesn't appear to be a problem with the avatar mask, i've imported the skeleton of the model and masked out the legs.
     
  11. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    not sure why but restarting unity fixed it, going to keep an eye on that one. thanks for the help though i'll update you if I figure any more out in case anybody else has this issue. all working fine now!
     
    RoyalAllen likes this.
  12. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    For more information, refer to the manual. Beyond that, I'm not exactly sure what there is left to say.
     
  13. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    I have them set on wander. Hmmm, very tricky problem. Even when bots themselves are set to wander in your example scenes, they still move in the most direct path to attack one another.
     
  14. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Think I just solved it by fixing another users issue.
     
    RangePlusOne likes this.
  15. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Which one?
     
  16. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Agents would check to see if they could see a target, not find one, shout that they found one anyways, hear their own shout, and then be able to see through the back of their head.

    Does disabling the agent's ability to hear things fix the issue?
     
  17. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    I'm sorry not to look like a total noob, but I can't seem to locate where to find and turn off the agent's ability to hear? :(

    I turned off Audio Enabled in sound script, no change in behavior.
     
    Last edited: Jan 23, 2016
  18. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Well, crap. I thought there was one. My bad.

    I have a couple fixes I want to put out, but I don't want to release one now when the current version of Unity spams the debug log with errors if you don't have patch 1 installed.
     
    Last edited: Jan 24, 2016
  19. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Bummer, I'm anxiously awaiting your fix :) Fingers crossed it will work... I hope the next version of Unity is launched soon... would really like to continue developing my game with your AI. In your next patch do have range limitation for the AI so they have to be in X range to fire?
     
  20. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,683
    Theoretically, Unity 5.3.2 is about a week away. I'll guess Feb 2.

    So maybe if an update is sent to Unity within the next few days, it comes out after 5.3.2 has hit ...?
     
  21. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Yes. I've almost done adding sprinting to destinations that are too far away- I just need to update the animation creation wizards.
     
    Last edited: Jan 26, 2016
    RangePlusOne likes this.
  22. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    I see a lot of posts concerning UFPS integration but I'm using another TPS foundation and would like to know what's the best way to trap Hit and Die triggers of my own character. The Health script seems to be working when I'm adding it to my own Player character. Am I aiming in the right direction ?

    Thx
     
  23. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Awesome, is there any chance that a zombie agent will be created? One that doesn't need a ranged weapon, just melee attack and different running speeds? I think your pack or additional plug-in would benefit from having this! ;)
     
  24. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    squared55
    I want to upgrade from Shooter AI, but could not find any tutorials abuot basic setup, some feautures etc.
    Could you upload pdf or something with documentation so it would attract and inform some develo9pers who is interested in Paragon AI.
    Lack of info about your Plugin doesn`t do any good to it`s potential users.
    Since there are no video tuts put up some docs at least.(for starters)
    And who knows maybe you will get someone that will do tutora for you.
    Look at UFPS for example, freely avalible docs, Plenty of tutors that are made by community members.
    Paragon AI will grow its user base mush faster with this approach.
    And we all will benefit from that.
    Cheers!
     
  25. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I believe that people have already done this by simply disabling the gun!
     
    Last edited: Jan 27, 2016
  26. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I believe the easiest way to damage an agent with a trap would be to just call the appropriate damage method on the agent using SendMessage() when you detect that the agent is in the trap.
     
  27. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I also whipped together a quick-start tutorial. 'Bout time too!

     
    Last edited: Jan 11, 2019
    julianr likes this.
  28. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    sorry my bad, I wasn't clear enough. AI Agents are not a problem . My problem is for my controlled character. I've added the Health script to my player object and when playing I see the script is working because Health value is going down, so AI is hitting me right and my layers well setup. So what's the best way to trigger my Hit and Dead animation from that health script ?
     
  29. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Ah. Well, it was never intended for that script to be used by characters other than Paragon AI agents. I suppose you could extend/override parts of the HealthScript class to do whatever you want... but honestly, I feel you should just make a custom health script for your player. You'll just need to make sure it includes the proper damage methods/functions and the Paragon AI bullets will work just fine. As for playing custom animations on your player, that's something that will be unique to your project and as such is beyond the scope of Paragon AI.

    If you need help writing a health script, post what you can and I'll see if I can help fill in the gaps. :)
     
    Last edited: Jan 28, 2016
  30. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Thanks ! you're confirming my thoughts but wanted to make sure I was not missing something. I understand this script will be very specific for each. I'll work on it and let you know if any problems :)

    thx again
     
  31. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Unity 5.3.2 is out. I'll be submitting to the asset store shortly. :)
     
  32. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    I may be a bit too late to answer you but I had exactly same problem today. Took me few hours to figure out why the enemy knew exactly where I was even if I was not moving and hiding behind few on objects. First thing I did is to double-triple check all my layers. No success. Everything look good. Everything else was working as expected.

    Then I enabled the Line of sight Debug view. No way I was even looking at me, AI never spotted me at all. Then I realized, gosh, if he can't see me, maybe he can hear me. I digged through the code and spotted one of the function ( can remember exact name) that was initiating the Sound Investigation. Turned that one off and bingo !!! The AI had no idea where I was hiding until he sees me.

    I'm not saying at all the problem is from Paragon AI, I know I've setup some footstep sound which for now is not working properly. So maybe I goofed somewhere and it's causing my footsteps sound to be propagated word wide and the AI is just behaving as expected , reacting to surrounding sounds.

    Squared55 , I'm pretty sure it's not related to your code but a side effect of my problem with footsteps sounds. But for now I didn't find any solution other than disabling Paragon AI sound investigation routine which obviously is not the problem at all.

    So just to share with you guys cause your problem looked a bit like the problem I had this morning .
     
    squared55 likes this.
  33. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Well, I did fix a sound related error. When the next version passes through the asset store, hopefully your problem will be resolved too. :)
     
  34. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Oh thanks to let me know. I'll work on something else since then ;-)
     
  35. CTPEJIOK22

    CTPEJIOK22

    Joined:
    Sep 4, 2013
    Posts:
    85
    nice ai, simple ufps integration. but enemy always see me, even removing "investigate sound" cant help.
    im using DemoMap example, maybe i need to change something in ai scripts? or make ai from scratch?
     
  36. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    In case my last post was too vague, there is a new version awaiting approval in the asset store. :)

    Does the controller layermasks include the layer that the level parts are on?

    I've also made some fixes in this regard that will be coming out in the next version. I imagine that one of these will solve the problem.

    On a side note, removing the investigate sound won't fix the problem, there are a number of things that need to be changed in the TargetScript.
     
    CTPEJIOK22 likes this.
  37. CTPEJIOK22

    CTPEJIOK22

    Joined:
    Sep 4, 2013
    Posts:
    85
    yes. at first i made few changes - added 8 physhics layer "Level parts", check c#_coverNodes, all seems good and enemys stoped to shoot me from start of the game. also add gameobject Controller with Controller Script and Layers Mask with Level parts, like at your video, all becomes better. but Tactical Ai with Search behaviour always walk to my position, then he finds me and shoot. now the best solution - use Wander. and my goal is something like Patroling area ai.

    anyway, your ai is great in battle, very interesting. and it would be great to share with community some other types of ai, like zombies or different agression, such as "defenders" or "attackers".

    p.s. "ParagonAIController" - its Empty Gameobject Controller with Controller Script?
    p.p.s. changed behaviour to Patrol, add some points, and now enemy attack me only when see me. its very close to my goal.
     
    Last edited: Jan 30, 2016
  38. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    That's correct. :)
     
  39. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    I have two teams of Paragon AI agents fighting each other, and I need the player to be able to switch allegiances at run-time. The way your code is structured makes this difficult, as I can't add a TargetScript using AddComponent at run-time and then change the allies and enemies arrays as the TargetScript sets up things as soon as it awakens, before there is a chance to change the arrays.

    Also, disabling a TargetScript doesn't make a difference at all, as agents don't take the enabled state into account. Changing the arrays post fact doesn't affect agent behaviour either; I guess affinities and animosities are evaluated at startup and then never again. Is there a way of retriggering this process?

    Any ideas?
     
    Last edited: Feb 1, 2016
  40. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    So, you just need the player to switch sides? Put 2 target scripts on your player, one for each team. If the priority of a target script is negative, agents should ignore it. If it's positive, they'll shoot at it.

    That's how I got the agents to fire at the exploding barrels only when there are enough members of the enemy team nearby.
     
    PeterB likes this.
  41. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Version 1.1 is out!
     
    Superjayjay, RangePlusOne and julianr like this.
  42. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Can you post all upgrades, changes, modifications, etc? Would really help everyone see the difference :D
     
  43. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Every asset store asset has a change log/version notes that can be viewed by clicking on the version number underneath the main section. :)
     
    99thmonkey likes this.
  44. barcode802

    barcode802

    Joined:
    Apr 6, 2014
    Posts:
    36
    Copied the change list from the asset store for the benefit of those on this thread (and for discussion). I'm excited about these changes since I am building a large map and was having a problem with agents starting to attack and shooting from too great of a range when they had close range weapons or shouldn't yet be able to see the player!

    I'm curious also - does this update require updating to Unity 5.3.2??

    1.1 Change list copied form the Asset Store:
    -Agents can now sprint when their destination is too far away.
    -Users can limit the distances from which agents will fire from
    -Users can set a maximum distance for the agents to notice targets.
    -Agents can now create sounds on death and upon reloading.

    Fixes: -Fixed a glitch preventing agents from losing awareness.
    -Fixed a glitch causing agents to notice targets outside of their field of view.
    -Fixed an issue that prevented the included animations from working properly with a humanoid rig.​
     
    RangePlusOne likes this.
  45. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    I like the nice little features you added in latest update. I'm having a little problem. AI can't throw Grenade more than few feet away . The grenade explosion and damage are working fine but for some reason AI leaves grenade at his foot. Ran some debugging ins GrenadeScripts.cs target transform is found is my player coordinates, the throwForce is usually around 6-7000 . Any idea ?
     
  46. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Does your agent have any colliders attached that the grenade may be bouncing off of? Are you using one of the default grenade prefabs?
     
  47. mareqq

    mareqq

    Joined:
    Feb 18, 2015
    Posts:
    5
    I would like to use only animation system with gun from Your asset, for example I take one of Your agent and attach own AI, Sight, Health Script - is there any simple option that I can run Crouching, Sprinting, Fire animation etc? It will be idealy that I can run simple method from my script like AnimationScript.animator.SetBool(sprintingHash,true); or something like that. If something like this doesn't exist Can You do this for us? I have difficult game scenario and I can't use AI from asset store but Your animation system is really nice.
     
  48. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Honestly, you'd probably be better off just making an animation controller from scratch.
     
  49. mareqq

    mareqq

    Joined:
    Feb 18, 2015
    Posts:
    5
    Is there any possibility that You can make Unity asset like that? If not maybe I can buy from You this functionality?
     
  50. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    It seems to me like the functionality you are looking for is already built into Unity.