Search Unity

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Deleted User, Apr 5, 2013.

  1. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    @jons190 @chelnok @C_Occlusion @TonyLi
    Thanks for all the help everybody! I have my actual speed, and my animation speed synced now. Still a tiny bit of skating, but honestly it's probably me being OCD nit picky.

    Y'all have been a great help!

    Anything I can do in return, don't hesitate to ask!
     
    jons190 and chelnok like this.
  2. C_Occlusion

    C_Occlusion

    Joined:
    Jun 4, 2012
    Posts:
    44

    Glad you got it working...Sorry about suggesting the Run and Walk animation speed in the AI...I had no idea they were removed...CO
     
    Oderus_Urungus likes this.
  3. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96

    It's cool. I commented them out of the code anyway.
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Unless you're using root motion (which RFPSP doesn't support out of the box) there's always going to be a little skating. No one will notice. A great many AAA games have some skating if you pay really close attention, but no one cares.
     
    Oderus_Urungus likes this.
  5. MaxDeMaxNL

    MaxDeMaxNL

    Joined:
    Jan 27, 2018
    Posts:
    4
    How to use post processing with the kit? When I use it it bugs as hell.
     
  6. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    Could you give an example?
     
  7. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    Does anyone know how to make the blood spatter larger when an enemy is hit?
     
  8. MaxDeMaxNL

    MaxDeMaxNL

    Joined:
    Jan 27, 2018
    Posts:
    4
    Everything is there twice. You have the same gun twice and in different positions
     
  9. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    ya me either!
     
    C_Occlusion and Oderus_Urungus like this.
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Adjust FPS Main > FPS Effects > Impact_Flesh > blood fast and blood slow. They're particle systems. You can play with values like Emission and Shape to get it to be as gory as you want.

    It's not a bug. By default, RFPSP uses two cameras: one for the world, and one for the weapon. This prevents the weapon from clipping into the world. Make sure Weapon Camera only renders Gun, GUICamera and that the Main Camera doesn't render these layers.
     
    Oderus_Urungus and jons190 like this.
  11. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Yes. Change the size of the animation particles on the emitter to slightly bigger. (FPS_main prefab/FPS_effects/Flesh_impact) There is a "slow blood" effect and a "fast blood" effect. You can tweak either or just one of them. If you are on a PC you can probably add to the number of particles as well. For mobile VR I had to drop the density(number of) and make the particles bigger for performance reasons. It turned out to be a fairly neat effect IMHO
     
    Oderus_Urungus and TonyLi like this.
  12. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96

    Nice. My dead replacement is body parts that are bloody, and I wanted to copy the particle component and have a big splash of blood when the dead replacement activates.
     
    jons190 likes this.
  13. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Oh
    I like this idea. I just use the ragdool death and I like it, but a puddle of bloody body parts .....I think I may steal that from you.... ;-)
     
    Oderus_Urungus likes this.
  14. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96

    Haha. Be my guest.
     
  15. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    Well this is weird. Now that I've switched my enemie meshes and animations out they aren't taking damage from grenades or explosive barrels. All other weapons damage them, though.
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Are the layers the same as before (e.g., layer 13, NPCs), and do they still have colliders and CharacterDamage or LocationDamage components?
     
  17. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    I'll double check when I get home, but I'm pretty sure they do.
     
  18. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    Has anyone published a game with this asset?

    If so, DM me a link to a vid of your game.

    If it's still a WIP as mine is, feel free to DM a link to me of a vid as well.

    I'd enjoy seeing what people are creating!
     
  19. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    Having an issue here that was working.
    My NPCSpawner is untagged, deactivated, my enemy prefab is assigned, unlimited spawning is unchecked, max active npcs =3, npcs to spawn =6, no waypoint group

    My NPCTrigger is tagged as player, I have a box collider set to istrigger, monster trigger script attached, npcs to trigger =1, element 0 has my enemy prefab assigned and both are on a separate empty game object.

    When I hit the trigger, it disappears but no enemies are spawning. You can see my enemy prefab disappear in myprefabs list when I got the trigger like it's instantiating, but it's not.

    This has been working for over a week, and now it's not. I haven't updated anything, or imported anything new.

    Any suggestions?
     
  20. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    http://huesgfx.com/firedrake
     
    Oderus_Urungus likes this.
  21. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Something HAD to have changed. Its always the case. some prefabs you import can mess with the game logic, or what happens to me on occasion is the dreaded "click and drag of death" I inadvertently will grab/mis-click/mouse button stick some element of a asset in my hierarchy (which is rather large at this point) and end up dragging it off to some other area of my hierarchy, in a split second, while my attention is else where....and then never be able to find what I moved. Its always back to the backup.... Tony Li has taught me the importance of backups ever few days.....
     
  22. mukki014

    mukki014

    Joined:
    Jul 30, 2017
    Posts:
    164
    Hi I want to know that what other AI system I can use with realistic first person prefab?
     
  23. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    That's what's driving me crazy. I haven't imported anything, I haven't updated anything, and the computer I develop on isn't even hooked up to the net.
    It literally went from working the night before when I shut it down, to not working the next day when I booted it back up.

    My last backup is about a week old, and I've done a lot of work since then. I'm just going to make a copy of the trigger on the demo scene, make it a prefab, then replace the zombies with my enemies.
     
  24. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    I feel your pain brother.... also0 this is a great reminder that I am a week out on my backups. I know what I am doing for the next few hours..... ;-)
     
    Oderus_Urungus likes this.
  25. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    Can someone please share on how to create this in RFPS.
     
  26. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    25
    I have problem when build game my player start rotate but in editor everything is fine ?
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    It would require a moderate amount of scripting ability. You'll need to run a raycast to see if it hits anything. If so, animate the connection. When moving the player, use the methods in MovePlayerAndCamera (located on FPS Camera) to permit your script to take control of the player's position.

    Is a joystick connected? If you unplug the joystick, does the player stop rotating? If so, your build may be more sensitive, and you may need to increase the Dead zone value of the Horizontal input definition for joystick (Edit > Project Settings > Input).
     
  28. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    25
    No joystick is not connected
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Not sure then. Is it a fast or slow rotation? Is it a consistent speed? If you import RFPS into a new, empty project and make a build, does the same problem occur?
     
  30. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    ok thanks
     
  31. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    Last edited: Jul 24, 2018
  32. SarmadFinz

    SarmadFinz

    Joined:
    Jun 25, 2018
    Posts:
    6
    hello I have purchased RFPSP a while ago while working with it i am facing a few problems here the are stated as
    1 . fps issue while i am working on editor my my fps is working just fine and it is around 60 as it is suppose to be but as soon as i make an android build fps drops down to 30 and sometimes it fells down to 10 too. i have tried a bunch things reducing the project quality and baking of navmesh statically while the requirements in my game are to be baked dynamically but nothing is working i even have removed environment in the scene and just replaced it with a simple 3d cub as playing surface but still the is falling in the same way and now i am out of option to do any thing while in profiler there is nothing irregular activity in spikes (I am uploading a pictures for reference )

    ( <h3> following picture in a screenshot from Mobile </h3> )
    Screenshot_20180724-100243.png


    (following image is taken from editor)
    editoer.PNG


    2. the issue i am facing secondly is if i restart the same scene with RFPSP it bounces out of the playing environment
    please send a quick reply i am waiting for the answer
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Your S-Inventory_Manager > Inventory GameObject should have an InventoryEvents component. You'll need to write a small script that hooks into the PlayerEquippedItem and PlayerUnequippedItem events. Something similar to:

    MyInventoryEvents.cs (example)
    Code (csharp):
    1. using UnityEngine;
    2. using S_Inventory;
    3.  
    4. public class MyInventoryEvents : MonoBehaviour
    5. {
    6.     void OnEnable()
    7.     {
    8.         var inventoryEvents = FindObjectOfType<InventoryEvents>();
    9.         inventoryEvents.PlayerEquippedItem += OnPlayerEquippedItem;
    10.         inventoryEvents.PlayerUnequippedItem += OnPlayerUnequippedItem;  
    11.     }
    12.  
    13.     void OnDisable()
    14.     {
    15.         var inventoryEvents = FindObjectOfType<InventoryEvents>();
    16.         inventoryEvents.PlayerEquippedItem -= OnPlayerEquippedItem;
    17.         inventoryEvents.PlayerUnequippedItem -= OnPlayerUnequippedItem;  
    18.     }
    19.  
    20.     void OnPlayerEquippedItem(S_Inventory.Item item)
    21.     {
    22.         if (item == null) return;
    23.         // Turn on mesh corresponding to item.Name.
    24.     }
    25.  
    26.     public void OnPlayerUnequippedItem(S_Inventory.Item item)
    27.     {
    28.         if (item == null) return;
    29.         // Turn off mesh corresponding to item.Name.
    30.     }
    31. }
     
    Weblox likes this.
  34. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Oh boy. I could write a book on how to optimize the RFPS for android. So lets start with what version of Unity you a re on. 5.6 was a fairly stable build for android development. I just upgraded to 2018 and am not that impressed with performance. Whats your draw call count? I am finding you get to about 50 instead of the 100 that Unity says is possible. Do you have a skybox? If so, delete it. No skyboxes on android. How aggressive is your occulusion culling? Android machines don't seem to handle occlusion culling that well. (and remember you have it enable it on TWO cameras in in the prefab. which eats preformence) Only set MSAA ro 2x and only on the main camera. If enabled on both, it won't run on android due to performance. You also have to tweak the effects animations. Change all those particles over to mobile and you have to delete many of them. (most have three emitters per effect and you only get to have one) Just out of the box, they were running something like 12% of CPU and like 18 draw calls. How are your levels designed? Lots of polies and verts? Have you used a "combine child mesh" type script? on all your level items. Unitys "static batching" never got me very far... Meshbaker pro works great for me. also check your default time. If i remember right you have to change it from 0.3333 to 0.01666 but you should look that up to make sure. Anyway, heres some stuff to check to get you started....
     
    leandrovtd and TonyLi like this.
  35. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    Where would I put this script under??
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Add it to your player. Note that it doesn't actually turn on any meshes. You'll need to add that code where the comments indicate.
     
  37. TauseefCVS

    TauseefCVS

    Joined:
    Mar 28, 2016
    Posts:
    15
    Hi All
    if anyone knows about slow-motion bullet effect with RFPS and please guide me and sends the script of slow-motion bullet effect if you do this thing.
     
  38. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    The script should be attached to the FPSPlayer prefab. There are values you can adjust for the slow mo effect when you scroll down.
     
  39. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    Can someone please help me with this multiple Item spawner, I have ran into an issue, what happens is that the time for an item to spawn works depending on how I set it but lets say its 10 second spawn. What happens is the item spawns after 10 seconds which is good but if its not picked up and 10 seconds over lap it what happens is that when you pickup the item on the floor a new one spawns right away. Can someone fix it so that It starts the timer from 0 when the current item spawned is destroyed


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class ItemSpawner : MonoBehaviour
    6. {
    7.     public bool SpawnOnStart = true;
    8.     public float timeSpawn = 120;
    9.     public ItemData[] Item;
    10.     public int ItemMax = 3;
    11.     public Vector3 Offset = new Vector3 (0, 0.1f, 0);
    12.     private float timeTemp = 0;
    13.     private List<GameObject> itemList = new List<GameObject> ();
    14.    
    15.     void Start ()
    16.     {
    17.         if(SpawnOnStart)
    18.             Spawn ();
    19.     }
    20.    
    21.     void Spawn ()
    22.     {
    23.         ObjectExistCheck ();
    24.         if (ObjectsNumber < ItemMax) {
    25.             if (Item.Length > 0) {
    26.                 ItemData itemPick = Item [Random.Range (0, Item.Length)];
    27.                 GameObject objitem = null;
    28.                 Vector3 spawnPoint = DetectGround (transform.position + new Vector3 (Random.Range (-(int)(this.transform.localScale.x / 2.0f), (int)(this.transform.localScale.x / 2.0f)), 0, Random.Range ((int)(-this.transform.localScale.z / 2.0f), (int)(this.transform.localScale.z / 2.0f))));
    29.                 if ((Network.isServer || Network.isClient)) {
    30.                     // Only server can spawn an items.
    31.                     if(Network.isServer){
    32.                         objitem = (GameObject)Network.Instantiate (itemPick.gameObject, spawnPoint, Quaternion.identity, 2);
    33.                         //Debug.Log("Spawn "+itemPick.gameObject.name);
    34.                     }
    35.                 } else {
    36.                     if(PlayerPrefs.GetInt("onlinegame") == 0){
    37.                         // Spawn in offline mode.
    38.                         objitem = (GameObject)GameObject.Instantiate (itemPick.gameObject, spawnPoint, Quaternion.identity);
    39.                         //Debug.Log("Spawn "+itemPick.gameObject.name);
    40.                     }
    41.                 }
    42.                 if (objitem)
    43.                     itemList.Add (objitem);
    44.             }
    45.             timeTemp = Time.time;
    46.         }
    47.     }
    48.    
    49.     private int ObjectsNumber;
    50.  
    51.     void ObjectExistCheck ()
    52.     {
    53.         ObjectsNumber = 0;
    54.         foreach (var obj in itemList) {
    55.             if (obj != null)
    56.                 ObjectsNumber++;
    57.         }
    58.     }
    59.    
    60.     void Update ()
    61.     {
    62.         if (Time.time > timeTemp + timeSpawn) {
    63.             Spawn ();
    64.         }
    65.     }
    66.    
    67.     void OnDrawGizmos ()
    68.     {
    69.         Gizmos.color = Color.blue;
    70.         Gizmos.DrawSphere (transform.position, 0.2f);
    71.         Gizmos.DrawWireCube (transform.position, this.transform.localScale);
    72.     }
    73.    
    74.     Vector3 DetectGround (Vector3 position)
    75.     {
    76.         RaycastHit hit;
    77.         if (Physics.Raycast (position, -Vector3.up, out hit, 1000.0f)) {
    78.             return hit.point + Offset;
    79.         }
    80.         return position;
    81.     }
    82. }
    83.  
     
    Mucossa likes this.
  40. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    Hello to all. I don't know if this question answered before, I didn't find a solution yet. Does anyone know how to make an enemy explode? Thank you in advance.
     
  41. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    I used body parts as my dead replacement, with force applied to each one. I also upped the blood and gore.
     
    Franciscotx56 likes this.
  42. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    I'm picking up Emerald AI this evening. Anyone use it in conjunction with RFPS?
     
    Franciscotx56 likes this.
  43. crimsonmortis

    crimsonmortis

    Joined:
    Feb 21, 2016
    Posts:
    63
    I have. I will be honest on a 1 to 10 scale my coding is a 2. I got it working together in 10 minutes.

    The layers and tags are well explained on YouTube, the integration guides online are very easy to follow.

    I also have Ice creature control which is buggy, outdated and maybe abandoned, though it has a lot more options in the gui/editors which give the AI more personality.

    Here is the link for the You tube video:
     
    Last edited: Jul 28, 2018
    Mark_01, TonyLi and Oderus_Urungus like this.
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    I'm not arguing for or against any specific AI solution. I just want to remark that animation, sound, and speed are a huge part of how an AI appears to the player. Two AI entities can have the same decision-making process, such as running toward the player and attacking, but different animation, sound, and speed will make them appear to have completely different personalities and motivations.
     
    Franciscotx56, Mark_01 and jons190 like this.
  45. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Just a thought.... Check your layering. Do you have the same layer rendering (gun) on each camera?
     
  46. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Exactly this. I am using the default RFPS AI and swap out speeds, attack ranges, animations weapons and sounds on all my monsters While it is a TAD limiting, It is still really versatile and works great for me and my small apps....
     
    TonyLi likes this.
  47. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Question for the group.


    I need to move the aiming recital to a new layer for VR display.

    Currently, when I build out to VR using the OSVR (rift, gearvr) Utils/sdk... The UI level of RFPS seems to get assigned to the "head tracking portion" of what I assume is the OVR default head camera , so that the Aiming recital is assigned to the head tracking, but it is needed on the same level or camera as the weapon, so that the aiming matches the point of aim on the weapon. Instead , in VR, the aiming recital is assigned to the free looking head camera so that the aiming point from the weapon and the aiming recital never match up correctly. (i.e. where you look, is not the same as where the weapon is pointing)

    I have tried every combination of layer and culling mask combination on the camera settings, to no avail and have played around with the UI canvas layering to no avail. Whatever I try, it seems that it always ends up that the recital is on the head tracking camera and never on the same layer/ camera that the weapon is on.

    Has anyone else come across this issue? If so, I would love to hear your thoughts on how to maybe get the aiming recital and the point of aim on the weapons to line up.
     
  48. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    checking now......
     
  49. jandd661

    jandd661

    Joined:
    Jun 25, 2017
    Posts:
    23
    Code (CSharp):
    1.  
    2.     void ObjectExistCheck ()
    3.     {
    4.         ObjectsNumber = 0;
    5.         foreach (var obj in itemList) {
    6.             if (obj != null)
    7.                 ObjectsNumber++;
    8.                 TimeTemp = 0f; // <----- maybe add this?
    9.         }
    10.     }
    11.  
    12.  
    I do believe the problem is above. I think you need to rest your timer if any items exist.
     
  50. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    Anyone can answer my previous question please? Is it possible for the enemies to explode like the exploding objects do?