Search Unity

Tactical Shooter AI - Asset Store Pack

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

  1. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    how to change range for every weapons ?
     
  2. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    You can adjust the maximum lifetime/speed of the bullets with the bullet prefabs themselves, and the min/max ranges that the agent will fire their gun under miscellaneous parameters in the gun script.
     
  3. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Hi man.
    Are there any optimization plans for base script?
    And where can i get old versions of TSAI with original base script?
    Thanks
     
  4. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I'll try and improve performance as I go, but I don't have any specific plans to improve the performance of any one component. And unless Unity has some old version saved, there is no way to get the original because I don't keep old copies myself.

    However, I'm not sure why you're having trouble with the BaseScript specifically- all the performance is taken up by the animation/bullet stuff, at least on my end. Got a profiler screenshot I could look at? Have you tried increasing the time between AI cycles? Disabled dodging?
     
    Last edited: May 27, 2016
  5. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    I will do that.
    Meanwhile if anybody has old original versions of Paragon AI please share the link so people could download it.
    I remember it being extremely fast on mobile with minor tweak.
    I`ll spam the forum from time to time for older version!
    In desperate need for it( - 38 bots on the map with 45fps on Galaxy3!!!
    So please if anybody has older versions of TSAI please share them with me!
     
  6. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Current version is 1.2.2
     
  7. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I just created a performance mode. Nothing fancy, all it does it shut down a bunch of features with a single click, but maybe it'll help on mobile. Until it goes up to the store, you can try manually disabling features, and increasing the time between cycles.

    Please don't publicly post download links. :)

    If the tweak is what I think it was, it was faster because you disabled the main AI loop. I suppose the same thing would still increase performance now, you'd just need to comment out more lines. You will end up disabling features, though.

    I would have thought almost 40 bots on mobile was good performance...

    What sort of performance would you like to achieve?
     
    Last edited: May 27, 2016
  8. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Easy way to get banned.
     
  9. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    ???
     
  10. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    I have few scenes where player has to withstand charging infantry attacks.
    Would be cool to have limitations dictated solely by skinned meshes max number for given device, and not get taxed by Scripts.
    Had this in febrary. Was unbelievable to see that wreally happening on device!
    Wonder if it will be anyhow possible to see again.
    Could you show me how to squeeze most performance speed? What lines to disable etc..
    Thanks.
     
  11. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    I can't add my overridden NavmeshInterface class to the spot for it in the base class in the inspector. Also may not be needed with A* but I can't override Vector3[] GetNavmeshVerticies.
     
    Last edited: May 28, 2016
  12. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    You need to add the script to your object, then drag the script from the object itself to the field- your cursor should never leave the inspector window. Did that make any sense? :)

    I mean, it really depends on what you're willing to sacrifice. The only real advice I can give you would be to progressively comment out lines and see if the AI still does what you want it. And again, keep cranking up the time between AI cycles. :)
     
  13. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    i am getting crazy!
    I want use Tactical SI with RFPS!
    I tried every thing but no result!
    does anyone do this?
     
  14. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I just got around to trying integrating them together. RFPS is coded in such a way that it makes it difficult to integrate out of the box while also not breaking when RFPS is not installed. Still, these code tweaks seem to work:

    In the RFPS weapon behaviour, line 2220, added onto the end of the if statement

    Code (CSharp):
    1. else if (hit.collider.gameObject.GetComponent<ParagonAI.HitBox>())
    2. {
    3.     hitCollider.gameObject.GetComponent<ParagonAI.HitBox>().Damage(damageAmt);
    4.     FPSPlayerComponent.UpdateHitTime();//used for hitmarker
    5. }
    6.  

    In the RFPS ExplosiveObject.cs, same idea as above, line 126:

    Code (CSharp):
    1.                          
    2. else if (hitCollider.gameObject.GetComponent<ParagonAI.HitBox>())
    3.                          
    4. {
    5.                              
    6. hit.collider.gameObject.GetComponent<ParagonAI.HitBox>().Damage(explosionDamageAmt);
    7.                          
    8. }

    In the AI Target right before the SendMessage calls for damage:


    Code (CSharp):
    1. if (healthScriptHolder.GetComponent<FPSPlayer>())
    2. {
    3.     healthScriptHolder.GetComponent<FPSPlayer>().ApplyDamage(h);
    4. }
    In the Explosion and Bullet Scripts, right before the SendMessage calls for damage:


    Code (CSharp):
    1.  
    2.   if (hit.collider.gameObject.GetComponent<FPSPlayer>())
    3.   {
    4.   hit.collider.gameObject.GetComponent<FPSPlayer>().ApplyDamage(damage);
    5.   }
    6.  
    Let me know if you can get it to work!
     
    Last edited: Jun 6, 2016
  15. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    It doesn't have the 2220 line! only 1430!
    i added the lines but this error apears!


    I didnt found where to put! these are my codes - can you please add them for me?

    [EDIT - DO NOT INCLUDE ASSET STORE ASSETS IN POSTS]
     
    Last edited by a moderator: May 29, 2016
  16. duniatorga

    duniatorga

    Joined:
    Mar 11, 2016
    Posts:
    21
    Please Check/ Answer pm In Facebook
    About Character Setup Ai
     
  17. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Darn, forgot I modified the hitboxes too. Change The ApplyDamage in that line to simply Damage. Modified code has been edited in above.

    As for the rest, just do a find for "SendMessage(", and paste the code right above. TargetScript for me is after line 496. Bullet Script for me is after line 73. ExplosionScript for me is after line 49.

    As for not having enough lines, are you sure you are both in WeaponBehaviour and have the most recent version of the package? It should go in the HitObject function/method.
     
    Last edited: May 29, 2016
  18. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    What is your progress?
     
  19. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    what?
     
  20. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Slightly edited above instructions, for anyone else interested.
     
  21. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    who can make a short tutorial for "UFPS integration"

    I am confused in layers and tags!
     
  22. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Here's a quick video I made. I'm not 100% happy with it, but maybe it will help. :)

     
    arnesso likes this.
  23. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    How did it go with RFPS?
    Do you have it working?
     
  24. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    no its not working! its very hard! really hard! I've start try using UFPS!

    ***as I remember in "Shooter AI - any combat solution " with changing 2 or 3 line of codes it become integrated with RFPS! but that is a old AI and is not good as Tactical SAI
     
  25. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Has anyone experienced an issue with the Agent's bullet sounds being very quiet during gameplay? The UFPS weapon sounds are normal when running the game , but I have no clue why the agent's weapons are so minimal. When I play them individually in the project folder they are perfect? Any suggestions?
     
    Last edited: Jun 2, 2016
  26. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    I did. Sounds are sort of chewed up and chopped off. When agent is firing every 5th or 7th shot is playing sound clip:/
    Dont know how to fix this:(
     
  27. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    squared55
    Could you please make tutorial about RFPS integration with TSAI.
    Hope it will not be difficulr for you.
    Thanks!
     
  28. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I imagine the UFPS sounds are 2D, so are being played at max volume while the AI sounds are not. You'll have to mess around with the audio source settings. :)

    Lower the rate of fire, this happens in Unity when there are too many sounds in the scene.

    I'm not done with integration yet! I plan on making it so you just need to uncomment a few lines and then copy/paste one small code segment into the RFPS script. As of right now, the above post is the best I've got. :) It has been edited several times, BTW.
     
    Last edited: Jun 3, 2016
  29. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Hope you`ll succeed with this thing soon;)
    Thanks!
    Anything with additional fire spawn points and secondary fire mode alteration?(for Helicopters and tanks)
    Still hoping to see it come some time:(
    Cheers!
     
  30. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    thank you man - I was able to make Ai shoot me but two problem!

    1- your AI are really smart and powerful !! how can I make them weaker ! the game is ULTRA HARD by default and player should try 100 times to pass a small part :) ? even I cant test game ! they kill me fast! I need to reduce their gun damage ! what should I do make them weaker and less damage?

    2- there is no VP_FX Bullet script in ver 1.5.2 and just there is VP_HITSCAN BULLET which contain all the options of FX bullet , but not the damage method ! so I cant shoot the AI !
     
  31. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    1) look for Bullet_SMG // Bullet_Shotgun // Bullet_Rifle // Bullet_Sniper and change the value (When you click on agents you can see their bullets assigned under Gun Script in the inspector and their health too.
     
  32. sheffieldlad

    sheffieldlad

    Joined:
    Oct 9, 2013
    Posts:
    154
    Hi.
    I'm trying to flip between different idle behaviours at run time so the player can tell team mates to follow him or search enemies.
    Just basic stuff for now.
    I have my player set up as the key transform in my ai agents script.

    Buttons on my UI call the following methods:

    Code (CSharp):
    1. public void Search(){
    2.         myBase.myIdleBehaviour = BaseScript.IdleBehaviour.Search;
    3.         myBase.SetIdleBehaviour (myBase.GetIdleBehaviour());
    4.  
    5.  
    6.     }
    7.  
    8.     public void Follow(){
    9.         myBase.myIdleBehaviour = BaseScript.IdleBehaviour.MoveToTransform;
    10.         myBase.SetIdleBehaviour (myBase.GetIdleBehaviour());
    11.     }
    Where myBase is a reference to BaseScript.

    The above code adds a new search script or a new move to transform script to the ai agent which works but is incredibly messy.
    The ai agent ends up with a large number of these scripts attached after a short space of time.

    Is there a cleaner way to switch between idle and combat behaviours at runtime?

    I'll be writing some custom behaviours at some point once I get to grips with the system a little better and ill probably end up wanting to swap these at runtime too but for now I'd like to use the existing ones.

    Many thanks.
     
  33. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    can you take a screen shot?
    gun script didnt have any option for damage! in bulletscript the damage is set to "2" - but I'm dying so fast by a little shots!
     
  34. sheffieldlad

    sheffieldlad

    Joined:
    Oct 9, 2013
    Posts:
    154
    Gunscript will allow you to slow down the rate at which the AI fire.
    Bulletscript is where you can change the damage.
    If you're using g ufps 2 on the bullet script will translate to 20 health. Try 0.2 which will take away 2 health
     
  35. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Uncheck RequireDamageHandler for all your UFPS bullets and explosions- full instructions for UFPS 1.5.1 and probably 1.5.2 are in the manual. :)

    Increase the UFPS health, it's really low by default. Also, decrease the accuracy on the gun. Make them slower, decrease their health. There's no once-size-fits all way to get perfect difficulty, so the only thing I can really say is to just keep messing with the settings, particularly those in the base and gun scripts.

    I would try creating only one instance of each behaviour when the agent spawns. You'd save these with a variable, and then you'd switch to that behaviour instead of using GetIdleBehaviour().

    So, something like:

    Code (CSharp):
    1. ParagonAI.CustomAIBehaviour newBehave = (ParagonAI.CustomAIBehaviour)gameObject.AddComponent(typeof(ParagonAI.CustomAIBehaviourTemplate));
    2. newBehave. behaveLevel = ParagonAI.CustomAIBehaviour.BehaviourLevel.Idle;
    in Start(), and then just

    Code (CSharp):
    1. newBehave.ApplyBehaviour();
    where newBehave is obviously the behavior you want to switch to. Lemme know if this works. :)
     
    Last edited: Jun 4, 2016
  36. sheffieldlad

    sheffieldlad

    Joined:
    Oct 9, 2013
    Posts:
    154
    Awesome. I'll try that in a few hours :)
     
  37. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    Hi @squared55
    I use Tactical with UFPS ,
    1st: I would like to make a basic xp system, so could you help me how to refer to the AI agent is aready dead then one xp point will be added ?
    2nd : Im trying to create hiding,sneak for UFPS Player. So I would need that an area with bushes ( for example) with sphere or box collider triggering then AI agent will not be able to see the ufps player with TriggerOn -TriggerOut stuff.
    Any idea how should I do the Agents cant sense The player when he is in bush, except the agent saw the Player ran into bush . ( I know it sounds difficult, but it is possible . ) I will share if i figured it out :)
    THanks ,
    CHeers :)
     
  38. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    1: You can use the OnAIDeath() method that is called when the agent dies. I use this in the included dismemberment script to trigger a special effect when the agent is killed with a headshot.

    2: If you want the agents to ignore a target, all you have to do is set it's priority to -1 or another negative number. So you'd set this value when the agent enters the bush, and raise it to a positive number when they leave the bush. Then, when an agent nears the bush, you could raise the priority of the player, so that they can still see the player if they are nearby. You also would not lower the player's priority if they are currently engaged in combat with an enemy. There's a number of ways to determine this- maybe if the player fired recently, or was recently hit?
     
    Last edited: Jun 4, 2016
    arnesso likes this.
  39. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Thanks, but just out of curiosity because I'm just getting back into dev... where do I put this? On an agent or in it's own script in the scene?
     
  40. sheffieldlad

    sheffieldlad

    Joined:
    Oct 9, 2013
    Posts:
    154
    As I understand it you should add a createsound script to your bullet prefab.
    This will create a sound when the bullet is spawned.

    If you want to create a sound again and again (footsteps for example) attache a createsound script to your player and call that line of code each time you want to create a sound.
     
    RangePlusOne likes this.
  41. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    I unchecked RequireDamageHandler but nothing happens !
    /// My package only got 3 page manual !
    ok - thank you
     
  42. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    Thank this is defiently useful :) My script knowledge is a little bit rusty . How should I call OnAIDeath() method ?
    This is Gain xp to send xp point if somebody died.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4.  
    5. public class GainXP : MonoBehaviour {
    6.  
    7.     // Use this for initialization
    8.     public ParagonAI.HealthScript healthai;
    9.     public LevellingSystemCSharp levelup;
    10.     public int getxp; /// How many xp will you get if you kill
    11.  
    12.     /// </summary>
    13.     // Update is called once per frame
    14.     void Update () {
    15.    
    16.         if (healthai.health <=0)/// I should insert here the OnAIDeath() , but how ?
    17.         {
    18.             levelup.xp = levelup.xp + getxp;
    19.         }
    20. }
    21. }
     
  43. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    3 page manual? That's not right at all, in fact, that's not even the first section. I'd try contacting Unity.

    Just change Update to OnAIDeath and apply the script to your agent.
     
    Last edited: Jun 5, 2016
    arnesso likes this.
  44. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    I found the Issue!
    the gun damage was low and I Thought the codes is not working
    Really big thanks to you @squared55
    just some more question abou desiging area and layers and tags!- but later!
     
  45. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Hey guys, new question for ya, I'm trying to making the damage direction arrow on UFPS player appear when the player takes damage right? It doesn't work with the Paragon AI bullet, but looking up UFPS they say this...

    "Add this to the Paragon GunScript just after the bullet is instantiated to get the damage direction.

    bullet.SendMessage("SetSource", (this.transform), SendMessageOptions.DontRequireReceiver);

    you must be using a UFPS bullet prefab."

    I'm really confused where the GunScript is located on the NPCs? Any chance anyone knows?
     
  46. sheffieldlad

    sheffieldlad

    Joined:
    Oct 9, 2013
    Posts:
    154

    It's on each paragon AI agent. Edit the script and add the code as I said in the post on the ufps forum.

    It's a bit of a crude hack really because the next update from paragon will probably include a new Gunscript which will overwrite the changes.
     
  47. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    @squared55 I'm developing mainly for mobile devices, targeting high end devices supporting Metal, so at least no old devices the 4S or iPad 2. But still, a 3D game is very demanding so can you give me few hints on what features are the most demanding on the CPU/memory. By example, is the covering system or searching enemies in a wide range is something than can be very CPU cycles consuming ?

    I'm at the the design phase, I want a good AI system like yours, but I can at this point make some compromises on some features if they're to be too demanding for the mobile version while giving me the option to reactivate it for a PC version.

    I know I can spend hours with the profiler to find out but I'm sure you can head me out in the direction lot faster :)

    thx for your help and great support in this forum
    Chris
     
  48. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    2 starter questions !
    1. I made a new scene and i added a terrain - i add an agent and ufps player and do same thing in targetscript which worked before in Paragon SAI demo scene ! I bake navmesh and set as walkable!but agent didnt attack me!so can you tell me what should I do to make my scene? I mean Tags and Layers !
    2. if I want to make a cube for cover (short or others) - I should set a specified height?any layer or tags or just put cover script near that is enough?
     
  49. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    You must add a target script to your UFPS player, and also need an empty gameobject with an AI Controller object applied to it.

    There's no specified height, but it's a good idea to make it lower than the agent's gun when standing, but higher than the agent's head while shooting. By default, this is somewhere around 1.3.

    For cover nodes, explosions, and the controller, set these layermasks to the things you don't want the agent to see through. For the bullet prefabs, set these layermasks to the things you want the agent to hit.

    No tags should be needed.


    Disable dynamic cover, for starters. Then increase the time between cycles, checks, etc. Lowering the rate of fire also helps alot. The fewer exposed bones in your agent, the better, so reduce fingers if you can. A lot of power goes to just moving and rotating the agents.


    Would it be possible to put the UFPS code in a separate script, so it doesn't break on updates?
     
  50. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    in TSAI demo scene I just added a target script to my UFPS player and it worked well! I didnt add any AI controller to UFPS player! you mean I should attach AI controller to agent?

    I dont understand this one! in Demo scene there is no layer set. just I think they are in "level part" layer!
    no picture or video tutorial for making scene?