Search Unity

Tactical Shooter AI - Asset Store Pack

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

  1. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    I was using the shotgun agent prefab, it is using your recommended behaviors and it's keyTransform is set to the GameObject the baseScript is attached to.
     
  2. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Well... there's the problem. Make it set to nothing.
     
  3. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    I thought you said to do that, having it set to nothing doesn't make a difference.
     
  4. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Where is your targetScript located relative to the agent? What are the BaseScript's Wander settings set to?
     
  5. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    I have a targetScript on a playerController and the targetScript that was on the prefab with different teams, the wander settings are diameter 50 and distance 4. The agent kinda moves a bit to the right then shoots and moves back to where it starter, the targetMarker is moved away from the agents position at runtime.
     
  6. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Is ReachedDestination working properly? Sounds like the agent never detects that it's reaching it's destination.
     
  7. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    It doesn't seem to get called, no.
     
  8. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Try changing it to a simple distance check as opposed to relying on the A* method. Also, if you heavily modified the other scripts in an earlier attempt, it's likely that you accidentally removed something that's needed. Is this a (mostly) clean import of the package?
     
  9. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    It moved the atDestination = false; out of the while statement in richAI and it now says the destination is reached but it still doesn't move after starting, it is a clean import besides the navmesh interface. I have to leave for a doctors appointment though so I'll have to continue this later.
     
  10. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Probably because now it instantly thinks it hit the destination. I'd highly recommend a simple distance check here.
     
  11. animatedtako

    animatedtako

    Joined:
    Jan 10, 2013
    Posts:
    7
    Hi, just wanted to check in and say again I like what your package offers! Excited to see the hit flinches and vaulting.
     
    squared55 likes this.
  12. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Working on adding advanced tactics!



    Here, we see an agent staying in an advantageous location providing suppressing fire, another agent flanking the target, and a third attacking head-on.
     
    Last edited: Aug 4, 2016
    animatedtako, Tinjaw and hopeful like this.
  13. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    Cool, what's the timing on that? A couple of months? I'm asking because I'm compiling my game mechanics now and can hold off a couple of months for the AI if necessary.
     
  14. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I'm planning on submitting the first version to the store tomorrow if I can finish the relevant documentation.
     
  15. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    So what do I have to update in the navmesh interface post-update 1.5? I will be sure to update my asset store review from version 1.1 as well. I really want to get this A* stuff working though, I think I was getting pretty close.
     
  16. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    These are the new methods I added, with descriptions. Unfortunately, I don't know what the A* equivalents would be.

    Code (CSharp):
    1.        //Are we on a navmesh link? (for parkour)
    2.         public virtual bool OnNavmeshLink()
    3.         {
    4.             return agent.isOnOffMeshLink;
    5.         }
    6.  
    7.         //Instantly move the agent/object to the end of the link
    8.         public virtual void CompleteOffMeshLink()
    9.         {
    10.                 agent.CompleteOffMeshLink();
    11.         }
    12.  
    13.         //Turn off the agent component (for stagger)
    14.         public virtual void DisableAgent()
    15.         {
    16.                 agent.enabled = false;
    17.         }
    18.  
    19.         //Turn on the agent (after stagger)
    20.         public virtual void EnableAgent()
    21.         {
    22.                 agent.enabled = true;
    23.         }
    24.  
    25.  
    26.         //Check if we have a parkour in the plotted path.  (If so, don't dodge because otherwise the agent breaks.)
    27.         public virtual bool HaveOffMeshLinkInPath()
    28.         {
    29.                 OffMeshLinkData linkData = agent.nextOffMeshLinkData;
    30.                 return linkData.valid;
    31.         }
    Fortunately, the advanced tactics probably won't need any new navmesh methods.
     
    Last edited: Aug 5, 2016
  17. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    The RichAI isn't as well documented as the AIPath script in the A* Pathfinding project so I might just be using it wrong. But after giving it some thought, why are we trying to get all the values from the PathAI/RichAI components when all we need to get paths from the A* mesh is the Seeker component, shouldn't we be able to just replace where the agent gets a path from the Unity navmesh for it to get a path from the Seeker without having to go through the example AI included with the A* Pathfinding project? The Seeker component should act like a NavMeshAgent without the steering, why not keep the acceleration, speed ect.. in the navmeshInterface AIPath and RichAI just send that stuff to the seeker. Really all is needed is a version of the NavMeshInterface that calculates the needed variables and sends it to the Seeker component included in the free version of A*Pathfinding Project. I am going to try and merge AIPath into the NavmeshInterface so I'm not having to go back and forth between multiple scripts.
     
  18. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818

    Well, that's worth a shot. I feel it probably would be easier to just use the premade stuff, but if you can get your own interface working, well, why not? :)
     
    Last edited: Aug 7, 2016
  19. Mr-Logan

    Mr-Logan

    Joined:
    Apr 13, 2006
    Posts:
    455
    Sorry I'm first answering now, I wasn't updated about your reply :)

    Yes, that would be totally bad ass, best of both worlds indeed :)

    I've been playing with setting an AI up on my own in RAIN, and I must admit that my skills in that area are somewhat lacking :D
     
    Last edited: Aug 14, 2016
  20. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    I read on the asset store that this can be integrated with Realistic FPS Prefab. I found info on UFPS integration but nothing on Realistic FPS integration. Is that still being supported? Where can I find that info?
     
  21. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    There are integration instructions included in a sepreate .txt file. Note that there is a slight modification that needs to be done with the latest version of RFPS.

    Code (CSharp):
    1. RFPS CODE:
    2. In WeaponBehaviour, line 2220, after the if statement in case 0
    3.  
    4. else if (hit.collider.gameObject.GetComponent<TacticalAI.HitBox>())
    5. {
    6.     hitCollider.gameObject.GetComponent<TacticalAI.HitBox>().Damage(damageAmt);
    7.     FPSPlayerComponent.UpdateHitTime();//used for hitmarker
    8. }
    9.  
    Should be

    Code (CSharp):
    1. RFPS CODE:
    2. In WeaponBehaviour, line 2219, after the if statement in case 0
    3.  
    4. else if (hit.collider.gameObject.GetComponent<TacticalAI.HitBox>())
    5. {
    6.     hit.collider.gameObject.GetComponent<TacticalAI.HitBox>().Damage(damageAmt);
    7.     FPSPlayerComponent.UpdateHitTime();//used for hitmarker
    8. }
    9.  
    Basically, move it up one line and change hitCollider to hit.collider in WeaponBehaviour.
     
    Last edited: Aug 15, 2016
    EvilGremlin likes this.
  22. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    Okay, great. As long as it can be done. Thanks for the reply.
     
  23. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Just fixed a glitch causing animations to break if the game pauses. To fix it, change the Update method in the navmeshInterface to:

    Code (CSharp):
    1.         void Update()
    2.         {
    3.             if (Time.deltaTime > 0.0001)
    4.             {
    5.                 returnVel = (myTransform.position - lastPos) / Time.deltaTime;
    6.                 lastPos = myTransform.position;
    7.             }        
    8.         }
     
  24. jtomes123

    jtomes123

    Joined:
    Dec 18, 2012
    Posts:
    7
    Hi, my employer bought this ai and wanted me to add it to their game, when i use the premade paragon agents they work pretty much flawlessly, they only keep shooting in the same angle for long time even if player walks away. But when I was trying to set it up with custom models it just didn't work, the ai just walks all the way up to the player and starts shooting next to him. I was trying to fix that for almost two days straight, but i couldnt figure out anything. I've read through this thread and through the manuals but i just can't get it to work. Help, please help.
     
  25. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Hello, sorry you've been having issues. There's a couple things that could be the issue, but I can't be sure given the description you've given. If you could post some screenshots of the agent's inspector and the issue itself would help immensely.

    1) Make sure your layermasks are configured properly. I'd test the agents in same scenes as the working agents to make sure this isn't an issue.

    2) Make sure you have chosen the correct behaviours. Berserker will make the agent run up to the agent, but I suspect you'll want Skirmish or Tactical.

    3) Make sure your agent's "eye" is facing the right direction, sometimes the animations will make the agent look the wrong way.

    4) Try enabling High Quality Aiming in the RotateToAimGunScript.
     
    Last edited: Jan 11, 2019
  26. pcg

    pcg

    Joined:
    Nov 7, 2010
    Posts:
    292
    @squared55 Firstly congrats on an excellent AI system. I bought it yesterday and I'm in the process of integrating with the A* path finding project thanks to the recent work both you and @FirefightGI have done in this area.

    On the subject of A* Path Finding, I found I had to make a small change to the BaseScript that I would like you to include in the next release if possible.
    Its just a call to the navI.Initialize(gameObject) method of the navmeshInterfaceClass object.

    Code (CSharp):
    1.             if (navmeshInterfaceClass == null)
    2.             {
    3.                 navI = (ParagonAI.NavmeshInterface)gameObject.AddComponent(typeof(ParagonAI.NavmeshInterface));
    4.                 navI.Initialize(gameObject);
    5.             }
    6.             else
    7.             {
    8.                 navI = navmeshInterfaceClass;
    9.                 navI.Initialize(gameObject);
    10.             }
    11.  
    I found that adding code in to the Awake() method of my custom NacmeshInterface object (as suggested in a previous post) ran too late but the above code solved my flow problems.

    Also a quick question on the dodging.
    I've set up a level and added the Team 1_Shotgun. I set his AI Type to Berserker and Idle Behaviour to Move To Transform. I also have a custom player object that has a target script added and when the AI bot comes around the corner and sees my player he starts firing a volley of shots. He then dodges and does not resume shooting or reloading. He will throw grenades but thats all. I can move my player around him but there is no further shots coming from the bot.
    If I turn off dodging then the bot will fire a volley of shots and reload then continue firing and throwing grenades.
    I would of expected the dodge to resume reloading and firing once the dodge was complete ?
     
    EvilGremlin likes this.
  27. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Perhaps you would be able to simply place your new code inside the classes constructor? In any case, I now have my base script calling "Initialize" on custom navmesh interfaces. :)

    As for the dodging, you're right, that's not intended behavior. I've never been able to replicate this glitch on my machine before, but I do have another user who reports a similar issue. We think that it only occurs in tight areas, and more often in ProBuilder levels, for whatever reason. Any information you could give me would be appreciated, but I am working on it!
     
  28. pcg

    pcg

    Joined:
    Nov 7, 2010
    Posts:
    292
    Thanks for adding that.

    I've done a bit of digging in to the dodging problem and for me it was because this condition was never met in your Dodge class due some bad code on my end.

    Code (CSharp):
    1. while(!navI.HasPath())
    2. {
    3.     yield return null;
    4. }
    I see there is a check for the desired dodge location with a Physics.Linecast but if that test doesn't work correctly then I imagine a path might not be found and you would get this problem.
    Perhaps you could have a time out on this while too?
    Hope this helps.
     
  29. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Might be worth doing to better accommodate other pathfinding systems. Unity's should return a path pretty much no matter what happens, but that might not be true of other systems. Thanks! :)
     
    Last edited: Aug 26, 2016
    pcg and hopeful like this.
  30. unity-werkstatt

    unity-werkstatt

    Joined:
    Oct 7, 2015
    Posts:
    10
    Agent follows me and shoots at me but they are too close to me so bullet spawn are behind me and then damage is not possible how to make them not to get to my zone more than lets say 5 10 meters.
     
  31. unity3d-studio021

    unity3d-studio021

    Joined:
    Dec 22, 2015
    Posts:
    8
    My custom models walk normaly in rfps, i have done everything to ad ai to them but when I want to use prefabs from ai they are moving but no animation walking or aiming , what i need is to get them working also , does anybody else have this issue
     
  32. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Attach a navmesh obstacle to your player, or increase the BaseScript's Minimum distance to target if not in cover value.

    RFPS has some issues with imports, in this case I'm guessing that it axed the TSAI avatars. You'll either have to re-make and re-apply them, or reimport the TSAI package,
     
  33. unity3d-studio021

    unity3d-studio021

    Joined:
    Dec 22, 2015
    Posts:
    8
    Re import of paragon TSAi fixed issue

    Thank You for fast response
     
    squared55 likes this.
  34. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    Firstly let me say that this is the best AI system i have used because it has really worked with a bit of help from space robot kyle video, but there is one thing is not working properly is the default animations and also the gun position. I bought awhile ago assult character pack on the asset store so i thought i will try it with this system and it does work but the gun ends up not in the right spot and the animations don't look right so i was wondering if you would be able tell me what other soldier animations do you think that will work with this character or is there away to edit the animations.
    I have uploaded a image to show you what i mean.
     

    Attached Files:

  35. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    Hi squared55

    I wan't to ask something. I'm have a talk system. So I need to talk with npc - stop character, rotate him to player and stop whathever he doing (when he is not in battle and not an enemy), and let him go only by player press some kind of "exit button". What's the better way to do this without rewriting your code and broke everything?
     
  36. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    When you configure the humanoid avatar, you must ensure that the model is in the T-pose. Arms out, palms down. There is an enforce T-pose setting in a dropdown near the bottom of the panel you can use for this.

    You could either create a custom override behavior, or simply disable all of the relevant scripts om the agent. You'd then manually manipulate it's rotation.
     
  37. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    what's new in 1.7 ?? is there any log for change ?
     
  38. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    Iknow how to align the the gun but yeah them soldier animations don't really work with this character. I did do the enforce T-Pose. I realized i already had really cool animations there which are FPS animation pack but there is no run backwards though and i know you need that one but will it work with a walk backwards instead.
     
  39. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    If you click on the version number of any product on the asset store, you can view the release notes.

    It may also be an issue with the orientation of the gun. The gun seems be too high up and angled down. Also, even if everything is green in the avatar mode, it may not work. Minor changes to the rotations of the bones will have effects on the animations. With the right configurations to the avatar, it should be possible to get the included animations to work.

    It should work with walk backwards.
     
  40. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    I decided to use a FPSCreator Classic model with this system and it works great. Even the animations work too now. I still have trouble with gun placement though but a part from that it works.
    Just wondering any chance you adding a zombie system to this. If you did it would be the perfect system for me. I did try a zombie and did settings from a post on this and it did work but zombies really don't have aim so it was flinching every time it saw the player.
     
  41. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    ohh didn't know that.

    i'm new to this asset so i have some questions
    1- how to make AI follow my player with max distance .
    2- if there is enemy run to near cover.
    3- if there is no enemy back to player.
    4- player can give location to AI to hold or cover or follow.

    thanks
     
  42. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    You could probably get melee only enemies by disabling the AI gun script, but anything beyond humanoid infantry will likely not be added to this package.

    You can assign each agent a "Key Transform" in their base script that will center their movements around this transform. If you need further control, you could make a custom behavior.
     
    Last edited: Sep 12, 2016
    xxhaissamxx likes this.
  43. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Did anyone confirm this? I'd like to see if this is true before I crack open the game dev'n again :)
     
  44. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    is there any tutorial for how to custom behavior coz i feel lost
     
  45. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    There are instructions on how to apply them in the manual, but when it comes to actually writing them, given their open-ended nature it's difficult to write a tutorial on that. If you have a specific behavior you're going for though, let me know and I could help get you pointed in the right direction. :)

    I have done it in the past, but I'd need to crack open the project next time I get the chance to confirm it still works.
     
  46. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    I would really appreciate it, I'm sure others would too - especially if you made a quick video on it :)

    I also had much trouble assigning new animations to the NPCs... is there a tutorial you can provide that would help assist? I remember trying to use these animations but could never get them functional.
    https://www.assetstore.unity3d.com/en/#!/content/61492
    https://www.assetstore.unity3d.com/en/#!/content/61491
     
  47. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Have wierd issue:/
    Installed 5.4.1p1.exe.
    Installed TSAI
    In demo scenes all agents just freeze after frame or two(
    What could that be?
     
  48. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Found out it`s RFPS causing this freezing(pausing) issue.
    Have anyone had same problem in 5.4 version?
     
  49. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Posting on mobile here, apologies if I mess something up.


    For melee only, it should just involve unchecking the gunscript, assigning the behavior to berserker and enabling melee in the base script.

    Custom animation controller set up is in the quick start video- Just drag and drop the animations in the wizard. Or, duplicate the controller asset yourself and replace the animations like any other unity animation controller if you find that easier. Then just assign it to the Ragdolls animator component.

    If the animations themselves are an issue (not appearing right on the model), you can try and tweak them with the avatar configuration (you want to make sure it's in the T-pose, arms out, palms down), but that's an issue with Unity's retargetting rather than the AI, so you might have more success asking in the animation subforum.

    RFPS automatically sets the timescale to 0 on import, so nothing moves until the RFPS player or another script tells it to. Set the timescale to 1 in the editor to make the demo scenes work.
     
    Last edited: Sep 18, 2016
  50. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    i want AI follow key transform with stop distance 3 and if there is enemy in range search for cover and if they killed all enemy in range back to key transform