Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Deftly - Flexible Top Down Shooter System

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

  1. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Hey, this is a great reference

    http://wiki.unity3d.com/index.php?title=Xbox360Controller

    Axis x and y on the input manager for unity reads the left stick using -1 to 1 as values from left to right likewise bottom to top. Axis 4 controls horizontal on the right stick and axis 5 the vertical. I usually just plug whatever names the initial inputs were into the above axis and see if it works straight up, sometimes it needs adjusting sometimes not.

    Set the gravity and sensitivity to 1 and I usually set the dead zone to 0.6 or above as my controllers are old and well worn, you could get lower hence more range. Make sure snap is off and you'll probably have to invert the up-down

    Lane I definitely recommend you get an xbox controller as they stand as a good reference and this asset would be most natural in a proper twin stick configuration - I'd imagine most people serious about their twin sticking would be doing it with a suitable controller, hence it being good if the control code adapted to this painlessly

    I'll add that I've been enjoying having a look at this asset and I can imagine it growing into something great. It doesn't quite fully fulfil my needs atm possibly because of a nonstandard animation setup but I'm definitely thinking about possible future use
     
    LaneFox likes this.
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    @lazygunn

    Nice reference page, was not aware of all that info so thanks for that and the first hand tips!

    My main concern was consistent recognition of various controllers (especially cross-plat!) which most store solutions seem to handle pretty well, thats why the lean toward them. But, I have not looked into Unity's built in strength in this regard just yet so I'll just have to tinker around a bit before I can decide which way to go here. I have piles of controllers to test with, being a Top Down & Local Co-Op fiend, myself :p

    I'm glad you like it! I agree it's not "there" yet for sure. I've built a more practical demo and it's revealed a lot of holes I can patch up, they're filling out well. I've got some ideas and experiment branches working toward supporting more traditional animation workflows so that will come along eventually. I fully understand not everyone will want to use the current IK handler.
     
  3. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    That would be great. I am no pro when is comes to C#, but the top-down control feels tons better with the joystick.

    this is the section I think needs the tweak:

    Code (CSharp):
    1.   #region AIMING SYSTEM SEGMENT
    2.             Ray ray = _cam.ScreenPointToRay(Input.mousePosition);
    3.             RaycastHit hit;
    4.             if (Physics.Raycast(ray, out hit, 1000, Mask))
    5.             {
    6.                 Vector3 dir = hit.point - _go.transform.position; dir.y = 0f;
    7.                 Quaternion fin = Quaternion.LookRotation(dir);
     
    LaneFox likes this.
  4. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    Thanks lazzygunn. I know how to configure the Input schema, but setting up the aiming in the PlayerController.cs is a bit of a challenge.
     
  5. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    If you could make the IK something you can swap out rather than being too buried in the system and anticipate forthcoming 'physically based' animation systems, such as those i'm testing (while its not at all accurate or fair comparing, but think Euphoria) then that would help a great deal. Being able to facilitate FinalIK for example would be a huge boost for example, regarding IK, as that can, if the dev wishes, not only take care of the weapon handling, headlook or foot placement but can also handle a lot of non-standard animation scenarios and even specific actions requiring IK to look 'right' (such as its interactions system)
     
  6. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    I managed to get some kind of Input feedback from my hacks. I am only getting 180 deg of rotation. Can you spot what could be causing this from the hacks to the code below. I can't share the full source for obvious reasons. This little section is I believe where we need the patch. I know you are going to update for control types, but I only need the 360 controller for now. Following the info lazygunn shared, I have the axis mapped.

    Code (CSharp):
    1.  
    2.             Vector3 aim = new Vector3(Input.GetAxis("Right Stick X Axis"),0,0);
    3.             Debug.Log (aim);
    4.            
    5.             Ray ray = _cam.ScreenPointToRay(aim); //aim kind of works
    6.             RaycastHit hit;
    7.             if (Physics.Raycast(ray, out hit, 1000, Mask))
    8.             {
    9.                 Vector3 dir = hit.point - _go.transform.position; dir.y = 0f;
    10.                 Quaternion fin = Quaternion.LookRotation(aim); //aim and some what works
    11.  
     
  7. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Good suggestion, I'll start looking at refactoring the way IK is handled so it can be modular.
    I'm not at my home computer so I can't test this, but something along these lines should be in the right direction.

    Note that it will not be sufficient for good gameplay with a controller, there's a lot to think about with this - specifically stuff like deadzone of the thumbstick.

    Code (csharp):
    1.  
    2.             Vector3 lookInput = new Vector3
    3.                 (Input.GetAxis("JoyH"), 0,
    4.                 Input.GetAxis("JoyV"));
    5.  
    6.             Ray ray =  new Ray();
    7.             if (useController)
    8.             {
    9.                 lookInput = _arbiter.transform.TransformDirection(lookInput);
    10.                 Vector3 spot = transform.position + lookInput;
    11.                 ray.origin = _cam.transform.position;
    12.                 ray.direction = spot - ray.origin;
    13.             }
    14.             else
    15.             {
    16.                 ray = _cam.ScreenPointToRay(Input.mousePosition);
    17.             }
    18.  
    The idea is to do something similar to what is happening with the Movement code below. You will have to have both the horizontal and vertical axis from a thumbstick so note what `Vector3 lookInput = ...` is doing.

    The comments on the movement code have lots of hints that explain what is going on.

    There needs to be a `useController` bool to dictate if this character is using a controller or not, but you'll have to edit the Editor class for PlayerController to get it to show up in the Inspector. To avoid doing that just do this at the top somewhere.

    Code (csharp):
    1.  
    2. private bool useController = true;
    3.  
    If you can't seem to crack it yourself just hang loose until I add proper controller support.
     
  8. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    Thank you and this works. If you come up with something better I'll be looking forward to it.
     
    LaneFox likes this.
  9. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    @LaneFox I have to say I am super impressed with the way the AI behaves. Just the combination of AI types makes for some interesting gameplay. Good job
     
    LaneFox likes this.
  10. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Ahh you know, another integration I thought of that could be relatively painless is possibly approach opsive who is the creator of behavior trees which has a tactical addon. He's pretty great at working with integration with other assets and I think the behavior trees and the tactical extension could make a good go-to simply to get some strong ai going.

    I don't discourage developing your own ai at all as it would definitely make the package more complete but what I suggested would be a great way, if it can work, to get some nicely nuanced ai straight up for those willing to invest in this and opsive's work
     
  11. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    Oh god this is just awful. Will just wait on what you implement. Maybe it's best with mouse keyboard. It all works, but need to normalize or smooth the rotation out some with the joystick. :) I'll wait.
     
  12. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Sounds about right lol :)

    It's not super simple, unfortunately. I'll look into it this weekend.
     
  13. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    @LaneFox reticle / crosshair would be great as well. The weapon with the target beam helps, but for the others it's hard to tell where your aim is. I have a custom mouse cursor, but it's not clamed to the player... meaning it goes anywhere the mouse is on screen.

    Code (CSharp):
    1. public Texture2D cursorTexture;
    2.     public CursorMode cursorMode = CursorMode.Auto;
    3.     public Vector2 hotSpot = Vector2.zero;
    4.     void OnMouseEnter() {
    5.         Cursor.SetCursor(cursorTexture, hotSpot, cursorMode);
    6.     }
    7.     void OnMouseExit() {
    8.         Cursor.SetCursor(null, Vector2.zero, cursorMode);
    9.     }
    10.  
     
  14. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    InControl support ready!

    @pixelone


    I'll get it wrapped up with some other stuff I want to finish over the weekend and hopefully I can submit an update to the store by Monday if it all goes smoothly. Likely the new Demo Standalone Build will be ready as well.

    I've tested on a PS4 controller and its working excellent. I don't see any reason other controllers wouldn't work the same after looking at how InControl handles them.

    I do not plan to support controllers with Unity's Built-in Input Manager. It does not seem reliable enough to do this. You'll need a more polished tool like InControl or ReWired to properly handle Controllers.
     
  15. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    @LaneFox Awesome! On a side note, I have several audio Master Mixers setup, but for the life of me I can't find the AudioSource attached to any of the game objects playing audio i.e. projectiles. Am I not looking in the right place? I need to set the AudioSource output to my Master Mixers, but cant find them to do so. any thoughts?

    I thought you had to have an AudioSource on a game object to play back audio? I am learning new things everyday
     
  16. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    Looks like you are instantiating "one shot audio" at runtime when shots are fired. I can't find the prefab. This is all I need to route the audio through my master mixer.
     
  17. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Yeah I was a bit shortsighted with that when I started making the sound code, some of the SFX are fired with PlayOneShot but I'm going to change this soon since there isn't any way to manage the sound effects with that way. It'll be more AudioSources on prefabs so you can plug them in however you want.

    I might be able to squeeze that into the weekend, but I doubt it.
     
  18. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    @LaneFox this is not a big deal, but being that you are updating the package. Here's another bug. When the player dies, he can still shoot thus causing an error with the bullet collision. I guess it is checking if the player is still alive. Again not a big deal, I am going to try an resolve myself.
     
  19. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    In the latest build I get rare cases of the player spinning at death but for the most part I fixed those - no more floating away or attacking while dead.
     
    pixelone likes this.
  20. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    That's good to know. I'll get in touch with him soon and see what can be done in this regard.
     
  21. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014


    Deftly 0.6.5 beta update heading to the Asset Store! (takes anywhere from 5-10 days)

    Release Notes
    Trello Roadmap (and known issues list)

    Check the Release Notes for details about what is included in the update. A standalone demo for windows will follow this week which will be a playable version of the level in the video above. Note that the video above is using a nukacola megaton of 3rd party assets and is definitely not included in the package. You still get Eleanor, the Weapons and the prefabs which are the important mechanical parts =)

    There are a couple of bugs introduced into existing systems, but I won't have a lot of time this week to fix them so I'm going ahead and pushing the update out to try to get ahead of Unite in case that bogs down submission times for the Asset Store since some of this stuff needs to get into your hands and tested properly.
     
    pixelone likes this.
  22. SimStm

    SimStm

    Joined:
    May 24, 2013
    Posts:
    44
    0.6.5 version looks like what I need to proceed with my studies. Awesome work. Waiting anxiously for the new release.

    Would be awesome to have a "future feature" to alternate between "walk and run" speeds (for now we can only move in a unique speed, so it's a little bit odd). How can we suggest new features? In this post, via email, Trello or what?

    Thanks!
     
  23. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Use Trello to upvote features and improvements. If it's not on the Trello board then you can post it here and I'll get it added.
     
  24. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    600 likes this.
  25. RTSlang

    RTSlang

    Joined:
    May 3, 2013
    Posts:
    56
    Is the AI constantly aware of the player?
     
  26. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Yes. They are aware of anything inside their Sight Range (Spherical)... I thought about doing some more robust configurations for sight but decided that would be further down the roadmap, likely post v1.0.
     
  27. PabloEscobarofgames

    PabloEscobarofgames

    Joined:
    Dec 15, 2014
    Posts:
    21
    Why do the bots not do anything if you give them the melee sword? They just stand still and do nothing.
     
  28. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    I imported the store version and tested the demo level - the bot with a sword seems to act properly. Seems to work okay when I give the sword to the other AI as well. Have you changed any settings perhaps? Any console errors/warnings?
     
    Last edited: Sep 20, 2015
  29. PabloEscobarofgames

    PabloEscobarofgames

    Joined:
    Dec 15, 2014
    Posts:
    21
    I havent changed any settings :/, maybe it is my unity version?
     
  30. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Which version are you on?
     
  31. PabloEscobarofgames

    PabloEscobarofgames

    Joined:
    Dec 15, 2014
    Posts:
    21
  32. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Did you import on top of a previous version? I cant repro that on my end starting fresh. Try starting a new project and importing the package from the store into it.
     
  33. SimStm

    SimStm

    Joined:
    May 24, 2013
    Posts:
    44
    I got the same issue with the AI just following you and pushing you (while running) with the melee weapon.
    I've created a new project and added the new Deftly version and the issue was solved.
     
  34. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Well, AI couldn't use Melee in the previous version (I may have overlooked documenting that in the patch notes?). Should work alright in 0.6.5, did some more tests and they seem to be behaving as expected. If you made a new weapon double check the Range on it. The Intellect reads the weapon to see how close it should get. If the range is zero then it'll just run into you constantly because it cannot get close enough.

    On that note, there is is a bug in 0.6.5 with IK where Melee weapons are not consistently handled between characters due to the way models are rigged differently and Mecanim interprets the hand axis. If you have a model with a weird rig it's probably going to mount the weapon wrong until the next patch. I've got it fixed by improving how IK is handled(similar results - more practical design approach), but I'm looking for ways to simplify it because the fix makes it sort of annoying to set up characters.
     
  35. SimStm

    SimStm

    Joined:
    May 24, 2013
    Posts:
    44
    @LaneFox
    Actually I had this problem while updating from 0.6.0 to 0.6.5 with the default melee weapon. Maybe updating/replacing the old version made some wrong changes in the code and causes this trouble. I was just about to create a new project to start a "cleaner" version of my project anyway, so no problems at all.

    Oh, and would be awesome to have the "Intellect Improvements 1" in the next version (with Wandering/Patrolling support for AI), mostly because the idea of the "Top Down Shooters/Hack'n'slash games" is to have the AI enemies patrolling/wandering an area and react to the player if he gets next OR if he gets attacked.

    Btw, I already have upvoted this improvement in Trello. :)
     
    Last edited: Sep 21, 2015
  36. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    That makes sense. I'll look around for problems that could stem from that. Thanks for mentioning it.

    I'll look into it. Might split the updates into smaller chunks.
     
  37. SimStm

    SimStm

    Joined:
    May 24, 2013
    Posts:
    44
    I forgot to add this in my previous post, but should be awesome to have Hand Correction for both hands, that way we could make little tweaks for the hand rotation of an animation via IK for each hand separately, for example.
     
    LaneFox likes this.
  38. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    319
    This looks like a awesome new kit, and I'm about to pull the trigger on it. I am wondering, however, I noticed in your project overview that DeftlyCamera.cs is a reqired component of PlayerController.cs. As I will be converting your project to VR, I will be using the VR camera and will need to modify DeftlyCamera.cs. Looking at your other project it looks like you undersand VR cam setup. Will there be a major amount of modification required to the PlayerController to detatch the camera logic? or could a switch be added to disable authoritative camera controls and parent the VR cam?
     
  39. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Hmm, I think I'd have to add support for this to work like you want. There probably needs to be a wrapper object with DeftlyCamera on it that handles the transforms, then the VR camera can be a child and do whatever it wants. There are some calls to Camera.Main in other scripts (to look at the rotation for control input corrections) so by changing the hierarchy there it might break some stuff. Might be enough to just make a reference on the script to the real camera and adjust the calls, though.

    Could be as simple as that... If you want to tackle it yourself I'll help you sort it out. I don't have any plans to add official VR support before 1.0, though.
     
  40. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    At the Weapon level you can adjust the IKGoal objects for this, or do you mean at the Subject level - constant additions to each hand's rotation/position?
     
  41. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Coming in next patch: Way better inspectors!



    • Replacing all of the old foldouts with slick toolbar buttons
    • Editor will now remember what foldouts you have expanded/collapsed!
    • Better organization of the variables and categories
    • General quality of life improvements to better your design experience using the inspectors.
     
  42. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    154
    This is very very nice! Thanks
     
  43. GrimDjim

    GrimDjim

    Joined:
    Jan 29, 2015
    Posts:
    7
    Just happened across this and it looks amazing. I'm not ashamed to admit I'm a total novice and looking for a top-down melee solution, looks like this will be it. Just curious if it contains a ragdoll on death system and if the blood particle stuff is included? It's not a deal breaker, would just be nice to save a couple of headaches. Many thanks.
     
  44. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    The blood fx are included, you can easily swap them out. All that's really happening is that when contact is made it looks at a tag list that you setup and spawns the correct prefab for that tag. There's no ragdoll, but you could set it up to do so if you wanted.

    Melee was just added in the previous patch so it's not as polished as the ranged weapon system. Let me know what you need from it after you dig in because its getting some attention in the coming patches.
     
  45. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Upcoming 0.6.7 patch is in the Beta Group for testing.



    Changes:
    • IK System Overhaul
    • Inspectors Overhaul
    • Minor changes across various things
    Release Notes
    http://www.cleverous.com/#!deftly-release-notes/c1cdb

    It will be out next week, pending the Beta Group feedback.
     
  46. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Patch 0.6.7 is live on the Asset Store.

    Backup your projects! the IK system is completely different and you'll have to adopt all Subjects and Weapons to it.
     
  47. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    401
    For some reason I can not open your site with the release notes. Ive used internet exploder, firefox, chrome. I am baffled. Is it possible you could start putting them on trello? I can access that site fine.
     
  48. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,184
    Nice update!
     
    LaneFox likes this.
  49. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,014
    Thats strange, are you somewhere geographically that sometime restricts site access or behind a proxy/school/work network?

    Here's the notes for this release:
    _0_yWKbRQ6qqUSqkuektAqWQwOrYCV8n9rkA8H_V-Dg.png
     
    wolfen231 likes this.
  50. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    401
    I work in China. But it seems odd that your site would be blocked. It's not a blog of some kind. Thanks for the notes.

    Even on shadowsocks and vpn it doesn't work. I got it to work once at home with shadowsocks. Once. lol

    Edit: And great update. Oh. Maybe you can include the release notes in the package? Or is that something Unity doesn't allow?
     
    LaneFox likes this.