Search Unity

Tactical Shooter AI - Asset Store Pack

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

  1. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Strange enough is I'm using prefabs for AI and grenades. I would 3 out of 4 times a grenade is thrown, it's end up at his feet and AI explode. But sometimes it's going through and perfectly aimed at me. I may have change something that is affecting that but just can't figure out yet. Rockets are working though.
     
  2. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    There`s rumor that there will be dedicated forum soon.
    Is it Vanilla forum?
    Do you have friends or teammates who helping you with that?
    Would be great to have one!
    Hope it`s true!
    Cheers man!
     
  3. Filhanteraren

    Filhanteraren

    Joined:
    May 14, 2014
    Posts:
    47
    Hi, tried to find some information about this issue; After the player being spot by an AI the AI still aims towards the player and shoot at him even if the player is behind a wall and the AI don´t have a line of sight? Anyone knows why this is happening? The Line of sight works as it should before the AI spots the player, ie the AI wont spot the player behind walls etc so there is nothing wrong with the setup I think
     
  4. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I'll probably be renaming Paragon Shooter AI to "Tactical Shooter AI." This might mean that you'll have to delete the Paragon AI project folder when updating in the future. Apologies for the inconvenience.

    If you move the bullet spawn to an area well out of reach of the rest of the agent, is the grenade arc more accurate all the time? This is an odd glitch, though. Never seen it before.

    I have no plans at the moment to make a custom forum.

    This is intended behavior. I didn't want targets to be able to lose the AI by simply ducking behind a chest high wall, or around a corner. The idea was that the player is behind a wall, so they wouldn't notice anyways.

    Furthermore, they'll continue to shoot at the player if the wall is thin enough in order to lay down suppressing fire. The sound cues would also let the player time when they can stand up and shoot- otherwise, the player would have no idea as to whether the AI will instantly shoot them when they pop up out of cover.

    If you want them to lose awareness of the player more easily, you'll need to modify the Target Check Parameters and Line of Sight Parameters in the TargetScript accordingly. If you don't want them to fire when the target is behind a thin wall, decrease the Dist Allowed In Front Of Target For Cover value in the Gun Script, under miscellaneous parameters.
     
    Last edited: Feb 9, 2016
  5. Filhanteraren

    Filhanteraren

    Joined:
    May 14, 2014
    Posts:
    47
    Ok, thanks for the explanation, I guess it makes sense in a more open ended environment, it just seemed weird to have them aim trough a wall at my exact position ( it´s a 3rd/above perspective), Will see if I can figure something out to make it work better.
     
  6. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Would be great to have a random offset to aim position of AI when player is behind wall to stimulate AI knows your there but does not know your exact position.
     
  7. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    I'm integrating UFPS with Paragon AI and am having a strange problem: as soon as the UFPS vp_FP Player Damage Handler is added to the player prefab, Paragon AI stops calling Damage() in my custom scripts (which drive the HUD shield and health bars). Everything else works as it should, the player takes damage and dies, but my script is no longer called. Is this something you've encountered before?
     
  8. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    Need help with rfps, did everything on the vids i think, seems all ok, no errors, can kill the AI but he dont damage me.

    Edit: got it working.
     
    Last edited: Feb 9, 2016
    squared55 likes this.
  9. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    I am deciding between "Paragon Shooter AI" and "Squad Command: Advanced Warfighter AI" I really like how in Squad Command you can command your teammates but the support with things like UFPS and adding my own character models seems problematic. But with Paragon integration with UFPS and adding my own characters seems easy and I could probably add in commands by extending the code easily as well. Both packages are the same price hmmm... has anyone worked with both? I'd like to know if I generate a navmesh on terrain and I have all my buildings and props dynamically instantiated on top of the terrain if AI will path around the buildings and props would I have to mark all the buildings as static? If that works it would be a selling point for me.
     
  10. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    Yes. They fill different niches. Paragon is self-contained, whereas Squad Command is based on RAIN and therefore open-ended. You can drop either of them into a scene with very good results. Paragon can be extended quite considerably, but certain things are hard-wired. Anything using RAIN can be tailored at a very deep level, provided you have the expertise to do so. Paragon is specialised, requires less of you as a developer and gives excellent results straight out of the box. I like both packages. Which one you use depends on whether you need other AI functionality in your project in which case RAIN is a good choice. However, Paragon's strategic stuff is more advanced straight out of the box, I'd say.
     
    squared55 likes this.
  11. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I'll look into making it so the agents won't adjust their aim until they see you again. However, this might end up with some weird edge cases.

    I can't say I've seen that problem before. I'll look into it; probably an issue with send message. In the meantime, would it be possible to work around the issue by making your HUD script call the damage method on the UFPS health script?
     
  12. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    Does Paragon AI use Newtonian bullet physics or hit scan like UFPS when the agent's shoot?
     
  13. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Paragon AI spawns a bullet prefab which moves at a set speed. However, this doesn't have gravity applied to it. That being said, there shouldn't be anything stopping you from replacing the included bullets with your own.
     
    Last edited: Feb 11, 2016
  14. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    Is there a parameter in the AI to shoot at min range of player?, i mean the AI come too close to player that it traps him or dont do damage. Also covers work as hidden/shadow zones where AI cant see player?. This can be good for horror/stealth games.
     
  15. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
  16. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    My model using Paragon`s animations in animation preview window moves fine, but in editor legs are stay in stance pose motionless.Like he is scateboarding.
     
  17. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Using humanoid rig. Had no warnings of any kind when setting him up.
     
  18. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    Same, the legs are not animating the agent just hovers with his legs out.
     
    Last edited: Feb 12, 2016
  19. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I renamed the package to Tactical Shooter AI. Lemme know if this inadvertently breaks something.

    Have you properly set up your animator mask and applied it to the Animation controller? Also, ensure you are using the most recent version of the package. Does the included animation controller work?

    If it is still broken, can you please post screenshots containing the import settings of your model? (All 3 tabs, please! :))

    (Also, last I checked, Mixamo is offering free animations from their site. They'll probably be higher quality than what I can provide.)
     
    Last edited: Feb 12, 2016
  20. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    The easiest way to stop the agent from getting too close would probably be to add a navmesh obstical to the player.

    Unfortunately Paragon AI cover cannot do that. All it does is mark a potential spot to take cover, but has no bearing on whether or not the agent can see a target in that location.
     
    Last edited: Feb 12, 2016
  21. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    I downloaded the package today, It does have the animator mask. It is funny you mentioned it I am using the animation pack from Maximo as well as one of their models for testing, the default animation controller does the same thing though and the only weird thing I can think of doing was that I changed the import settings on all the mixamo animations and the mixamo character from generic to humanoid but that didn't make much of a difference it seems. The problem could always just be me I don't have much experience with animation in general. Here are some screen shots. tab1.png tab2.png tab3.png
     
  22. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    For every animation your agent is using, make sure loop time is checked in the 3rd tab. I bet each animation is just playing once and then not looping. Make sure you get every animation, and not just one (there can be more than one in each file), or just the model.
     
  23. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    Checking loop time had no effect, I checked it in the animations used in the animation controller and on the model the avatar is built from. I did notice that when I create a new Paragon AI all the linked components in the animator, base, gun ect.. are empty but whenever I try to manually assign anything to the gun script's linked components the editor console gets spammed with errors:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:190)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7091)

    I am not sure why the linked components don't get assigned, is this normal or possibly the source of the issue?


    Edit: This was the issue although I can't assign the linked components in the gun script so the AI can't fire at all and the rifle (using the ufps rifle) doesn't line up in the hands right but the other animations work now. Also all AI in the scene even the prefabs that came in the package all seem to gravitate to 0,0 in the world for some reason.
     
    Last edited: Feb 12, 2016
  24. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I messed up the custom editor in the current version. Switch the inspector to debug mode. I'll try and get a fix out soon. :)

    Apologies to anyone affected by this glitch!
     
    Last edited: Feb 12, 2016
  25. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    I downloaded animations from Mixamo and rigged my model there but this didn`t change results. (Same old scateboarding agent)

    You will get little help from users describing their numerous agent setup fails untill you inspect the matter with your own eyes.
    Best thing to do is that you`ll go thru the Mixamo pipilene yourself and if you`ll fail, you`ll will notice possible glitches first hand.But if you`ll succeed you might as well do step by step Tutorial on Agent setup using mixamo animations.

    Mixamo`s Rifle Pro pack contains all nessesary animation clips for Agent setup. So you`ll have all you need to investigate this issue.
    P.S.
    One thing i noticed though that may be of any help in finding glitch : Once i set up Avatar mask(Draged my model`s avatar in to "Use skeleton from" field and imported skeleton) and Aplied it to Paragon Animation Controller and did rest of the following operations i still got scateboarding agent. Then i checked Avatar mask and saw that "use sceleton from" field became empty saing : None(Avatar)
     
  26. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    I have got the mixamo animations from the pro rifle pack working on a mixamo rigged model, you just need to check all the loop time boxes on the animations and the character to fix the "skateboarding" I had the same problem but with the updated version renamed "Tactical Shooter AI" the editor is a bit broken so they can't shoot. Other than that the animations work. I also set the avatar and all the animations from generic to humanoid in the import settings as well if checking the loop time box doesn't fix your problem.
     
  27. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I will try and get a bugfix out ASAP for the editor issue. This is embarrassing.

    Enabling loop time for all models and animations should work, but I'm not sure why that's not the case for you. I'll look into it more.

    Do you have a link to the pack in question?

    In the meantime, cross reference your set-up with one of the default prefabs and animation controllers. There is probably one or two settings improperly set that's bringing the whole thing down. Of course, it may be due to my custom editor glitch. Deleting the editor scripts may provide a temporary solution, at least until I can publish a fix.

    Set the inspector mode to debug or delete the custom gun editor script for what should be a quick fix to the shooting problem.
     
    Last edited: Feb 14, 2016
  28. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Submitted bugfix for the custom editor bug.
     
  29. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    Unfortunately that doesn't seem to be possible. The UFPS health component must be present on the Player; if it isn't, Unity will hang as soon as enemies fire and must be force quitted. And as soon as it is present, it will intercept the Damage() calls made from UFPS.

    Disabling the UFPS health component gets you sort of half-way there, but then there are other issues, and damage from enemies is only occasionally registered.
     
  30. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Any way I can keep to AI to a certain distance of me (Player) and keep shooting ?

    I disabled Melee and I have set Min Dist to Fire Gun to let say 10.

    When < 10 : AI just stop shooting , not doing any Melee but still pointing his gun in my face :)

    Any clue ?

    thx
     
  31. Nizraan

    Nizraan

    Joined:
    Apr 1, 2014
    Posts:
    6
    How Destroy enemy dead body. I adjust Time until body destroy after death.that is not working.
     
  32. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    https://www.mixamo.com/store/#/ - ProRiflePack is the lowest left baner with swat guy holding m4 carbine.
    Rig your model at their page to get mixamo rig on it and you`re good to go. If you`ll ,ake things work please make step by step tutor including mixamo steps for they have differend file format offerings ect.
    Cheers!
     
  33. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    Are you really asking the author for a tutorial when I literally told you how to set up mixamo animations and characters. I'll go though it again:
    1) In Mixamo download the animations and characters as .FBX or .UnityFBX.
    2) Import the animation pack and character into your unity project.
    3) Animations and characters from Mixamo are set to generic by default I set them to humanoid so here is how to do that
    4) Go to all the animations and character prefabs you just imported, click on them and navigate to the "Rig" tab and change the rig from generic to humanoid.
    5) Now do the same thing again but go to the Animations tab and check the "Loop Time" box.
    6) Create a new Paragon AI animation controller and drag the mixamo animations to the appropriate spots.
    7) Create new paragon AI agent with the animator controller you just created attached to your mixamo character.

    These are the steps I used to setup Mixamo animations and it works without "skateboarding" as you called it, you just need to make sure your import settings are right.
     
  34. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818

    A navmesh obstical will push the agent back to the appropriate range, but that may not be the behavior you intend. Adding a preferred fighting distance for agents not in cover is tough because you need to deal with walls and height variations and balconies and the like. In the meantime, I'd recommend adding more cover nodes to your scene.

    That's a glitch. I was intending on removing the dependency on separating the agent's ragdoll from the navmesh agent, but reverted before releasing the last version, which has caused problems as I forgot to undo everything. It's a simple addition of one line; I can post it once I get back to Unity.

    That's really odd. Maybe it's calling all methods on a different object, and thus not reaching your HUD script. I seem to recall something about UFPS generating an extra object for hit detection, which would explain the problem, but I can't double check ATM. Damage still works, right- your player can die, but the HUD is not updated, correct?

    In the meantime, I suppose you could link your UFPS health script to the HUD script and access the appropriate variable via something like healthScript.healthVariable, but that would force you to access the value every frame. Or, change the name of your HUD script's damage method and make the UFPS health script call it, but that would force you to hack open the UFPS code, so, again, not the best solution.

    I'll look into it.
     
  35. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    I did setup Agent using Mixamo pipeline. But animations on same rig look perfect on website and ugly in Unityafter swiching rig and animation clips to Humanoid.As if Ai got cerebral palsy during conversion process. It behaves predictibly well. So i guess it is time for tedious muscles tweaking to mitigate this rig glitch. And all animations Root transforms got out of wack after swiching them to humanoid type. But this is to be complained to Mixamo support team i guess.
    squared55 You`re the man!!!
    Cheers!
     
  36. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Rigged Model comes from Mixamo at 0.01 scale of what it was when i uploaded it to website for autorigging. Not sure why. Will try to look in to that.
     
  37. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    squared55 How can i make agent shoot random capacity bursts (So it would shoot first burst 3 shots, another burst 5 shots, ) could you make shots per burst random value from 1 to whatever number?
    And is it possible to make Paragon animation controller to be able to have more animation clips for any given state (Few for each and not just one) So user could define how much clips he wants to set for Idle, and How much for Firing etc.
    Also would be great to add prone animations to Agents to make them more diverse.
     
  38. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    There are some settings on the animations tab you need to uncheck and some dropdown options that need to be changed- compare the settings in the Mixamo animations with the default Paragon animations. I had to change a bunch to stop them from walking on their toes, leaning backwards, and generally flailing around the place. Unfortunately, I can't remember the specifics.

    You can set a range for the number of bullets shot per volley with the min and max rounds per volley variables. So, it goes

    1. Number of shots per clip (Number of shots before playing the reloading animation)

    2. number of bursts per volley (Number of bursts that will be fired before taking a break, but the reload animation is not mandatory)

    3. number of shots per burst (Make this greater than 1 for, say a 3-shot-burst assault rifle)

    4. number of pellets per shot (Make this greater than 1 for a shotgun)

    Currently there is no way to have Paragon generate a controller with multiple animations for each state. If you want to do it right now, you'd need to do it yourself. :)
     
    Last edited: Feb 16, 2016
  39. Axid02

    Axid02

    Joined:
    Sep 26, 2014
    Posts:
    5
    With UFPS while having my agent on Tactical/Search it seems to only start shooting when I crouch (press shift), otherwise it just walks close to the player without shooting. Any ideas?
     
  40. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    There's probably a collider blocking the target that gets moved out of the way when you crouch. Try making it so that the player is on a physics layer excluded from the layerMask in the Controller.
     
  41. Axid02

    Axid02

    Joined:
    Sep 26, 2014
    Posts:
    5
    That worked, thanks!
     
  42. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    If anyone manages to have agents with proper working animations please share your knowledge!
    Thanks!
     
  43. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    squared55
    Do you have Agent spawners of any sort ?
     
  44. Nizraan

    Nizraan

    Joined:
    Apr 1, 2014
    Posts:
    6
    player When near to the AI Agent, then AI Agent run towards to the player(near) & Not Damage (Get Stuck). Any Solution for that
     
  45. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    No, that's something you'll have to implement yourself.

    I'm sorry, but I don't understand what you are asking here.
     
  46. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    Can you give us an estimated time on when the patch for the editor will be available on the asset store?
     
  47. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I just got the confirmation email actually... but it's not showing the updated version number on the asset store, so I don't know. Perhaps I meant to change it but forgot. Lemme know if the bug vanishes.

    For future reference, though, the asset store submission process is a black hole- once the submission goes in, you have no idea how long it will take to get a response. :)
     
    Last edited: Feb 18, 2016
  48. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    ?How do i destroy(Deactivate) ParagonAi Gameobject to be pooled again by this script:



    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;

    public class SpawnController : MonoBehaviour
    {


    private GameObject enemySpawn;
    public GameObject[] enemyType;
    public int maxEnemies = 12;
    public int maxEnemiesMem = 48;

    List<GameObject> enemies;
    public static int numEnemies;


    private int spawnRange = 100;
    private int minSpawnRange = -100;
    private int enemySwitch;



    // Use this for initialization
    void Start ()
    {
    enemySwitch = 0;
    numEnemies = 0;
    enemies = new List<GameObject> ();
    for (int i = 0; i < maxEnemiesMem; i++)
    {
    GameObject obj = (GameObject)Instantiate (GetEnemies ());
    obj.SetActive (false);
    enemies.Add (obj);

    enemySwitch += 1;
    if (enemySwitch > 4)
    {
    enemySwitch = 1;
    }
    }

    }

    // Update is called once per frame
    void Update ()
    {

    while (numEnemies < maxEnemies)
    {
    SpawnEnemies ();
    }

    }

    void SpawnEnemies()
    {
    Vector3 spawnLocation = Random.insideUnitSphere * spawnRange;

    Vector3 finalLocation = new Vector3 (spawnLocation.x, 0, spawnLocation.z);

    if (float.IsInfinity (finalLocation.x) || float.IsInfinity (finalLocation.y) || float.IsInfinity (finalLocation.z))
    {
    finalLocation = new Vector3 (5, 0, 20);
    Debug.Log ("fixed infinity");
    }

    if (numEnemies < maxEnemies)
    {
    for (int i = 0; i < enemies.Count; i++)
    if (!enemies .activeInHierarchy)
    {
    enemies .transform.position = finalLocation;
    enemies .transform.rotation = Quaternion.identity;
    enemies .SetActive (true);
    numEnemies += 1;

    break;
    }

    }
     
  49. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Script is from this tutorial:
     
  50. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    In BaseScript there`s this function:


    //Kill AI///////////////////////////////////////////////////////////
    public void KillAI()
    {
    //Check if we can actually do this, to stop errors in wierd edge cases
    if(this.enabled)
    {
    if (combatBehaviour)
    combatBehaviour.KillBehaviour();
    if (idleBehaviour)
    idleBehaviour.KillBehaviour();

    //Call method on other scripts on this object, in case extra stuff needs to be done when the AI dies.
    gameObject.SendMessage("OnAIDeath", SendMessageOptions.DontRequireReceiver);
    //GameObject.Destroy(gameObject, timeUntilBodyIsDestroyedAfterDeath);
    GameObject.Destroy(gameObject);
    }
    }

    Should it be separate script with something like that:


    using UnityEngine;
    using System.Collections;

    public class DeactivateGameobject : MonoBehaviour {


    public void OnAIDeath ()
    {
    Invoke ("Destroy",2f);
    }

    void Destroy()
    {
    gameObject.SetActive(false);
    }
    }

    This didn`t work for me.
    ////////////////////////////////////////////////////////////////////////////////////////////////
    I want dead agents dissapear after some time so they could respawn again.
    Like In team deathmatch