On this page I will be looking at one of the major problems I faced during this project, I will look at how I handled it, my thought process and how I came to a solution.
Example Problem Breakdown: Creating a point of contact damage system & showing progressive damage to the car
Throughout this project I faced an untold amount of problems that required research, fixes and workarounds. In this section I will be breaking down one of the larger issues I faced to give an idea as to the mentality and thought process behind solving complex problems.
​
Aim: Create a damage system where the front, middle and back left as well as the front, middle and back right of the car can take damage, with their own unique health values, have damage calculated based off a cars collision and have visible damage appear on the car at that location
​
Breakdown
​
To begin with I started out with a design to get an idea as to how the damage system would be carried out. Below are examples of these for each class of car
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
The idea here is that there are the 6 damage locations holding a certain amount of armour. If the armour has been broken on that damage point and the car is hit there again it will start to damage the cars total HP. The exception to this is the front of the car, being hit here after the armour has gone will take from the engine HP. If either the engine or the total hp reach 0 the car stops running and the player is out.
​
I started to apply this to my cars within engine. I started by creating a number of collision boxes around the specific areas of the car to enable each damage location to be tracked. I set this up modularly on a BP_BaseCar which was the parent car to each class of car (as each class has different armour/health values). This way the health and armour could be set dynamically through a datatable, allowing for more classes to be added later as well as easily tweak, change, balance and iterate on the current stats.
​
Problem: The cars are not registering correctly when hit, the cars can get hit in the front and it deal damage to the side, and more damage than expected.
​
Example: Car A crashed at full speed into a still car B. Car A crashed with front left and hit car B in back right. But car A took a bunch of damage in the back right and car B took next to none in the front left.
​
This took a lot of tweaking, debugging and playing around. Due to the way damage was being communicated the cars were not passing damage as they should and were instead applying them to themselves. This was quite a simple fix but it took a lot of testing to determine the cause and to understand the problem at hand.
​
Problem: The cars don't even hit and damage is still dealt.
​
It came to my realisation that the collision boxes were slightly too large out the side, meaning that sometimes the models would barely clip with the collision boxes and then apply damage. This problem is what made the previous problem take so long, as collisions were not registering as they should. Again fixing this was simple but it took a lot of play testing to ensure it worked.
​
Problem: Damage is now applied appropriately but it is way too much damage for the crash at hand.
​
The logical explanation was to try balance this better as the numbers must have been too high from the speed. However when running prints and debugging this, the numbers were not as high as they were dealing. However the numbers were printing multiple times, sometimes 10 to 20 times. I had found the issue, the damage numbers were not too high, they were just being applied multiple times. This is due to the collision boxes were looking for overlaps rather than on hits which meant that damage was applied over and over. This is a persistent issue I had only learnt a lot further into the project and is something I would do differently if starting fresh. But, I was too far into it at this point so I aimed to fix what I had. I had managed to tweak and ensured that once damage had been applied there was a grace period where the car hit would not take any damage from the specific attacking car.
​
Problem: Due to damage being taken from the velocity of the car the Speedster car is the best by default due to the velocity it can reach. This means the other cars don't stand a chance against it's damage. This doesn't make sense as the speedster is also supposed to be the fragile and dexterous car, not one that relies on strength.
​
To balance this car and give a greater sense of character and class to each of the cars I added a new value to the previously mentioned datatable. I added a CarDamageModifier value as well as a MaxDamage value for each class of car. This gave a better sense of identity and could be easily changed for balancing purposes. Damage is calculated as shown below, written in plain text:
​
Calculate Damage
-
Find highest velocity value of attacker, save as temporary float “Attacking force”.
-
Attacking force/50=Value
-
Value*CarDamageModifier=NewValue
-
IF NewValue<MaxDamage True: set DamageOutputValue as NewValue calculated False: Set DamageOutputValue as MaxDamageValue
​Deal Damage to health
-
Determine damage location collision (back & middle collisions for health) ​
-
IF DamageLocationCurrentArmourValue>0 True: Continue steps False: Skip Step 3, 4
-
IF DamageLocationCurrentArmourValue<DamageOutputValue True: Continue all steps False: Stop at step 4
-
DamageLocationCurrentArmourValue – DamageOutputValue
-
Health – DamageOutputValue (if armour has been broken the damage value output is the leftover damage)
-
IF Health<0 True: Disable Input, player game over. False: Nothing
​
Deal Damage to Engine Health​​​
-
Determine damage location collision (front collisions for engine health)
-
​IF DamageLocationCurrentArmourValue>0 True: Continue steps False: Skip Step 3, 4
-
IF DamageLocationCurrentArmourValue<DamageOutputValue True: Continue all steps False: Stop at step 4
-
DamageLocationCurrentArmourValue – DamageOutputValue
-
EngineHealth – DamageOutputValue (if armour has been broken the damage value output is the leftover damage)
-
IF EngineHealth<0 True: Disable Input, player game over. False: Nothing
Problem: Big hits don't feel impactful enough
​
Any big hits would only slightly move the car. This didn't often look right and was a very jarring perspective. I played around with different forms of physics till I got something that felt like the correct amount of impact. I ensured to have many play testers to give feedback as to how the impacts felt, as this is one of the core features that makes the game fun.
​
Problem: The big hits are now impactful but the car still looks pristine.
​
I did some research into how to apply damage to models dynamically and eventually landed at morph targets. This was completely new to me so I dove in for my first attempt. I exported my models from unreal (I do not own these models they are free car models on the unreal store) and moved them into 3Ds Max. I proceeded to create 6 different copies of each model to then crumple and apply damage to, one model for each damage point. I applied the morpher modifier to the main model, set the values and proceeded to export out of max, into engine. I then set up the morph targets in engine and based off a percentage scale the car would morph based off the amount of damage each damage point has taken. I also added some custom made smoke particles for added effect when low on health.
​
Problem: The mesh with the morph targets now will not move at all.
​
Since adding the new mesh no input would allow my car to move. This was incredibly frustrating. Through some changing of collisions on the mesh I eventually managed to get the car to move but noticed that the wheels, which previously had "span" were stationary. Cross referencing from the old no morph targets models the collisions were different and the wheels were attached on the new model. I tried nearly everything at this point, including creating custom collisions, researching for similar problems, asking lecturers about the issue and even students from the art division about exporting from 3Ds Max. Nobody seemed to know the issue and I was hung up on this for a while. I went as far as I learnt rig and skin the vehicle (something I had never done before) to allow for the wheels to turn. This actually worked with some minor graphical glitches. I persisted with the issue however and eventually realised the old model had a skeleton and was already skinned. Which means the skeleton must have been lost at some point during the exporting phase. I consulted another lecturer who knew the issue with losing a skeleton, so I could now import it. However I had rigged and skinned my own at this point (which looked worse!) so I decided to scrap my own and redo all the morph targets with the better skeleton. This then worked as intended. and my cars took damage over time and I learnt something new as I now know some of the basics of skinning a rigging a vehicle.
​