[UNITY 5 FPS Tutorials] GTGD S3 - Advanced First Person Shooter

Welcome to Gamer To Game Developer Series 3! I’ll be showing you how to build a powerful FPS system in Unity 5 that you can expand upon for making any type of single player FPS game, from survival to all out action! In Chapter 1 I explain the basics and from there I’ll show you how to build the systems that make up GTGD S3. I start out with Unity 5.2.0. I code in C#.

S3 is now available for purchase on Steam as well!
Includes Steam trading cards :smile:

USER CONTRIBUTED CODE
Gun Recoil!
Visual Studio script template
Enemy field of view!
Removing defeated enemies when they are out of view
Aiming down sights
Crouching

Chapter 1 Unity Primer
[2] Install Unity
[3] Unity Basics
[4] Code Basics
[5] Finding & Accessing
[6] Delaying Code
[7] Input
[8] Raycast
[9] Tags
[10] Layers & Visibility
[11] Layers & Detection
[12] Walk Through Walls
[13] Triggers
[14] Accessing Scripts
[15] Materials & Color
[16] Instantiate
[17] Add Force
[18] Collision Detection
[19] Overlap Sphere
[20] Explosion Force
[21] NavMesh
[22] AI That Pursues
[23] Cursor Lock State
[24] Enemy Spawner
[25] Events
[26] Clean Up
[27] Your Assignment

Chapter 2 Game Manager System
[28] Intro To Chapter 2
[29] Game Manager Master
[30] Game Manager Pause Toggle
[31] Game Manager Toggle Menu
[32] Menu UI
[33] Game Manager Toggle Player
[34] Game Manager Toggle Cursor
[35] Game Manager References
[36] Game Manager Toggle Inventory UI
[37] Inventory UI
[38] Main Menu
[39] Game Manager Go To Menu Scene
[40] Game Manager Restart Level
[41] Game Manager Game Over
[42] Script Template
[43] Panel Instructions UI
[44] Game Manager Panel Instructions

Chapter 3 Player System
[45] Intro To Chapter 3
[46] Player Master
[47] Player Health
[48] Canvas Health
[49] Player Canvas Hurt
[50] Canvas Hurt
[51] Player Detect Item
[52] Player Ammo Box
[53] Unity 5.3 Conversion
[54] Player Inventory

Chapter 4 Item System
[55] Intro To Chapter 4
[56] Item Master
[57] Item Throw
[58] Item Pickup
[59] Item Tag
[60] Item Name
[61] Item Rigidbodies
[62] Item Colliders
[63] Item Set Layer
[64] Item Set Position
[65] Item Sounds
[66] Item Animator
[67] Item UI
[68] Item Ammo

Chapter 5 Enemy System
[69] Intro To Chapter 5
[70] Download Golem
[71] Setup Ragdoll
[72] Enemy Controller
[73] Enemy Master
[74] Enemy Animation
[75] Enemy Detection
[76] Enemy Nav Pursue
[77] Enemy Nav Destination Reached
[78] Enemy Nav Wander
[79] Enemy Nav Pause
[80] Enemy Attack
[81] Enemy Health
[82] Enemy Take Damage
[83] Enemy Ragdoll Activation
[84] Enemy Collision Field
[85] Spawner Proximity
[86] Enemy Nav Flee

Chapter 6 Gun System
[87] Intro To Chapter 6
[88] Download Gun Assets
[89] Gun Item Setup
[90] Gun Animations
[91] Gun Controller
[92] Canvas Ammo
[93] Dynamic Crosshair UI
[94] Dynamic Crosshair Controller
[95] Muzzle Flash
[96] Hit Effects
[97] Gun Master
[98] Gun Standard Input
[99] Gun Shoot
[100] Gun Muzzle Flash
[101] Gun Hit Effects
[102] Gun Apply Damage
[103] Gun Animator
[104] Gun Sounds
[105] Gun Ammo & Reload Part 1
[106] Gun Ammo & Reload Part 2
[107] Gun Ammo UI
[108] Gun Reset
[109] Gun Dynamic Crosshair
[110] Gun Burst Fire Indicator
[111] Gun Apply Force
[112] Setup Another Gun

Chapter 7 Destructible Objects
[113] Intro To Chapter 7
[114] Download Barrel Assets
[115] Setup Barrel Item
[116] Destructible Master
[117] Destructible Health
[118] Destructible Take Damage
[119] Destructible Explode
[120] Destructible Particle Spawn
[121] Destructible Sounds
[122] Destructible Collision Detection
[123] Destructible Low Health Effect
[124] Destructible Degenerate
[125] Destructible Player Inventory Update
[126] Scorpion81 Fracture
[127] Destructible Activate Shards
[128] Item Drop
[129] Item Transparency
[130] Item Set Rotation
[131] Pocket Hut Part 1
[132] Pocket Hut Part 2
[133] Pocket Hut Part 3

Chapter 8 Melee System
[134] Intro To Chapter 8
[135] Setup Crowbar
[136] Crowbar Animation
[137] Melee Master
[138] Melee Standard Input
[139] Melee Swing
[140] Melee Strike
[141] Melee Reset
[142] Melee Hit Effects
[143] Melee Sound

Chapter 9 NPC AI
[144] NPC AI Introduction
[145] Enemy NPC Prefab
[146] NPC Master
[147] NPC State Scripts
[148] NPC State Pattern 1
[149] NPC State Pattern 2
[150] NPC State Patrol
[151] NPC State Alert
[152] NPC State Pursue
[153] NPC State Flee
[154] NPC State Follow
[155] NPC State Melee Attack
[156] NPC State Range Attack
[157] NPC State Struck
[158] NPC State Investigate Harm
[159] NPC Animations
[160] Edit Golem Controller
[161] NPC Health
[162] Improve NPC State Melee Attack
[163] NPC Turn Off Animator
[164] NPC Turn Off Nav Mesh Agent
[165] NPC Turn Off State Pattern
[166] NPC Take Damage
[167] NPC Collision Field
[168] NPC Ragdoll Activation
[169] NPC Drop Items
[170] Change To Item Master
[171] NPC Head Look
[172] NPC Hold Range Weapon
[173] Gun Script Improvements
[174] Gun NPC Input
[175] Setup Ranged Ally 1
[176] Setup Ranged Ally 2
[177] General Improvements
[178] Item Make Noise
[179] Destructible Cause Distraction
[180] Bug Fixes
[181] Waypoints & Factions
[182] Edit Gun NPC Input
[183] Assign Waypoints
[184] Look At Target Improvement
[185] NPC Dynamic Faction
[186] Edit A Few NPC Scripts
[187] NPC Relations Data Structure
[188] NPC Relations Master
[189] NPC Relations Processor
[190] NPC Set My Attacker
[191] NPC Apply Relations
[192] NPC Relations UI
[193] Destructible NPC Relation
[194] Edit Destructible Cause Distraction
[195] Edit Item Make Noise
[196] Upgrade To Unity 5.6

Chapter 10 Vehicles
[197] Introduction To Vehicles
[198] Edit Various Scripts
[199] Edit NPC Scripts
[200] Setup Unity Car
[201] Edit Standard Car Scripts
[202] Vehicle Camera Master
[203] Vehicle Camera Follow
[204] Vehicle Camera Free Look
[205] Setup Vehicle Camera
[206] Vehicle Master
[207] Player Vehicle Interaction
[208] Vehicle Enter
[209] Vehicle Exit
[210] Vehicle Apply Damage

19 Likes

Thank you so much for doing this series. I’ve found your teaching style to be excellent and really resonates with me. I just stumbled upon your channel on Saturday, watched through your series, and decided to take your challenge! I’m brand new to Unity, but I’ve been a desktop & web developer for years so that part isn’t a big stretch.
Anyway, here’s my submission for the end of Chapter 1. Wish I’d waited for Chapter 2 to implement my menus since I really struggled on some of those things, especially buttons and decided to put that aside for now.

Link to the video:

Download at: www.rongothebold.com

I really went too far in attempting to incorporate way too many models/sounds/effects, but I figured if you’re going to do something, you might as well go overboard :slight_smile:

Thanks,
Joe

1 Like

A+ for being totally Awesome
That’s such an impressive achievement for the Chapter 1 assignment. By the end of S3 I think you will be wowing your viewers!

Here is my submission. I changed a few things on the list, substituting audio for canvas updates, but everything should be there. That is one powerful boomstick.

1 Like

A+ Excellent Quality
Excellent video intro and really interesting control of lighting (better than I can pull it off)!

Thanks. The light is from my ‘moon’ object with a directional light, but you can use any object with any type of light. I just turn it White to Red the first time, then disable the script. Then I re-enable the script when EnemyDetection can no longer find ‘Enemy’ tags and set reverse bool to true.

using UnityEngine;
using System.Collections;

namespace Chapter1
{
    public class ChangeLight : MonoBehaviour
    {
        public Color color0;
        public Color color1;
        public Light myLight;

        public bool reverse = false;

        float tChange;
        float speed = 0.3f;

        void OnEnable()
        {
            SetInitialReferences();
            tChange = 0; //Resets everytime the script is enabled so reverse bool will work
        }

        void SetInitialReferences()
        {
            myLight = GetComponent<Light>();
        }

        void Update()
        {
            if ( tChange < 1 )
            {
                tChange += Time.deltaTime * speed;

                if ( !reverse )
                    myLight.color = Color.Lerp(color0, color1, tChange);
                else
                    myLight.color = Color.Lerp(color1, color0, tChange);
            }
            else
            {
                enabled = false; //Turn off component
            }
        }
    }
}
1 Like

Cool, thanks for sharing your code. I’ll certainly be interested in seeing what you pull off at the end of Series 3.

dumb question… but I looked everywhere…

Is there the source for this? Id like to use it as a reference

The source will be exclusive to the Steam package which I’m aiming to have ready by March 2016.

Ok. Ill try the old ones for now… maybe they are compatible with Unity 5 ?

I wouldn’t recommend trying to follow Series 1 or 2 in Unity 5, they won’t be compatible.

I made some final Chapter 1 tweaks and updates before starting Chapter 2. I’m very proud of the ghost heartbeats. They are all randomly timed and fadeout as the ghost ‘dies’…again. I’m still hunting for a way to tone down the physics and reduce the force applied to the bricks when shot and the dead ghosts.

1 Like

Really, really good stuff. I reckon you’re onto making a pretty neat game. I adjust the masses of objects till they feel right, so the brick walls for example can be heavier so that the shotgun bullets don’t make them fly so far.

Thanks for the ideas on the physics. I will try applying force depending on the tag and adjusting the mass. I want the story to stay in the Enchanted Forest, but eventually Ash will have to be replaced.

Elmer Fudge (to avoid copyright infringements of course) :slight_smile:

Hi everyone! Here is my project:

I have added a few extra features such as controller support, a few animations, death (kind of) and other stuff :).
Hope you enjoy it!! Thanks GTGD for your awesome tutorials :wink:

4 Likes

A+ for ASTOUNDING
I found myself compelled to download it and play. Fantastic work! It was simple yet felt so polished. I love how the grenade launcher barrel rotates, and it’s cool that you make the level restart if the player falls in the pit or gets caught by an enemy. The choice of sounds and visuals was really great. Keep up the great work!

Here is a link to my Chapter 1 Series 3 assignment. I had fun going through this material and I learned a lot as well. I definitely have the game programming bug now! Looking forward to Chapter 2. Thanks so much for these lessons!

A for GOOD SOLID EFFORT
Nice work there, you’ve implemented character animations and they’re actually walking. Once I get to the enemies chapter you’ll be able to update your project and make it a lot more fun as the enemies get blasted about as ragdolls :). Thank you for sharing!

Hello there, thanks a lot for your tutorials, here’s my simple version. Looking forward to learn more!

1 Like