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.

[RELEASED] DarkTree FPS system

Discussion in 'Assets and Asset Store' started by DarkTree, Mar 29, 2019.

  1. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    @Tema_ Good question. I'm thinking that it might be a good idea to change this over to animation events. Only way to know for sure is to test and see if animation events are more performative.

    Right now, it looks like GetCollisionTag.cs is casting rays to constantly read the tag of the floor object below the player and passing that to call FootstepSound.cs to play the correct sound for that tag. It's using PlayOneShot, so what you are probably noticing is the audiosource doesn't finish playing one sound before the next one starts, so you hear fewer steps the faster you move. Tricky problem to overcome. The only parameter that seems to be changing is the randomization of the pitch, not the speed of the sound. DarkTree will have to confirm.

    Animation events would only fire when the event is triggered by the animation. Walk faster or run, and it only plays when YOU tell it that the foot has hit the floor. In the image below, an (AI) event has been created on the pistol_run_inPlace animation to play the event RunFootSetpSound at about0:25 and again at 0:80 on the timeline. This is when the foot looks to me has hit the ground. If I follow similar logic to what already exists, I can produce the same tag-based sound playing, without the overhead of raycasting.
    upload_2019-6-30_16-1-6.png

    Mark
     
  2. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    507
    english plese.. this is an internation board...sorry wont to be rude.. but we cant help you if we cant understand you
     
  3. Tema_

    Tema_

    Joined:
    Jun 30, 2019
    Posts:
    2
    Thanks a lot!
     
  4. ASHWINNJ

    ASHWINNJ

    Joined:
    May 31, 2019
    Posts:
    5
    hi , can u update free version too, just a little bit,
    that grenade makes the game crash and it is unlimited, not asking too much , just a bug fixx, couldn't buy the asset as i myself searching for job now :p or just by sharing fixed script :) . just asking if possible :)
     
  5. scarfell

    scarfell

    Joined:
    May 16, 2017
    Posts:
    10
    @DarkTree Down the line have you considered adding a trade/barter system. Kinda like STALKER/Escape from Tarkov. I think that could be really cool


     
  6. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hi. Think that it might be cool.
     
  7. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Essentially, I wanted to make grid based inventory like in diablo or stalker, but there is not any tutorials about that. Logic of same inventory is kind of bdsm for my brain:)
     
    scarfell likes this.
  8. scarfell

    scarfell

    Joined:
    May 16, 2017
    Posts:
    10
    Hows the new update going
     
  9. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Done player save system now thinking about level save (npc, items, etc)
     
    scarfell likes this.
  10. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Is someone can explain why unity often rebuild all project? Getting annoyed with that! I lost my main scene where was all new settings about week ago and here's the same again. It freezes progress every time!

    2019-07-07_00-56-31.png
     
  11. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    Sounds like you need to submit a bug report to Unity, and start backing up your work more often to prevent losses and delays.

    Mark
     
  12. Ewan-Churchill

    Ewan-Churchill

    Joined:
    Oct 10, 2018
    Posts:
    20
    Hi quick question is there an easy way to change the code to allow for the unity message system so that i can allow for your assets settings and damage system deal damage to a different AI asset that uses a public float damage with unity message system?
     
  13. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hello. Honestly, I have not worked with message system. I think that you can place your message call in the weapon script. Try to find damage methods in the code
     
  14. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239


    Doing FPS body movements
     
    scarfell likes this.
  15. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    Anybody got head shots working yet?
    I have reduced the size of the Assaulter's capsule collider and added a sphere at the head location. I have tagged that collider as "HeadShot" and added code to the weapon script to detect the tag and apply 1000 damage to the NPC script. It doesn't work. Anyone?

    Code (CSharp):
    1.            
    2.             // Headshot Insta-Kill !!!
    3.             if (hit.collider.tag == "HeadShot")
    4.             {
    5.                 if (hit.collider.GetComponentInParent<NPC>()) //
    6.                     hit.collider.GetComponentInParent<NPC>().GetHit(1000);
    7.                 else if (hit.collider.GetComponentInParent<ZombieNPC>())
    8.                     hit.collider.GetComponentInParent<ZombieNPC>().ApplyHit(1000);
    9.             }
    10.  
    Mark
     
  16. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hi! Try put debug lines to see where code wasn't executed. I recommend you to create script for headshot event and take all references on start. Also with this script you will able to see where are references looses if your variables are public
     
  17. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    I have tried many things, including adding debug lines, one of the first things I do when troubleshooting.
    I have tried using the RagDoll head collider, setting its tag to "HeadShot" and modifying the code to GetComponent / GetComponentInParent.
    I have tried creating a sphere object over the head and disabling its meshrenderer, setting its tag to "HeadShot" and modifying the code to GetComponent / GetComponentInParent.

    I did get one head shot to work. Only one out of about 100. That was with the capsule collider pulled up over it, so it probably took the hit first, and then hit the headshot collider. Mostly it just doesn't register the hit at all if the colliders don't overlap.

    I would suggest head shots as a feature request. Pretty common in an FPS shooter. I am going to restart Unity when I get home. For some reason, that seems to fix a lot of issues with code that looks like it should work, but doesn't. I will continue to push for a solution. It seems outwardly simple!

    Mark
     
  18. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    OKAY! I think I have head shots down, and a cure for the grenade death errors (Null Ref and the player just skids until you reset).
    HEAD SHOTS:
    First I created a script called HeadShot.cs:
    Code (CSharp):
    1. using DarkTreeFPS;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class HeadShot : MonoBehaviour
    7. {
    8.     public GameObject head;
    9.     public NPC npc;
    10.  
    11.     public void InstaKill()
    12.     {
    13.         npc.GetHit(1000);
    14.     }
    15. }
    16.  
    I attached this to the head bone. I created a tag "HeadShot" and added that label to the head bone. It already has a sphere collider for the ragdoll deatth.

    I modified the NPC.cs script at around line 162:
    Code (CSharp):
    1.             foreach (Collider collider in GetComponentsInChildren<Collider>())
    2.             {
    3.                 collider.enabled = false;
    4.                 if(collider.transform.tag == "HeadShot")
    5.                 {
    6.                     collider.enabled = true;
    7.                 }
    8.             }
    9.  
    This section was turning off all of the colliders.

    Finally, I modified Weapons.cs around line 465:
    Code (CSharp):
    1.             HitParticlesFXManager(hit);
    2.  
    3.             if (hit.collider.GetComponent<HeadShot>())
    4.             {
    5.                 Debug.Log("HEADSHOT!!!!");
    6.                 hit.collider.GetComponent<HeadShot>().InstaKill();
    7.                 hit.collider.GetComponent<HeadShot>().enabled = false;
    8.                 GM.headShotCount++;
    9.             }
    10.  
    This code looks for the headshot script on the collider, and if present, it IS the head. It calls the Instakill function which gives our NPC 1000 damage, then disables the headshot script so you can't just keep shooting him to get headshots after he's dead. The last line just increments a counter for updating my GUI.

    Finally, for the grenade death issue, I wrapped the entire DropWeapon function to check if the FPSController script is active. It gets shut down on player death. If it ain't active, dude's dead, so don't execute the code.
    Code (CSharp):
    1.         private void DropWeapon()
    2.         {
    3.             if (playerTransform.GetComponent<FPSController>().isActiveAndEnabled)
    4.             {
    5. ...
    6.  
    I consider all of this workaround code. I trust @DarkTree will provide the actual fixes.
    Regards,
    Mark
     
  19. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    @DarkTree What are the plans and ETA for the next version?
     
  20. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    There's a features and improvements I did for now:
    - Basic save system for player's inventory, states, weapons, position. Still in progress.
    - Rocket launcher and rocket script.
    - Small animation improvements.
    - Fixed inventory stacking bug, camera shake after death, infinite grenades bug.
    - Added player body with special animator controller and script.

    You can request new features there. I'm always open for your requests. Also I keep in mind your feedback and I will work with your notices after update release.
     
  21. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239


    Hi! Update was sent for review. It takes about 2 days approximately. So update is almost here
     
    scarfell and Daniel466 like this.
  22. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    421
    Looks good. Thank you for the update. :)
     
  23. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    I have downloaded the update into a new project. I am using 2019.2.0f1 Many errors and warnings.
    • First, there are still "dependencies" on import, these can be overcome by choosing "Upgrade/Install" pop up. Runtime versioning requires 2 restarts during installation.
    • Once installed, you have to choose preferences and update from 2.0 to 4.x runtime.
    • Most issues after install completes have to do with Postprocessing stack. I install the latest version. I end up with 47 errors:
      Assets\Standard Assets\PostProcessing\Runtime\PostProcessingBehaviour.cs(7,23): error CS0246: The type or namespace name 'BuiltinDebugViewsModel' could not be found (are you missing a using directive or an assembly reference?) FogMode, Antialiasing, etc. This seems to be related to the Standard Assets stub under the DarkTreeFPS folder. I end up deleting the runtime folder from standard assets to get rid of the 2 files.
    • After deleting the runtime folder, I get 999+ exact duplicate errors:
      Unknown error occurred while loading 'Assets/DarkTree FPS/Content/NPC/Materials/SoldierHeavy_packed0_diffuse.mat'.
      UnityEditor.AssetPreviewUpdater:CreatePreviewForAsset(Object, Object[], String) These relate to a file that Unity cannot type. SoldierHeavy_packed0_diffuse.mat. May be corrupt. I delete the file and clear the errors.
    • Others relate to missing scripts on prefabs.
      • Most onerous of these so far is a missing script on the Camera&Recoil object within the GamePrefab. What is the last script on this object supposed to be?
      • Explosion is missing an object. I believe that this is the explosionEffect prefab from Standard Assets.
    Any help or clarification of these missing elements would be appreciated. I am going to have to figure out what edits I made to the previous scripts are still required, and what I no longer need. Good thing I have the rest of the week off! LOL

    Mark
     
  24. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hello! I'm going to update the asset for latest unity version. More than half of this issues are caused by unity editors incompatibility. Missed scripts are bugs of new prefab system which make doubles for components on applying changes.
     
  25. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Super interested in this asset, just a couple questions.
    1. How sure are you if you are going to add multiplayer or not and if so, when?
    2. What will be in the next couple of updates and when are the scheduled dates for them aimed for?

    - Thanks.
     
  26. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hello!
    1. I'm not sure about multiplayer now. Of course it possible in some way but I have no strong knowledge of multiplayer part.
    2. I work on my mobile game which using DT fps as the core and I improve code of the asset every day. Next update takes 1,5 of months approximately
     
  27. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    It's probably worth waiting for Unity to get their networking code finished. Save yourself some hair. I had a 2 year crack at UFPS multi-player using Photon. Didn't go so well. I was able to do player versus player, but AI was so bad. Lagged out big time, and so many synchronization issues. One player would see five bots at the other player's six o'clock, that player could only see three, but would take damage when the others attacked. I finally gave up and scaled back to single player for now.

    Mark
     
  28. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    @DarkTree Here are a bunch of feature requests to consider:
    1. Update the UI to use TextMeshProUGUI elements. They are part of the Unity package now, and are free. They will provide much better, clearer text that scales with the UI.
    2. Add a minimap to the standard UI. I have cobbled one together, but it would be a nice feature.
    3. Add icons to the minimap for displaying the player and AI positions. Streets and buildings too.
    4. Update to the latest Postprocessing stack.
    5. Add a "cover" system for the AI. (I'm playing with this idea on my own at the moment)
    6. Document or obviate how to increase/decrease the accuracy, reaction time, and damage AI do. I know there is a tooltip in the inspector, but it really should be more obvious. High/Medium/Low selectors might help.
    7. Add grenades to the AI arsenal. If I got 'em, they should have 'em.
    8. Simplify grenade usage. Good to see that they are not unlimited anymore, but having to go to the inventory to get one is kind of annoying. Assign them to the "G" key for whipping one out, then the usual fire button to execute the toss. (and then auto-switch back to the original weapon)
    9. Stackable items in the inventory would be appreciated. Maximum of three of anything would be cool.
    10. Selectable fire rates on weapons in inventory would be a good addition as well. Add a button to move through single shot, "tap" (double shot), or full auto where applicable. Obviously not for revolvers, rockets, or shotguns.
    11. Finally, I can't underscore how great this asset would be with EmeraldAI integration. I've done it, and it seems pretty easy to do. I use both Emerald (more complex behaviors) and the DarkTree AI I(fast and easy) for variety. I can barely program my way out of a wet paper bag yet, so should be simple for you!
    I've added most of these things already to my own test game, but I know I will lose these things with every update, since they are easiest added to the core code rather than using additional scripts. Any ETA for the next release?

    Mark
     
  29. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    @DarkTree It has gotten awful quiet in here. What are you working on? Any updates for us?
     
  30. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hi. I working on my game project currently. I do some updates and improvements of DT FPS during game development (I use DT FPS as core here). So now I can't promise release soon because i'm busy with my own project.

    upload_2019-9-6_19-7-28.png
     
  31. DJGarbage

    DJGarbage

    Joined:
    May 6, 2019
    Posts:
    2
    for anyone having issues getting the AR to pick up in the demo, just add a box collider to it. i recently discovered this issue, and resolved it in just a few minutes. no lines of code needed. I used the same dimensions as the box collider with the SCAR and it was perfect.
     
  32. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hi. Glad to say that I begin work with asset again. I aim for amazing update and want bring to you new cool features and improvements as in the road map described. Sorry for a long delay and no news and posts here. I though a lot about new features to include and how asset should be with future updates.

    So, people ask me sometimes. 'Can you put cars in the package? Can you put one thing? Second thing? ETC'. As I said before, my main goal is to bring quality fps engine with best AI solution. And I want to make it work fine, smooth, sharp and stable. I've tested a huge amount of different unity controllers and must say that more than half of it is real crаp! Developers want to put as many features as they can and often it works jerky and ugly. For example, we have FPS controller with ugly weapon system but we can change gravity and walk on walls! Absolutely useless in my opinion. Before you have strong and powerful core you should not put secondary functions.

    I hope you enjoy with DarkTree FPS. I put a lot of time and my soul to create asset I'd like to myself. And I work to make it better with every update. I listen every opinion and read every review I get, so I can say that we develop asset together. Thanks for waiting.

    With the best, Nick!
     
    DJGarbage likes this.
  33. Thilon

    Thilon

    Joined:
    Jul 23, 2012
    Posts:
    10
    Hey @DarkTree !

    I purchased your asset 1 month ago and i totally agreed with you. I tried a couple of FPS controller solutions, but your FPS core looks very promising :) Im currently working on my project, the project name is Codename: FLUX. I changed my currently controller system to your system, but i got some weird bug what i don't understand why is happening so i'm writing now for help :)

    1. Footsteps sound duplicated
    By unknown reason, the footsteps sounds is heard twice. I changed the terrain tag to "dirt" and i have buildings where i use the wood tag, but i hear both sound when im inside the house. If i just running in the terrain, i hear the dirt sound twice.

    2. Rocket jump bug.

    I changed the player scale size to 2 because my terrain and the objects is bigger than the player. After the change sometimes when the player is crouching and try to standing up the player flies into the sky like a rocket :D

    I waiting your answer! :)
    Best regards: Thilon
     
  34. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hi:)

    1. It looks like game prefab have two footstep components on itself. I noticed that unity duplicate components on prefabs in some cases, so there is might to be same case.

    2. Rocket jump is fixed now. Will remove that bug with next update!

    And thanks for purchasing!
     
  35. Thilon

    Thilon

    Joined:
    Jul 23, 2012
    Posts:
    10

    Update: 3 footstep manager running in same time 2 on the weapon holder + 1 on the assaulter.
    Plus 2 collision tag detector one on the player, one on the assaulter.

    Now i use the tag detector on the Player and the audio source + footstep manager used on the weapon holder.
    Actually i got perfect footstep soundeffect, but one script cant stop spamming this: "Assaulter' AnimationEvent 'PlayFootstep' has no receiver! Are you missing a component?"

    But everything is good and working. :confused: Im confused. :D
     
  36. yarskiss

    yarskiss

    Joined:
    May 7, 2019
    Posts:
    5
    I'm new to Unity and noob at coding... But I found this assets to my liking (I got it working at least...after bit of a struggle with prefabs flickering and disappearing.).
    Now I'm planning to get more sophisticated AI Emerald AI 2.0. BUT - are DT and Emerald working together? I mean do FPS character and enemy AI receive damage out of the box or does it need much coding to do so?
     
  37. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239


    Progress.

    Use animation, head bob, drag n drop inventory handler, stacking - unstacking, building system with scriptable objects
     
  38. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    507
    good work.. but please dont take ages between updates LOL
     
  39. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    There is not much coding I think. I will help you to integrate damage if you need
     
  40. Thilon

    Thilon

    Joined:
    Jul 23, 2012
    Posts:
    10
    Very nice update @DarkTree !
    Im currently working on flashlight battery system, new death animation and some extra stuff:

    - Recharging the flashlight with batterys,
    - The light starting flickering when the flashlight is close to discharge,
    - If the player is dead, the player fall to the ground,
    - The player has small HP a red frame warn you have a low HP,
    - Upgradeable stats: More hp, faster running. (Maybe stamina system for sprinting)

    Im thinking about buying Chamferzone Ultimate FPS weapon pack(https://assetstore.unity.com/packages/3d/ultimate-fps-weapons-pack-64555)
    @DarkTree , these weapons can work in your engine?

    Maybe in the future the weapons have option to upgrade with optics or with silencers for example?
     
  41. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hi! Of course they will work. You only need to animate it in 3d software or in the unity.
     
  42. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    Progress indeed! Good work. When can we expect the next update?
    Will the next update also fix the save/load and level change issues we've spoken about in PM?
    If you recall, I need to be able to move from level 1 (interior) to level 2 (exterior) and subsequent levels without losing access to the items in inventory using DoNotDestroyOnLoad for the GamePrefab.

    Do keep adding new features and capabilities, but please don't forget to finish these ones.
    Cheers,
    Mark
     
  43. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hello, I'll include scene transition example in next update.
     
  44. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239


    Making new grid inventory. Like in diablo, stalker etc. WeaponManager will be removed by equipment manager because it's too complicated now. Slot scripting will be much easier
     
    scarfell likes this.
  45. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    I am liking this! It really expands the inventory capability. Good job.

    When is the next update coming?

    Mark
     
  46. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hello Mark. I'm really interested in release, but not sure with the date now. I think it should took two-three weeks. I redesign all weapons as well, making rigged animations for weapons to take new quality level. Also I want to include outdoor demo scene which takes a lot of time too. I very satisfied with results I've got for now, but still working to make it f-g AAA awesome.
     
    scarfell likes this.
  47. danbulant

    danbulant

    Joined:
    Jul 23, 2018
    Posts:
    1
    Any chance for full character? I want to see my legs and shadow (also importing own character would be great)
     
  48. chakiry80

    chakiry80

    Joined:
    Oct 2, 2017
    Posts:
    8
    Hi Guys , i wanna know how to make the player Hold the weapons at start instead of picking them up ?
     
  49. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Answered on your email
     
  50. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    239
    Hello! character body and legs are done already. I also created tutorial how to put your own model as body