Skip to content

244. WoT – Shooting Damage

October 27, 2015

Now that I have shooting controls and a way of knowing where a shot hits, I can think about damage.

There’s a video at the end of the explanation.

The simplest type of game would simply record a hit and give each tank (say) three lives before it dies.

World of Tanks is much more complex. Hits can damage tracks, cause fires, disable the engine or gun, or knock out the driver, gun loader, etc. The damage also allows for the angle at which shots hit the armour, and the thickness of the armour, which varies.

Armour thickness

This part is easy. Typically, the armour is much the same thickness all the way round except for the front (and maybe also the whole turret), which tends to be about twice as thick. So I’m simply making the forward facing triangles, and the turret, twice as thick as the others.

Effective armour thickness

The greatest damage is caused by hitting armour head on, at right angles. The least damage is caused by hitting it a big angle – in fact, in World of Tanks, I understand that shots start bouncing off when the angle exceeds 70 degrees.

So how does the angle affect damage? It’s actually very simple.

The picture below shows a sheet of (grey) armour with thickness t, and on the left, a red shot is hitting it vertically, at right angles to the armour.


How much armour does it travel through before it reaches the inside (the line marked e)? The answer is obviously t.

Now look at the shot on the right, which hits the armour at an angle a from the vertical. Clearly, the shot has to travel further before reaching the inside. We can calculate the distance e, knowing that cos(a) = t / e, so e = t / cos(a). I’m calling e the “effective” thickness of the armour.

Here is the best part. When I test my triangles to see which one was hit, the first thing I do is use the dot function to test if they are facing toward or away from the shot (and ignore them if they are facing away). And do you know what the dot function is, assuming you have normalised the directions you are comparing? It is the cos of the angle between the directions, which is the angle a in the picture above. So I can calculate the effective thickness very simply, as the actual thickness, divided by the result of the dot function.

Both in World of Tanks and in real life, you’ll see advice to angle your armour, often at 30 degrees to the enemy (that means, from the enemy viewpoint, your front armour is angled at 30 degrees, and your side armour at 60 degrees). If you apply the thickness formula above, this means the effective thickness of your front armour is 15% bigger, and that of your side armour is twice as thick. So, you can “increase” the armour thickness of the front, and although you are partly exposing your weaker side armour, the big angle doubles its effective thickness to be as large as the front armour, and there is also a good probability any shot at the side armour will bounce.

Where did I hit?

I answered this a couple of posts ago, using some fancy math I found.

I can calculate

  • what distance the shot travelled
  • which part of the tank was hit (body, turret, or tracks)
  • which triangle was hit
  • the angle at which it hit

The amount of damage is calculated using distance, angle, and actual armour thickness.

What is the damage?

I did some reading, which is a fun part of this kind of project, and learned all kinds of interesting but irrelevant things, but when it came to damage, the answer always seemed to be “it depends on [a big list of things]”. Shots that penetrate may spray fragments or bounce around inside and kill everyone, or hit the ammo and explode the tank, or hit the engine but not hurt anyone, or go straight through the tank without damaging anything, or ….[many other things].

I’m going to keep things simple, and borrow some ideas from World of Tanks. Something like this.

Part of tank hit    Damage type       Effect
Front plate         Visibility        Worse
Left side plate     Accuracy          Worse
Right side plate    Ammunition        Slow reloading > Explosion
Back plate          Engine            Speed reduced  > Can't move
Tracks              Speed             Speed reduced  > Can't move
Turret              Turret Rotation   Slow > Can't rotate           

I didn’t explain that for penetration testing, I made a table of vertices for each of the body, turret and (the bounding box for) the tracks. I can easily add a table which tells me which damage category each triangle falls into, so when I know where a shot hits, I can just look up the damage category, adjust it randomly, and apply the damage.

So the damage system looks something like this:

  1. Has the shot hit a tank?
  2. If it has, find the triangle that was hit, the distance travelled, and the angle
  3. Adjust the penetration power by the angle and distance travelled
  4. If it penetrated the armour of that triangle, look up the damage category
  5. Apply damage based on that category

So now I’ve programmed all that, and below is a video where I shoot at all the sides and different parts of a tank, showing the results on screen. These results include

  • distance to the tank,
  • the angle at which the shot hit,
  • the combined effect of those two factors on the power of the hit,
  • the actual armor thickness
  • the damage category

Now I can use this to set up a health system, and adjust speed, accuracy, etc based on hits.

But the really hard part is coming up. Getting the enemy tanks to drive around and then “see” the player and shoot at him.


Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: