Search Unity

UFPS : Ultimate FPS [ RELEASED ]

Discussion in 'Assets and Asset Store' started by VisionPunk, Mar 9, 2012.

Thread Status:
Not open for further replies.
  1. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Thanks for the quick turnaround time fixing those issues! :) I'm digging into SimpleScript.cs now. One of the first changes I'm making is (of course) to change it to use Input axes instead of the literal keyboard codes.

    It occurs to me that lots of people will probably want this. Do you mind if I just paste my SimpleScript here for other people to use? It doesn't contain the actual core code of UFC, just references to it, so it shouldn't harm sales any. But I figured I'd ask first. :)
     
  2. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Sounds great! I'm glad you want to help out. Please only post your suggested changes and surrounding relevant code though. I agree, SimpleScript in particular is not a core system, but I think this will be a better precedent for future similar requests.

    By the way, how did the NGUI camera issue work out for you? Was it as easy as changing the layer integers in script?

    Thanks

    /Cal
     
  3. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Is it possible to move the arm with the gun in the middle of the screen during zoom in ? Sorry, i am just a beginner with Unity and scripting (not programming).
     
  4. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    No problem unicat :) this is easy and can be done in two different ways.

    The quick and dirty way is to modify the zoom code and hard-script the weapon positions.
    In either DemoScript.cs or SimpleScript.cs, find the ZoomIn method and add the following lines inside the inner bracket:

    Code (csharp):
    1. m_Camera.CurrentWeapon.PositionOffset = new Vector3(0.005f, -0.266f, 0.17f);
    2. m_Camera.CurrentWeapon.RotationOffset = new Vector3(-3.158258f, 0, 0);
    3. m_Camera.CurrentWeapon.RefreshSettings();
    4.  
    In the ZoomOut method, add the following lines in the corresponding place:

    Code (csharp):
    1.  
    2. m_Camera.CurrentWeapon.PositionOffset = new Vector3(0.149f, -0.266f, 0.17f);
    3. m_Camera.CurrentWeapon.RotationOffset = new Vector3(-3.158258f, -5f, 0);
    4. m_Camera.CurrentWeapon.RefreshSettings();
    Modify the position and rotation values to get the weapon position and angle you desire. Note that hard scripting the position / rotation might not work for all your different weapons so you may want to check which weapon is active. This can be done by getting:

    Code (csharp):
    1. m_Camera.CurrentWeaponID
    The second way of doing this is creating preset files for all different positions and activating full (or additive) presets for the respective weapon. This is the way most things work in Demoscript.cs, and is covered in some detail in the manual. But just give me a headsup if you need more help!

    Good luck

    /Cal
     
  5. Duskling

    Duskling

    Joined:
    Mar 15, 2011
    Posts:
    1,196
    This is fantastic!!!!!
     
  6. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Gotcha. It turns out UFC uses a lot of keys that don't exist in the default Player key configs, so assigning virtual axes to them all would mean the default code breaks in a lot of projects. This would make it look like your product doesn't work "out of the box" and probably make implementation of quick and dirty demos more annoying, so I can see why you did it this way.

    That said, Vertical, Horizontal, Fire1, Fire2, and Jump all exist by default, so you could consider working that into the SimpleScript just so noobs have examples of both to learn from. (Is this less elegant because it uses two seperate Input techniques? I can't tell.)

    Anyway, change stuff like:

    Code (csharp):
    1.         // classic 'WASD' first person controls
    2.         if (Input.GetKeyDown(KeyCode."w") { m_Controller.MoveForward(); }
    3.         if (Input.GetKeyDown(KeyCode."s") { m_Controller.MoveBack(); }
    4.         if if (Input.GetKeyDown(KeyCode."a") { m_Controller.MoveLeft(); }
    5.         if (if (Input.GetKeyDown(KeyCode."d")) { m_Controller.MoveRight(); }
    6.  
    to

    Code (csharp):
    1.         // classic 'WASD' first person controls
    2.         if (Input.GetAxis ("Vertical") > 0.01) { m_Controller.MoveForward(); }
    3.         if (Input.GetAxis ("Vertical") < -0.01) { m_Controller.MoveBack(); }
    4.         if (Input.GetAxis ("Horizontal") < -0.01) { m_Controller.MoveLeft(); }
    5.         if (Input.GetAxis ("Horizontal") > 0.01) { m_Controller.MoveRight(); }
    6.  
    Good forward thinking about setting precedents!

    Yeah, I haven't been able to break it ever since the patch. It's actually startlingly precise now when the new gun appears. Good job on the bugfix! :)

    Suggestions for future features: muzzleflash, an example of projectile integration, reload gesture and sound effect, an example of how to swap out presets at runtime, and if you really wanna sink the time into it, a system for layering presets over the top of your existing behavior. (pistol camera + drunk sway, for example.)
     
    Last edited: Apr 11, 2012
  7. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Thank you, MrDuskling. I aim to please :)
     
  8. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @WarpZone: All good points! I'm currently working on some of the features you suggest ;)

    This is already supported. For example, in DemoScript.cs, you would basically load the Drunk preset onto the camera, then use "SetWeapon" with the weapon you want and load any weapon specific presets you want onto the weapon. But maybe this isn't very clear, I'll likely do some tutorials at some point.
     
    Last edited: Apr 12, 2012
  9. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Man, i like this so much. Alone jumping looks so naturell i have not seen in any other engine or games. Thank You for this great plugin.
    Can`t wait for updates.
     
  10. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    unicat, I'm so glad you like it (feel free to review / rate it in the Asset Store). Also, if you need any help with the system, don't hesitate to ask.

    /Cal
     
    Last edited: Apr 14, 2012
  11. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Here's a small status update of what's currently in the pipe. The "shooter" and "bullet" classes so far support hitscan projectiles, scriptable accuracy falloff in the shape of a cone, multiple simultaneous projectiles (for shotguns), decals, range and ofcourse projectile force for messing up those rigidbodies! There's also a decal manager system which keeps the amount of decals in the scene at a fixed amount and fades out the oldest decals as new ones are born. Fun logic, but trickier than I thought.

    Cheers

    /Cal
     
    Last edited: Apr 21, 2012
  12. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Ahh, really nice. Can`t wait.
     
  13. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Rating done in asset store. :)
     
  14. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Really great, keep up updating this great package. Could you lean little more into melee system? For example hit animations, maybe collision detection of weapon and hitting riggidbodies. Maybe camera shakes with hits would be nice. Just a suggestion:D
     
  15. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @unicat: Yay, thanks a lot *humble bow* :)

    @janpec:
    Yeah, I'd really like do do something specific for melee combat. Something along the lines of swinging the weapon and reacting to collisions with camera and weapon shakes.. It's not a high priority right now but at some point for sure. For now you can use regular animations for melee weapons and let the system animate them for weapon bob, falling impact etc. BTW you do already have great control over shaking the camera and weapon using the built in methods to apply force to the respective springs.

    Thanks guys
     
  16. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    the most popular weapon for fps is a knife, but i would love a sword for melee as well ;)
     
  17. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    hehe, i'd love to do both :)
     
  18. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Whatever you do for melee weapons, it should be as modular and expandable as the guns are now. It's easy to forget in the post-Halo world but part of the novelty of cracking open a new FPS used to be "I wonder what they made the melee weapon this time?" Pipes, wrenches, hammers, swords, all the way through to Oldschool Duke's Mighty Boot.
     
  19. Gherid_lacksGPS

    Gherid_lacksGPS

    Joined:
    Dec 3, 2011
    Posts:
    111
    This is a WONDERFUL asset which I will probably be picking up shortly. A few quick Q's, though:

    - Are there other secondary/alternative fire options built in, aside from zoom, than can be defined/setup? Such as remote detonate, charge launch distance, dual wielding, etc? Or even two fire functions from the same weapon, like machine gun/grenade launch?

    - How much control do you have over jumping? Double jump? Can you change the "fade in/out" of ascent and descent?

    Again, great asset.
     
  20. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @Gherid_lacksGPS: Glad you like the demo! In reply to your questions: "Dual wielding" and "charge launch distance" are not in yet but are planned for the future. "Remote detonation" is not planned at the moment. The jump functionality is "classic"; basically just a one shot upward force and gravity. But double jumping, for example, could be fairly easily achieved by script modification. This basically comes down to your scripting capability. Finally, double / secondary fire should be easy to do by adding multiple "Shooter" components to the same weapon. Just drop me a line if you need help setting that up!

    @WarpZone: I agree. Will always try to keep the system as open ended and expandable as possible.

    Cheers

    /Cal
     
  21. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    May I see a YouTube as I currently cannot play a web player? Other than looks looks fantastic. Will demo ASAP and possibly buy; this looks like it may just be what I need.
     
  22. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Don't forget:
    - Multiple projectiles (I.E. shotgun.)
    - Particle system upon impact.
    - Sequential "burst" fire (I.E. you pull the trigger once, it fires three rounds in a row, rapid-fire style, like some assault rifles. # of rounds per burst should be customizable. Don't forget to click instead of firing if out of ammo!)
    - Option of actual projectiles instead of hitscan. (Rockets, etc. Variables like the amount of damage done should pass through gracefully if a projectile prefab is supplied.
    - A lot of modern games use "slow" bullets which are *almost* like hitscan except they have a slight delay to them. This reads as more realistic in some situations, particularly with sniper rifles. There are existing scripts that demonstrate how to do this in Unity, I think. An old solution was called "Don't Go Through Things," but there might be a better one by now.
     
  23. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @SevenBits: Sure. I'll see if I can get around to uploading a clip tomorrow. Stay tuned.

    @WarpZone: Thanks for your suggestions. Multiple projectiles (for shotgun style weapons) is already done and will be included in the next build. It's pretty cool.
     
  24. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @SevenBits: Ok, here's a quick preview of the current version (1.11).

     
  25. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Actually, in the code it says:

    But I don't use layers 30 or 31 at all. I'm trying to toggle off User Layer 9, which is what I'm arbitrarily using as the GUI Layer. I don't see how changing it from 30 to 25 (which is currently unnamed and, as far as I can tell, unused) would change the situation. For some reason instead of just messing with layers 30 and 31, it seems as if your code sets ALL the layers to visible and THEN messes with 30 and 31. Is that correct? Is that the desired behavior? Why not just inherit the camera's render layers first, then set 30 and 31? I think it would prevent a lot of problems like this one and the water one...
     
  26. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Got it! :D Kudos to the IRC channel.

    replace line 147 (I think) with
    Code (csharp):
    1. camera.cullingMask  = camera.cullingMask   ~((1 << BodyLayer) | (1 << WeaponLayer));
    And that should do the trick! It works for me anyway. Now unless someone explicity uses layers 30 and 31, fpsCamera won't break what the user was trying to do with the camera's render layers! :D

    (I didn't show anyone on IRC your script, I just asked some general questions about how boolean operations on INTs work.)

    Update: Even better:

    Code (csharp):
    1. camera.cullingMask = ~((1 << BodyLayer) | (1 << WeaponLayer));
     
    Last edited: Apr 20, 2012
  27. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Excellent, WarpZone. Thanks for finding this solution. I was under the impression that you could no longer reproduce the problem so that's why I haven't been looking myself. Anyhow... good work!

    /Cal
     
  28. SRoland

    SRoland

    Joined:
    Apr 20, 2012
    Posts:
    7
    Hmmm, might check it out when I get home.
     
  29. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711


    I've been delving into shooting FX for the last few days. Decals and Muzzleflash done. Particles to go.
     
    Last edited: Apr 21, 2012
  30. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Nice, can`t wait to play with the new features.
     
  31. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711

    One more sneak peek from the upcoming build ;)
     
    Last edited: Apr 27, 2012
  32. lapfire

    lapfire

    Joined:
    Mar 9, 2011
    Posts:
    62
    Interested to see the final result with bullets and muzzle flash. When can we expect a build with those features included? I'm anxious. :)
     
  33. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hello, I've lived to regret "announcing dates" many times ;). But I'm working very hard on it, it's 80% done and I'm trying to get it out as soon as possible. Thanks for the interest!

    Cheers

    /Cal
     
  34. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Hehe i can relate to that a lot:D

    Good job on package so far, keep it comming!
     
  35. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
    Yep, the motion in this package is top notch. I espsecially like the low-gravity/austronaut style.
     
  36. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Thanks guys, feel free to rate it in the asset store if you like it.

    /Cal
     
  37. Jump4ever

    Jump4ever

    Joined:
    Apr 30, 2012
    Posts:
    2
  38. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    Very nice demo!
     
  39. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hmm, I must confess I'm no bunny hopping expert. FYI: the FPSController has an "air speed" variable. This should probably be set to 1.0 for it to work. Also, in the "UpdateMoves" method of "vp_FPSController.cs" you may need to make some changes along the lines of what's suggested in the following article:
    http://forums.steampowered.com/forums/showthread.php?t=1229932

    But again I'm no expert in the matter. I really like the idea though. I'll probably take a look at this somewhere down the road if noone solves it before me :)
     
    Last edited: Apr 30, 2012
  40. Jump4ever

    Jump4ever

    Joined:
    Apr 30, 2012
    Posts:
    2
  41. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    No problem, asking doesn't hurt, does it? :) Actually I have quite a long todo-list already so it might be a while. Next up is the first FX build, which should be done any day now.

    Cheers

    /Cal
     
  42. JohnNShields

    JohnNShields

    Joined:
    Apr 23, 2012
    Posts:
    22
    Bought it! Looking forward to new update!
     
  43. lapfire

    lapfire

    Joined:
    Mar 9, 2011
    Posts:
    62
    I'm shaking with excitement! I'm telling you, once this FX build comes out, you'll have a buy from me.
     
  44. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Cool :) Well, it's pretty much done. Basically just some code cleanup and documentation left. I'm aiming to do the app store submission this weekend.
     
  45. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Excellent news! :D Everything's modular and tweakable, right? Mesh and muzzleflash offsets can be plugged in per-gun, with traditional animation as an optional extra?
     
  46. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Warpzone, yes everything is modular and tweakable per weapon. And as before, nothing in the system prevents you from overlaying the procedural motion with traditional animations.
     
  47. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Bombs away! Version 1.2 was submitted to Unity last night and is pending approval.
    (just a heads up)
     
  48. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711


    Ok, Ultimate FPS Camera 1.2 has been approved and is available in the Asset Store. The system now has raycasting bullets, a decal manager for bulletholes, realistic shell case physics and muzzle flashes. Several example particle FX prefabs are included. The manual has been extended to discuss all new features in extensive detail.

    Read the full Release Notes HERE
    Check out the new webplayer HERE (Don't see the new features? Refresh or clear your browser cache.)
    Asset Store LINK

    Now I'm going to sleeep ;)

    /Cal
     
    Last edited: May 7, 2012
  49. lapfire

    lapfire

    Joined:
    Mar 9, 2011
    Posts:
    62
    Thank you so much for this! You have a buy within the day. :)
     
  50. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    166
    Hi, I like this asset a lot. But I would like to see the weapons move into position slowly, so that when the player switches weapons the gun leaves the screen and then the selected weapon gets brought into view.

    I like the fact that all your code is open so that I can change it, something that all the assets should be forced to have. But I noticed a spot where I could program this additional feature:

    Code (csharp):
    1. public void SetWeapon(int i)
    2.     {
    3.  
    4.         if (m_Weapons.Count < 1)
    5.         {
    6.             Debug.LogError("Error: Tried to set weapon with an empty weapon list.");
    7.             return;
    8.         }
    9.         if (i < 0 || i > m_Weapons.Count)
    10.         {
    11.             Debug.LogError("Error: Weapon list does not have a weapon with index: " + i);
    12.             return;
    13.         }
    14.  
    15.         foreach (Transform t in transform)
    16.         {
    17.             if (t.name.Contains("WeaponCamera"))
    18.             {
    19.                 t.gameObject.SetActiveRecursively(false);
    20.             }
    21.         }
    22.  
    23.         if(m_CurrentWeaponID > 0)
    24.         {
    25.             m_Weapons[m_CurrentWeaponID - 1].SetActiveRecursively(false);
    26.         }
    27.  
    28.         m_CurrentWeaponID = i;
    29.  
    30.         if (m_CurrentWeaponID > 0)
    31.         {
    32.             m_Weapons[m_CurrentWeaponID - 1].SetActiveRecursively(true);
    33.             m_CurrentWeapon = (vp_FPSWeapon)m_Weapons[m_CurrentWeaponID - 1].GetComponentInChildren(typeof(vp_FPSWeapon));
    34.             if (m_CurrentWeapon != null)
    35.             {
    36.                 m_CurrentWeapon.WeaponCamera.SetActiveRecursively(true);
    37.                 m_CurrentWeapon.SetPivotVisible(false);
    38.             }
    39.         }
    40.        
    41.     }
    In this function all you are doing is making the old weapon invisible and making the selected weapon visible. But what if we altered it so that the weapon is removed from view by being put at a certain location, then after it reached that specified location it would turn invisible.

    What are your thoughts on this?
     
Thread Status:
Not open for further replies.