Search Unity

FPS Advice?

Discussion in 'Editor & General Support' started by CelticKnight, Mar 31, 2015.

  1. CelticKnight

    CelticKnight

    Joined:
    Jan 12, 2015
    Posts:
    378
    Hello guys,

    I have been trying to get a really basic FPS thing happening (w/ Unity4.6.1f), in that I have my Animator working for the idle/walk/run states and a down the crosshair view using an FBX gun object, muzzle flash via a particle system and, I have shooting happening via the creation of "clone" objects.

    What I would like to do is have some damage occur if the bullet should hit something, like if its something rather solid leave a mark something like the following:



    Or, if something less solid say a box knock it over, perhaps a small explosion (and sound) so you know it hit something solid.

    I did buy a book that said it covered a First Person Shooter and was working diligently through the book building the exterior environment and the interior of the "house" where the action was to take place only to find out yesterday that it doesn't cover shooting at all :mad::mad::mad:. What it does cover is moving about shooting a ghost with a "camera". And even worse still is that all the walls of the house are one plane walls so to have the house not being able to be seen through you have to go and double line all the outside walls, I don't even want to think about how to do that on the 3 storey house I was making. Nothing on how you might combine the exterior and interior from separate scenes, don't even get me started on the doors, stairs and the colliders.

    And that was the only book I could find that vaguely resembled a FPS tutorial.

    So, to get where I "need" to I need some help be it a book, a website, a YouTube series perhaps. Or even just a tip of what I should look at next so I can look for myself. It would have to be a bare bones tutorial as I don't have 3ds Max or Maya to develop an area to play in like one tutorial on YouTube

    Thankyou and Regards,
    CK.
     
    Last edited: Apr 2, 2015
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,288
    Well, one way to make double sided walls is to use very thin cubes. You'll probably want them in an 3d editor so you can texture them the way you want. Use Blender if you've not got any other tools available. If you're not a 3d modeller, find someone who is.

    Regarding bullet holes. Well, use ray casting to see where the bullet hit. For simplicity, put a small quad at that point and render it with your texture. You'll probably have to edit the texture to make it contain and alpha channel. (A more detailed solution will be to have two textures, one with the wall texture, and one where you can write your bullet texture into. Have a shader that knows how to render the bullet texture over the top of the wall texture.)

    Complaining here that your bought a book without doing enough research seems a bit pointless to me.
     
  3. CelticKnight

    CelticKnight

    Joined:
    Jan 12, 2015
    Posts:
    378
    Well, in my defense the book was recommended to me by another user on the forums. And I did do some research on the book - and this is the Chapter summary of the book I found online:

    Chapter 4: First person Shooter Part 1 - Creating exterior Environments
    Chapter 5: First Person Shooter Part 2 - Creating Interior Environments
    Chapter 6: First Person Shooter Part 3 - Implementing Gameplay and AI

    So, ... stupid me thought it would teach about First Person Shooters :(.

    And while it may seem pointless to you to complain about it - I was trying to show that I am serious in my attempt to progress on the FPS front. I spent a good 4 weeks working on this trying to solve the myriad of problems I encountered - I don't expect the information to just magically appear in my lap, and am willing to do the hard yards to make it happen. And there is no information @ http://unity3d.com/learn/tutorials/modules about making an FPS. And there are NO other books whatsoever. That book was my last hope on that front.

    Using thin cubes is something I would like to use for the walls. It would certainly make things much easier, but, I don't know enough about using the supplied textures/materials to map these to the cubes correctly. Would this be possible in Blender? That is using sections of the supplied textures to cover the sides of the cube that will become the walls, and not use the part of the texture used for floors, celings, staircase, etc? If so, could you please steer me towards a tutorial showing how it's done?

    The only experience with Blender was YouTube tutorial for ABSOLUTE beginners on how to make a cup ;).

    So, the main thing I will take from your reply is to look at Raycasting. That is entirely new to me. Time to head off to YouTube to learn about that. Unless there is something I should be looking @ the Unity website about Raycasting, so, I'll take the opportunity to ask - is there?

    Regards,
    CK.
     
    Last edited: Apr 2, 2015
  4. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,288
    Well, post a thread that talks about your experience using the book. Post the Title and Author, so other Unity community members can take something away. Don't mix that topic with help on your FPS. You're posting on the support forum.

    Me dropping into my local car mechanic and telling him that the user manual for my car is a bit rubbish isn't going to solve anything.* If instead I posted on a forum and said "hey guys, this user manual is a bit rubbish, what do other people thing?" then I might get some input which helps me, or at least confirms my view is similar to others.

    You probably want to look at:

    http://docs.unity3d.com/ScriptReference/Physics.Raycast.html

    This describes an API you can use to cast a ray in a direction of your choice, and see what collider objects it hits. Your ray is probably going to be from your gun, and in a direction it's pointing in, and a distance which reflects how far you think a bullet can travel. If the ray hits anything you'll have a RaycastHit object that'll tell you a lot about what was hit.

    * I use car analogies a lot.
     
  5. CelticKnight

    CelticKnight

    Joined:
    Jan 12, 2015
    Posts:
    378
    I would post the name of the book, the author, the publisher and every problem the book entails to make people aware of the book - but, that would open up myself and Unity to a possible 'libel' case. And I have too much respect for Unity to do that. Unity does things that I never would've thought possible without programming your own custom engine - I was blown away by the terrain editor, Mecanim and many other features.

    And yes, I have been looking at Raycast on Youtube and now Docs and it appears to be one of the missing links in my knowledge of the FPS.

    Thankyou for bringing that to my attention :cool:.

    * I am verbose, tend not to hold back anything, and wear my heart on my sleeve.
     
    Last edited: Apr 2, 2015
  6. wizardious

    wizardious

    Joined:
    Dec 31, 2009
    Posts:
    189
    Hey CelticKnight
    Well I've been away from Unity for a while, and just returned, but I am a big Fps fan, and have a little experience with Unity and Fps creation. So A few resources/tutorials.... I would look into FPSControl, not sure if it works with unity 5 but was working with 4.6, and 5.x beta, its in the Unity store for free. An old on is Bastardly Banana's FPS kit, I believe its also on the store, I had it working in 4.6 with a few tweaks, maybe check my posts if interested in that, also free. Next I would visit armedunity.com http://armedunity.com/. And I also ran into this tutorial series, but have not checked it out yet.http://forum.unity3d.com/threads/st...-10-videos-all-project-files-included.190506/.
    I also have the very old original Unity fps tutorial but its outdated, I could upload the .pdf's if your interested.
    If I had to give you one piece of advice it would be, "Don't upgrade Unity in mid project!"
     
    CelticKnight likes this.
  7. CelticKnight

    CelticKnight

    Joined:
    Jan 12, 2015
    Posts:
    378
    Will look into those for sure, I have also been looking at UFPS it looks very good from what I have seen.

    Thanks those links are very much appreciated, I'll get to looking at those over the next week :). That 10-parter looks very interesting.

    I would appreciate that very much!!!

    I hear ya :). Although, I was 'very' tempted to change to Unity 5 when I saw the new FPS controller though it has footsteps, headbobbing and running all built-in and ready to go now - no playing around with the charactor motor, scripting for running and having the sounds synced up sounds like sliced bread.
     
  8. wizardious

    wizardious

    Joined:
    Dec 31, 2009
    Posts:
    189
    Okay so here is the entire original FPS Tutorial including the assets. It's very old and many of the functions are deprecated, but i did manage to get it working in v4.6 a while ago. Just remember, if you follow the tutorial, many of the java commands are no longer valid, and now have alternate versions.
    I hadn't heard of UFPS, but checking it out, it looks really good. I would say if you have the cash, it would be the way to go. Although I would research it before buying,..... forums, website, comments ect. But thanks for pointing it out.
    https://www.dropbox.com/s/o67isbm9odwgqmk/FPST.rar?dl=0
     
    CelticKnight likes this.
  9. CelticKnight

    CelticKnight

    Joined:
    Jan 12, 2015
    Posts:
    378
    Thanks greatly for posting those files, I downloaded them yesterday :cool:.

    And I've never been really bothered about commands no longer working, the reason why is because I have had SOOOOO many tutorials (books, magazines, websites) where typing the code directly into an editor or IDE either doesn't work, or does something completely weird to what the author says it will, that I pretty much automatically end up at the manual or other trying to figure out what went wrong or latest versions of functions.

    This has happened so many times with deprecated Java (getting rid of every deprecated function is a real pain), C++ problems, and latest game products like GameMaker & Unity, that its not funny.
     
    Last edited: Apr 7, 2015