Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

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

  1. Deleted User

    Deleted User

    Guest

    Hi Bonzotaz1, this is a feature that will be introduced in the next update. Faction recognition for the NPCs involves a few AI changes and new scripts that handle targeting. This update will be released soon.


    Haven't experimented with this much yet, littlewinch, but it may be possible to create a new weapon model with two weapons present in the player's view, then modifying the WeaponBehavior.cs script to play muzzle flashes and eject shells at two positions instead of one. It may also be possible to have two active weapon objects at once, with some modifications to the scripts. We'll look into this once we've completed some other features. Thanks for your feedback!


    Hi USTGames, version 1.22 is finished. Just updating the documentation now. The release date was pushed back a bit, because in the process of checking the scripts, some bugs fixes and improvements were made that took a week or so. One of the main changes, was the removal of the WorldRecenter.cs script from the player prefab, and the addition of a second, optional player prefab, which uses 2 cameras and upscaled weapons to significantly reduce spatial jitter of weapon models in huge 12000x12000 unit scenes. The other player prefab uses one camera, is more compatible with shaders and image effects, and has shadows from world geometry cast on weapon models, but works better in scenes that are 1200x1200 units. Thanks for your patience, as it has been a lot longer than expected since the last update, but development will be picking up speed again.


    Here's a list of the improvements for version 1.22:
    • Added condition checks to WeaponBehavior.cs to prevent shells from ejecting from weapons by selecting "none" for Shell Prefab RB and Shell Prefab Mesh references in the inspector.
    • Added godMode var to FPSPlayer.cs.
    • Fixed canZoom var of WeaponBehavior.cs to allow /prevent zooming for a weapon.
    • Fixed jump button not moving player up ladders.
    • Added legs in first person view and wrote a VisibleBody.cs script.
    • silentShots var of WeaponBehavior.cs can be used to make NPCs not hear certain weapons firing.
    • Fixed logic error in slope check code.
    • Created static function to replace old PlayClipAtPoint code. Only one instance of this utility script is needed per scene.
    • New player prefab called "FPS Main 1 Camera" can be used for 1 camera setups to allow shadows from level geometry to be casted on weapon models and for better compatibility with image effects and shaders.
    • New, experimental tree models using Unity 5's LOD system, TODO: fade shaders between LOD states
    • Improved a few weapon textures and models.
    • Udated game assets to use Unity 5's new standard shader.
    • Updated WaterZone.cs and WaterZone prefab to use new Unity 5 water shader.
    • Moved zoomSensitivity var to WeaponBehavior.cs to allow for tuning of zoomed mouse sensitivity per weapon.
    • Improved NPC horizontal tracking of targets. Smoother and more accurate rotation allows them to attack strafing targets much better now.
    • NPC registry, spawner, and wave manager scripts created to track, and dynamically add NPCs to scenes.
    • Replaced Autowaypoint.cs with WaypointGroup.cs, to optimize NPC patrolling and to lay foundation for more future NPC behaviors.
    • Added Mecanim support for NPC animations.
    • Cached most GetComponent calls for Animation and RigidBody components.
    • Added removeTime var to WeaponPickup.cs to allow weapon pickups to be destroyed after a time.
    • Added reachDistance var to FPSPlayer.cs to allow custom distance for item pickups and activations.
    • Increased grounded detection height slightly to prevent sliding over uneven terrain at higher speeds.
    • Improved 2 camera player prefab by upscaling weapons to prevent spatial jitter on larger terrains. This prefab can be placed in scenes with dimensions up to 12000X12000 before spatial jitter is apparent on weapon models, though shadows from world geometry are not cast on the weapon models while using this prefab.
    • Removed WorldRecenter.cs script from player prefabs and moved removePrefabRoot var to FPSPlayer.cs, since WorldRecenter is not needed anymore for huge maps.
    • Changed shell ejection position handling and added shellEjectPositionZoom var to WeaponBehavior.cs for proper shell ejection using the dual camera player prefab with upscaled weapons.
    • Added code to the Update() loop in WeaponBehavior.cs and removed all otherfx.pitch statements in WeaponBehavior.cs to allow reloading sound effect to dynamically scale up or down in pitch to match game speed.
    • Increased grounded check capsule cast radius to prevent situations where player became stuck in ungrounded state when confined in a space just narrow enough to fit player collider after becoming ungrounded.
    • Added code to prevent null reference errors for several assets if missing and added a console error in AI.cs if navmesh has not been baked for a scene, or NPC can't find navmesh.
    • Fixed multiple landing sound effects playing from high drops.
    • Optimized AI.cs by bypassing LOS check if target is not within range first.
    • Improved AI.cs to allow the timeout value to make the NPC resume initial behavior more reliably after the heardPlayer state was true.
    • Added footSteps, walkStepTime, and runStepTime vars to AI.cs to play footstep sounds for NPCs.
    • Added FoliageRustle.cs and the foliageRustles and foliageRustleVol vars to Footsteps.cs to play rustling sounds when moving through foliage.

    If you're using a previous version of the Realistic FPS Prefab in your project, and find that the player sometimes gets stuck in confined, elevated spaces, you can change this code around line 1084 of FPSRigidBodyWalker.cs:

    Code (CSharp):
    1. if (Physics.CapsuleCast (p1, p2, capsule.radius * 0.9f, -myTransform.up, out capHit, capsuleCastHeight, clipMask.value)
    to this:

    Code (CSharp):
    1. if (Physics.CapsuleCast (p1, p2, capsule.radius, -myTransform.up, out capHit, capsuleCastHeight, clipMask.value)

    Here's a link to a web player demo of the current version, which will be available soon:

     
  2. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Yay! Thanks for update!
    its not a problem but... AK47's sights not correct :l
     
  3. ivansemenov3d

    ivansemenov3d

    Joined:
    Dec 20, 2013
    Posts:
    2
    Hi. I'm add an oxygen to FPSPlayer.cs All coded similar hunger and thirst. But i have an strange errors in code, and i dont know whats wrong.... Plz help me.

    Assets/!RFPSP/Scripts/Player/FPSPlayer.cs(813,10): error CS1519: Unexpected symbol `if' in class, struct, or interface member declaration
    Assets/!RFPSP/Scripts/Player/FPSPlayer.cs(813,25): error CS1519: Unexpected symbol `+' in class, struct, or interface member declaration
    Assets/!RFPSP/Scripts/Player/FPSPlayer.cs(813,37): error CS1519: Unexpected symbol `>' in class, struct, or interface member declaration
    Assets/!RFPSP/Scripts/Player/FPSPlayer.cs(813,54): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration
    Assets/!RFPSP/Scripts/Player/FPSPlayer.cs(814,30): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
    Assets/!RFPSP/Scripts/Player/FPSPlayer.cs(814,47): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
    Assets/!RFPSP/Scripts/Player/FPSPlayer.cs(815,13): error CS8025: Parsing error

    my code where's somthing wrong:

    //Apply oxygenAmt
    if(oxygenPoints + oxygenAmt > maxOxygenPoints){
    oxygenPoints = maxOxygenPoints;
    }else{
    oxygenPoints += oxygenAmt;
    }

    //set oxygen hud value to oxygen points remaining
    OxygenText.oxygenGui = Mathf.Round(oxygenPoints);
    OxygenText2[1].oxygenGui = Mathf.Round(oxygenPoints);
     
  4. Ratboy601

    Ratboy601

    Joined:
    Jun 22, 2014
    Posts:
    29
    Hi! Super glad you're updating this to work well with Unity 5.0. I put my project on hold to do some other stuff for a while, came back and everything was outdated and not working right anymore. Anyway, I'm just curious if you could expand on what you meant by the scene dimensions you mentioned. Maybe I'm still too new at Unity, but I didn't know you could dictate the scene size. Could you point me toward some documentation or give me an explanation of how that works and what its good for? Does it have to be squared? I'm confused :/
     
  5. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    I'll probably stick with older version of RFPS. Currently I see no features that are worth the time invest in upgrade.
     
  6. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    300
    Does this mean we will see more frequent updates now. Also are you planning on increasing the price with this new update?
     
  7. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    there is any chance of mini map or radar
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    I've tested RFPS with NJG MiniMap and KGFMapSystem, and they both work great.
     
  9. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    @Azuline Studios
    a request :
    please make our character's legs look better while standing like NPC standing animation! its just look like.. flat ._.
     
  10. TopThreat

    TopThreat

    Joined:
    Aug 7, 2012
    Posts:
    136
    Good update, thank you for taking the time to reinvest in this asset!!!
     
  11. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Hey Everyone!
    I am getting an error when I try and spawn in AI with RFPS!
    Here is what the debug log says! Help would be very much appreciated thank you!

    NullReferenceException: Object reference not set to an instance of an object
    AI.CanSeeTarget () (at Assets/!RFPSP/Scripts/AI/AI.cs:205)
    AI+<StandWatch>c__Iterator0.MoveNext () (at Assets/!RFPSP/Scripts/AI/AI.cs:138)
     
  12. MageC

    MageC

    Joined:
    Nov 4, 2013
    Posts:
    1
    You could put a guide to add Oculus Rift DK2 ...
     
  13. reflexct9

    reflexct9

    Joined:
    Apr 13, 2015
    Posts:
    3
    @Azuline Studios Future request, add varieties of hitboxes not only head but body, arm and leg too. Each hitbox receive different amount of damage multiplier. Also please add hand grenade.
     
    Gua likes this.
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    I recommend Bloody Mess for this. The developer recorded a video tutorial to integrate it with RFPS.
     
    TheNorthridge and reflexct9 like this.
  15. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    What 3d modeller was used to create the M4 and Arms? I ask because when I load it into C4D and just save it back it gets messed up with the slide,mag etc now in the wrong place.
     
  16. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi,

    I use 3DS Max for modelling and MAYA for animation.

    :)
     
  17. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    It's ok, seems to be getting messed up when C4D exports a fbx file. saving as a C4D file and deleting the fbx solves the problem.
     
  18. poison77

    poison77

    Joined:
    Dec 24, 2013
    Posts:
    40
    when we can expect 1.22 ?
     
  19. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    Please take a few minutes of your time to backtrack a few post back and read up..

    In fact Azuline has answer that very same question in this very page.
     
  20. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    I have a question regarding future updates. RFPS isn't actually a plugin but a complete project. In the weeks I've been using it in anger I've made substantial changes to the scripts to make it do things I want it to do. So when this next update comes you can't just import it into an existing project without deleting all the changes I've made. What's the correct procedure for updating a project using this package?
     
  21. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    @arkon, I'm afraid, you might have to re-do them by hand.

    Updating the asset will overwrite your change, so be sure to keep them somewhere.

    If I were you, I would start a new project, import the new RFPS asset (when released), and you could try to overwrite the script you have modified or re-modifying the new one by hand.

    That's why, when possible, I try to extend the scripts instead of modifying them..
    When that is not possible, I at least comment out where I did modification, so I can find them easily.

    Good luck.
    Perhaps someone that has more experience with this asset, will have better tips.
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @arkon - Some of your changes may no longer be relevant in the new version. For example, it sounds like the AI has been rewritten. If you've customized AI.cs, it might not have an analogue in 1.22.

    That said, here are some guidelines I try to follow when working with third-party assets. They're pretty much the same thing @sluice said.
    • If I'm working on a project that I intend to release, then once I get past the prototyping stage I lock down the platform, no changes to the versions of Unity or third party assets except for critical bug fixes.
    • Whenever possible, I try to extend scripts by creating subclasses, registering events, etc., rather than touching the script itself.
    • When I do have to touch a script, I add the comment //[TL]. This makes it easy to search for all customizations in a project.
    • I never add functional code to a third-party script. Instead, I add some kind of a hook that lets me call my own script --- for example, changing a method to virtual or adding a public event and invoking it.
    If you haven't added an identifying comment such as "//[TL]" to your changes, you can always run your custom script and the original through a 'diff' tool to highlight the changes. I like the online Diff Checker page for quick checks.
     
    Deleted User, Ratboy601 and sluice like this.
  23. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    @Azuline Studios
    EPIC BUG!
    in 1.22 Unity 5 demo, when reloading starts(mag out) cancel it with running and then keep running to reload without walking :O
     
  24. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    @TonyLi I'm also thinking about coplete lockdown. Glad it isn't a crazy idea. Thank you for sharing this advice.

    But I will update if they will fix that annoying mouse flicker bug :)
     
    Last edited: May 22, 2015
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Does it only flicker in the Unity 5 editor? Or does it flicker in builds, too?
     
  26. Ratboy601

    Ratboy601

    Joined:
    Jun 22, 2014
    Posts:
    29
    You're like seriously saving my life here dude... man I wish I knew that when I started using this asset. Live and learn!
     
  27. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    @TonyLi Only in editor. But it still driving me nuts.
     
  28. Ratboy601

    Ratboy601

    Joined:
    Jun 22, 2014
    Posts:
    29
    Anybody know how to download an older version? I need a copy of 1.19 so I can find all the changes I made to the copy I currently have.
     
  29. Deleted User

    Deleted User

    Guest

    Hi Takahama, we'll take another look at the sights for more precise alignments since they were repositioned for the new camera setups. For the AK, setting the WeaponBehavior.cs vars called Weapon Zoom X Position to -0.07 and Weapon Zoom Y Position to 0.028 seems to be more accurate at longer range. If you're not satisfied with the accuracy of any of the other weapons, they can be tuned in the same way.


    Hi ivansemenov3d, your code looks good, but those type of errors makes it look like there might be a syntax problem a few lines above in the script? You might want to check for missing characters if you made more edits too. Hope that helps.


    Sure Ratboy601, I was referring more to the accessible area that the player can move around in. The area doesn't need to be square, it should only be contained within those bounds. I don't think there is a "scene size" setting in Unity, but terrains can be set to a certain size. The main constraint is floating point precision the further the player gets from the origin.

    In version 1.22, the FPS Main 2 Cameras prefab has a farther camera near clip distance and upscaled weapons that works better in large scenes, with the trade-off being that 2 cameras are used, which prevents shadows from world geometry being cast on weapon models like with the FPS Main 1 Camera prefab. This limitation can be worked around using light probes if more lighting is needed on weapon models. Here's some info from the documentation:

    Also, the single camera setup could be modified to work in larger scenes than 1200x1200 (-600, 600) if the weapon models were scaled up and a system was added, like in some games, that makes the player pull the weapon back or horizontal if it would clip through scene geometry like a wall the player has run into.


    Updates will be picking up speed again, giraffe1. As far as a price increase for the next update, it will stay at 30$. It may change in the future, depending on the features added, but it shouldn't be anything drastic and we'll try to inform you guys beforehand if that happens.


    Really appreciate the feedback Takahama! I see what you mean with the player character's idle animation. That animation has been updated and some additions were made to the VisibleBody.cs script to allow more customization in version 1.22.


    Thanks LeeAllen, there's more additions on the way!


    It looks like there's probably an error when the NPC initializes after spawning and attempts to acquire a target. These issues have been been resolved in version 1.22, which should be available soon.


    We are looking into this, MageC. Thanks for your patience.


    Hi reflexct9, both these features are on our list. Bloody Mess also looks like a great asset!


    Maya was used to make the weapon models, arkon. If the different model elements are not lined up correctly, there might be an issue with C4D not reading the .fbx pivot points/object origins like Maya does. Please let us know if you need more help with this.


    Thanks Takahama, some alternative code in the WeaponBehavior.cs script was being tested, but it should be back to normal in version 1.22.


    Hi Gua, we've noticed this too. Might be something to do with Unity 5 since there have been other reports of this issue. Testing the scene with "Maximize on Play" checked seems to hide the cursor. You can also try adding this code to SmoothMouseLook.cs:

    Code (CSharp):
    1.     void OnGUI(){
    2.         if(Time.timeScale > 0.0f){
    3.             Cursor.lockState = CursorLockMode.Locked;
    4.             Cursor.visible = false;
    5.         }
    6.     }
    ...which fixed the issue on this machine.


    Please send us an email or PM and we can send you the old version, Ratboy601.


    As far as news on the next update, version 1.22 has been uploaded and is waiting to be reviewed by the Asset Store team. It can take a few days or a week, depending on how many assets are waiting in the queue. Thanks for your patience as this version has taken much longer than anticipated, but it should be worth the wait :) Here are some demos showing the different AI behaviors introduced in version 1.22:

     
  30. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    @Azuline Studios I'm happy to see your return among us ;)

    I wait for the update :)
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Unfortunately this is still an issue (Issue Tracker) in Unity 5.0.1f1 on Windows 7 & 8, and I don't see any fixes in the release notes for 5.0.2. The OnGUI workaround works in a few cases, but it doesn't work consistently for everyone. The only reliable workaround right now is to use Cursor.SetCursor to set the cursor image to a blank texture. Create a blank texture in your project, assign it to a Texture2D, and pass this to Cursor.SetCursor when you want to hide the cursor. Pass null to Cursor.SetCursor to restore the default cursor.
     
  32. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Yay! Thanks for update!
    Another "glitch?" when enemy detect you, run insite the house and prone, they return to their waypoint :<
     
  33. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Deleted User likes this.
  34. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    llJIMBOBll and Defcon44 like this.
  35. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thanck you :)
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Defcon44 likes this.
  37. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    I finished my second game with RFPS, I received many 5 stars , very happy about RFPS again.
    Thank you Azuline Studios

    Death And Dust is available and free for 2 weeks, join now thousands of players.
    -8 players per Map
    -5 weapons
    -6 Maps
    -Chat system

    Android :
    https://play.google.com/store/apps/details?id=net.lowcostapp.deathdust


    Windows Phone :
    http://www.windowsphone.com/s?appid=7401afe1-09e8-4dbf-9256-cd569a2efd42


    Iphone, Ipad :
    https://itunes.apple.com/us/app/death-and-dust/id987537790?l=fr&ls=1&mt=8
     
  38. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
  39. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    Gua likes this.
  40. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    Thanks! :)
     
  41. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Last edited: May 27, 2015
    TechSinsN, Defcon44 and TonyLi like this.
  42. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thank's for update Azuline :)

    I have a little probleme with WaveSpawn.

    I have download RFPS and create a new project, after test i have imported some script to my games.
    No probleme with the import.

    But i have one error message in game
    "NullReferenceException: Object reference not set to an instance of an object
    WaveManager.FixedUpdate () (at Assets/!Realistic FPS Prefab Files/Scripts/AI/WaveManager.cs:104)
    "
    The line 104 is : "
    Code (CSharp):
    1.     void FixedUpdate(){  
    2.         WaveText.waveGui2 = NpcsToSpawn - killedNpcs;
    3.         WaveText2[1].waveGui2 = NpcsToSpawn - killedNpcs;
    4.  
    So this is the probleme :

    1) How i can show the " WaveText " on the camera, because if i'm right, IF the WaveText is not here the wave systeme don't work ?

    2) Now, All NPC don't see the player (like Player doesn't create)
    All Tag & Layer is good and re import (1.22)

    Picture :

     
  43. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Well.. im stuck at this stage .___.
    RFPS import.png
     
    Last edited: May 27, 2015
  44. TechSinsN

    TechSinsN

    Joined:
    Apr 12, 2014
    Posts:
    121
    Its working all fine for me , also where is the bullet spawn located on the weapon? i need to change its position
     
  45. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Looks like problem is on Unity 5.0.0, 5.0.2 fixed it
     
  46. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    @Azuline Studios please in next update, dont give us all patch notes make some surprise :D
    like an epic thing not listed in notes :p
    EDIT : i find a glitch! (test in slow motion) in 2 camera mode use shotgun for best way to see it. Fire and move your camera. You see shell just tracking camera's position :l
    HELP D:
     
    Last edited: May 27, 2015
    Defcon44 likes this.
  47. TechSinsN

    TechSinsN

    Joined:
    Apr 12, 2014
    Posts:
    121
    @Defcon44 how did you get your GUI health and ammo like that?
     
  48. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Deleted User likes this.
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    I'm updating the Dialogue System's support package this week. The existing functionality has all been updated. The only things that remain are controlling factions and waves within conversations, and updating the Multiple Scene Example.
     
    Deleted User and closetgeekshow like this.
  50. LAUDSOFT

    LAUDSOFT

    Joined:
    Jan 5, 2014
    Posts:
    102
    I have the same problem T_T