Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Shooter AI – The Ultimate Artificial Intelligence Solution

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

  1. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    Finally i'm back!
    2 new tutorials! Melee and UFPS.
    https://www.youtube.com/watch?v=8F0nHcebvms
    https://www.youtube.com/watch?v=z1XLGrdCQrs

    @99thmonkey -
    It looks like my hosting website just got bough by a Russian hosting service :D i'll add new links in the next update.

    @nertworks -
    Try rebuilding the NavMesh. If the problem continues we'll go in more detail over skype. Very weird.

    @Smartline-Games 99thmonkey -
    Updated CTF demo (will be available with coming update): https://dl.dropboxusercontent.com/u/86419401/Demos/SAI CTF/SAI CTF.html

    @whatisandunderscore -
    This is just impossible, we have over 700 users without a single report of a virus. I'm really sorry if Unity bugged out and screwed your project up.
     
  2. Smartline-Games

    Smartline-Games

    Joined:
    Aug 15, 2013
    Posts:
    67
    @nikita68 -
    Nice to see updates; the more coming, the better, the more possibilities.
     
  3. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
  4. nertworks

    nertworks

    Joined:
    Mar 6, 2014
    Posts:
    21
    @nertworks -
    Try rebuilding the NavMesh. If the problem continues we'll go in more detail over skype. Very weird.

    I tried rebuilding the NavMesh and now when I tried and load the game it just crashes Unity. I followed your video. Please let me know what I'm doing wrong.
     
  5. HarvSubunderground

    HarvSubunderground

    Joined:
    Apr 24, 2014
    Posts:
    4
    Amazing pack guys.

    Is is fairly simple to enable the A.I. to only have their weapons in hand when they're in combat situation? ie. when running around or patrolling they play full animation without weapon, then I.K to their weapon when in combat? Just so they're not all running around with pistol out in front of them? Also, is it easy enough to I.K. to rifle/RPG etc. rather than pistol? Already bought the pack and watched the videos so just getting to grips with it. Looks really great!
     
  6. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    How to add custom animations to AI? for example I need a reloading animation when the AI characters is going to reload their weapons.
     
  7. lfdl2401Studios

    lfdl2401Studios

    Joined:
    Mar 4, 2012
    Posts:
    12
    Hi there! I just got this pack and its great, made my life easier. I was going over a few things and I notice that there are a few aspect of it that are a little more complex that what I actually need and was wondering if there's a way around them. To be specific I was wondering if there's a way to make the AI only have one health area that doesn't change size?
     
  8. swishy

    swishy

    Joined:
    Apr 26, 2014
    Posts:
    1
    I'm using UFPS. When I stay still the health damage is normal from enemies but when I am moving one hit kills me instantly. I have tried changing max health and the bullet extra hit damage. Any help with this?
     
  9. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @nertworks - Is your character mecanim rigged? I

    @HarvSubunderground -
    Thank you!
    1) Yep, thats really easy. Right now you can do it through custom script (like 5 lines of code) or through a feature coming in the 1.5 update.
    2) Setting up the IK takes practice, but once you get it, you can make really nice effects: https://www.youtube.com/watch?v=G4ypV3nm15Q

    @tr1stan -
    You can edit animations through mecanim. The animator you want to edit is called "EnemyAnimator" (you can search this in the Project View).

    @lfdl2401Studios -
    Yep, just delete the area that you don't want. The whole system is modular so you can have as many or as little health areas as you want.

    @swishy -
    Weird. I'll look into this.

    Thanks!


    EDIT: New confirmed feature ;) Heres a tutorial on it for those who want to start using it the day it arrives: https://www.youtube.com/watch?v=-_d-BF-DC8E&feature=youtu.be
     
    Last edited: Apr 26, 2014
  10. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    any chance for adding AI that use astarpathfinding and can climb ladders and jump over defined gaps?
     
  11. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @99thmonkey -

    Thats easily done through Links. Create 2 gameobjects that are going to represent the jump/climb -> On one of them goto "Add Component" -> "Pathfinding" -> "Link" -> Drag and drop the other gameobject into the "End" slot of the script.

    Thanks!
     
  12. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    I can't figure out how to make my shooter AI use those links. They go the long way around instead and never go on the ladder or jump over the gap.
     
  13. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
  14. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    yep, no help on that forum. My guess is no one has a good answer on how to implement ladders and jump. I was hoping this AI solution would have it built on.
     
  15. Dazz2000

    Dazz2000

    Joined:
    Apr 27, 2014
    Posts:
    19
    I seem to be having a lot of issues when loading in Terrain Packs like Modern Ruins or Post apoc intact I've tried about 5 different packs theres something going on with Image Effects (Pro Only) folder and every thing inside it ....and the editor ( containing Image effects ) ... i can remove them and clear the errors .. but i really want my effects !!
    only happens when i load Shooter AI
     
  16. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @99thmonkey -
    If ladders/jumps are critical to you and A* hasn't got the features for it, i recommend moving to Unity's built-in Navmesh, as it has quite a stable offmesh link system good for jumps.
    We're just providing the brain of the AI, and give the developer the options to choose between which navigation provider to use.

    @Dazz2000 -
    Try deleting the Image Effects folder before importing other assets. Its probably just an error of duplicate scripts.

    Thanks!
     
  17. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    Unity NavMesh links are only for Pro Users. I would consider the AI to have the brain to actually move the AI up/down a ladder and jump over a gap. I would consider the navigation data to contain whether or not it's possible. A* pathfinding pro has links, but the AI has to have the brain to use the links. Therefore, I would think your AI would have the brain to do this.
     
  18. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @99thmonkey -

    The brain of the AI is a bit different than what you would expect. The main brain, AIStateManager, evaluates calculated data and sends it to their respective recipients, though in itself, the brain does nothing. The whole path finding is done by the A* seeker component, and nothing done by the brain. This is to increase modularity and make it easier to swap out entire parts of the AI without having to "rewire" the brain.

    The developer of A* has said that hes working on a better link solution.
     
  19. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
  20. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
  21. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Thanks for fast response! The out of box support for RFPS sounds cool.
    I just got a new question. If I want to tweak the AI behavior based on the weapons of NPCs how to do it? For example when an enemy is using a shotgun he will try to get closer for a more powerful shot, and opponent with assault rifle may shooting at a relatively further distance. And is it possible to change the shooting accuracy of AI characters?
     
  22. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @tr1stan -

    1) You can tweak that by either setting the "Distance For Close Combat Logic" higher or lower. If that setting doesn't give the right results, try modifying the the "Sight" script on the "SensorSight" child, which you can find under "Sensors" which is a child of the AI.

    2) You can adjust the shooting accuracy indirectly through adrenaline and fear, but we're adding a direct feature in the next update.

    @Everyone -
    We've just finished with the bulk of the 1.5 update.Hopefully the package will update in the Asset Store end of this week, end of next. Heres the list of features:

    1.5
    - LOD manager
    - Predefined cover points
    - Object drop when dead
    - Unity Free IK bugs fixed
    - Unity Free High Quality Soldier Prefab
    - Added resting position for weapon when not engaged/investigate/chase
    - Added rate of fire min/max
    - AI can carry multiple weapons
    - Heavy brain optimisation
    - Aim offset added
    - Generic spawn script added
     
  23. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    I've just tried to modify the "Distance of close combat" and it works for me.

    Regarding the 1.5 update:
    1. Will you add the change of accuracy feature?
    2. The LOD feature in 1.5 update what't the difference between it and the LOD system of Unity pro?
     
    Last edited: Apr 30, 2014
  24. Pirogun

    Pirogun

    Joined:
    Dec 1, 2012
    Posts:
    31
    @nikita68
    I purchased your asset and I am using UFPS and I would like to integrate the two. My UFPS character uses mainly melee weapons and I searched the thread to find the snippet of code you offered. The code allows me to do damage to the AI in the FPS Demo scene, but it is only a 1 hit. I also tried making a blank scene with a plane, navmesh, soldier/zombie prefab, and my player, but the AI seemed to be a little messed up as in the soldier crouches and hovers and the zombie flails its arms. My main problem is how do I reduce the 1 hit aspect of the melee weapon in the FPS Demo scene?
     
  25. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @tr1stan -

    1) Yeah, thats the offset thingy.
    2) The LOD manager is much easier to use in general. Here is a tutorial on it: https://www.youtube.com/watch?v=OJ_-rV5qOPA

    @Pirogun -

    1) Have you tried setting the hit values really low? I'll look into this.
    2) That looks like you need to adjust some zombie melee values.
     
  26. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    @Pirogun

    Also, those guys aim for your head. One shot to head (even if low setting) is considered a critical hit. Frustrating.
     
  27. Pirogun

    Pirogun

    Joined:
    Dec 1, 2012
    Posts:
    31
    @nikita68

    I have looked at a couple of your tutorials and I have attempted to create an AI, but my main problem is creating a melee weapon for the AI. The setup I have for my models is that they have weapons already in their hands and their animations are suited for their locations. Is there a way that I can keep my position their and simply use a damage handler on the weapon rather than go through IK? Thanks!

    EDIT:
    I read that you can't use legacy, I messed around with positioning my sword in the hand of the AI and it seems that it just spawns above its head. I have tried fumbling about with Weapon Holding Location and Rotating Location. Would creating a child in the palm of my AI and then setting it as the locations work? Thanks!

    p.s. Will this asset work for just Melee combat between AI and the player? I am trying to make a hack and slash and your asset stood out. Thanks again!
     
    Last edited: May 1, 2014
  28. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Hi Nikita, I noticed a bug of AI. When the character is knocked down (not die ) by bullets, he still can move his position like been dragged on the ground while trying to get up. And it look like the character movement is independent from the character animation. The AI character sometimes moves in crouch and down state as faster as running. That's weird. You should find a better way sync the movement with animations, say if AI is crouch the movement is slowing downing from running, and stop movement when he's knocked down.
     
  29. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @99thmonkey - You can easily disable (or add more) hit areas. If you open up your AI, go under HealthManager, you'll see different hit areas. The script "Detecthit" allows you to determine whether its a critical area etc...

    @Pirogun -
    1) Sure! Just provide an empty gameobject as the model. Then you can create custom script to manipulate Mecanim/legacy animations.
    2) If the positioning of the sword is off, try manipulating the "Elbow" object position/rotation.
    3) This should work nicely for a hack and slash game, though it really depends in the end how you want your game.

    @tr1stan -
    Thank you! This has been noted down and we'll fix them either in this or the next update.

    Thanks!
     
  30. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    $Screen Shot 2014-05-02 at 1.44.44 AM.png $Screen Shot 2014-05-02 at 1.45.34 AM.png

    @nikita68 I have a problem with the IK.

    Everything works great except the arm doesn't look very nature. You can see from above images though I have setup the IK position and rotation correctly, the left arm is still twisted.

    It looks like the IK only affect the forearms and elbow, the shoulder doesn't move with IK so the character pose looks very stupid. I'm using Unity Pro. Anything could do to make it look better?
     
  31. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @tr1stan -

    Thats strange. It looks like as the AI is trying to use Unity IK Free.
    Try running the game and pausing after a few seconds. Then, if you find in the children of the AI (AI/HoldingPositions/HoldingPositions/IK Control), the script "IKFree Manager", what does the "Activated Free IK" say?

    We're releasing a fix for the Unity Free IK in the 1.5 update and in the worst case you can use that, which gives more control over elbow position.

    Thanks!
     
  32. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Thanks you for the quick reply.

    I've verified in realtime when the game is playing the "Activate Free IK" is set to false. So that means it's using Unity Pro's IK solution?

    And i also tried your default model from the demo scene. Same problem. The shoulder doesn't move with IK so it looks very strange.

    $Screen Shot 2014-05-02 at 2.54.20 AM.png $Screen Shot 2014-05-02 at 2.54.40 AM.png
     
  33. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    @nikita68,
    As I explore more of this pack today, I got a few more issue. Hope you won't mind to help.

    1. When I add the "CleanUpAfterDeath" script to AI objects, occasionally there's a "MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it." error at SearchCover.cs line 438. Did I miss anything?

    2. While AI character is deleted by "CleanUpAfterDeath" script the weapons and empty magazines are still visible. How can I delete them safely?

    3. For some reason I don't want to assign the empty magazine for a weapon, such as a shotgun. But if I don't assign it there will be an error. I know a workaround could be assign a non-visible object as magazine but do you have a more elegant way if my weapon don't need to throw magazines?

    Thanks!
     
  34. LoDx

    LoDx

    Joined:
    Feb 13, 2013
    Posts:
    67
    Hi nikita68,

    I'm facing similar problem, the soldier prefab that comes with the pack appears strangely. Specifically, the arms are weird :-
    $SAI-SolPref1.jpg
    $SAI-SolPref2.jpg
    $SAI-SolPref3.jpg
    $SAI-SolPref.jpg

    1. At first, the soldier prefab looks ok, but when it start to react to character ( Player ), the arms starts to be out of position.
    - when player character move around, the soldier prefab's arm started to shift/move, and it get twisted out of correct position as per attached images above.


    I've tried out on the (AI/HoldingPositions/HoldingPositions/IK Control), the script "IKFree Manager" :-
    - IKFree Manager activated - same result, arms twisted as images above
    - IKFree Manager deactivated - same result , arms twisted as images above

    It seems that while the arm/weapon are dynamically reacting to Player's position/movement, the body doesn't intelligently react to move/shift accordingly, thus making the arms appears weird.

    2. Also, the soldier prefab ( head gun ) start shaking heavily when it fire/shoots, in the sense that it ( head weapon ) move up/down/left/right repeatedly/rapidly ( the soldier body is holding still, appears alright )


    Note :
    I didn't edit any part of the soldier prefab , except the IKFree Manager ( activate/deactivate ) while hoping to see if the prefab is behaving correctly.


    Thanks.
     
  35. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @tr1stan -

    1) Thanks for finding that! Fixed in 1.5

    2) Those can be deleted directly with Destroy(gameobject);

    3) Unfortunately, right now thats the only way. Any suggestions?

    Thank you for your bug finding, it helps improving this asset.

    @LoDx -

    We have rrewritten large parts of the IK code and we provide an updated soldier prefab in 1.5, as well as a new soldier prefab using a more customizable IK solution. These bugs should then be fixed.

    Thanks!
     
  36. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Thanks for the fix. I'm looking forward to the new IK code in 1.5

    For the empty magazine scene, can you make it like this: in the weapon script if I don't assign any gameobject as magazine object, it will not try to throw empty magazines. The code just simply check if that magazine object is null. If null just don't do anything else or throw an error.
     
  37. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @Everybody -

    Just submitted 1.5, hope for it to be out in the next few days. Heres the full feature list, though we added a lot of new features so expect some minor bugs that will be quickly patched :)

    1.5
    - LOD manager
    - Predefined cover points
    - Object drop when dead
    - Unity Free IK bugs fixed
    - Unity Free High Quality Soldier Prefab
    - Added resting position for weapon when not engaged/investigate/chase
    - Added rate of fire min/max
    - AI can carry multiple weapons
    - Heavy brain optimisation
    - Aim accuracy offset added
    - Generic spawn script added
    - Improved CTF demo behaviour
    - Reduced speed of AI when crouching
    - Fixed that you could walk through AI
    - Strafing
    - Fixed AI that could move whilst still getting up
    - Fixed multitude of smaller bugs
    - Weapons don't need an empty magazine object now
     
  38. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    @nikita68, any update to Unity Pro's IK bug fixing and custom IK?
     
  39. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @tr1stan - Unfortunately the Unity IK system is really closed, so we're working with Free IK and trying to integrate Final IK in the future.
     
  40. LoDx

    LoDx

    Joined:
    Feb 13, 2013
    Posts:
    67
    Hi nikita68,
    Just got the v1.5
    a. these are the SoldierPrefab from Prefab/FullyFinishedCharacter folder :-

    $SAI-Sol1.jpg $SAI-Sol2.jpg $SAI-Sol3.jpg


    b. these are the SoldierPrefabUnityFree from Prefab/FullyFinishedCharacter folder :-
    $SAI-SolUF1.jpg $SAI-SolUF2.jpg

    For both, I just drag/drop the prefab into scene and hit play ( didn't edit any part ).
    - Is there anything I need to edit when using the prefab , to overcome the above problem ?

    Note :
    Both the soldier prefab works, just the IK for the arms is out of position.


    Thanks
     
  41. Fred_H

    Fred_H

    Joined:
    Jan 15, 2014
    Posts:
    4
    Hi all,

    I'm seriously considering using this for my current project but I have a couple of questions first:
    1) I have the pro version of the A* project, does Shooter AI integrate with that properly? Can I use the A* pro NavMeshes instead of the Unity ones?
    2) I've seen a few code snippets referring to using SendMessage. From my understanding SendMessage is something to be avoided if at all possible due to it's (comparatively) high execution costs. Has anyone found this to be a problem once the AI is running alongside other game logic?

    Thanks in advance :)
     
  42. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    Yeah ! I was just passing by to suggest that :)
     
  43. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @LoDx -
    That is really weird. We explicitly tested the IK in our release and with our BETA testers. Did you first delete the Shooter AI folder and then import the new update? Unity sometimes screws that process up.
    I am really, really sorry for these complications.

    @Fred_H-

    1) We ship A* free with all Shooter AI versions so you can easily integrate your pro license.
    2) We use SendMessage around 3 times in all our code and is executed with 60 AIs at a rate of ~10 per second max (in a full blown battle). The rule of thumb is never to use SendMessage more than once per frame, but we're very far away from that boundary.

    @XenoGalaxies -
    We're working on it, though it might take some time as its a complicated system.

    Thanks!
     
  44. LoDx

    LoDx

    Joined:
    Feb 13, 2013
    Posts:
    67
    Hi nikita68,
    I've removed and re-import the whole Shooter AI folder/asset , same situation.
    - also just realized the zombie prefab IK also having the same problem ( the arm's IK )

    It seems that the soldier prefab arms/IK are twisted out of position ; other than that, the AI are working nicely.

    Thanks.
     
  45. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    Last edited: May 14, 2014
  46. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    @nikita that's awesome. Gonna check it out!
     
  47. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Hi Nikita68, with Final IK which prefab should I use, the soldierPrefab or SoldierPrefabFree?
    When I drag and drop the SoliderPrefab (1.5v) into the scene it looks like this

    $Screen Shot 2014-05-13 at 3.59.43 PM.png
    Then I added the Final IK and your script as in your tutorial, but that soldier still looks the same. SoldierPrefabFree does look better but it's not working with final ik too.

    It takes me 2 weeks to wait for your update on IK fixing. By now I still can't setup the IK properly. Can you show us a step by step guide on how to setup the IK with 2-hand weapons?
     
  48. Efgames

    Efgames

    Joined:
    Aug 10, 2012
    Posts:
    22
    I'm also having the exact same problem. When I drop the soldier and hit play, he first stands idle properly, but then, both his arms go into his body.

    I have noticed that there are 2 soldiers tho: SoldierPrefab and SoldierPrefabUnityFree

    If you use SoldierPrefabUnityFree the weapon and arms placement is somewhat correct (hands are kind of twisted).

    The difference between the 2 prefabs is the GameObject RestingPosition that is not within the SoldierPrefab, under Elbow.

    But, when you hit play, the RestingPosition gets added, but at a wrong position. You can move it within the editor while playing, but the arms are completely messed up.
     
  49. nikita68

    nikita68

    Joined:
    Feb 8, 2013
    Posts:
    289
    @tr1stan - Did you deactivate "IK Active Global" on the "Hand IK" script, located on the "Model" child of the ai? This overrides Final IK if its turned on. Also under ai/HoldingPositions/HoldingPositions/IKContron - "IKFree Manager" - "Activated Free IK" set to false?

    I'm going to make a step - by -step guide for 2-handed weapons after the release of 1.5.1.

    Sorry for all these bugs, i'm astonished myself that they got passed the BETA testers.

    Heres a screenshot of the fixes:
    $sai1.51ikfix.png

    @Efgames - Thank you for the header! We just found the errors, and will send out the update today/tommorow.

    @Everybody -
    We need more BETA testers. If anybody is interested, please PM me.
    Requirements:
    - Basic knowledge of Shooter AI
    - Understanding the concept of Unity and scripting

    Thanks!
     
  50. Efgames

    Efgames

    Joined:
    Aug 10, 2012
    Posts:
    22
    Also noticed that for the SoldierPrefabUnityFree - IKControl within Holding Positions, it's set to both hands - which seems to be the way it should be, given it's a 2 handed weapon.

    But even I set it to both hands on the other Prefab, after adding the RestingPosition as well, arms are still messed up.

    I'm actually digging into the package quite a bit, so if I find anything else odd, or bugs, I'll make sure to send them your way.

    Post on the forum, or directly at the support address from the doc?