Search Unity

Deftly - Flexible Top Down Shooter System

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

  1. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    It has a blog on it, but WIX hosted pages are really common so.. i dunno..

    I could include them in a text file or something I suppose. I like keeping them in one place to lower the chances that I forget to update something and old information is in there. I'll figure something out.
     
  2. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Well, don't over worry about it. I'm just one d00d haha.
     
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Finally got time to clean up the demo a bit! Download the demo and check it out for yourself!

    Please report any issues you run into with it =)
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    I decided to go ahead and add the Advanced Stats in place of the basic ones. I figured it was better to do this earlier than later because it wipes out all of your Subject's Health, Max Health and Armor values.

    Here is what it's looking like:



    You'll have an option to toggle off the formula's that these stats are based on. That basically means you can ignore the 'stats' and just use Health/Armor like it is in the current patch.. I may also move around some code for damage handling and stuff to more generic systems that make it simpler to maintain the formulas. Not sure about this yet, though.

    If you have thoughts on this change, feel free to comment.
     
  5. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514


    Now we're tracking lots of stat data including character information scaled by leveling up as well as damage, hit counters and in-game coin/cash!

    The RPG stats are floats so you can calculate in fractional values, then round off to int's when needed, such as if you only want a stat to increase on every 4 levels it will be a "Per Lvl" of 1.25.

    The formulas are really straightforward and easy to manipulate if you need to change something. The stats do not affect anything like weapon damage or damage reduction yet. They just scale properly in this patch. In fact, they're only added now because I don't want to break the Health and Armor stats later when the asset has a wider userbase.

    Recent changes going into the 0.6.9 patch are online here. You may want to take a look in case something affects your game.
     
  6. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    323
    Very nice! This is shaping up nicely.
     
  7. ad456m

    ad456m

    Joined:
    Jul 13, 2012
    Posts:
    5
    Loving the asset, is the ability to dual wield weapons(guns and/or melee) on the books for a skill or otherwise?

    cheers Ad
     
    LaneFox likes this.
  8. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Maybe.

    I thought about it while I was redoing the ik system. Could work, but it's a ways down the line. =)
     
  9. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Actually, you could probably do it now for ranged weapons by adding both models in a single weapon, then use the non dominant hand target on the other model. Use multiple spawn points to fire from the weapons separately.

    Only problem could be that the space between weapons is constant and unaffected by character scale. Give it a try :)
     
  10. ad456m

    ad456m

    Joined:
    Jul 13, 2012
    Posts:
    5
    Cool, I'll have a mess around with that when i get a chance.
    Kudos for the quick replies

    Cheers
    Ad
     
  11. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514


    Check out the new Trailer!
     
    600 likes this.
  12. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    591
    any chance to make this asset into a third person shooter ?
     
  13. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Nah, doesn't really work in that perspective. It would get close but require some revamping to make it work real good as a tps.
     
  14. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    591
    can you create a custom one or as add-on ?
     
  15. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Possibly eventually somewhere down the line, but not any time soon.

    There are other great 3rd person setups on the asset store already.
     
  16. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    591
    to be honest bought them all and no single one for them is good
     
  17. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    0.6.9 update is on the store.

    Check the release notes for changes and alerts before updating!
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Hi,

    Congratulations on being in the Cyber Weekend sale!

    I know multiplayer support is on your tentative roadmap.

    Is the code base in a state yet where I could implement local multiplayer myself without having to restructure too dramatically? I don't mind holding off if, for example, PlayerController.cs currently assumes there's only one player and works like a singleton, or if other scripts use a lot of FindObjectOfType assuming that there's only one instance in the scene.
     
  19. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Thanks! =)

    I think it is in a good enough place to do that on your own if you wanted to. PlayerController.cs doesn't work like a singleton, you can rename the inputs on each character. However, I assume you would be using InControl for your local multiplayer - If so, it currently just uses the first active device so you'll just need to assign characters to Device ID's correctly. I haven't dug into it to see what else would be involved in more local players but I did expect that to be one of the primary issues.

    DeftlyCamera.cs can already track multiple GameObjects by positional average (haven't thoroughly tested it with all the options) but you would need to add stuff like frustum constraints, etc. Not terribly difficult. I don't think I use FindObjectOfType anywhere. I tried minimizing that sort of thing and when necessary I try to use Camera.main because its easy/cheap to access and always exists.
     
    TonyLi likes this.
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Thanks! I just picked up a copy.
     
    LaneFox likes this.
  21. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Hi Lanefox,
    Your plugin looks great , i have few questions :
    1) It is possible to activate or deactivate player weapons, so he can only use active weapons ?
    Do we need to declare the list of all possible weapons or can we declare some gun weapon type and another rifle type and change the prefab of the gun depending on the gun model the player would choose on it's inventory ?
    I mean can we change each weapon model at runtime , they keep same behaviour but they have different stats and a diferent model look ?
    For example like Borderlands weapons, you have several types, but many model looks and variations.
    2) It is possible to rotate the top down camera ?
    3) It is included some mini radar option showing red dots for near ennemies ?
    4) it is possible to use our own characters with custom rig and still be able to use the IK system ?
    5)Can this work for bigger maps ? i mean having far ennemies not active and not displayed until the player is near enought for performance reason ?
     
  22. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    1. I'm not really clear what you mean, but you can specify which weapons are available by defining them in the Subject script. Predefined weapons are immediately available. You can then pickup and drop any weapons at any time through the Weapon Pickup system. Is that the functionality you are looking for?
    2. You can change the camera orientation by modifying the Vector3 variable in the DeftlyCamera script on the Camera. This is the literal distance offset in xyz from the target position.
    3. No radar is included.
    4. You can use any model as long as it is Humanoid rig type. Some rigs can cause issues with Optional Bones. Assess these issues as needed per model inside Mecanim.
    5. There aren't any special features in Deftly to optimize for enormous map sizes beyond good practices, if built-in culling is not fitting the bill you may need a 3rd party solution that caters to your specific needs or customization of the scripts that are causing you performance spikes at large scales. Toggling enemies off at a specific distance - for example - may not be something that suits every application. I can look into this if its a hot requested item, though.
     
  23. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    I have played your desktop demo and moving animations look... umm... wrong? I assume root motion is off and animation controller do not handle it at all. The only possibility to not notice it - keep camera as far away as possible, as in your videos. Are you going to fix that?
     
  24. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I mean, if we have a pistol weapon type enabled, if the player found one it is equiped like defined in the script.
    But when we have 15 type of different pistols each with it's own 3D model and it's own data (damage, fire rate), do we need to declare all 15 pistols or can we change in code at run time the 3D model when the player change the pistol type ?

    When the character turns direction some walk or slide blending animation would do better perhaps, it is easy to add ?
     
    Last edited: Nov 28, 2015
  25. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    The direction fed into the Animator is correct, what you're seeing is probably because there are only 5 movement animations on the character: Forward, Back, Left, Right and Idle. This makes movement in some directions look fairly lacking. If you need more fidelity in the movement animations you'll probably want to get an animation pack and overhaul the Animator Controller, or roll your own. Otherwise you can add more movement animations and they'll blend fine.

    The weapon swap code will deactivate the current weapon GameObject and activate the target weapon GameObject. I suppose you could modify the Weapon script on the GameObject when you swap to it but this is not the designed path. It's designed to be setup where each weapon has a separate prefab and you interact with it as needed.

    You can definitely add more animations to the controller with ease. There are lots of different ways to setup a controller and I chose to provide a simpler set of animations and layer system to keep it easy to work with. If you have experience working with more advanced controllers and animation sets then you'll probably want to roll your own controller.
     
  26. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    591
    is the zombie AI included -?
     
  27. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    The AI system (Intellect) is included. The zombie model is not included but is free on the asset store. The zombie is basically just an AI with a melee weapon with a very short range defined so it has to close in before attacking.
     
  28. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Will there be mobile controls? Thank you
     
  29. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    591
    in your video i couldn t see how to set up the zombie etc i mean the melee function
     
  30. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Hi, is it not possible to use navmesh upstairs? After walking up a slope, the characters height stays there so if I walk back the character is floating on top of the level, or am I doing something wrong?
     
  31. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Change the Drag value on the Rigidbody to something like 0.1 instead of 50.

    The reason it is like this is because the majority of the Top Down games I sampled data from did not have varying floor heights so I set the drag high to reduce the character's response to external physics inputs since that was now an option if I didn't need gravity. You'll need to adjust the Rigidbody values and such to suit your game.
     
  32. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Ah I see, thanks :)
     
  33. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Thanks for mentioning this, if something isn't clear let me know. I'll try to make a video on how to do this mid next week but basically here's a rundown of how it works:

    The zombie is just a regular Intellect with a melee weapon that has a very short Intellect Range value. This makes the Intellect get to a very close distance before attacking with its weapon. The weapon is a Melee Type. Melee Weapons need "Melee Attack" references to work - these include some info for the Animator like what event to send so it can run the Attack Animation. Since the Weapon is in the enemy hand you just have to make a Melee Attack that sends the right Animator Event.

    If you want it to 'just work' then give any Intellect the Blade Of Grass weapon prefab, watch them use it properly, then examine how that is setup in the Inspectors for the Subject, Intellect and Weapon. The Zombies do the same thing but instead of the Blade Of Grass it's just a Melee weapon like it but doesn't have a model to represent it - only a Trigger box...

    Edit: Actually, I think the MoronBot prefab is basically the Zombie. Check it out.
     
  34. mdcreation

    mdcreation

    Joined:
    Apr 19, 2012
    Posts:
    7
    hi,
    how to fix this?

    transform.localRotation assign attempt for 'Fistacles(Clone)' is not valid. Input rotation is { NaN, NaN, NaN, NaN }.
    UnityEngine.Transform:set_rotation(Quaternion)
    Deftly.IkProxy:OnAnimatorIK(Int32) (at Assets/Deftly/Core/Internal/IkProxy.cs:151)
     

    Attached Files:

    • ex1.png
      ex1.png
      File size:
      339.6 KB
      Views:
      861
  35. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Does this happen consistently? I can only reproduce if I import to a new project and run the scene for the first time without restarting Unity. After restarting Unity I don't see any errors.

    I'll look into it, but it seems to be limited to importing and not restarting Unity. Possibly Script Execution Order or something. Let me know if you can produce it more consistently.
     
  36. mdcreation

    mdcreation

    Joined:
    Apr 19, 2012
    Posts:
    7
    yes,it consistently. and The referenced script on this Behaviour is missing! in point light of ImpactExplode prefeb.
    i use unity v 5.2.2f1
     

    Attached Files:

    • ex2.png
      ex2.png
      File size:
      288.2 KB
      Views:
      879
  37. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Thats probably from a fading light script used for a while and scrapped it but didnt remove the component so it throws a warning. You can remove the missing component.

    I'm not seeing the warning produce if I restart Unity after importing. Are you updating an existing project?
     
  38. Argantonius

    Argantonius

    Joined:
    Nov 28, 2013
    Posts:
    2
    Hi,

    any chance of allowing multiple AudioClips for the projectiles?
     

    Attached Files:

  39. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Yes I want to do that, will aim for next patch if I can.
     
    hopeful likes this.
  40. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    I'm trying to follow Getting Started Guide, set up camera, set up character, but when I click play camera moves ahead of character. It looks like camera position offset axes are shifted. Have you experienced such thing before?
     
  41. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Change the Track Distance on the Deftly Camera script to zero. This is the distance ahead of the target that it will look, later there will be some blending options to make it smoother.
     
  42. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Did a little investigation. The problem is that the camera doesn't want to look at player at all, so I went and looked at your code and now I completely lost. This is the only place where LookAt is in use:
    Code (csharp):
    1.  
    2.             if (!Application.isPlaying)
    3.             {
    4.                 transform.position = _averagePos + Offset;
    5.                 transform.LookAt(_averagePos);
    6.             }
    7.  
    How is that supposed to work at all?
     
  43. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    _averagePos is the position average of all of the camera's targets. For instance if you have two players then _averagePos will be the point between them. Offset is added because you have to define the literal position distance in xyz as an offset in the inspector for how far you want the camera to stand off from the target (which is _averagePos).

    After it sets the position, it then looks at the position.
     
  44. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    The problem is this: if(!Application.isPlaying)
    OK. I see you have just set a fixed angle on your camera in demo, that's why demo is working. It would be good to mention it in documentation.
    Another question, is it possible to completely replace your animator/camera but keep everything else? The included one is not suitable for production at the moment and I would like to use 3rd party solution for movements/camera, e.g. Motion Controller.
     
  45. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    The if(!Application.isPlaying) is for setting this while you adjust the Offset in the Inspector while its not running the game. Adjust the position prior to running the game.

    There are some dependencies on the camera script right now. The arbiter bits is used to figure out some orientation stuff for controls so you'll need to accommodate that. Search for anything using Camera.main to find the dependencies, should be pretty straightforward.

    Improvement for the Camera script is roadmapped, just have to allocate time to get to it. What would you expect to see? Feedback is really helpful to improve the design.
     
  46. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    The biggest problem at the moment is animator. I would like it to use root motion. Now it looks unnatural, when direction is changed to opposite legs just slips on the ground.
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Great work on Deftly! I just wanted to report that it was easy to set up local multiplayer -- just set the InControl Device ID for each player, make copies of the Canvas, assign each player to its own copy of the Canvas, and add the players to the DeftlyCamera list. I'm on the fence between automatically zooming the camera out to encompass players when they move apart or restricting movement to inside the frustum. It would be nice to have one or both options built into Deftly in the future. I also handle player deaths differently (respawning unless all players are dead at the same time), but that's going to be project-dependent.

    I agree. Root motion support would be nice.
     
    LaneFox likes this.
  48. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,514
    Thanks for the feedback,Tony! =)

    I agree with the camera movement constraint options, I'll be working on this. Probably going to overhaul the Camera script to behave more intuitively than it does now.

    Will look into specifically supporting Root Motion driven animation setups. I think I understand what you guys need here and confident I can get it added. I assume you're aiming to use something like Kublod's animation packs or general mocap kits, right? Should be straightforward to support this, just haven't studied it yet.
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Apart from the constraints (either restricting movement to frustum or zooming out), the camera works just great for me. No complaints at all.

    Yes, if Root Motion is ticked on the Animator, please just let the animation take care of moving the transform instead of moving it yourself.
     
  50. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Exactly, thank you!