For 2020, I am working on an untitled project. In this project I am trying to get out of my comfort zone and try to develop an Android based project using Unity. The purpose of this project is to deeply understand the code implementations and discovering new methods and techniques to apply for a Third Person Stealth Shooter game. To challenge myself, I will be creating a story line for two different characters which in the end they will be able to meet one another.
I am not familiar with third person controls using a mobile joystick, I am documenting my process for future references.
I have also created a Youtube Playlist for Mobile Third Person Shooter based on the tutorials that I find helpful if you want to try to develop a Mobile Third Person Shooter for yourself.
- Day 1 | Project Goals
- Day 2 | Third Person Controller
- Day 3 | Ragdolls
- Day 4 | Raycast Shooting
- Day 5 | IK Idle Animation
- Day 6 | Walking To Running
- Day 7 | NavMesh Agent
- Day 8 | Aiming & Crouching
- Day 9 | Environment
- Day 10 | ProGrids & Jump Function
- Day 11 | Running & Crouching Updates
- Day 12 | AI Cone of Vision
- Day 13 | Dialogue Box
- Day 14 | Expanding Environment (Apartment & Parking Lot)
- Day 15 | Mod Shop Design
DAY 1 – Project Goals
The assets I am using for this project is purchased from https://assetstore.unity.com/packages/3d/environments/sci-fi/polygon-sci-fi-city-pack-115950
On Day 1, I have set a list of goals that I want to achieve, the goals are as below:
– Learn how to animate a humanoid character
– Create a Third Person Shooter Controller using Joystick
– Create a shooting mechanic
– Combine animations [Blend Tree]
– Create a jumping and hiding mechanism
– Create an AI Patrol
– Figure out how to make the hands aim to where the camera is pointing.
– Make enemy AI react to bullet accordingly.
I decided to try on animating a wall run on my first attempt.
DAY 2 – Third Person Controller
On the second day, I dive hands down on implementing a Third Person Controller.
To implement the Third Person Controller [TPS] I have followed a tutorial series from DitzelGames.
The only difference from the tutorial is I had to animate the characters to apply the movement. I am not good at animating characters but this is what the project is about, learning something new and improving my skills. The result are as below:
DAY 3 – Ragdolls
On the third day of development, I find it hard to animate using Forward Kinematics as it is very time consuming and looks unrealistic, as I was searching for an answer I found out about Ragdolls, I ended up playing with Ragdolls for the rest of the day. I had to put an animated platform just for the fun of seeing the ragdolls jumping around. I am planning to use Ragdolls in the future for the Enemy AI.
DAY 4 – Raycast Shooting
On the fourth day, I was focusing on the shooting mechanics. On previous projects I’ve made, I will always instantiate a bullet prefab and adding enough force to hit a target, however I find it due to the update function, sometimes the target’s collider does not detect a hit properly due to the speed of the bullet and how the engine calculates a collision.
After some digging I found a better solution, which is to use Raycast. The tricky part about using Raycast in a TPS is that you have to calculate the angle from the camera and the point of your gun tip to make it look like as if you were shooting from the barrel of your gun. The tutorial from DitzelGames helped out for the basic of the mechanics.
I had also found out Animation Rigging Package to help with my animation. Apparently IK was really helpful when animating a humanoid character. You can see the blue spheres near the bones of the characters arms, however the elbow was looking quite odd. I was following the tutorial for Animation Rigging below:
DAY 5 – IK Idle Animation
On the fifth day, I looked deeper into the implementation of the IK. As I was finding it odd on my previous attempt, I had to look through the Animation Rigging documentation to find out where I was going wrong.
Apparently the previous tutorial video was nearly there but with some minor changes, especially about adding Hints on where the connector should go. Now my animation looks way better. The shoulders and the knee joints are now position correctly.
DAY 6 – Walking To Running
For Day 6, I focused on applying a secondary animation if the condition is met. In this case, on my ThirdPersonController Script, I had to calculate the Rigidbody’s Velocity with the Joystick Input to change the state from Idle to Walking to Running. However I still have to work on the walking and running animation to make it more believable.
DAY 7 – NavMesh Agent
Today I am learning how to setup a NavMesh Agent, the purpose of this is to understand how an enemy AI navigates itself to find the player’s location. As of now it looks really wonky, I have also not set what the AI is supposed to do when they get near the player at a certain distance. I am planning to make the AI able to use the environment as a cover and attack the player accordingly.
DAY 8 – Aiming & Crouching
Today I am attempting to combine a couple of new animations, which is Aiming & Crouching, both of this animations will be added with a walking animation based on the Rigidbody’s velocity.
DAY 9 – Environment
Today I’ve been focusing on the environment of the game, with the assets that I’ve purchased, it was very easy to setup the environment. The idea is to make the environment has a deserted feel. As far as the first attempt, this is what I’ve come up with so far, I’ve also baked the light, baked the navigation and added occlusion culling to save up on performance. For the animation, I’ve changed to using animations I downloaded from Mixamo.
DAY 10 – ProGrids & Jump Function
On The previous environment, I’ve relied on positioning the environments freely by mostly eyeballing where the roads, buildings and props should be placed, this has caused a lot of unwanted gaps in the environment. Today, I experimented with Unity’s ProGrids. It makes the level design a lot smoother, also previously I assigned a box collider on individual objects which has caused a lot of time wasted, instead I applied them in the GameObject’s prefabs to align everything with just a few clicks. I’ve also added a jumping mechanic as another one of the ability for the player to get over certain obstacles.
DAY 11 – Running & Crouch Update
The previous Running & Crouch animation was very rough and today I replaced it with animations from Mixamo. The state machine of the player is progressively getting complicated. I am planning to make the running state affected by the player’s stamina soon.
DAY 12 – AI Cone of Vision
Today I did something very interesting, I’ve created an AI Cone of Vision. This is useful for stealth purposes in the game, as the AI will only start to chase you if you appear in their cone of vision. This would add up to the mechanics of the game. I follow a tutorial by Sebastian Lague in Youtube. The outcome is amazing. there is even an editor script which makes you able to see the cone of vision in the editor.
DAY 13 – Dialogue Box
Today I’ve created a dialogue system, it will be a great feature for the users to read the dialogue’s between the player and NPCs and to tell the story of the game. I followed a tutorial by Brackeys to achieve this type of dialogue system.
DAY 14 – Expanding Environment (Apartment & Parking Lot)
Today I decided to expand the area with an apartment and a multi level parking lot, I plan to use all these locations as part of the locations the player has to reach for certain objectives.
DAY 15 – Mod Shop Design
I wanted to create a more lively area where the player can select their missions and look at their progress, the idea is to create a space that looks like a mod shop in a black market. You can barely see this “Shopkeeper” that gives you your missions, but his decisions usually will result in something big.