Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Tactical Shooter AI - Asset Store Pack

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

  1. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Hi,

    I'm guessing that there's a problem with the AI Controller's layermask. Make sure that its layermask includes the physics layers that your level elements are on, but exclude the ones the player is on. If you're having trouble, try setting it to nothing, and then 1-by-1 add back all the layers that you can without reintroducing the problem.

    Make sure that the layermasks on the cover nodes also match those of the AI Controller.

    (Also, note that the layermask is NOT the same thing as the object's physics layer- one is a script variable, the other is the dropdown at the top of every object. You can select multiple physics layers in a layermask but only one layer for the layer dropdown.)
     
  2. gringan

    gringan

    Joined:
    Oct 27, 2016
    Posts:
    42
    Hi.

    I m trying to spawn AI agents.

    If i use IA agents without spawning them, all works very well.
    if i try to instanciate an IA agent prefab, all the IA agents on the map start ignoring me. ( even with target priority set to 1 and the right teams parameters).
    I really dont understand what is happening.
    I have 0 errors and 0 warnings but all agents are ignoring me.

    I also tryed with an asset : Ultimate spawner, same result. Each time the spawner instanciate a prefab of ia agent, all the agents stop attacking me and ignore me. They dont aggro me when i walk on them.

    After some test, i have found that :

    - If i kill the spawned ia agent , all others agents start attacking me.
    - If i instanciate a non agent prefab , all work well with other IA agent.
    - If i instanciate a lot of agents, sometimes i have 1 that aggro me and all others spawn aggro me at same time. It seems only one doing damage but all others agents plays animations.

    Any idea on what is happening and how i can fix ?

    I have a video to show :

    In the video , you can see that mobs aggro me if i dont use spawn, but i i try to spawn even 1 mob (yellow gun mob in video), all others ia agent ignore me.

    EDIT :

    Today i tryed to add a script on controller :

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using TacticalAI;
    6.  
    7. public class MyIAControllerManager : MonoBehaviour {
    8.  
    9.     Target[] ennemies;
    10.  
    11.     // Use this for initialization
    12.     void Start () {
    13.         ennemies = TacticalAI.ControllerScript.currentController.GetCurrentTargets();
    14.  
    15.         Debug.Log("TARGETS :" + ennemies.Length);
    16.  
    17.         foreach (Target i in ennemies)
    18.         {
    19.             Debug.Log("i + UID " + i.transform.name + " + " + i.uniqueIdentifier);
    20.         }
    21.     }
    22.    
    23.     // Update is called once per frame
    24.     void Update () {
    25.  
    26.         ennemies = TacticalAI.ControllerScript.currentController.GetCurrentTargets();
    27.  
    28.         TacticalAI.ControllerScript.currentController.UpdateAllEnemiesEnemyLists();
    29.  
    30.         Debug.Log("TARGETS :" + ennemies.Length);
    31.  
    32.         foreach (Target i in ennemies)
    33.         {
    34.             Debug.Log("i + UID " + i.transform.name + " + " + i.uniqueIdentifier);
    35.         }
    36.  
    37.     }
    38. }
    39.  
    Updating enemies list seems to work for aggro but i still have this error :

    NullReferenceException: Object reference not set to an instance of an object
    TacticalAI.NavmeshInterface.Update () (at Assets/Tactical Shooter AI/Tactical AI/Csharp/Helper Scripts/NavmeshInterface.cs:51)



    Thank you for your help.

    best regards.
     
    Last edited: Feb 10, 2017
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    Is there a demo scene available of this asset to try?
     
    Last edited: Feb 10, 2017
  4. gringan

    gringan

    Joined:
    Oct 27, 2016
    Posts:
    42
    Sorry, no. I dont have demo. My project take17GB.

    I really dont understand why i had to add in LateUpdate to make it work:

    Code (CSharp):
    1. TacticalAI.ControllerScript.currentController.UpdateAllEnemiesEnemyLists();
    I also made it for navmesh issue. Now Agents aggro me
    .
    But i m trying to understand why that doesnt work without refreshing Ennemies list.

    Can you explain me please ? Thanks.
     
  5. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    I was asking the author for a demo scene of the asset not your project. Sorry for the confusion.
     
  6. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    524
    @magique The basic scene shown is part of the package. I know I'm not the author, but it is a basic demo scene. There are actually a couple of example scenes, all using very basic geometry.
     
  7. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    I mean that I would like to try it in a WebGL demo or stand-alone demo before buying. There aren't even any demo videos. I see the tutorial videos, but they don't really show it in action.
     
  8. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    524
    @magique Yeah, he doesn't have a web demo or webgl demo.
     
  9. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I'm honestly not sure why that would happen. If I had to guess, I'd say that the controller that is initialized at the start of the game somehow ignores all the agents due to the multi-scene thing you have going. Then, when you do something to trigger the recompilation of the target lists, now the AI's recognize the controller that is currently active.

    Try calling that line of code right after you spawn each AI. If it works, you'd get better performance than calling it every LateUpdate.
     
  10. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    Perfect. I'm actually using RFPS so the demo should help evaluate your asset even more for my purposes.
     
  11. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    Last edited: Feb 11, 2017
    squared55 likes this.
  12. gringan

    gringan

    Joined:
    Oct 27, 2016
    Posts:
    42
    Edit :
    I tryed like this and that dont work. Mobs dont aggro me when i start game :( ( see code )
    It work if i use LateUpdate().

    I really dont understand what is happening :( I need help to make this work without having to use LateUpdate.

    I m not sure about multiscene because if i dont spawn anything, all agents see and attack me.

    That happens only when i try to spawn an agent.

    Also , when i kill an spawned agent, i have to use onAiDeath() to launch :

    Code (CSharp):
    1. SpawnableManager.informSpawnableDestroyed(mob);
    if i dont do this, the spawner dont know the agent is dead and stop spawning.

    Code (CSharp):
    1. using UnityEngine;
    2. using UltimateSpawner;
    3. using TacticalAI;
    4.  
    5. public class MySpawnManager : SpawnManager
    6. {
    7.     Target[] targets;
    8.  
    9.     public override void onSpawned(Transform spawnedObject)
    10.     {
    11.         Debug.Log("onSpawned Overrided");
    12.  
    13.         TacticalAI.ControllerScript.currentController.UpdateAllEnemiesEnemyLists();
    14.  
    15.         targets = TacticalAI.ControllerScript.currentController.GetCurrentTargets();
    16.  
    17.         if (targets.Length <= 0)
    18.         {
    19.             Debug.Log("Houston we have a problem here");
    20.         }
    21.  
    22.         Debug.Log("Amount of Targets :" + targets.Length);
    23.  
    24.         foreach (Target i in targets)
    25.         {
    26.             Debug.Log("Name + UID " + i.transform.name + " + " + i.uniqueIdentifier);
    27.         }
    28.     }
    29. }

    Edit :

    I have a reply from devs of SpawnerManager:

    The ‘onSpawned’ event is called just after ‘Awake’ and before ‘Start’ so if Tactical Ai Shooter needs to do some setup code from Start before it can update the enemy list then this could be the problem. It sounds like the Tactical AI method you use needs to be called later.


    Unfortunately the problem seems to lie with Tactical AI because it expects you to have your enemies in the scene and not spawned in dynamically (Which is common in Unity games due to the prefab system).

    I dont understand , your asset is able to spawn enemies dynamically ?

    I tryed to use a bool to do it only once in LateUpdate. But that dont work. So right now it refresh once every second to be working.
     
    Last edited: Feb 11, 2017
  13. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818

    The AI definitely supports the instantiation of prefabs- I posted a few simple spawner scripts a couple pages back. But, I've done all my testing in a single scene- multiscene might have some issues that I haven't come across. (Also, this asset has never played nice with )

    Are you just using Instantiate to spawn the agents, or something else?

    Do you have a different AI Controller in each one of the scenes used in the multi-scene?

    Maybe setting the controller to not DestroyOnLoad could solve the problem.
     
    Last edited: Feb 11, 2017
  14. gringan

    gringan

    Joined:
    Oct 27, 2016
    Posts:
    42
    Hi.

    I m using Ultimate Spawner to spawn ennemies. But i also used your script :

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. public class SpawnPoint : MonoBehaviour {
    4.     public GameObject[] prefabs;
    5.     public Transform[] spawnPoints;
    6.     void Spawn () {
    7.         RaycastHit hit;
    8.         Vector3 spawnPos = transform.position;
    9.         if (Physics.Raycast(transform.position, -Vector3.up, out hit))
    10.         {
    11.             spawnPos = hit.point;
    12.         }
    13.         Instantiate(prefabs[Random.Range(0, prefabs.Length-1)], spawnPoints[Random.Range(0, spawnPoints.Length-1)].position, transform.rotation);
    14.     }
    15. }
    16.  
    And its the same thing, all the IA agents ignore me after the spawn.

    I m using a single controller wich is in the main scene. (base scene). All agents are in the second scene (the scene that is added on the main scene on load)

    Code (CSharp):
    1. public void LoadScene(int sceneId)
    2.     {
    3.         SceneManager.LoadScene(sceneId, LoadSceneMode.Additive);
    4.  
    5.     }
    All works perfectly if i dont use spawn.

    I have set the controller to dont DestroyOnLoad but dont need because the controller is on main scene. (base scene)

    But there is something i noticed :

    All my IA agents are on the "second scene"
    But the spawned IA agent appears on "base scene".

    Maybe that is the problem ?

    Please, i really need to fix this.

    Thanks for your help.
     
    Last edited: Feb 11, 2017
  15. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    Is there some documentation anywhere showing how to use this with RFPS? The stand-alone demo you provided uses RFPS so I figure there must be a tutorial out there somewhere.
     
  16. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    There is an RFPS integration document included with the package- it's a .txt file. Copy/Paste the lines of code to the locations indicated, and you should be good to go. I also posted the instructions to this thread a page ago.

    On a related note, RFPS released an update recently. The release notes only say there are changes to the RFPS AI prefabs, which probably won't affect integration at all, but in any case, if you run into issues please let me know. :)

    I imagine that is related to the issue. I can take a brief look now, but I won't have the time to fully look into it until Monday or Tuesday at the earliest.

    EDIT: So, I just tried a set-up where I had an agent in a second scene and the controller in the first. After 600 frames, I spawned a new agent in the second scene, and everything worked fine. Spawning in new agent in the first scene with the AI Controller also worked perfectly. Is there any more information regarding your scene set-up that you can give me?
     
    Last edited: Feb 12, 2017
    magique likes this.
  17. gringan

    gringan

    Joined:
    Oct 27, 2016
    Posts:
    42
    Hi. I finally have found the guilty.

    Its my safe zone.

    I set the player target priority to -1 when i m Inside the safe zone.

    The spawn occurs when i m inside this safe zone and this is causing my bug.

    You cant have the player target priority to -1 when a spawn occurs.

    So i have fixed by overriding the spawn method like this :

    Code (CSharp):
    1. using UnityEngine;
    2. using UltimateSpawner;
    3. using TacticalAI;
    4. using Devdog.General;
    5.  
    6. public class MySpawnManager : SpawnManager
    7. {
    8.     Target[] targets;
    9.     vp_FPPlayerEventHandler m_Player;
    10.     protected GameObject gringanCamera;
    11.     protected bool isPlayerSafe = false;
    12.  
    13.     private void Awake()
    14.     {
    15.         if (m_Player == null)
    16.         {
    17.             m_Player = GameObject.Find("Gringan").GetComponent<vp_FPPlayerEventHandler>();
    18.         }
    19.  
    20.         gringanCamera = GameObject.Find("Gringan/FPSCamera");
    21.     }
    22.  
    23.     public override void onSpawned(Transform spawnedObject)
    24.     {
    25.         Debug.Log("onSpawned Overrided");
    26.  
    27.         targets = TacticalAI.ControllerScript.currentController.GetCurrentTargets();
    28.  
    29.         if (targets.Length <= 0)
    30.         {
    31.             Debug.Log("Houston we have a problem here");
    32.         }
    33.    
    34.         Debug.Log("Amount of Targets :" + targets.Length);
    35.  
    36.         foreach (Target i in targets)
    37.         {
    38.             Debug.Log("Name + UID " + i.transform.name + " + " + i.uniqueIdentifier);
    39.         }
    40.  
    41.         gringanCamera.GetComponent<TacticalAI.TargetScript>().targetPriority = 1;
    42.  
    43.         TacticalAI.ControllerScript.currentController.UpdateAllEnemiesEnemyLists();
    44.  
    45.         if (isPlayerSafe)
    46.         {
    47.             gringanCamera.GetComponent<TacticalAI.TargetScript>().targetPriority = -1;
    48.         }
    49.  
    50.     }
    51.  
    52.     void OnMessage_PlayerIsSafe(bool b)
    53.     {
    54.         isPlayerSafe = b;
    55.     }
    56.  
    57.     protected virtual void OnEnable()
    58.     {
    59.         if (m_Player != null)
    60.             m_Player.Register(this);
    61.     }
    62.  
    63.     protected virtual void OnDisable()
    64.     {
    65.         if (m_Player != null)
    66.             m_Player.Unregister(this);
    67.     }
    68.  
    69. }

    Best Regards.
     
    squared55 likes this.
  18. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Thanks for letting me know. I look into adding a check that rebuilds the target lists whenever a TargetScript's priority is altered.
     
  19. gringan

    gringan

    Joined:
    Oct 27, 2016
    Posts:
    42
    Hi.

    I am very happy to be able to help. I hope it will be useful to others.

    Best Regards.
     
    squared55 likes this.
  20. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Hi

    Can we make an ennemy using multiple ranged and melee attacks and make him choose one depending on a situation ?
     
  21. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Right now, you can give each agent 1 melee attack, a primary fire, and a secondary fire (like shooting a missle or throwing a grenade). Unfortunately, the package does not currently support anything beyond that out of the box.
     
  22. barcode802

    barcode802

    Joined:
    Apr 6, 2014
    Posts:
    32
    Having an issue with UFPS + Tactical AI. The enemies can't damage the player. I'm not sure what I'm doing wrong as I'm pretty sure I did all the steps in the manual and tutorial video on youtube and searched this forum as well. I have the latest versions of both assets with latest Unity version and am also using Inventory Pro + Playmaker in the project so don't know if those might cause conflicts (but I have this issue when doing the setup in the demo Tactical AI scene provided - haven't tried integration with Inventory Pro yet)
     
    Last edited: Feb 14, 2017
  23. gringan

    gringan

    Joined:
    Oct 27, 2016
    Posts:
    42
    Hi.
    Did you followed this tutorial :


    Also check the Tactical AI prefabs/Bullets folder and for each bullet , check if you have "Damage method name" to Damage and dont forget to apply the right Layer Mask (maybe "everything")

    Also check the UFPS projectiles folder prefabs in inspector and set "Damage mode" to Unity message and "Damage method name" to Damage to all bullets
    This works for me, i m using UFPS , Tactical AI, Inventory Pro too :) (I got playmaker 2 weeks ago but all these Arrows get me mad, i prefer code)

    Hope this can help you.

    Best.
     
  24. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I liked a lot the demos and i have some more questions :
    - Can we use our own custom legacy animations without using Mecanim and Paragon animations set ?
    - It is hard to add a second weapon for a soldier ? for example make it switch shotgun to long range weapon when the player goes far away.
    - Can we make npc carrying a shield that would protect them from shots when oriented towards player ? And have NPC lower the shield and fire ? Perhaps we coule be able to adjust their rotation speed towards player for Npc tanks that would be slower.
    -Can we add some shield ability for soldiers and player for Sci Fi games ?
    They could activate a shield effect that could only be destroyed with laser weapons, before the NPC can take any damage ?

    I ask that because i would need some customisations to make something different from the default soldier while keeping it's AI general behaviour.
     
    Last edited: Feb 14, 2017
  25. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Double check the layermasks on the bullet prefabs; make sure they include the layer that you player is on.

    1) TSAI uses mecanim for all it's animation blending, but you can use generic rigs/animations. You would just need to create a unique animation controller for each model/rig.

    2) I am not sure, I've never attempted it.

    3/4) I've implemented a few different shield types with the precursor to TSAI. The first is a riot shield sort of deal, that the enemy just holds in front of them as they march towards the player. This will require a unique move/idle/fire animation for this enemy, but shouldn't require any extra coding besides removing the hitbox component from the shield's collider. He also does turn slower than other enemies.

    I also have a bubble shield that lowers whenever the enemy wants to fire, so the player must time their shots right or use a grenade. This will require extra coding as this system is not included with the package, but it is possible.

    Finally, there's the regenerating shields, static health system that is included with the package and used by all agents by default. This seems close to what you're looking for, but the shield won't be immune to non-laser weapons while also allowing them to do comparable damage to the laser when the shield is down.
     
    Last edited: Feb 14, 2017
  26. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    This is not necessary as most AAA games ennemies most of the time uses only ranged and melee weapons, but this could be good for some wizards able to cast different magic projectiles or zone effects.
    Can the AI fight with melee only, like try to approach the player using covers or directly approach him without covers ?

    Yep, with some modifications on shield code, i should be able to change the dammage it receives depending on the weapon laser or not.
     
  27. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    This should be possible, yes.

    Finally, someone who wants to use this feature! :)
     
  28. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    I'm a little stuck on this integration. I did all the code changes indicated in the text file, but I'm confused on the layermask for the AI. In the file it says

    Ensure that the AI Controller has it's layermask set to include the objects that make up your level
    But I can't find where this layermask is set for the AI Controller. I can see a public layermask field in ControllerScript, but I don't see this script being use for the AI Agents anywhere. I'm sure it must be somewhere, but I just can't find it.

    Also, I noticed that the AI Agents are all too small compared to the RFPS player. I had to scale them up to 1.2 to look correct.
     
  29. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    The ControllerScript variable is what that line is referring to. All agents in the scene use that layer mask for the purposes of determining line of sight.
     
  30. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    That's my problem. Where is the ControllerScript? I even right click on ControllerScript.cs and say Find References in Scene, but it doesn't find anything. And I definitely have a Team 2_Rifle AI agent in the scene. I also look at the scripts attached to the AI agent, but don't see that at all.

    [EDIT]
    Here are the scripts attached to the AI Agent:

    upload_2017-2-18_14-31-40.png
     
  31. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    Apparently, I had to add the ControllerScript to the AI Agent. I didn't see that anywhere in the instructions. I also had to add tags for AI Controller and Cover. Now the AI is moving around and shooting me.

    However, the animations aren't playing. I see some mention of this in the readme file, but I don't see anything wrong with the animations in the controller.

    Also, my bullets don't seem to have any affect on the enemy. Though he's able to kill me.

    [EDIT]
    The only thing I see wrong with animations is that when I look at the Rig for each one in the inspector, it says Source Missing (Avatar). I would assign an avatar, but I can't find any in the
    project.

    [EDIT 2]
    Weird, but I re-imported parts of the package and now the avatars are assigned and solider is animating. Still trying to figure out why RFPS player can't damage it though.

    [EDIT 3]
    Finally got it. Had to make sure AI Agents were on Default layer and level collisions were on RFPS World Collision.
     
    Last edited: Feb 19, 2017
  32. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    - How works covers , can we place our own cover points ? Does it uses Raycast for more precision ?
    (this is how i made my own cover system with Raycast to determine where are hidden spots among the list in the cover and find the shortest path calling a navmesh function)

    - Can we make our own strategies ? change strategie when some number of agents are down ?

    - Can we customize and agent to berserk with a shotgun ignoring covers ?
    Or make an agent move to player and execute a custom action instead of melee ?

    - I am not sure it will be easy to use my custom made characters and rigs ? Or use my own animations ?
    Must follow some rig or animations conventions ?

    - What needs my custom player character to be able to work with the plugin ?
    (I have already a controllable character with it's own weapons systems)
     
  33. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    I got RFPS working with Tactical Shooter AI, but I'm seeing an issue that's very strange. The AI soldiers can't seem to figure out where to shoot the player if the player is on the side of the agent. As long as the player is in front or behind, then the agent will face the player and fire at him. But as soon as the player goes off to the side, the AI agent continues to try to fire forward and doesn't turn to face the player. If the player crosses the 180 degree line from the front to the back (while being on the side of the agent), then the agent turns 180 degrees and tries to fire at the player as if the player is behind him. Any ideas what could be wrong?

    [EDIT]
    Also, any chance that we can get proper textures for the AI agent's weapons?
     
  34. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    @magique

    Ah, my bad. You need to create an empty game object and add the AI ControllerScript to this object. You should only have one ControllerScript per scene.

    I suspect that the issue you are currently having may be related to there being multiple ControllerScripts in the scene. If it turns out it's not, the parameters for tracking are in the AnimationScript and RotateToAimGunScript- I'd recommend reviewing these settings and making sure the tolerances are large enough. However, I can't say that I've run into your specific issue before. If you can post screenshots which display the values for each of the scripts on your agents I can try and help.

    Unfortunately, it is unlikely that I will be able to acquire textures for the default placeholder weapons. You could swap the model though, for instance, replacing it with a weapon from RFPS.

    Yes, and yes. The system supports cover which is manually placed as well as cover that is found dynamically at runtime.

    You can code custom behaviors, which can be changed at runtime. You can also use the inbuilt flanking/suppressing fire system.

    Yes. One such agent is included with the package.

    Yes, through the dynamic objects system.

    There are very few, if any restrictions on what rigs you can use. It supports generic and humanoid rigs. But you will need to supply your own animations if you use a generic rig.

    The only thing that may need modification is the damage system. Otherwise the agents can identify any transform as a target and act appropriately.
     
    Last edited: Feb 19, 2017
  35. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    That's great, thank you.

    1) Also does the AI take new decisions if it receives damages but can't see the player ?
    Like the player flanked to a wall and the AI is on the roof just above.

    2) Can AI handles verticality or must level design avoid it ? AI on different level heights and the player able to breal line of sight flaking to walls ?

    3) Can characters be aware of dynamic obstacles ?
    For example there is some vehicles with weapon helping them, are they able to avoid it in a good way when moving anywhere ? instead of only using navmesh agent avoidance that is too basic and bad.

    4) Does always agents AI move smoothly without blocking each other ? Navmesh Agent navigation without beeing aware of other characters proximity is not so great.

    5)And does agents take care to not stay in line of fire of another agent ?

    6) Can we tell an agent to stay within a zone volume, radius or box zone while fighting or waiting ?

    7) Can agents patrol randomly inside a defined zones ?
     
    Last edited: Feb 20, 2017
  36. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    Thanks for the info. I changed the scene so it has only one controller script on a new game object.

    As it turns out, that's not the problem. It was actually related to setting Performance Mode on. If I uncheck Performance Mode then the AI works correctly.
     
    squared55 likes this.
  37. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818

    1) The agent will attempt to keep a target in their line of sight if engaged in combat. They can react to "sounds" as well.

    2) Verticality works perfectly fine.

    3/4) The system uses Unity's navmesh system by default. You can use navmesh carving for better avoidance results, or you can use a different pathfinding system by modifying the Navmesh interface class.

    5) They pay no special attention to it.

    6) You can give agents a key transform that they will center their actions around.

    7) You can set agents patrol routes or set them to wander around, among other things.
     
  38. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I made many tests, actual Navmesh avoidance is not a real avoidance system. A good one have navmesh agents raycast around when there is agents blocking the path to determine free paths.
    With Unity Navmesh you will always have agents sliding againt others agents and it does not look good at all.


    5) my question was not detailled enought.
    Does agent stop firing if there is an agent moving in front of it ? Or is this friendly fire, or agents fire passing throught other agents ignoring them ?

    There is come things i can do, but i would have been happy to find in the plugin :
    - Dogs units and fast melee agents running like Borderlands game
    - Flying agents with jetpacks or flying units able to behave alone or in formation with ground units
     
    Last edited: Feb 20, 2017
  39. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    If you assigned the agents to the right physics layer and adjusted your layermasks accordingly, I assume they would would be treated as a wall and depending on your other settings, would stop firing. Beyond that, they don't pay any attention to friendly fire.

    Likewise, you could set the bullets to ignore the physics layer that friendly agents are on. You can also use your own bullet script.

    You could simulate hovering and flying by simply lifting your model up off the ground, but they would still be constrained to the same 2D movement system.
     
  40. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    234
    Hi i`m getting red error after updating TSAI that says this :
    Tag: A is not defined.
    UnityEngine.Component:set_tag(String)
    TacticalAI.ControllerScript:Awake() (at Assets/Paragon Shooter AI/Paragon AI/Csharp/AI Behaviour Scripts/ControllerScript.cs:34)

    what could that be?
    I can still play the game in editor but i`n afraid it can choke me later.
    I made tag A and placed it on GameController object still no changes?
     
  41. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I'm not sure why an error referencing a tag called "A" would be occurring. Have you modified the code in any way? What does line 34 of the script say?

    If the game runs without any adverse effects, you may want to try just commenting the line out.
     
    Last edited: Feb 28, 2017
  42. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    234
    Code (CSharp):
    1.  transform.tag = "AI Controller";
    Wierd:/
     
  43. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    If the game works without it, comment it out.
     
  44. AsafAmit

    AsafAmit

    Joined:
    Feb 14, 2017
    Posts:
    4
    Hey :)
    I've just started to mess around with your awesome AI, and I have a small problem.
    When I apply the "Team 2_Rifle" prefab in my own scene, I cant make him use the cover nodes I spread over the map.
    The agent seem to ignore them and only use dynamic covers.

    What may be the problem?
     
  45. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Check the layermask variable on the nodes and ensure they match the one on your AI controller.
     
  46. gringan

    gringan

    Joined:
    Oct 27, 2016
    Posts:
    42
    Hi.

    What is the best way if i want to use your AI for a non humanoid ? ( no gun , no fire ) .
    I just want some beasts in game that only proc melee damage.
    Should i use avatar mask ? how to set the ai controller ?
    Thanks for your help .
     
  47. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Aside from manually checking off all the bones in your rig, and disabling the gunscript/removing the bullet prefab, the set-up should be the same.
     
  48. gringan

    gringan

    Joined:
    Oct 27, 2016
    Posts:
    42
    Thanks for your reply.

    ok for disabling the gunscript and removing the bullet prefab but where should i check off the bones ? Do u mean when creating the avatar mask ? (green dummy ?)

    Sorry for questions.

    Thanks for helping.
     
    Last edited: Mar 15, 2017
  49. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    182
    Hello. Does anyone know which settings I need to mess with so that AI units will stay between 100 to 200 meters away from each other when fighting each other? I am trying to stop their tendency to quickly run toward each other and fire at each other. I would like to keep a large distance between them all the time
     
    Last edited: Mar 20, 2017
  50. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Sorry for the late response. Yes, that's what I mean.

    I don't have the project open right now, but there should be a setting along the lines of "Min Dist To Target When Not In Cover" that you can adjust. They might still get closer if they can't get a line of sight to the enemy, but out in the open they should stop when they get to the distance specified.

    Besides that, you'll want to adjust the combat range parameters in the Cover finder scripts.
     
unityunity