Search Unity

Tactical Shooter AI - Asset Store Pack

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

  1. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    1) Try speeding up your standing up/crouching transitions in mecanim.

    2) Those aren't in the package at the moment, but they can be put on the to-do list. Unfortunately, you'd need to modify the animation script as well as create a custom behavior for this to work. Then you'd have to deal with the problems associated with an agent changing targets in the middle of running to a target. Also, getting the animations right when the agents turn around 180 degrees is probably going to be tricky.

    3) There currently is no master pause function. Aiming can be enabled /disabled by calling Activate()/Deactivate() on the RotateToAimGun Script. As for stopping the agent's movement, I imagine the easiest way would just be to set the navmesh agent's speed to 0.
     
  2. dreinhart

    dreinhart

    Joined:
    Dec 5, 2015
    Posts:
    9
    Great package! Is there a way to get the agents to stop short of their target and fire, rather than running directly to the target and standing on top of it? I'm using this in a FPS game and the agents continue approaching the camera (target) until they are directly on top of it.
     
  3. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Put a navmesh obstacle on the target.
     
  4. dreinhart

    dreinhart

    Joined:
    Dec 5, 2015
    Posts:
    9
    perfect, thanks!
     
  5. dreinhart

    dreinhart

    Joined:
    Dec 5, 2015
    Posts:
    9
    How can i get agents to stay in cover longer, or move between cover nodes, rather than rushing toward the target? (to behave more tactical, less berserker. I am using Tactial AI type) Would I need to adjust values in the base script, or the cover finder script?

    I have Cover Nodes set up, and the agents are using them, but only for a split second before advancing toward the target.
     
  6. dreinhart

    dreinhart

    Joined:
    Dec 5, 2015
    Posts:
    9
    UPDATE: actually, it looks like the agents are running right by the cover points once they're aware of a target. Is there a setting I'm missing?
     
  7. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Just a general heads up, support will likely be slower this month.

    Have you properly set up your layermasks? (On the controller, bullets, etc.)
     
  8. bluesubstance2

    bluesubstance2

    Joined:
    Jun 1, 2014
    Posts:
    11
    Do you have any plans on adding RFPS support? :)
     
    EvilGremlin likes this.
  9. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    How hard would it be to add an extra state to the enemies, so that when you shoot them they can fall back a bit and or play a being hit animation? Is this a planned feature or should I go ahead and implement it myself?

    Cheers!
    Gaz.
     
  10. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I'll put it on the list, but there are other things I want to get done first.
     
  11. dreinhart

    dreinhart

    Joined:
    Dec 5, 2015
    Posts:
    9

    Thanks! Works great after tagging and setting everying on proper layers. Thanks for the support!
     
  12. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Cant recall if I have asked this yet or not, can you make agents forget they have seen you? Once they see me they know im there, I like it when theyre searching for me.. so when I die for example id like to flag them all as not having seen me, but it seems like they know where I am after I die and return.
     
    hopeful likes this.
  13. animatedtako

    animatedtako

    Joined:
    Jan 10, 2013
    Posts:
    7

    Thanks for getting back to me! I'll take a stab at some of these and see how it goes. If you're taking votes for future features, I would throw my hat in for hit reactions. Do you have a public facing list of potential future features?
     
  14. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    They automatically revert to their idle behaviours if you get far enough away from the last spot they saw you. I'd highly recommend reloading the whole scene on death though. I've seen quite a few UFPS games get panned because there are no consequences for dying if every enemy you kill stays dead.
     
  15. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Added one to the first page!
     
    Last edited: Dec 8, 2015
  16. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    Hi!
    I have noticed a problem with my agents, at a certain point in game, they stop walking to pursue my ufps player and doesn't do melee attack when i am closer. The only thing that works is fire and reload animation and rotation towars me. Why? No errors in the unity console.

    At that state the agents had acceleration =10000 and stopping distance =0 in navmesh agent component. ???

    I have tried disable dogging, rebake navmesh, enable and disable gun and cover script. No luck.
    The same happens whith an agent of my team have no enemy agent alive in the scene. The agent of my team then doesn't do wandering in spite of be tactical/wander

    Anyone had seen this? Regards

    Ps. I have found that isDodging variable never was restored to false, so i commented code that wait for setdestination (haspath) that variable assign. Till squared55 gives me a best solution
     
    Last edited: Dec 9, 2015
  17. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I've never seen anything like this before. Any more advice on how to replicate it? Is there a problem with the Paragon default agents?
     
  18. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    No, I think SetDestination must be replaced with calculatepath and setpath. In some cases HasPath doesn't work as expected. I think it is not a problem with Paragon.
    For me now, disabling HasPath and not setting isDodging to true is a dirty solution for now.
    Thank you for your support.
    I am more interested now for the behaviour os friendly agents where there is not more enemies. The don't wander. Any idea?
    Regards
     
  19. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Unfortunately, I don't have any quick fix for this, I've never seen a bug like this before. I'll look into it, but in the meantime, keep messing around with the settings.
     
  20. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    The first problem is simple to reproduce. Put a mesh obstacle with carve between player and agent with no path and haspath never get to true. There is no exit to loop and agent gets freezed.
    The second problem well, I am planning to exit scene when all enemies are dead.
    Regards
     
  21. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Thanks. I'll look into it when I get the chance. :)
     
    PicturesInDark likes this.
  22. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    Thank you very much for you for share thos excelent software, please continue with this.
    ;)
     
  23. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    Hi mate! Great setup for this. I'm having an issue that I fixed but then unity crashed before I could save and I cant remember what I did... (great right?)
    My enemies aren't moving or attacking me, I'm certain that its to do with the target script settings.
    Currently my enemies are set to team 2 enemy is team 1
    my player character (target script on the main camera) is set to team 1, enemy team 2.

    navmesh works fine too, that was made well before I fixed the issue before. (they even got the drop on me a couple of times which is always good XD)

    I'm sure that I'm missing something simple here... it's going straight over my head.
     
  24. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Make sure you actually set the enemy team number to 1 and not just made it so there was 1 element in the array.
     
  25. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    Thanks for the quick reply, the arrays are all fine, I was worried it was that so i've checked it a million times. I'm certain the fix was something to do with the target script on the player character but having tweaked it for ages I still cant figure it out. damn.
     
  26. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    I have some of the prefab soldiers that come with Paragon in the scene too, all lined up ready to shoot me. when it worked I was bloody terrified haha. but now still nothing. when I got it right everyone attacked at once.

    I feel like Schwarzennegger in Predator shouting "DO IT COME ON KILL MEEE!" XD
     
  27. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    I'm getting a null reference exception on the layermask. for target script.
     
  28. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Honestly? My advice at this point would be to start from scratch, assuming you haven't invested too much work into custom settings. It'll be easier than tracking down some obscure bug. Also note that by default the agents will fire at team 0, not 1, so I'd recommend adhering to that standard- It'll probably make things easier later on. :)
     
  29. dreinhart

    dreinhart

    Joined:
    Dec 5, 2015
    Posts:
    9
    I'm having trouble firing a bullet from the camera toward the direction it is facing. It fires forward in my direction, but not up and down. I've tried a number of things, including getting the main camera's forward rotation, and adding a gun barrel object and an empty game object on the end, and trying to use that to get the forward direction. No matter what I do, the bullets only shoot directly foward at the camera's eye level. Any ideas? Here are a few things i've tried... I've tried using the camera's forward, the gun barrel tip's forward, and tried calculating the vector between 2 points to get the correct vector, but the bullets still will not fire up and down.

    fireRotation = Quaternion.LookRotation(gunTip.forward);
    GameObjectbullet = (GameObject)(Instantiate (bulletObject, gunTip.transform.position, fireRotation));

    fireRotation = Quaternion.LookRotation(Camera.main.transform.forward);
    GameObjectbullet = (GameObject)(Instantiate (bulletObject, Camera.main.transform.position, fireRotation));

    Vector3 gunTipProjected = gunTip.transform.position + gunTip.transform.forward * 10;
    fireRotation.SetLookRotation(gunTipProjected - gunTip.transform.position);
    GameObjectbullet = (GameObject)(Instantiate (bulletObject, gunTip.transform.position, fireRotation));

    Thanks!!
     
  30. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Have you tried increasing the gun's maxFiringAngle variable? Does increasing the inaccuracy cause the bullets to move up or down? Does your character bend in order to aim at their target?

    Code (CSharp):
    1. //PS:  use code tags! :)
     
  31. dreinhart

    dreinhart

    Joined:
    Dec 5, 2015
    Posts:
    9
    Thanks for the code tag tip. I increased it max firing angle to 90, and also increased inaccuracy to 10, but it still doesn't move up or down. Attached is an image of my player object. I have a bullet spawn point, gun barrel, and camera, but when i get the forward direction of any of them, the y component of the forward vector is always 0. (See console in screenshot)

    here another thing i've tried with the BulletSpawn on my playerController:

    Code (CSharp):
    1.  
    2. fireRotation = Quaternion.LookRotation(bulletSpawn.forward);
    3. GameObjectbullet = (GameObject)(Instantiate(bulletObject, bulletSpawn.position, fireRotation));
    4.  
    Thanks again. I'm really enjoying working with your product!
     

    Attached Files:

  32. dreinhart

    dreinhart

    Joined:
    Dec 5, 2015
    Posts:
    9
    BTW, it seems to be the same issue described here, but i don think think Paragon AI the bullets have a rigidbody, so i can't use this solution using AddForce:
    http://answers.unity3d.com/questions/128632/fps-bullet-direction-help.html
     
  33. dreinhart

    dreinhart

    Joined:
    Dec 5, 2015
    Posts:
    9
    SOLVED: Not sure why, but this was caused by a Nav Mesh Agent i had attached to my player in order to make agents avoid getting too close. Tuned it off, and it works as expected. I'm going to go back to using Nav Mesh obstacle instead, though they agents still act unnaturally as they just run up to the edge of the obstacle and continue running in place.
     
    squared55 likes this.
  34. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    @squared55 - hi! I'm just implementing this into my game finally! I noticed on the AI vs AI demo that once one Team is destroyed, the other team walks to a destination and groups together, but doesn't Idle. If this is not part of the functionality, it would be good if the remaining AI forgot their targets, or destinations and just went idle until more enemy Team AI are spawned, Then they wait until a target is seen from Line of sight.
     
    squared55 likes this.
  35. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    They should revert to their idle behaviors- I believe the issue is that the idle behavior they're using never got the chance to select an enemy as a destination and as such they default into going to (0,0,0). I'll look into changing that for the next release.
     
    julianr likes this.
  36. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Hello, first off please allow me to say that my mind is completely blown at the quality and price.... seriously, this pack is allowing me to develop ideas I never dreamed I could do alone... so thank you!

    I am having problems with the enemy grenades, I can't seem to make the player hurt from the explosions. I've done this " Make sure your Paragon AI explosions have “Should Do Single Hitbox Damage” disabled. " but still nothing... I've tried making the grenade the same layer as the player, just to try random things - nothing yet... but curiously the explosive barrel works... and I'm not sure why... any suggestions???
     
  37. RotaryBlaze

    RotaryBlaze

    Joined:
    Dec 18, 2015
    Posts:
    7
    Hi, first time posting. I have looked through a lot of the posts and numerous times in the included documentation and I'm not sure if my problem has been answered. I am using UFPS.

    I had my enemies working fine, but when I went to build, and played the build, everything went to hell. The enemies simply charge at my player and ignore the cover modes. Because of this, all the enemies rush to the beginning of the level and kill the frame rate.

    I have checked the following:

    - They are set to "Tactical", not "Berserker".
    - All my levels are on "Default" layer
    - My UFPS player has the Target Script set on the camera, its Health Script Holder is on the HeroHDWeapons object which is the UFPS highest hierarchy object and has the Player Damage Handler, the player is on the "LocalPlayer" layer
    - ParagonAIController, layer set to "Default", layer mask is set to "Default"
    - All Paragon bullets have been placed on the "LocalPlayer" layer, in the Bullet Script, the layer mask is set to "LocalPlayer" layer
    - All cover nodes have been set to "Default" layer

    Hopefully you can reply soon, as I have a deadline in one week. Thank you for all your work!
     
  38. RotaryBlaze

    RotaryBlaze

    Joined:
    Dec 18, 2015
    Posts:
    7
    Also, is there a way for them to just stand in one position? For example, a sniper in a window? I tried doing this and he moves strangely in and out of cover. If I could have certain enemies just stay in one cover position that would be ideal.
     
  39. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Did you disable singlehitboxdamage for both explosions? There are two that come with the package.
     
  40. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Hi! That's a really weird bug, I've never seen anything like that before. I won't have time to really look at it until next Tuesday, but in the meantime can you try and give me as much information as possible? What platform are you building to? Do any layermasks work at all? Is there any third party conflicts that you can tell me about?

    If Tuesday is too late for you, send me a PM ASAP, and I'll see what I can do. I'd also recommend posting in whatever other relevant boards you can.

    As for making a sniper, that would require a custom behaviour almost identical to the "move to point" behaviour. If you don't want to do that, then you may be able to substitute it by simply dropping the sniper where you want it and setting its speed to an extremely small number.
     
  41. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    I recreated the project... and now the grenades work. I must have clicked something or assigned the wrong layer. Thanks for your comment!
     
    Last edited: Dec 19, 2015
  42. RotaryBlaze

    RotaryBlaze

    Joined:
    Dec 18, 2015
    Posts:
    7
    So, I went through and compared things with your demo level. During my learning phase, I had copied your "C#_CoverNodes" game object (along with all the cover node children) from the demo level. I did not realize that this had the Controller Script attached to it. Since I was also following instructions in the documentation, I had created another ParagonAIController object that had the Controller Script on it as well. So the two must have been conflicting with each other and that's why I was getting the strange behavior. I believe it is fixed now. Thank you for taking the time to answer all these questions.

    Another question I have, is that sometimes when I shoot at the enemy AI, it does this quick strafe dodge to the side. How do I prevent this? I have "Should dodge" unchecked, so I am not sure if this is the AI dodging or doing something else strange.
     
  43. bluesubstance2

    bluesubstance2

    Joined:
    Jun 1, 2014
    Posts:
    11
    I also ran into that bug before. The AI seems to go crazy when it is not set as default layer...
     
  44. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Hi all - back with another question!
    The AI kill each other mercilessly if they line up when trying to kill me, any way to adjust the FF and the range they can fire at?? Cheers!
     
    Last edited: Dec 19, 2015
  45. Taorcb

    Taorcb

    Joined:
    Mar 15, 2015
    Posts:
    39
    I saw another comment about this, but my AIs aren't returning to idle after all the fighting's done. They walk to the last cover spot they had and sit there pointing their guns at nothing in particular. Something I noticed was that the MoveToTransform script that gets auto-generated had (0, 0, 0) as it's target and the enumerator (I forgot what it's called) is set to none. Changing it to idle does not help.

    Another thing - the other auto-generated script (It has something to do with cover, I forgot the name) also had it's enumerator set to none, but the cover point Vector3 had it's last known cover point as it's value, as I stated above.

    I think it's because after they kill all their enemies, they look for a new target and can't find one, so they revert to the MoveToTransform state, which either sends them to their last cover point or the world origin (It seems to be random).

    EDIT: It's always the last cover spot that they get sent to. I can't tell if the AI is in idle or combat mode but since they're running for cover, I'd guess it's combat. Is there a quick fix (or even a not so quick one)? Has this issue been diagnosed?

    EDIT 2: Somebody else found it, on the next page. There's a line of code comented out in the BaseScript that sets engaging to false on line 380.
     
    Last edited: Jan 1, 2016
  46. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Try just setting everything related to dodging to zero.
     
  47. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    You could make the bullets phase right through Paragon AI agents by modifying the layermasks, or replace them with your own. There currently is no way to change the range that they can fire at.
     
  48. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I'll look into finding a solution to this.
     
  49. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Okay bummer! Any timeline estimated before this is implemented?
     
  50. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I've learned the hard way that giving timelines and ETA dates is not a particularly good idea. :)
     
    Tinjaw and hopeful like this.