Tuesday, July 30, 2024

Smaller Project

The following page is to highlight a smaller project that does not need a dedicated project documentation.

Special Attack

Update on the previous project. Now the player has different weapons and is capable of executing special finishers.

Shade Testing

In this project I am testing 2 shaders. Quibli and Nulltale shader and moving forward I will exclusively use them.

Model provided by : Vanya Dzhus

Environment Design

Reference

3D image refererence by : 3DGhost903

Project Overview

In this project I wanted to test myself in environment design. I try to create a level similar to a persona series where the player can roam around a level. The level is separated by 3 different hours; Morning,Evening and Night. In Morning the station is more congested while at other times the station will be less congested.

The level separated into 3 different sections. In section 1, I use high details models. I did a research, to create a more interesting visual I added more imperfection to break any constant visual. By changing the tree color,size and rotation. Rearrange the vending machine, number of platforms shade and during night time, one of the lights is purposely not lit up.

As it goes further, I use fewer poly count models and disable the foliage movement. I added a few models in the background to prevent negative space. I purposely set the camera dolly to capture the background view of the water tower and at night able to see the night sky and the moon.

Monday, July 8, 2024

Character Locomotion and Handler

Introduction

The following is the character design on how to handle locomotion(3D movement such as walking,running and jumping), handling attack and on hit handler

Player Input Handler

I separate the input handlers as their own gameobject. The scene starts with the input handler reading the player input. If there are any other game objects they can refer to the following code to retrieve input.

Interaction Diagrams Gameobject Hierarchy Example above, the script is able receive player input by added the PlayerInputHandler component

Player Component

I break the operation into a smaller component. Each component handles a specific requirement. Example movement handler player locomotion, rotation and gravity.

Example in Resident Evil Prototype.
  • Player Animation
  • Player animation is separated into 3 layers. Base layer is the player's main movement blend animation. Attack layer handle knife attack, aiming gun and fire weapon On hit layer handle when the player character got hit.

  • Player Locomotion
  • Handling Player locomotions and gravity

  • Player Hurtbox Handler.
  • To to handle if the player been inflicted damage

  • Player Audio
  • Hold all player audio. Example if a player runs on a wood surface. It will create a wooden step sound.

  • Player Camera Handler
  • Handle player camera, if the player is aiming or sprinting the attribute will be change accordingly

  • Player Handler
  • Act as the main brain of the character. It will initial all other component requirement

Player Locomotion

The following is the explanation on how character movement was handled.

After receiving player input. In PlayerHandler will submit 2 attributes, relativeMovement and relativeRotation. Relative movement is the direction of player input based on camera position while the relative rotation is rotation facing that direction. The return value of turnamount and forwardamount is for animation purposes. To indicate player is moving forward and rotation

  • Movement Handler
  • After receive direction and rotation, this function will add force to player to the direction of requested

  • Gravity Handler
  • If the character is not grounded, it will add downward force to the player

  • Rotation Handler
  • Similar to the movement handler, after receiving the relativeRotation. The player will be rotating to face the direction

  • Player Inventory
  • Handle on Player weapons inventory.

  • Jump Handler
  • As the name imply, this to allow player to jump

  • Collider shift
  • Similar to Dark Souls principle, collider shift is to provide a collider for the player to prevent passing through other objects. It shifted up a few units upward allowing movement in uneven surfaces such as stairs.

    I was able to implement this by activating Auto Simulation, calculated the ground height and using Unity Character Controller.

Hurtbox and Hitbox setup

Hurtbox

The hurtbox bind to the character model. The hurtbox layer set to Hurtbox layer mask

Under the project setting, the physics setup is set as follows. This is able to simplify the hitbox and hurtbox calculation/interaction.

It handles when the character has been hit, this includes how much damage is inflicted, updating player status and which animation needs to be played.

Attack Handling

For attacking process, I use a ScriptableObject able to create a custom attack properties and in future able to reuse this model again

  1. PlayerAttackHandler is a component that handle player attack request.
  2. PlayerInventory will hold current player weapons. When the PlayerAttackHandler request to attack, it will pass the weapon reference
  3. PlayerWeapon hold the hitbox and particle(Blur and weapon trail).
  4. The weapon itself have custom weapon attribute.The reason behind this, is to provide flexibility on each attack value. Each variable for player action(ground attack,light attack,heavy attack and etc).
  5. SingleAttackAttribute hold cooldown timer and number of movelist.Example how many light attack move there is in this weapon
  6. Lastly, this class how much this per move will cost damage and if there any special value related to this move(knockback or launch).

Hitbox Handler

Simple explanation on how hitbox work.During the attack frame, it has an animation event request for knife collider to be active. When the collider is active it will check if it contacts any collider under Hurtbox physical layer mask. If it hit it will trigger the attack process and send information(damage,location,direction) to the enemy. Thus enemies will play animation based on the direction/location and update their health. On later frame there is another animation event where the weapon hitbox will turn off.

Example few animation events as follow. This allows a better attack mechanic when the player is attacking.

  • Apply/RevertMovement - To allow or prevent player movement. Therefore when the player attack, it will disable the player locomotion
  • Apply/RevertSwordParticle - To allow sword particle to be played or stoped
  • Apply/RevertGravity - To modify play vertical movement on certain attack
  • ApplyAttackRotation - Autocorrect attack to prevent missing the target on the frame of attack
  • Apply/RevertHitbox - To able or disable weapon hitbox
  • Apply/RevertRootmotion - To able or disable animator root motion

Player Animation Handler

The playerAnimation Handler is an extended class from UniversalAnimation. UniversalAnimation holds the animator component. The reason I created this component to allow me standardize the animation event function

In future project this class can keep extended to make fit any criteria

Example

Player Layer Animation Handler

I created a custom state machine script. When it enters the state animation, the script will apply all the requests.

Example in the attack layer, when attacking the root motion will be activated. If there is no follow up request it will enter the ‘attack empty state’. This indicates the animation has been completed. While entering this state, if the script has a request for root motion and is disabled. The root motion will be disable

This function appears in another layer.(Movement Layer/Hurtbox Layer/Guard Layer). It is very useful and able to scale with other projects.

Player Camera Handler

Handling the player camera mostly using the Unity Cinemachine component. After receiving mouse input from the player input handler, this component will respond accordingly

Player Handler

I design Player Handler as the primary brain. All the necessary components are initialized in this component for standardized purposes.

Example above, the following how the player component is setup when initialize

Tuesday, July 2, 2024

Sekiro Prototype Game

Introduction

The following is a brief explanation of the unity project. The project is a recreation of Fromsoftware Sekiro game mechanic.



Gallery

Game Documentary

The same is a prototype of a Sekiro -like game. Where the player need to manage their mana to defeat the enemy

Player/Enemy/Actor Component

For both Player and Enemy use a similar design as follows.(Link)

Player Attribute

  • Player have 3D movement
  • Player able lock on the target
  • Player able to jump
  • Player have light and heavy combo
  • Player have air light/heavy attack
  • Player have projectile attack simiar to Notic teleporter

Gallery

Example Light Attack Combo Example Heavy Attack Combo Example Air Light Attack Combo Example Air Heavy Attack Example Projectile Attack

Enemy Attribute

The enemy state have 2 state, normal and aggressive.

Both states have 2 different behaviors in terms of attacking and strafing timing.

  • Enemy have limited amount of health
  • Enemy projectile attack, close range attack and AOE attack

Saturday, June 1, 2024

Resident Evil Prototype Game

Download

PDF version | Unity Build

Introduction

Game Documentary

The game is a recreation of Capcom Resident Evil game mechanic.

Player/Enemy/Actor Component

For both Player and Enemy use simillar design as follow.(Link)

Player Attribute

  • Player have 3D movement
  • Player can't jump
  • Player have 4 weapon (knife,pistol,shotgun,skorpion)
  • Player can perform knife attack
  • Player can change the primary weapon between pistol,shotgun and skorpion
  • Player can aim

Enemy Attribute

In this project there are 3 different types of enemy.

  • Windmill Enemy
    • For windmill enemy is more aggressive and have much bigger detection range
  • 3 Pair Enemy
    • The Pair enemy is the basic enemy. It will roaming around the map
  • Big Tree Enemy
    • The big tree enemy is less aggressive and less detection range as long the player does not disturb the enemy

Game Mechanic/Design

The following is a simple explanation of how the gameplay is implemented.

Enemy Detection

The enemy has 2 radius of detection, far and near radius. Both radius have a degree of detection arena, if the player enters on that area it will increase detection value. If near it will increase much faster. When the detection value is completed enemy will engage with the player

Player Aim Mechanic

  1. When the player presses aim, the animator will play "Atack_EquipGun". This animation will play an animation where player pull the gun for the holster.
  2. When the state enter attack aim, a boolean will set true where the player ready to fire.
  3. If the player presses fire the animator will play "Attack Fire". A function will also handle other requests such as fire particles, dust and smoke. Other functions will also be such as input pulse, camera shake etc.
  4. When the player releases the aim button,the animator state will enter the "Attack_UnEquip" state. This animation where player put weapon back to the holster
  5. Finally the function is completed, where it enters "Anim_Enter" where there is no animation. The main base layer animation will override other animation

Hitbox Handler

Player midst of attack animation Attack animation frame

Simple explanation on how hitbox work.During the 9th frame, it has an animation event request for knife collider/hitbox to be active. When the collider/hitbox is active it will check if it contacts any hurtbox. If it hit it will trigger the attack process and send information(damage,location,direction) to the enemy. Thus enemies will play animation based on the direction/location and update their health. 12th frame there is another animation where the knife collider/hitbox will turn off.

Final Year Project

Introduction

The target of this project is allowing the patient to control a Remote Control Car.The remote control car is a combination of micro controller and camera. It will transmit a video feedback to the patient. The patient will only require only a head movement, this allows patient with various kinds of injuries or diseases capable of using the system. The Patient able to use this system if they have the capabilities to move their head either sit or lay using this system. As long the system still able detect patient head and patient position does not constrain the movement.

Project Diagram

The following is a brief explanation on the FYP process

Process A

Process A starts from the end user(patient). When the patient move his/her heads, the application will process the image and convert it into an input and send data to the remote control car via TCP

Process B

Process B is where a remote control car sends a live feed to the end user.

GUI Application

Modules

To simplify, I separate the project into multiple modules Module 1,2 and 3. The purpose of breaking the project into multiple modules is easier to standardize and monitor the input and output on each module.

Module Name/Entity Module Description
Patient -
Module 1 Application & Camera
Module 2 Remote Control Car
Module 3 Engine(s) + Camera(s)

Module Description

In this section, it will give a brief explanation on how the overall modules process. A more detailed explanation will follow.

In Module 1 is where the interaction happens between the patient and the application,handled via image processing between patient and application. In additional, the application also provide a patient camera configuration for patient comfort and provide a video feedback


The Module 2 is handled on the remote control car. The remote control car have small application that can receive command from the main application and store the movement process


In module 3 handle; after receiving command the engine will move based on the command(break,forward,turn and etc). In module 3 also will capture live video input and show back to the patient.

Sequence Diagram


Conclusion

Hindsight

In hindsight, there is a couple of optimizing that able to implement to the system

  • Lowering image resolution, the current image uses a raw scale of HD resolution of the camera. Increase the image processing process
  • Instead of transferring text files with partitions to the RCC, it is more recommended to transfer a JSON file for optimizing. This able to prevent the bottleneck in kernel level

Result

Alhamdulillah, after 2 semesters struggling completing this project. I receive A- for all my hard work and mark it as my greatest achievement.