Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Shooter AI – The Ultimate Artificial Intelligence Solution

Discussion in 'Assets and Asset Store' started by nikita68, Oct 8, 2013.

  1. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    Thanks!
     
  2. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    UPDATE:

    Just updated the demo scene to use the upcoming Shooter AI update.
    Most of the visible work can be seen in the fluid animations, espcially head IK and weapon movement. But the main feature of the new update will be extremely high optimisation.

    More info when the update will be released on the Asset Store.
     
    Last edited: Nov 20, 2013
  3. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    UPDATE:

    Updated the UFPS demo. Still ultra hard :D
     
  4. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    UPDATE:

    The new update is now on the Asset Store. As always, we are up for any suggestions and requests.

    1.01 (20.11.13)
    - Heavy optimisation
    - IK improvement
    - Weapon animation improvement
    - New Demo scene
    - Team overview
    - Team strategies
    - Event initiated custom scripts
    - Multiple visual engagement scripts with custom chance of execution
    - Cleaning up code and project
    - One handed gun wielding
    - Fixing bugs/little quirks
     
  5. AdamBu

    AdamBu

    Joined:
    Jun 26, 2013
    Posts:
    9
    This AI literally won my heart.
     
  6. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    Hey, good job on the new UFPS integration demo, now its really hard , I m satisfied !
     
  7. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    An little preview of the upcoming update:

    Zombies are fun

    And also updated the old demo:

    Updated Demo

    Lets see who can spot the difference :)
     
  8. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Does this offer mobile support? will it work on UFPS mobile version?
     
  9. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    Just tested it out. In short, it works well, though you need to heavily optimize the meshes and scene, as that is what makes mobile so slow.

    Regarding UFPS mobile: i haven't had the opportunity yet to test it out, but if it works on the same infrastructure (basically if "Damage" is called when the player is attacked) then it should work.
     
  10. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    awesome! I killed all those zombies and then I reloaded the demo to kill them again, and again, and then I purchased the asset :)

    Note that the zombies feet get inside the ground sometimes, I think when they go down the slope. Not very relevant, not really an AI bug ;)

    Make the zombies respawn in your next demo and I wont be able to stop playing it :p
     
  11. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    If your wondering where the zombie prefab is, its coming in an update in the next few days (Asset Store takes a few days to update).

    1) I'll look into correct foot IK.

    2) Will do :D
     
  12. TheStone

    TheStone

    Joined:
    May 18, 2013
    Posts:
    77
    I was wondering if this is mobile ready ? :confused:
     
  13. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    In theory yes, though you would need to optimize your models. I haven't tested it out practically though.
     
  14. Cyrien5100

    Cyrien5100

    Joined:
    Oct 17, 2012
    Posts:
    145
    Hi,
    is this AI react to the sounds of player (like shooting, walking etc) ?
    Is it possible to make the AI search the player if he see a dead body ?
     
  15. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    Hello!

    Yes, the AI reacts to the sounds of players walking, shooting etc...

    And yes, the AI already reacts to seeing other players, though using the new custom team event reaction system, you can customize what they do.

    Thanks!
     
  16. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    This looks absolutely amazing, I havent been able to get great AI going yet, and this looks like the solution (im using ufps), mind you UFPS has its own AI plugin, I plan on using both of these AI plugins to provide some awesome AI :) Will buy this soon.
     
  17. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Also I cant see where the animations are specified - is this in code or done in the gui? And what "states/events" can have an animation triggered? for example if the character goes for cover could we use some sort of "going for cover animation" (like going behind a wall and hugging it) and get it so it looks right?
     
  18. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    Hello!

    Shooter AI uses mecanim animators to control the animations
    There are 2 ways of finding the animator:
    1) Click on your AI character -> Open its transform hierarchy -> Click on the 'Model' gameobject -> Open the 'Animator' component -> You'll see thr animator there
    2) Search in the Project Assets for 'EnemyAnimator'
     
  19. fhl41

    fhl41

    Joined:
    Jan 8, 2014
    Posts:
    14
    can you ad some code that we can have a distance between the player and enemy, most of the time its still bomping up the player and keeps walking
    it needs a stop and that he still attack (shoot with the pistol) untill he is dead it whould be nice to type the distance in the inspector window can you please do that, that whould be awesome (its the best navmesh ai there is)
    thanks.
     
  20. fhl41

    fhl41

    Joined:
    Jan 8, 2014
    Posts:
    14
    And how can i add sound to shooting enemy (fire sound)
     
  21. fhl41

    fhl41

    Joined:
    Jan 8, 2014
    Posts:
    14
    i found the fire sound its on the bullet1.prefab :D
     
  22. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    Thank you for your feedback, i will definitely add that in the next update. For now you can improve that behavior by increasing the "Distance For Close Combat Logic" under "Weapons And Engagement" in the "AI Controller Child" script.

    Have fun with Shooter AI :)
     
  23. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    177
    Can I use this in an isometric/top down shooter?
     
  24. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    I'm very interested in this plugin... I'm not sure how to explain this feature.... Would there be a way to set up a hidden from view volume. Set up a volume like a trigger or collider but when the player in inside the volume he/she is hidden from NPC's. that way if your doing stealth missions and you have patrolling guards the designer can put strategic hide volumes in the level to hide from patrolling NPC...
     
  25. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @Wheelbarrow: Sure. Any game that has any tactical shooter element can use Shooter AI

    @Licarell: Sure! You should be able to put up a trigger collider that acts as a hide volume. If you have any problems just contact me i and i'll gladly fix any problems.
     
  26. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    New features look amazing, I really enjoy the demos, one thing I have noticed is that enemies dont know if you have shot them or near to them, when a bullet hits them or very close to them I would expect them to at least rotate around from the direct of the bullet, and then they will probably see you anyway. Apart from that it looks really great.

    PS, im going to try your AI my shooter very soon www.genocidedolphins.com :-D

    pps, just bought this, amazing stuff! Although initilising takes a LONG time, whats happening here, is this the nav mesh? I was hoping to have a very large world maybe 20x larger than the demo but it might be an issue if the start up time takes even longer?

    Was looking at the code, it is lovely but some of the formatting is a bit weird or maybe this is personal style :) Lovely amount of comments though, Im enjoying reading it... Thanks for such a cool system, im quite interested to know how easy it is to get a character from daz3d into this with animations working etc, both the supplied stock anims, but also using daz3d animations, Im sure this is going to be fun :D
     
    Last edited: Jan 28, 2014
  27. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hi there! Sorry if that has already been asked (Most probably). Does the system consider the use of cover?
    Edit: Found on manual =)
     
    Last edited: Jan 27, 2014
  28. cdutoit

    cdutoit

    Joined:
    Jul 20, 2013
    Posts:
    34
    Hi -

    Just bought it...loving it so far and still trying to make sure I understand it properly. I *think* I found a small bug and wanted to check with you.

    I am using the zombie prefab that comes with the kit. I disabled the sight sensor and go just with the "ear" sensor. I notice though that the zombie immediately "hears" me and comes running to my character, regardless of what I set the hearing distance too.

    Upon investigating the code, I see the following and need your confirmation:

    In auditory.cs you declare a float but do not initialize it:

    Then this code makes the AI think it hears the character:

    but, distanceToEnemy hasn't been initialized up to this point yet because it only gets set when this condition is met:

    I fixed it by just initializing distanceToEnemy to some large value when the variable is declared:

    and now it works fine. The AI doesn't hear me automatically at the beginning. Just wanted to confirm with you so that if its a bug you can fix it cleanly .. not like my hack!

    Thanks
    Chris
     
  29. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    177
    Another quick question: You mention in one of your answers above that the asset uses mecanim animators to control the animations - does this mean the asset can't use models with legacy animations?
    Cheers.
     
  30. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @ radiantbody -
    1) The AI actually does react to being hit and even hearing bullets, though they need to have a rigidbody attached (the bullets)
    2) I believe the load times are because of the models, though it could be the NavMesh. I'll look into it, but if you find anything please tell me. NavMesh baking and using usually isn't a problem.
    3) Thank you for your kind words :) Have fun and please keep me posted on your game - it looks genuinely interesting and it looks like its got a huge potential.

    @ cdutoit - Thank you very much!!!!! I am blessed with the best community in the world.

    @ wheelbarrow - Unfortunately Shooter AI isn't compatible with legacy animations as we provide all animations rigged up and ready to go. We evaluated that Mecanim is a very good and scalable animation system so we picked it. If you have any problems/questions etc.. specific to your project, don't hesitate to PM me.

    Thanks :)
     
  31. cdutoit

    cdutoit

    Joined:
    Jul 20, 2013
    Posts:
    34
    Hi -

    I'd like some more information on the UFPS integration please. I followed the instructions in the documentation which works. However, how can I make the enemy AI bullets hit and damage my player? UFPS has a vp_hitscanbullet script but attaching that to the bullet1 prefab in AI Shooter is not having any affect.

    Can you please advise how to implement "being hit" by the AI specifically for UFPS?

    Thanks
    Chris
     
  32. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    If you attach the "Bullet1" prefab into "Vp_FPWeaponShooter" -> "Prefab" slot on the gun in UFPS, it should work.

    Thanks,
    Nikita
     
  33. cdutoit

    cdutoit

    Joined:
    Jul 20, 2013
    Posts:
    34
    Hi Nikita68 - thanks for the fast response. However, I am not talking about the Player hitting the AI. I'm needing the other way around, with the AI shooting the Player.

    I see the AI shooting, but the "hit" on my player does not register in UFPS.

    Sorry if I'm not making myself clear, and thanks for the help.
     
  34. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Could you do a tutorial on how to make your own characters? it would be fun to take them from daz into this, but it gets abit confusing with mecanim. Also is there a way for them to not have guns and just walk around calmly?
     
  35. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I think you need to broadcast "Damage" to the player.. I have a capsule on my player with a trigger so I do this when it gets hit:

    public class PlayerHitByRocket : MonoBehaviour {

    GameObject player ;

    void Start ()
    {

    player = GameObject.FindGameObjectWithTag(Global.PLAYER_TAG);

    }
    void OnTriggerEnter(Collider col)
    { //otherwise we hurt ourself when we move sometimes
    if (col.tag == Global.PLAYER_TAG !name.Equals("_Capsule"))
    {
    Debug.Log (""+name+" WAS HIT BY "+col.name);

    player.BroadcastMessage("Damage", 5, SendMessageOptions.DontRequireReceiver);
    }

    }
    }
     
  36. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I have managed to get a character from daz3d into Shooter AI, very pleased (will do a short tutorial), weirdly though Im always getting a null pointer when I start it up as if the gun isnt initialised even though it is,

    the error is "NullReferenceException: Object reference not set to an instance of an object" at
    if(weaponHoldingObject.GetComponent<AIWeaponSelected>().ammoCurrent == 0f)
    in AIWeaponController,

    how is that my weapon is null?

    Please see screenshot here that should show all the info, https://dl.dropboxusercontent.com/u/4194619/Snap 2014-02-01 at 15.30.27.png

    Also even with the AIWeaponController turned off when I kill the enemy I get a null point in the DropWeapon() method, here: weaponHoldingObject.GetComponent<AIWeaponSelected>().objectHoldingGun = null;

    Somehow the object holding the gun is null too?
     
    Last edited: Feb 1, 2014
  37. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I did a bit of a tutorial on DAZ3D to Unity3D to Shooter AI, I hope no one thinks im spamming the thread. It is also to demonstrate my weapon issue, although the screenshot does it better to be honest, but I didnt want to wake up tomorrow and have forgot what to do :) I realise most of this is in the tutorial videos from Gateway Games, just wanted to cover some more specifics about Daz3d really after my research, cheers.
     
  38. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @cdutroit - Usually the bullets handle that automatically and directly out of the box, though radiantboy provided a robust fail proof solution:
    Code (csharp):
    1.  
    2.  
    3. public class PlayerHitByRocket : MonoBehaviour {
    4.  
    5. GameObject player ;
    6.  
    7. void Start ()
    8. {
    9.  
    10. player = GameObject.FindGameObjectWithTag(Global.PLAYER_TAG );
    11.  
    12. }
    13. void OnTriggerEnter(Collider col)
    14. { //otherwise we hurt ourself when we move sometimes
    15. if (col.tag == Global.PLAYER_TAG  !name.Equals("_Capsule"))
    16. {
    17. Debug.Log (""+name+" WAS HIT BY "+col.name);
    18.  
    19. player.BroadcastMessage("Damage", 5, SendMessageOptions.DontRequireReceiver);
    20. }
    21.  
    22. }
    23. }
    24.  
    I'll look into this in more detail.

    @radiantboy -

    1) Regarding the weapon, you were putting in the model of the weapon into the slot of the finished weapon object. To create a weapon object go to "Tools "-> "Shooter AI" -> "Create New Weapon" then just follow the wizard there and drop the finished weapon into the slot.
    2) The rest of the development team looked into your game and was really impressed! :D


    Thanks!
     
  39. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Thank you so much for the help and the complements, I see a combination of ShooterAI and VisionPunk's own AI as a totally cool way to have awesome and varied AI.. Thanks for the awesome asset!! It still gives us a laugh almost every time! Some hilarious things happening, and we have gangs in this game so its going to be ideal :)

    Another video for those interested... been a long day, done 4 of these, see my channel for more ;)

     
    Last edited: Feb 1, 2014
  40. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Forgive me for being a bit new to Unity, but is there an actual way to change the animations in this asset? Like how would I swap the idle animation for another one? Ideally without having to use the animator drag n drop locomotion stuff, but if that's the only way I will :)

    My other issue is shown in the video, I have given the woman a gun but she isnt holding her arm out like the demo rag dolls do, I dont think shes really carrying it, or can shoot..

    Actually she does shoot but doesnt raise her arm, im thinking maybe my ragdoll is messed up
     
    Last edited: Feb 2, 2014
  41. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @ radiantboy
    1) No problems. Unfortunately if you want to use your own animations, you need to use Mecanim. The AI animation controller is called "EnemyAnimator".
    2) If you want to modify the location of the weapon, you just open the AI Character -> "HoldingPositions" -> "Elbow" -> Then modify the position of the "WeaponHoldingObject" so that it goes where you want. If you need to setup correct hand positions, open your gun -> "IK" -> Then modify the position and rotations of the objects that will then tell Shooter AI where to place the hands.
     
  42. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    WARNING: THE PRICE OF SHOOTER AI WILL GO DOWN TO $45 IN THE NEXT WEEK SO IT IS RECOMMENDED TO WAIT FOR THE PRICE TO DROP!

    Heres a small preview of the upcoming update :)

     
  43. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Thank you very much, I love the response times here!.. I will look into that now.

    I have another issue, in the idle state my character appears to have their arm stuck inside their own body, why would this be ? Please see https://dl.dropboxusercontent.com/u/4194619/Snap 2014-02-02 at 19.02.16.png
     
  44. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    Thats because of the IK scaling issue. If you do any scaling, you need to do it though the import setting or Unity will mess up the calculations. Also i recommend ajusting the position of the gun
     
  45. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Yes thanks its working much nicer when I move weapon holding location, love how it moves the arm to whereever!
     
  46. cdutoit

    cdutoit

    Joined:
    Jul 20, 2013
    Posts:
    34
    Hi -

    I seem to be having a problem to have any character properly hold the gun. I set everything up, and in design mode it looks correct: The character is standing in a T-pose with the gun floating just in front of them. I've set the left and right hand holding position, muzzle flash location etc. I've also create the ragdoll.

    Then when I click run, the characters arms drops to his side. And everything works: He walks around and shoots, he collapses like a ragdoll if shot etc, but his arms stay by his sides. They don't hold the gun. So the gun continues to just float in front of the character. I've tried it with a character I imported from the asset store and the Humanoid that comes with AI shooter. Neither one has the hands move to the right location, so I'm sure I'm messing up something.

    Any one have any ideas/most obvious cause for this happening?

    Thanks!!

    EDIT: Even the demo scene that ships with Shooter AI shows the generic character walking with the gun floating in front of them, not holding the gun.
     
    Last edited: Feb 2, 2014
  47. eliteslayer

    eliteslayer

    Joined:
    May 12, 2013
    Posts:
    64
    Yeah, I tried redoing the characters again but the AI's do not shoot at a player or hold the guns, I hope this could be fixed in the next update. Also if it is possible to add some kind of seeking ai that seek the whole map without waypoints like in call of duty and have a team death match with the ai bots that would be awesome. Thanks.
     
  48. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @cdutoit - It seems as though you don't have Unity Pro. Unfortunatly, Unity Pro is needed for IK, though i'm currently looking at free solutions

    @eliteslayer - It is really strange that they don't shoot. Usually its because the player doesn't have a collider.
     
  49. cdutoit

    cdutoit

    Joined:
    Jul 20, 2013
    Posts:
    34
    [

    Hi Nikita - ouch, that's a pretty big blow to find out you need unity pro. Given that I'm not an expert on Unity - can you share some pointers on how I can create a character holding a gun - either through a assset on the store or some tutorials/articles somewhere. I've been struggling for a few days and not making any progress - I can get a solider on the asset store, but I don't know how to make him hold and run with a weapon. Would love to get some ideas/pointers from anybody on this forum. thanks!
     
  50. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @cdutoit

    I'm actually developing a free IK system right now! Hopefully it will be in the next update. Sorry for this misinformation.