Technical:
Completed with the support from programmer Song Huang
Environmental Art
I referred to architectural art when designing the environmental elements, such as the Grand Palais in Paris and the Crystal Palace in London. The overall color tone of the game has been re-adjusted with post-process volume and post-process layer components.
(Figure.Grand Palais in Paris)
(Figure.Crystal Palace in London)
2023.10.03 Version:
Plan Design: The interactive gears are not easily distinguishable from the decorations.
Vertical Design: All items are integrated into the same layer, so the player will be confused.
2023.10.30 Version:
Plan Design: I added one piece of delicate glass to cover some decorations. The gears are more golden in color.
Vertical Design: The interactable items and decorations are separated into different layers.
Interactable spatial UI
There are many interactive structures in the game, such as chargers, machine guns and turrets. In order to increase the usability of scripts, it is better to define a MonoBehaviour called StructureBehaviour, to control all the interactable structures which has a interactive button.
In order to make the scene clearer, the UI button only prompts when the player approaches them. So many structure shhould have colliders to test if the player is nearby or not. This UI is a spatial UI, it is 3D in the world but set up on Canvas and always face the main camera.
Each interactable button has three layers:
Progress Bar, Interact Button and Text.
Progress Bar
Text
Interact Button
The flow chart of interactable UI is shown below:
Program Structure
Program Framework
1.Player
Player controller (health)
Player movement (death)
Shooting controller
2.Level
Level setting (time, score indicator, etc)
Level UI controller (non-digetic UI, spatial UI)
Sound effect manager
Material Manager
Tutorial
3.Enemies
Enermy controller
Enermy routes
Enermy movement
Enermy config (blood, speed, prefab model)
4.Waves
Timer
Route information
5.Turret
Attack range drawer
Search target behaviour
Weapon
Rotate gun behaviour
VFX
Structure activation
6.Machine Gun
Interactive behavior of machine gun
The Implementation of the Enemy's Advance Route
Here is an example of a route, which consists of multiple route points. Each point helps the enemy to track key directions.
For a tower defense game, complexity should be considered in the programming since the enemies become more and more as time passes.
In order to make the enemy army not so costly to the program, this project applied rigidbody instead of a character controller to move and generated all enemies with prefab and configuration to complete automation of repetitive tasks.
Coordination of Collision Detection between Gameobjects
1. "Has Reach" the route point:
The enemy's collider volume is relatively large and if it has not passed through a particular point because it is pushed away by other enemies, it becomes difficult to determine its path. In such cases, it is necessary to increase the tolerance value. Even if the enemy has not fully passed through the path point, it is still considered as having reached the point.
(Figure.The condition colliders in Unity)
2. Layer Collision Matrix:
When the enemy is blown into pieces, some parts of its body will fly to a larger range of space. The colliders on its body parts will push other enemies and the Tesla Soldier to deflect. So, in the project settings, more collision layers should be considered to ensure they will not exert unnecessary influence on each other.
Assets Production Workflow
1.Search for reference materials and generate ideal character design with Photoshop and Midjourney.
2. Build and assemble all models in Blender.
Enemies
3. Generate bones for enemies through UMotion plugin in Unity.
4. To create enemies one by one, it is best to use prefabs for each kind of enemy.
5. Link features like health points, speed with script to record the enemy's state.
The configuration of each enemy prefab is shown below:
Tesla Soldier
Property:
The configuration of Tesla is shown on the right:
Motion:
In order to differentiate the robot's movements from those of humans, some code was added to change the angle of the protagonist's turn. This causes the Tesla soldier to turn first before starting to walk. If the player wants to move in a direction more than 45 degrees away from the protagonist's facing direction, he must press the directional key in order to continue moving forward.
1.Search for reference materials and generate ideal character design with Photoshop and Midjourney.
2. Build and assemble all models in Blender.
3. Upload player model to Mixamo and download the animations.
4. Retarget the player's bones and generate bones for enemies through UMotion plugin in Unity.
5. Script for animator and control the movement in Visual Studio with C#.
6. Link features like energy value, attack power with script to record the player's state.
Weapon Systems
Machine Gun
Shoot with Energy Cost:
In this game, the Tesla Soldier's energy functions as his "health points," the resource to trigger turrets, and the bullet to activate machine guns. Therefore, all actions in the game should be connected to the energy system to manage and track the player's energy value.
The program structure of the machine gun is shown on the right:
The energy circle is divided into two halves: the right half represents the energy level of 100%-40%, shown in green; while the left half represents the energy level of 40%-0%, shown in red. When the energy value falls below 40%, the UI will issue a red warning to remind the player to recharge the Tesla Soldier.
Full Energy
Energy Value <40%
(Figure MachineGunAttackBehaviour.cs)
(Figure MachineGunAttackBehaviour.cs)
Collider Boxes:
To take control of the machine gun, two collider boxes are set.
Sphere Collider: To check valid firing position
The sphere collider tests if the player enters a certain position close enough to the machine gun to start shooting.
Box Collider: To check valid enemy
The box collider checks if there are any enemies within the firing range. If there are multiple enemies in the collision box, the machine gun will shoot the enemy with the smallest absolute distance.
(Figure MachineGunSearchTarget.cs)
(Figure MachineGunInteractBehaviour.cs)
Turrets
In order to help players identify which turret is activated from a top-down perspective, I designed a small light that changes material. When the turret is activated, this light illuminates.
Turret Programmed System
The game contains three different types of turrets, but their functioning logic is identical. Every turret needs to perform three tasks: searching for the target, rotating the muzzle, and firing the weapon. To accomplish these tasks, three scripts are utilized, with each script responsible for one of the three tasks.
Before activation
After activation
Target Searcher:
As enemies often march in groups, there are frequently multiple enemies within firing range. This program is designed to target the earliest-spawned enemy, making it suitable for attacking individual enemies.
Muzzle Rotation:
The direction in which the muzzle rotates is determined by the position of the targeted enemy in the search results of the Target Searcher. To ensure a smooth rotation, an interpolation calculation is performed, which prevents the muzzle from suddenly jumping to the final position.
Turret Weapon:
Every time the turret fires, the program calls vfx and sound. For individual attacks, the turret fires at the earliest spawn enemy.
For group attacks, all enemies within a certain radius of the center of damage receive the damage (damageEffectiveRange). The damage value decreases from near to far, calculated using the Mathf function and the damage curve (Mathf. CailToInt (damage * damageCurve. Evaluate (distance/damageEffectiveRange).