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. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Hello I have a problem with the interface UI my canvas works perfectly in the Unity editor with different resolution but when the game is Builde its not working , it's completely shifted and does not adapt to the resolution of my screen. Thank you for helping me.
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    If you're using a screen space canvas, make sure your anchors and pivots are set up to handle different resolutions automatically. For example, if you want a Text element to stay in the lower right, set its Pivot to X=1, Y=0. Then set its Anchor to the lower right (the icon with red bars on the right and bottom edges, and a yellow dot in the lower right).

    See the UI Rect Transform tutorial (the second video) on the Unity UI Tutorial section for more info.
     
  3. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Tony thank you my problem is resolved
     
  4. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    I have a problem with backup "Dialogue System for Unity
    Prefab Menu Template " which is based on " Game Jam Menu Template "when I save in the pause menu , the backup game but when I load the whole game is reset to zero (life, weapons etc ...)

    How do I make when I load my scene , my states ( ammunition , life, hunger , thirst, etc ... ) remains when I save the game.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    I'll put together an example scene with instructions and post it here later today.
     
  6. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Thank you
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Here are the instructions to use the menu template with RFPS in a project:
    1. Import Realistic FPS Prefab.
    2. Import the Dialogue System for Unity.
    3. Import Dialogue System/Third Party Support/Realistic FPS Prefab Support. (The latest version is currently on the Extras page.)
    4. Import Unity's Game Jam Menu Template; don't import the ProjectSettings.
    5. Import the Dialogue System Menu Template.
    6. Add Horizontal and Vertical input definitions as described here.

    7. Add the scene Dialogue System Menus/Example/Start to the build settings.
    8. Add the scene Dialogue System/Third Party Support/Realistic FPS Prefab/Example/Realistic FPS Prefab Example to the build settings.
    At this point, you should be able to play the Start scene, go through the menus, and load and save games properly.

    In your own project:
    • In the Start scene, assign your dialogue database to the Dialogue Manager GameObject. Customize the Dialogue Manager as needed. Also customize the UI to look the way you want. I suggest customizing the UI last. Make sure everything functions properly first.
    • Add your your gameplay scene(s) to build settings. Add the first gameplay scene as scene 1 in build settings.
    • In your gameplay scenes:
      • You do not need to add a Dialogue Manager. The Dialogue Manager will persist from the Start scene. But you can add a Dialogue Manager if you want for testing purposes, so you can play immediately from the gameplay scene without having to come in from the Start scene. Just keep in mind that during regular play this Dialogue Manager will be destroyed by the main Dialogue Manager coming in from the Start scene.
      • Set up your player as described here. These are just the usual steps for setting up RFPS with the Dialogue System. The critical components that these steps add are FPS Lua Bridge and Persistent Position Data. But you'll probably also want all the other components that get added by the steps, such as Show Cursor On Conversation.
    I'm not posting a downloadable package because, as you can see in steps 1 - 8 above, you can set this up without having to modify any of the example scenes. Please try those steps and, if you run into any issues, just let me know.
     
  8. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    The backup system and loading works perfectly , really thank you :):D
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Glad I could help!
     
  10. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    His works perfectly but I have 2 little problem :oops: :

    _The first problem is that the menu I put an image with text and when I click " Start " to load the level, the text and the picture remains on the screen . How do I make when I load the next level after the menu, the image and the text disappears ?

    _The second is not really a problem, how to make that when I load the next level in the menu, the menu music stops in the next level ?

    Thank you :)
     
  11. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    The first problem is solved. He had simply drag the " menupanel " .
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    1. In your start scene's Hierarchy, expand UI/MenuPanel/MenuButtons. Inspect Start.
    2. In the On Click () section, click the "+" in the lower right to add another event handler.
    3. Assign the UI GameObject, and then select PlayMusic.FadeDown. Set the value to something like 0.5.

    Repeat for the other buttons: Continue, Restart, and the LoadGamePanel/Panel/LoadButton.

    If you want to play music in your gameplay scene, you can assign the music clip to the UI GameObject's PlayMusic component. Make a note of the element number (e.g., 0, 1, 2, etc.). Then call PlayMusic.PlaySelectedMusic(#). I prefer instead to just put an Audio Source in my gameplay scene, assign the music to it, and tick Play On Awake and Loop.
     
  13. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    OK thank you
     
  14. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36


    I am currently using the latest version of Realistic FPS Prefab and for some reason when ever I move all the models start twitching I don't know what is causing this problem but if you notice at points in the video I stop moving for few seconds and everything stops twitching. If anyone can figure out why this happens please let me know thanks.
     
    Defcon44 likes this.
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Are you using the two-camera prefab? If so, is the weapon camera set up to only render the weapon/hands?

    Also, it looks like you're getting some bleed-through of the grass into the asphalt. This usually occurs if you put two flat surfaces in the same place (e.g., at Y=0). They'll fight over which gets rendered first. Make your road a little thicker so it can be slightly above the grass.

    That may not be the entire answer, but it'll probably help.
     
    Defcon44 likes this.
  16. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    Thanks il let you know if it works.
     
  17. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    Im not using the 2 cameras.
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Maybe adjusting the scene will help, such as making the road thicker. If RFPS's sandbox scene works correctly, then probably something just needs adjusting in your scene.
     
  19. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    im a d
    fixed it :) thanks.
     
  20. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    by any chance do you know how to add a UI and put images on them to adjust to every screen resoultion?
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Unity UI does a good job of this, but it's complicated and takes some time to learn. The best resource is Unity's UI tutorial videos. These are the pieces to really bone up on:
    • Rect Transform anchors - make UI elements stick to edges of the screen, even when the resolution changes.
    • Canvas Scaler - Scales the entire canvas relative to the screen solution (but you still should use anchors correctly to make it look right)
    • Layout Controllers - Organizes child UI elements under a parent element.
    The most important piece to really get right is the Rect Transform.
     
  22. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Please tell us HOW ?!
     
    Defcon44 likes this.
  23. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hey guy's !

    Happy new year in first :)

    Second, the turret system works perfectly with the Asset "Turret System" thanks Tony !

    Thirst, i want to make a reading system but i don't know how to implemented in RFPS, what i want :

    The player look the page press "F" and the page appear on the screen (texte can be write in the script, not an image).

    Somebody know how to make that please, maybe with dialogue system no ? :)

    Thank you
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Happy New Year! Here's a book example using the Dialogue System: RFPS_BookExample.unitypackage

    The GameObject Book is on a table near the player. It's configured as an RFPS Pickup. It has these components:
    • Dialogue System On Pick Up Item: Sends "OnUse" to itself.
    • Conversation Trigger: Starts the book conversation when it receives "OnUse".
    • Override Dialogue UI: Uses a custom book UI.
    The GameObject Book Dialogue UI is a custom UI for books. I didn't use any special graphics; you'll have to customize this yourself to make it look nice.
     
    Defcon44 likes this.
  25. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thank you Tony for you'r help (like always ;) )

    I go look this right now :)
     
  26. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    125
    I've been lurking in this thread forever and have also had ideas for a reading system in RFPSP but have been too meek to ask about it. Thank you @TonyLi, I'm going to check this out today!
     
  27. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Works perfectly Tony !

    Thank you :D

    Edit:

    I have imported the package to my really project, i don't get error BUT i have a little problem.

    When i press "escape" the dialogue menu appear, i don't want this because i have already a pause menu. And when the page appear on the screen i don't have the cursor so i can use the button :s
     
    Last edited: Jan 4, 2016
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Hi @Defcon44 - Remove the Feature Demo script from the Dialogue Manager GameObject.

    Check two things:
    1. Your FPS Player should have a Show Cursor On Conversation component.
    2. Assign FPS Player to the book Conversation Trigger's Actor field.
     
  29. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hey,
    The feature demo script is remove, menu don't appear now, thanks.

    I have put the Show Cursor On Conversation on my FPS Player and assign the FPS Player to the "actor" slot but the cursor don't appear :s
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    I included an example scene with the package. Does it show the cursor?
     
  31. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Yes it does, this is the strange parts ^^
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Strange! Look for differences between the scenes. Maybe your FPS Player is missing a component, or maybe it has an extra component that hides the cursor again.
     
  33. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Yeah i go looks the differences ^^

    Thanks Tony, i make feedback after search the problem :)
     
  34. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Ok so, i have copy/paste a lot of script to FPS Player demo scene ----> My FPS Player

    Now, when i open the book i have the cursor and the game look like "pause" +1 :D

    But when i close the book i can't move my player :/
    I have a script with 11 element on my FPS Player but that doesn't works good with my player :/

    Exemple :

    Demo scene Player = Element 4 : Main Camera (FollowFPSPlayer)

    My Player = Element 4 : Main Camera(CameraKick)*

    When i drop my main camera in the slot, this is always the same script "Camera Kick", i have copy/paste all the script of the Main Camera (Demo Scene Player) but i take always the CameraKick, i don't know how to take another script :s
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Make a backup copy of your scene. Then select your FPS Player and use menu item Window > Dialogue System > Third Party > Realistic FPS Prefab > Disable Gameplay During Conversations. This should configure your player with all the scripts necessary for conversations.
     
    Defcon44 likes this.
  36. supg

    supg

    Joined:
    Jan 2, 2015
    Posts:
    2
    This looks to be a great asset! I just have a couple questions before I buy.

    1. I know a good amount about OOP principles / C# / etc, but very little about game development, game design best practices, and haven't had much of a use for complex math since my time in school. I've spend the last few weeks recreating a basic version of "A Link to the Past" as a learning exercise. I've made some really good progress, and have all of the basics working (and even implemented a mouse direction aiming system). I feel like I'm ready to take the next step into more advanced math, models, and 3D. Would this be a good asset to learn from? It seems like it touches on a lot of Unity's features. Is it fairly up-to-date with Unity3D best practices and modern ways of doing things?

    2. How tightly coupled is this package? Can I take bits and pieces of it, add it to an existing project or does this need to be implemented from the get go?

    3. How extensible is this package, and if I want to make modifications how will the RFPS updates work? Can I extend classes from your library? Would any changes break my ability to upgrade to the new version you are about to release?

    4. Does it have different hit-box zones? (Like headshots)

    5. In a very broad sense, how difficult would it be to implement networking?


    Thank you for your time!
     
  37. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thanks Tony, all works good now :)

    I have the cursor when the book is open and the player don't move.
    Just, how i can change the test of the page ? i have look the label of the canvas but this is not that, i have look with "dialogue editor" select the conversation but i don't see anything with "this is page 1/2/3".

    Thanks :)
     
  38. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    TonyLi thank you, by chance, you know how to add an NPC with RFPS? (I tried but the animation does not market the characters do not move ...)
     
  39. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    125
    If you're using Mecanim animations:


    Remember to make a new Animation Controller (you can duplicate the example one and swap out the animations) and assign it to the new NPC. You also have to bake the navmesh.

    If you're using Legacy animations:
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    The text is in a conversation in the dialogue database. Edit the dialogue database and open the conversation. You can add and remove pages, and edit the text of pages. You can also use rich text codes if you want to add bold, italics, different colors, etc. Note that I used the [position #] tag to specify which button to use for each blue "reply" node (Done, Next, and Back).

    I'm not the developer, so these are just my impressions as a user and as the maintainer of the Dialogue System for Unity's integration package for RFPS.

    RFPS is a good example of a project that implements the fundamental pieces of an FPS as a comprehensive whole. It's really got a lot -- NPC AI, environment-based footsteps, iron sights, etc. It's been around a while, which means the code is fairly solid and bug-free. It does carry over some older techniques such as using GUIText instead of Unity UI for HUDs, and it doesn't use some newer features like the Audio Mixer. But, for the most part, fundamental design practices haven't changed in Unity, so apart from these little things it's up to date.

    As with many Complete Project packages, the code is tightly coupled and interdependent. On the plus side, this means everything ties together. However, it's difficult to extract bits and pieces without using the whole thing. It's not terribly difficult to add new functionality, though. The Dialogue System adds conversations, quests, saving & loading, etc. Heavy Diesel's Bloody Mess adds hit-boxes and dismemberment. And there are a couple tutorials on the Pixel Crushers website such as how to switch to Unity UI for the HUD instead of legacy GUIText, and how to add grenades (a downloadable on the Dialogue System Extras page).

    RFPS uses messages for things like damage and pickups. This makes it easy to extend by adding scripts that listen for those messages. The book example a few posts above, for instance, listens for the "PickUpItem" message to "read" a book by running it through a Dialogue System conversation. UnityEvents might be a "newer" way to accomplish the same thing as messages, but I don't think it makes much difference either way.

    Other than messages, though, the classes are mostly not virtual, so it's difficult to extend them with subclasses. To change some functionality, you'll have to edit the original source files, which means you'll need to re-add the edits when updating to a new version of RFPS. Also, the classes can be a bit intimidating to read through since some of them are hundreds of lines long. But they're organized in a way that makes sense, without a lot of crazy indirection that some other FPS packages have that make it really hard to follow what's going on.

    No, but you could add them yourself (with some effort) or use something like Bloody Mess.

    Rather difficult. I posted steps to set up networking with Bolt some time ago, and that was for a non-authoritative server. Generally speaking, it's difficult to add networking to an existing system such as RFPS after the fact, especially if it uses Unity Physics, like RFPS does, which can't easy rewind to sync up with an authoritative server. Networking really needs to be built into a system from the onset.
     
    Last edited: Jan 5, 2016
    Deleted User, supg and Defcon44 like this.
  41. supg

    supg

    Joined:
    Jan 2, 2015
    Posts:
    2
    Thank you so much for the detailed response, that cleared up a lot for me.
     
  42. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Oh .... *stupid* .... i don't see the list in the conversation tab --'

    I have change the text ^^' thanks Tony!
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    I forgot to mention that you can assign a unique Override Dialogue UI for each book. For example, for a treasure map, you could make a dialogue UI with a map image in the background. Then make your conversation an empty string so it only shows the map.

    Happy to share my opinion! Speaking of extending RFPS, I just came across an interesting post where @schipman posted how he extended RFPS to work with Emerald AI.
     
    Defcon44 likes this.
  44. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Closetgeekshow thank you for your reply I managed, how do I disable some resolutions in lancher Unity? I want to start with only 1024x768. And it is possible to launch the game has a resolution imposing?
     
  45. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    You can set a default resolution in Build Settings->Player Settings-> Resolution and Presentation.
     
  46. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Thank you for your answer , but when I go to Resolution and Presentation I not see "default resolution " , you could say it's exactly that option ' Resolution and Presentation ?
    Thank you
     
  47. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    It is the correct location. Unity may default to "Default is native resolution".. Deselect this option and you will see where you can enter a default.
     
  48. TA_Ahmad

    TA_Ahmad

    Joined:
    Nov 4, 2015
    Posts:
    2
    Hi everyone!
    i need some help about the Realistic FPS Prefab ,
    i hope you can help me urgently , i need wanan more zooming of FPS using UI slider ,
    I am Try since last 2 day and em write some script but its not woking properly , please sir help me as soon as possible
    thanks
     

    Attached Files:

  49. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    How did you fixed? I'm also having that. Also using 1 camera.
     
  50. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Has anyone tried to implement a co-op mode with RFPS? I have had a look through the thread and could not really find anything.
    I am probably going to need to get one going and am thinking it would need to include:
    1. 2 players on the same machine, so that would mean split screen.
    2. 2 players via a connection, so multiplayer system/lobby etc.
    I saw some things about bolt by @TonyLi and others, but nothing about Unity's own networking. I also saw that @menfou seems to have done his own setup, which was interesting too. Still nothing about co-op though that I could see.