Search Unity

Deftly - Flexible Top Down Shooter System

Discussion in 'Assets and Asset Store' started by LaneFox, May 27, 2015.

  1. BilginSahin

    BilginSahin

    Joined:
    Jul 2, 2012
    Posts:
    48
    yeah its just in theory. i could give a try but i hope you will improve your asset cause for further updates. i dont like to hack something in. dont understand me wrong. you have currently the best working ai in asset store! i tryed so many and none of them is working so good like yours. shooter templates are many in asset store but no real good AIs.
     
  2. BilginSahin

    BilginSahin

    Joined:
    Jul 2, 2012
    Posts:
    48
    i tryed a little bit in the ProcessConditions method. but then both patrol & combat are running (see it from debug.log). how do i clean get out of the combat state or any other state?

    Code (CSharp):
    1. if (MyMood == Mood.Combat) {
    2.  
    3.                 if (!TargetCanBeSeen (CurrentTarget.gameObject)) {
    4.                    
    5.                     Debug.Log ("Cant see target");
    6.                     Provoked = false;
    7.                     // Goto Wander
    8.                     yield return MyMood = Mood.Patrol;
    9.                     yield break;
    10.                 }
    11.  
    12.             }
     
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    The states are evaluated every tick from top to bottom in the code so there is a 'priority order' to them. The only way to get into a state is to fulfill the conditions for that state to be chosen, then the AI will choose it. This is deliberate in order to make it react to whatever conditions you specify in the code rather than chaotically forcing states all throughout the code.

    So, you're on the right track but you haven't given it what it needs: proper conditions to patrol. Basically you say "Go patrol", then the next frame it evaluates the conditions and selects a different state because patrol is not what it should do based on the conditions.
     
  4. BilginSahin

    BilginSahin

    Joined:
    Jul 2, 2012
    Posts:
    48
    isn`t if(!TargetCanBeSeen (CurrentTarget.gameObject)) a proper condition? i dont get why patrol & combat both are running. please help =)
     
  5. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    @LaneFox

    Do you have an updates in the Unity asset store review queue? This is based on your twitter post of Nov 16, 2016 "Deftly commit: 1.01 - Editor script methods to Virtual"
     
  6. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    It should already be on the store but let me know if there are some methods not virtual, the store was acting pretty weird last month. I didn't get emails back when things went through.

    Patrol and combat aren't running at the same time, there can only be one mood at any given time. These condition blocks only purpose is to see if they should set the mood to one specific value and when it does find one that it should use then stop looking at conditions and start acting on that mood.

    There are already condition blocks for both Wander and Patrol so all you've really got to do is make the moods above them more strict so they won't be chosen before Wander/Patrol are considered.
     
  7. BilginSahin

    BilginSahin

    Joined:
    Jul 2, 2012
    Posts:
    48
    sorry tried it but cant figure it out. i dont have the overview like you. they are some things that are checked like a threatlist etc which bring the ai back into combat. i hope you will implement it in a future update. this would be awesome! any plans? i also wait with my review.
     
  8. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    The Unity asset store still says v1.0 (NOV 22, 2016) ... so I guess it is still in the unity asset store review queue.
     
  9. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    @TonyLi

    Actually I wonder if Aim Assist should be called independent targeting? It would be on by default to support twin stick users on gamepads and off (for those who want to move and fire in the same direction) and also off for those who use X-arcade tankstick style controllers
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    For a couple of my guys, I might need to keep it on for those who want to move and fire in the same direction, too. More likely than not, they'll probably be off by 5% or so as they're moving toward an enemy. You should see how often we have to revive them in Broforce. ;)
     
  11. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Broforce (I saw it on the Rewired website just today) and I only noticed if after you mentioned it.

    I think if your guys had better controllers (e.g. joysticks) they would not have a problem when firing/moving in the same direction. The ThrustMaster T16000M is a good budget priced joystick and it works fine and should reduce the 5% to under 1%. It would be good if they could test it out and see how well it works. It works fine for me and I should also try out CH FIghterStick (flight controller) and see how that works since that is what I use for most of my testing.
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Thanks, @longroadhwy - I'll give it a try. One of the guys recently bought a nice joystick to play Elite. That may be the solution for him. Then again there's no fixing the hardware problem between the couch and the joystick. ;)
     
  13. BilginSahin

    BilginSahin

    Joined:
    Jul 2, 2012
    Posts:
    48
    How can i deactivate complete movement and fireing for cutscenes? i found InputPermission in the scripts (subject, playercontroller, weapon) and its working for the movement but weapons can be fired and switched anyway. deactivating the scripts also didnt work.
     
  14. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Use the SetInputPermission() method.

    Code (csharp):
    1. public virtual void SetInputPermission(bool allowWeaponCycling, bool allowMovement, bool allowFiring)
     
  15. BilginSahin

    BilginSahin

    Joined:
    Jul 2, 2012
    Posts:
    48
    this is working but if i press any key like left mousebutton it turns it automaticly on again. did a debug.log in the SetInputPermission to check what is going on. first it logs (false,false,false) which should be correct. after pressing any key it logs(false, true, true)

    Edit: Tried it in the maindemo. seems to be a bug
     
    Last edited: Dec 10, 2016
  16. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Yeah thats a bug, does it only happen on melee weapons? Try this to fix it - change Weapon.cs line #292 to...

    Code (csharp):
    1. while (Owner == null || !InputPermission) yield return null;
    Change from an IF to a WHILE, basically. The weapons lock controls sometimes and the melee code cleans up those locks when it is done attacking, but the if statement wasn't preventing the code from running in the first place. There's still a small chance it will bug if you try to lock the controls while the routine is running (attacking) and it cleans up, thus unlocking the subject. I'll look into a more consistent fix.
     
  17. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    @LaneFox

    In the Assets\Deftly\Core\Internal\Preferences.cs on line 14 should the AssetVersion be 1.0 instead of 0.7.5?

    Code (CSharp):
    1.         public string AssetVersion = "0.7.5";
     
  18. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    You might try out your friend's joystick with Deftly and see how well it works for you also. Testing it with Broforce would be another good test for the joystick too.

    For joystick manufacturers you should avoid Saitek products for a while since they were recently purchased by Logitech (from Mad Catz) so it will be a while before they get everything ironed out with regard to the production issues, warranty policies, etc.

    With joysticks that are flight oriented (or hotas related) many have a twist stick to handle the rudder so customers do not have to purchase physical rudder pedals. The ThrustMaster T16000M is one of those type of joysticks with twist stick for rudder. Most of the popular joysticks seem to have twist stick rudder these days. Once you get used to it might not be an issue at all. Just make sure that twist stick rudder (axis) is not mapped to anything. If you also play flight games like Elite then have twist stick rudder is a good thing without having to spend a extra $100+ for rudder pedals.

    CH Product is the probably the only company with joysticks that does have any twist stick rudder. The ThrustMaster Warthog (expensive $500 hotas system) also does not have twist throttle.

    For Elite some people use two joysticks together like the dual ThrustMaster T16000M joysticks. I was thinking something like that setup might be really good setup for Deftly.

    Practice with a good joystick (compared to gamepad) can do wonders.
     
  19. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    @TonyLi

    You mentioned earlier in this thread you had several mods on top of Deftly. Do you still use any of those mods or have most of those issues been incorporated into the main Deftly product?
     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @longroadhwy - Apart from game-specific things like a persistent character roster, Lane has incorporated them all into Deftly -- local co-op, different damage types, etc.
     
  21. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Yes, sometimes I forget to update that line.
     
  22. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Thanks for the clarification.

    The asset store review is certainly taking a long time for your 1.0.1 release? So approximately 3 weeks. Have you contacted the asset store and see what the hold up is?
     
  23. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Good to know. Tankstick works really nicely for a 8-way joystick. Still working on the single player mode and hope to spend a bit more time on control mapper.
     
  24. BilginSahin

    BilginSahin

    Joined:
    Jul 2, 2012
    Posts:
    48
    I cant figure out the "Out of Range - > back to Patrol/Wandering" for Enemies. Is there a chance you will give it a try?
     
  25. JohnnyDang3r

    JohnnyDang3r

    Joined:
    Mar 5, 2013
    Posts:
    12
    Hi! Figuring out how things work right now. How do I make a shotgun? I can't figure out how to with the weapon or projectile scripts. Do I need to code a new projectile or weapon type? Thanks!
     
  26. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Shotguns are usually smoke and mirrors in games. If you want a ray for each pellet you'll probably be best making a custom Projectile that does fires a bunch of rays. Everything is open to you in that direction since you can put anything you want on the prefab used as the Projectile. If you want a cheap way then make a shotgun looking particle effect and use a spherecast/raycast type weapon.
     
    JohnnyDang3r likes this.
  27. frbrz

    frbrz

    Joined:
    May 10, 2016
    Posts:
    76
    Hi. I want to test Deftly, but the current demo was published a year ago. Do you have a demo for the 1.0 version? If not please consider an update.
     
  28. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    I was just thinking about that today. There is a point release on its way to the store right now, but I'll work on finishing the downloadable demo for the next release.

    In other news...

    v1.05 : Auto Import CoOp Example content
    The examples for co-op were hard to get working so I made an automatic importer (accessible from the Window dropdown) to import the package, change the build settings, and open the menu scene for you. This should eliminate a lot of the confusion about how to get it working. Also some minor bugfixes and QC changes are in 1.05.
     
    TonyLi and frbrz like this.
  29. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Looking forward to your new update.
     
  30. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    @LaneFox

    You should change this while you are making your other changes ....

    Assets\Deftly\Core\PlayerController.cs (on line 12) this line should be changed

    Code (CSharp):
    1. public readonly ControlVersion Version = ControlVersion.ReWired;
    The Rewired product is called Rewired and not ReWired which some people have been calling it in this thread. You should change this in the code to reflect the proper name.

    So the code change would be to this.

    Code (CSharp):
    1. public readonly ControlVersion Version = ControlVersion.Rewired;
     
  31. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    @LaneFox

    Are you going to have a Rewired integration in next Deftly release? I posted my example as a reference so it should not be hard to add.
     
  32. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Not in the update in the pipe.
     
  33. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Deftly 1.0.5 is on the asset store already.

    Building the co-op demo (using Deftly 1.0.5 / InControl 1.6.9 and Unity 5.4.3 [windows] ) The co-op demo scene load without any prefab missing errors and builds as expected.

    I did get these warnings in the editor.

    OnLevelWasLoaded was found on PersistentHandler
    This message has been deprecated and will be removed in a later version of Unity.
    Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed


    Assets/Deftly/CoOp/Core/PersistentHandler.cs(308,44): warning CS0618: `InControl.InputDevice.MenuWasPressed' is obsolete: `Use InputDevice.CommandWasPressed instead.'
     
  34. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Thanks for letting me know.

    I'm aware of that warning, I just keep forgetting to update it since it doesn't show on the version I export from.
     
  35. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Are you only testing Deftly against Unity 5.3.2 and not any newer version of Unity? Also are you using the latest InControl v1.6.9 or only a older version? Also what version of Rewired do you have?
     
  36. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    I test it on the step version releases of Unity to make sure there are no errors, but always export from 5.3.2.
     
  37. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Hi! Just bought an asset, it is great! Gone through your YouTube videos but never found that "in depth Animator" video you mentioned in one of them. What I'm struggling with is making new animations set, like bows, they need all the same treatment as firearms (IK, setup, etc) but whole different set of animations. How can I approach this?
     
  38. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Hmm, there isn't really a supported case of IK + Animations for weapons. For bows you'll probably need to fallback to animations. You'll need to write some of your own code and probably subscribe to the events on the Subject to listen for firing and stuff so you can let the Animator know when/what animation to run.

    The biggest driver for this kit was to alleviate the need for Weapon Animations by using IK, but since there isn't "charged" weapon support or a combo IK/Anim way to do things, bows are something that will require animations.

    The general setup for animations is to only provide Locomotion, weapons (even recoil) is data driven via IK.
     
  39. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Thank you!
    And one more thing that bothers me a lot - going backward-right and forward-left 45 degree ish animates so weirdly... like some kind of a bizarre moonwalk.
    Can it be fixed somehow?
    I played with blending and tried to tweak everything but with no luck.
    Walking animation is unusable in that state :(
     
    Last edited: Jan 7, 2017
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    This was my only issue with Deftly, too. Switching to root motion made all the difference. I use Pistol Animset Pro with the animator controller that Lane included in Deftly. (Kubold's Pistol Animset Pro is a separate purchase but well worth it for really polished-looking animation.)
     
    LaneFox likes this.
  41. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Lol yes, this drives me bonkers too. The included animations don't have enough directions to look well when blended and getting custom 8-way mo-cap animations to ship with it was prohibitively expensive during development. Ideally you would replace them with a more robust collection of better root motion ones like @TonyLi mentions. Pistol Animset Pro is really nice and the controller I made for it (included in the addons folder) will behave and look a lot better than the stock animations in Deftly although it still doesn't utilize all of the kit's animations, so there is a lot of room for growth there still if you wanted to explore improving the Animation Controller.
     
  42. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Oh YEAH! I bought it and it is so nice! BTW Thank you for the controller! that was so very cool of you to include it.
     
    LaneFox likes this.
  43. xagarth

    xagarth

    Joined:
    Sep 7, 2016
    Posts:
    17
    Hi @LaneFox ,

    How are you doing?
    I've been using Deftly for some time now with pretty good results.
    Recently, I've started new, small side project and I've noticed one thing.
    IK proxy is using world to rotate hand. Because of that, when upside-down, or on a side, my character's weapon stays at the original position, ie. my character's weapon does not rotate with my character.
    As you can imagine this is far from ideal.

    I've tried to fix it myself, but failed miserably, could you maybe give me a hint?

    Thanks,
    x
     
  44. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Glad to hear things are going good with your project! On your new side project, can you be more specific with why the character is rotating like that? What is the use case?

    The Weapon is made a child of the Subject, IKProxy.SetupWeapon() will put it in the right position and rotation, one time, based on the unique Weapon data. Next the IKProxy will continuously tell the Animator to IK the hands to reach for the target positions on the weapon. Since the Weapon is already positioned, rotated and made a child of the Subject's Transfrom it technically doesn't need to update, it always inherits the Subject's position and orientation.

    If you want to change how the setup behavior works you can probably modify IkProxy.SetupWeapon() lines 127 and 128 to take into consideration the current Subject rotation.

    Code (csharp):
    1.             _weaponTransform.localPosition = Vector3.zero + SubjectTr.TransformVector(Subject.WeaponPositionInHandCorrection);
    2.             _weaponTransform.rotation = FindWeaponOrientation();
    There is certainly an absolute way to get the above information relative to the Subject's Transform but I'd have to setup a scene to experiment with since I dont have a solution off the top of my head, so knowing what your actual situation would help me repro the conditions.

    I haven't visited this code in a really long time, but the FindWeaponOrientation() method looks like this:
    Code (csharp):
    1.         protected virtual Quaternion FindWeaponOrientation()
    2.         {
    3.             Transform bone = GetRightHandBone();
    4.  
    5.             return Quaternion.LookRotation(
    6.                 bone.TransformDirection(Vector3.Cross(Subject.ThumbDirection, Subject.PalmDirection)),
    7.                 bone.TransformDirection(DominantHand == Hand.Right ? Subject.ThumbDirection : -Subject.ThumbDirection));
    8.         }
    So it might be something as simple as changing TransformDirection to InverseTransformDirection. The position would have to be modified as well. Keep in mind this only happens when you switch weapons and the IKProxy updates this information and then the weapon relies on the Subject Transform, so if you're using Animations to make your character do a flip or something then that would be an unsupported scenario unless you turned off the IK, reparented the weapon to a bone, let the animation run, then setup the weapon again via IkProxy.SetupWeapon().
     
  45. xagarth

    xagarth

    Joined:
    Sep 7, 2016
    Posts:
    17
    Ahhh, I'm sorry, I should have given you more background at the beginning.
    First of all, thanks for fast reply.

    My sideproject is a small game where player walks around a planet. So I have a sphere with faux gravity, unity gravity is disabled and player is aligned to the planet. Everything works fine (maybe except aim, but I think I can fix that :p) except IK stuff. When I disable IK, everything works fine. With IK enabled I get upside down weapons and hands.
     

    Attached Files:

    • top.png
      top.png
      File size:
      342.9 KB
      Views:
      821
    • top.png
      top.png
      File size:
      342.9 KB
      Views:
      807
    • down.png
      down.png
      File size:
      277 KB
      Views:
      833
  46. BilginSahin

    BilginSahin

    Joined:
    Jul 2, 2012
    Posts:
    48
    Hey i have a request. Can you maybe implement the feature, that the player is shooting to the real mouse/ crosshair position.
     
  47. BilginSahin

    BilginSahin

    Joined:
    Jul 2, 2012
    Posts:
    48
    Found another problem: I setup a character with no weapons, placed a weapon pickup on the ground, set in the preference asset the autoswap option but he is isnt swapping. What could it be?
    Log Debug "Trying to switch weapon to slot -1 from 0. Total Weapon Count: 1" is the index right?
     
  48. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    Probably an unexpected case of there being no weapons equipped. Sounds like a bug, I'll check it out. You can probably fix it by equipping a blank melee weapon (like fists, as iirc the demo does).
     
  49. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,529
    1.1 is sent off to the store team.
    • Min version is 5.5. Fixed a bunch of API depreciation warnings and handled the API upgrade changes so importing is smoother.
    • Integrated Rewired support (courtesy of Guavaman) to the coop installer so its easy to setup the example scenes.
    • Updated docs.
     
    TonyLi likes this.
  50. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Thanks for this update. Looking forward to seeing the Rewired integration for co-op mode.