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

UFPS : Ultimate FPS [ RELEASED ]

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

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

    jrkienle

    Joined:
    Apr 14, 2012
    Posts:
    71
    Hey guys! Just a little update on my progress on converting UFPS Camera to multiplayer. The camera is now fully functional and I am working on FPS game essentials such as damage, respawning, and a scoreboard. I'll post screenshots/tutorials as soon as I finish!
     
  2. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Sweet! :)
     
  3. d10sfan

    d10sfan

    Joined:
    Oct 29, 2012
    Posts:
    25
    Very nice! Looking forward to seeing it
     
  4. Unicron

    Unicron

    Joined:
    Sep 28, 2011
    Posts:
    191
    Very cool! Definitely looking forward to this.
     
  5. OmarChapa

    OmarChapa

    Joined:
    Dec 30, 2012
    Posts:
    3
    Hi, I just bought the UFPSC and I wanted to know if it has dual weapon support or if I need to modify the scripts to make it work because in my current project dual weapons it's a must have and I wanted to ask if it has already some of that functionality already before starting to modify the scripts
     
  6. bubbalovesponge

    bubbalovesponge

    Joined:
    Nov 8, 2012
    Posts:
    69
    Create a gameobject and assign a box colider. then position it just slitghly above the stairs.
     
  7. jrkienle

    jrkienle

    Joined:
    Apr 14, 2012
    Posts:
    71
    Hey visionpunk! I have two big questions for you:

    1) How would one create a flamethrower style weapon?
    2) How would one make it so users can pick up weapons from the ground?

    I really appreciate all the help you've given me!

    jSoftApps
     
  8. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Thanks so much, what a clever idea!! Great product btw, almost finished a game using it :)
     
  9. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Was meant to ask, how do the control work on iOS/Android, do we have to code that or are they implemented in this already?
     
  10. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi Omar,

    In the case of "akimbo" weapons (one separate weapon in each hand) this is something that I haven't implemented yet. So the answer is: yes it requires script modification. (I think it's basically a matter of expanding the camera's SetWeapon' method so it can take more than one weapon; currently it hides all weapons but the one it sets).
     
  11. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi JSoft,
    1) The shooting class works by simply spawning a Unity gameobject. Create a prefab with a camera oriented, additive billboard and a rigidbody. Put it in the shooter objects's projectile slot. If the prefab has a script that sets some velocity on it in its Awake method, it will fly away when fired. Set the firing rate quite high. Check the manual for more info on setting up weapons and projectiles.
    2) This is very easy with some basic scripting. See the manual chapter on scripting and placeholder inventory features. You should be able to easily create an item pickup system using the existing methods for giving and taking away weapons from the player.

    Good luck!
     
    Last edited: Jan 2, 2013
  12. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
  13. bubbalovesponge

    bubbalovesponge

    Joined:
    Nov 8, 2012
    Posts:
    69
  14. d10sfan

    d10sfan

    Joined:
    Oct 29, 2012
    Posts:
    25
    Worked for me, looking good :)
     
  15. d10sfan

    d10sfan

    Joined:
    Oct 29, 2012
    Posts:
    25
    Been working on a project with this camera, been alot of fun using it. First time making a game, so mostly just tinkering and seeing what I can do. It's a combination of assets I found and custom code, as I'm not very good at modeling or animations, but can program, so this camera's a great fit for me.

    Have a webplayer at http://fy06.com/unity/flat if anyone wants to give it a try.

    Pretty much the extra features are:

    Main menu with settings for graphics, controls, etc (using cinput for controls); can also reset the game by going back to the menu and clicking new game
    Spawn area has some stuff to destroy (boxes, explosive barrels, destrucible walls)
    couple enemies to shoot and destroy in the city
    Car driving, can enter and exit the car by clicking the f key when near it (used the car tutorial)
    New weapons (Beretta and MP5), imported models and animated using the camera, animations still need work lol
     
    Last edited: Jan 2, 2013
  16. bubbalovesponge

    bubbalovesponge

    Joined:
    Nov 8, 2012
    Posts:
    69
    Nice, I like it
     
  17. bubbalovesponge

    bubbalovesponge

    Joined:
    Nov 8, 2012
    Posts:
    69
    I wrote a full functional iOS/Android version. My focus was to use the same technique that Cal(VisionPunk) uses in his code.
    In Addition, I created a few new code snippets for when you hit the enemy to produce blood instead of the debris impact, among other stuff.
    I will write some tutorials up.
     
    Last edited: Jan 2, 2013
  18. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    thanks buddy - please post the link when this is ready, im so amazed by this product and its supporters... im gonna have to list some credits somewhere, thank you again im eagerly awaiting touchscreen control, respect and thanks..

    Just another noteto tell Vision Punk that he is spreading joy to the world, THANK YOU, this is a BEAUTIFUL asset and then some!!!
     
  19. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Now it works for me, bubba. That's really cool :). Getting the Walking Dead feeling ... Is it gonna be a full game?
     
  20. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    This was also fun to see. Especially with the car and nice cInput integration (was the latter hard to do in your opinion?)
     
  21. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Wow, I'm quite speechless :). Thanks.
     
  22. Amon

    Amon

    Joined:
    Oct 18, 2009
    Posts:
    1,384
    @VisionPunk

    Purchasing this was the best thing I did. I've tried others including rolling my own but none nor mine were to the standard of this! Keep up the good work as your asset store stuff is exemplary in quality and usability!
     
  23. d10sfan

    d10sfan

    Joined:
    Oct 29, 2012
    Posts:
    25
    The car wasn't too bad, found a tutorial on youtube for the enter and exit portion. Had to modify the script to support the camera, but now it works great.

    cInput was great, basically just commented out the normal input lines in the camera code, changed them to the cinput calls, and it worked. In the menu, I'm using their input menu example code for the control section. It's nice to be able to change an input on the fly and have it applied immediately.

    Been very impressed with the camera. For someone like me that has only done programming, it's perfect. Plus the feature set is very nice
     
  24. bubbalovesponge

    bubbalovesponge

    Joined:
    Nov 8, 2012
    Posts:
    69
    Yes, working on the coding and feel of eveything first, then adding in all my other models (buildings, city, etc).
    Still have to improve the zombies, but it is fully integrated into your tool so I can just drop into anything and it works.:p

    I have been enhancing your existing code to include a few things:
    Added in an additional AmmoClip to the vp_FPSShooter to allow a max of clips the user has. That way they have to find more ammo within the game.
    Created a Health Bar code to send damage and recieve damage to the user.
    Edited the Hand model to be a closed fist to punch objects when out of ammo.
    Modified the vp_Bullet to show either blood effect or bullet hit decal effect.
    and other fun stuff.
    My mobile version is a seperate code using all your code that if enabled the PC mouse/keyboards are disabled.


     
    Last edited: Jan 7, 2013
  25. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Thanks Amon. Makes it feel good pushing on :)
     
  26. EiKON-Andy

    EiKON-Andy

    Joined:
    Nov 13, 2010
    Posts:
    66
    I bought this yesterday and am planning on spending a bit of time later today integrating it into our player prefab (for a multiplayer FPS using uLink). I just wanted to mention the documentation - wow! I read the whole thing from beginning to end last night on my iPad in bed :)

    If everybody could write documentation like you, the world would be a better place! Keep it up!
     
  27. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Yes, the documentation on this is excellent.
     
  28. rockyada

    rockyada

    Joined:
    Jul 23, 2012
    Posts:
    8
    Hey, I would like to make that walk-stomping effect that u have in your mechcockpit example. I made it from scratch and set variables from presets like in that mech example, but I dont know how to make that stomping effect. Can you help me please?
     
  29. bubbalovesponge

    bubbalovesponge

    Joined:
    Nov 8, 2012
    Posts:
    69
    @VisionPunk
    Thought this might be of use to you. One key thing in any game is that you are normally limited to the ammount of ammo on hand. So I created this ammoclip pack so that when a ammo clip is found it will increase the ammount of ammo you have on hand.
    To use copy the AmmoCount stuff in vp_FPSShooter as a new int AmmoClip

    /////////////////////////////////////////////////////////////////////////////////
    //
    // vp_AmmoPack.cs
    // Not © 2012 Microcyb, Darren Hedlund. No Rights Reserved.
    //
    // Description: Increase the vp_FPSShooter AmmoClip count
    // Required: Create a vp_FPSShooter AmmoClip as int
    /////////////////////////////////////////////////////////////////////////////////

    using UnityEngine;
    using System.Collections;

    public class vp_AmmoPack : MonoBehaviour
    {
    private Transform _target;

    void Update()
    {
    GameObject _target = GameObject.FindGameObjectWithTag("MainCamera");
    float dist = Vector3.Distance(_target.transform.position, this.transform.position);
    if (dist < 3f)
    {
    Destroy(this.gameObject);
    vp_FPSCamera Ammo=(vp_FPSCamera)_target.transform.GetComponent("vp_FPSCamera");
    if (Ammo.CurrentShooter != null)
    {
    Ammo.CurrentShooter.AmmoClip++;
    }
    }
    }
    }
    Download this guy ammo case
    Add this script to the ammo case.

    Easy Breeze Cover Girl. LOL

    I also changed the CurrentShooter.Reload( to check if the Ammoclip is less then 0 to prevent reloads.
     
  30. Junkie_XL

    Junkie_XL

    Joined:
    Jan 27, 2011
    Posts:
    12
    Very cool package but man there are just so many settings. Tedious to change values, hit play, stop, repeat...

    I don't suppose anyone has a shotgun preset they would like to share? :p
     
  31. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Just take it directly from the sample project.
     
  32. rockyada

    rockyada

    Joined:
    Jul 23, 2012
    Posts:
    8
    I tried that, but there are a lot of thing connected each other. Mainly that "Demo" object is causing problems, because the code, which makes stomp, is in that class. That class also contains a lot of code that I don't need.
    This code makes the stomp
    Code (csharp):
    1.                    
    2. m_Player.Camera.BobStepCallback = delegate()
    3. {
    4.                         m_Player.Camera.AddForce2(new Vector3(0.0f, -1.0f, 0.0f));
    5.                         m_Player.Camera.CurrentWeapon.AddForce(new Vector3(0, 0, 0), new Vector3(-0.3f, 0, 0));
    6.                         m_AudioSource.PlayOneShot(m_StompSound);
    7. };
    I tried to seperate that code in new class, but I can't make it work.
     
  33. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi rockyada,

    Ok let's see. 'm_AudioSource' can be changed to just 'audio'. 'm_Player' should be substituted for a reference to your own FPSPlayer instance. To fetch the player object, if your script is a child to the FPSPlayer object, do this in Start or Awake:
    Code (csharp):
    1.  
    2. m_Player = (vp_FPSPlayer)transform.root.GetComponentInChildren(typeof(vp_FPSPlayer));
    3.  
    ... where 'm_Player' is declared like so at the top of the script:

    Code (csharp):
    1.  
    2. vp_FPSPlayer m_Player = null;
    3.  
    Other than that it's hard to say what's going wrong. If you are seeing an error message, please provide it.
    Also, more info on bob step callback is available in the manual section: FPSCamera -> Bob.

    Cal
     
  34. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi Junkie_XL,

    Glad you like the asset. In fact, you don't have to hit play, stop, repeat. There is a feature called "Persist play mode changes" which makes it so that Unity doesn't destroy your tweaks when you hit stop. Other efficient workflows are also possible. You might want to read the chapters "Presets" and "States" in the manual. The latter chapter has info on the persist feature.

    Cal
     
  35. thommoboy

    thommoboy

    Joined:
    Jul 20, 2012
    Posts:
    59
    Hey How can i enable the mouse cursor when i want to? because when i am running i want the player to use the GUI but the mouse does not have focus
     
    Last edited: Jan 10, 2013
  36. bubbalovesponge

    bubbalovesponge

    Joined:
    Nov 8, 2012
    Posts:
    69
    Within the vp_FPSPlayer.cs look for Screen.lockCursor = LockCursor;

    You will see a comment:
    // if the 'LockCursor' property is set on the player, hide
    // mouse cursor and center it every frame
    In short, the Screen.lockCursor is set to true.
    // enables / disables the mouse cursor
    protected bool m_LockCursor = true;
     
    Last edited: Jan 10, 2013
  37. rockyada

    rockyada

    Joined:
    Jul 23, 2012
    Posts:
    8
    Thx VisionPunk, It's working now. I have must changed some code, when I was adjusting the functionality, so it was not working previously, so I made it once again from a scratch.
     
  38. theSoenke

    theSoenke

    Joined:
    Dec 4, 2012
    Posts:
    106
    It's a very nice asset, but it should be easier to add new weapons. It should be possible to just drag and drop them to the other weapons and change the settings of the weapon. But in the moment you first have to add arms and so on to your weapon. It would be also nice if the player could lie down.

    When will version 1.4 published? Hope very soon :)
     
  39. thommoboy

    thommoboy

    Joined:
    Jul 20, 2012
    Posts:
    59
    that works but it is still stuck in the center of the screen
     
  40. rockyada

    rockyada

    Joined:
    Jul 23, 2012
    Posts:
    8
    I have another question :). I tried to add new GUI textures, but some issues occur.


    Look at the picture. I added GUI layer to main camera. When I added textures like those arrows and shoot via code, they looked ok. But when I added texture not by code, the texture appears behind the cockpit. I need those textures to be clickable, so I need to add colliders to them. I think it's not possible to add collider to GUI generated by code. So my only option is to add textures not by code, but i don't want them to look like they are behind the cockpit.

    I also tried to add buttons by code and then put texture on them. That seemed like a good idea, but I need to detect, if the button(texture) is still clicked. But on buttons, I can only detect onmousebuttonup, so that means I can't detect if mouse button is still pressed on that button. I need to detect if the mouse is still pressed, because otherway I must click 100x times on arrow to move forward a little.

    Any ideas how to solve this?
     
  41. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Are you certain you cant post the code somehwere? Im very interested, firstly I want ios/android to work and secondly im wondering how to get around the issue of shooting - with keyboard and mouse you can move and shoot and look - but on touchscreen i dont see how you can shoot whilst looking and moving, there simply isnt a way to press a fire button in the same way - or is there?
     
  42. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    How would I add usb joypad support to this? I figured it might work out of the box but for me it doesnt, any ideas?
     
  43. rockyada

    rockyada

    Joined:
    Jul 23, 2012
    Posts:
    8
    ok I solved it by myself. I just commented one row in camera script where the culling mask was setting up. I have never really investigating what all the settings on camera mean.
     
  44. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi theSoenke, Thanks for the feedback. As for lying down, you can easily create a preset file that does that by modifying the ones used for the crouch state. Just move the camera a bit further down and ahead. Make sure to enable the 'compact' mode of the controller collision, as is done for crouch. See the manual for info on creating states and presets, and comments in the player and controller script for more info about 'compact' mode.

    I hope to get it out within this month.

    Cal
     
  45. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi thommoboy, In fact, for version 1.33, you should not use the 'Screen.lockCursor' Unity property to do this, but rather the 'LockCursor' property of the vp_FPSPlayer class. You can study how this works in "vp_FPSDemo2.cs -> Update".

    Code (csharp):
    1. if (Input.GetKeyUp(KeyCode.Return) || Input.GetKeyUp(KeyCode.KeypadEnter))
    2.     m_Player.LockCursor = !m_Player.LockCursor;
    I know this is confusing. It has been changed in v1.4. More details will come, but for now you can do the above.

    Cal
     
  46. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Ok cool. Glad you solved it (sorry I didn't get around to answer this earlier).
     
  47. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Actually, this can be solved in various ways. In touch shooters you can usually fire and look with the same 'button'. For example: the camera is rotated using your right thumb, but if you put down your thumb on the fire button and drag it outside the button, the weapon will keep firing until you release the screen. Some games also have auto-aim solutions that rotate the camera towards the nearest monster / current target while firing (resulting in circle strafing), so you can move and fire freely without worrying about loosing the target.

    What is it that doesn't work, specifially? Do you get error messages? Doesn't the app recognize the device? If not, does it work using other scripts / assets?

    Cal
     
    Last edited: Jan 13, 2013
  48. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Ouch just lost my reply, this forum software is confusing, I hit "reply to thread" and it went... Anyway what I said was I found and uncommented:

    if (Input.GetAxis("Vertical") > 0.01f) { Controller.MoveForward(); }
    if (Input.GetAxis("Horizontal") < -0.01f) { Controller.MoveLeft(); }
    if (Input.GetAxis("Vertical") < -0.01f) { Controller.MoveBack(); }
    if (Input.GetAxis("Horizontal") > 0.01f) { Controller.MoveRight(); }


    this meant that moving with left stick works fine, but then I want to map right stick to mouse look. So I defined 2 new axis in unity, using axis 3, and 4. Then I tried in updateMouseLook():

    m_MouseMove.x = Input.GetAxisRaw("Horizontal2");
    m_MouseMove.y = Input.GetAxisRaw("Vertical2");

    However it doesnt quite work as expected, moving right stick left and right appears to make the player look up and down, but up and down doesnt seem to work properly. If you swap the code to:

    m_MouseMove.y = Input.GetAxisRaw("Horizontal2");
    m_MouseMove.x = Input.GetAxisRaw("Vertical2");

    then left and right on the right stick work as expected but up and down dont do anything.

    Just wondering if theres a simple way to hook this up so it would play with left and right stick, im basically going to clone the call of duty controls for now.
     
  49. WillOfTom

    WillOfTom

    Joined:
    Aug 6, 2012
    Posts:
    9
    I've been making a few modifications to the shooter class that a few of you might be interested in. My game is going to use a lot of non-hitscan projectile weapons. By default the shooter class always fires the projectile from the centre of the camera, which when firing a slow projectile like a rocket is quite obvious and distracting. Additionally you can clearly see that the projectile does not originate from the weapon.

    So I modified the shooter class to find "emitters" from which the projectile is instantiated from. I expanded this so multiple emitters could be attached and cycled through with each shot, as shown in the video below. I still want to do some work on it, including moving the muzzle flash to fire from the emitter and including a choice between cycling through each emitter or to fire a projectile from every emitter at once.

     
  50. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    These dont seem to match the current code as far as I can see? Its a shame no one has posted code to get this going on mobile :) If I get it sorted I will post it.
     
Thread Status:
Not open for further replies.