project-navigation
Personal tools

Author Topic: Damage dealing formula?  (Read 5846 times)

Woreczko

  • Guest
Damage dealing formula?
« on: May 20, 2007, 03:30:29 pm »
Hey!

I would like to know how does damage system works in this game:)
 
1. Does, say, "damage 37" mean, that a given weapon will take away 37 points of health, assuming no armor, or is it more complicated?
2. How exactly "protection" and "hardness" values of armors work? Especially 100 hardness vs particle based weapons gives me a headache...
3. Does a flechette round indeed has 8 projectiles hitting (or not hitting) target separately, or is it just a fluffy description?
4. I assume, that through firing in burst mode one may hit several targets?

Thanks in advance

Offline blondandy

  • Sergeant
  • *****
  • Posts: 391
    • View Profile
Damage dealing formula?
« Reply #1 on: May 21, 2007, 03:56:34 pm »
1. & 2.
Don't know, but I would like to find out too. I plan to browse the code (comes with the game or use web interface to SVN on sf.net).

3. & 4.
I am reasonably sure that each shot is calculated seperately.

Offline breversa

  • Rookie
  • ***
  • Posts: 47
    • View Profile
Damage dealing formula?
« Reply #2 on: May 21, 2007, 06:43:47 pm »
Quote from: "blondandy"
I am reasonably sure that each shot is calculated seperately.


Yes, although the damage shown on an weapon's description is base damage * number of shots.
E.g. a single rifle bullet may deal 37 and a 3-rounds burst may deal 117.

Offline blondandy

  • Sergeant
  • *****
  • Posts: 391
    • View Profile
Damage dealing formula?
« Reply #3 on: May 22, 2007, 03:18:59 pm »
re: original post Q2, see the SVN

http://ufoai.svn.sourceforge.net/viewvc/ufoai/ufoai/trunk/src/game/g_combat.c?view=markup
around line 350.

protection: how much the damage is reduced by.

hardness: how much damage the armour takes in saving your hide. The more the armour protects you, the more it is damaged.

nearby in the code is lots of interesting stuff, eg effect of difficulty on HP taken, etc.

Woreczko

  • Guest
Damage dealing formula?
« Reply #4 on: May 22, 2007, 04:32:16 pm »
Eh, I`m no coder, could you explain this to me?

Code: [Select]
if (ad->protection[fd->dmgtype] > 0)
damage *= 1.0 - ad->protection[fd->dmgtype] * ent->AP * 0.0001;


Does it mean, that dmg modifier = 1 - protection value*(what? - armour piercing? armor protection again?)* 0.0001?

So if I shoot an alien for 100 impact damage, and he has protection of 50, then it`s:
100* (1-50*50*0.0001) = 100*0.75=75?

if protection = 25
100*(1-25*25*0.0001) = 100*(1-0,0625) = 100*0,9375 = 93?

Eh, I don`t know... :?

Offline Zenerka

  • Sergeant
  • *****
  • Posts: 301
    • View Profile
Damage dealing formula?
« Reply #5 on: May 22, 2007, 08:50:38 pm »
Quote from: "Woreczko"
Eh, I`m no coder, could you explain this to me?

Code: [Select]
if (ad->protection[fd->dmgtype] > 0)
damage *= 1.0 - ad->protection[fd->dmgtype] * ent->AP * 0.0001;

damage = damage * (
1 -
(armour_type-protection-against-given-damagetype) *
armor_protection_of_an_entity *
0.0001
)

damagetype can be plasma, particle, laser, etc
every type of armour has different values of protection against given damagetype
armor_protection_of_an_entity is current armor protection of an actor (if his armour is heavily damaged, his protection will be small, etc)

HTH

Alex

  • Guest
Damage dealing formula?
« Reply #6 on: May 23, 2007, 03:51:47 am »
So basically it calculates the damage dealt by taking the maximum amount of damage possible for the shot, then subtracting the armor's protection value for the type of damage, the entities armor value, divided by 10000 (presumably so that the damage isn't reduced to a stupidly low or negative amount).

By the way, isn't
damage * 1 - whatever
exactly the same as
damage - whatever
?

Wanderer

  • Guest
Damage dealing formula?
« Reply #7 on: May 23, 2007, 04:21:23 am »
Quote from: "Alex"
So basically it calculates the damage dealt by taking the maximum amount of damage possible for the shot, then subtracting the armor's protection value for the type of damage, the entities armor value, divided by 10000 (presumably so that the damage isn't reduced to a stupidly low or negative amount).

By the way, isn't
damage * 1 - whatever
exactly the same as
damage - whatever
?


37 - .6 is 36.4

37 * .6 = approx 20.

Very big diff.

Offline Zenerka

  • Sergeant
  • *****
  • Posts: 301
    • View Profile
Damage dealing formula?
« Reply #8 on: May 23, 2007, 08:33:14 am »
Gentlemen, please take a closer look at what I wrote.
I didn't wrote damage = damage * 1 - [...]
I wrote damage = damage * (1 - [...])

Woreczko

  • Guest
Damage dealing formula?
« Reply #9 on: May 23, 2007, 09:54:28 am »
Yes, it basically means, that damage dealt is reduced by protection value in %. I.e: 50 protection = 50% damage reduction. It also takes into consideration the shape of your armour. I.e. armor with just 50 "health" and 50 protection offers in fact just 25% damage reduction.

I suppose aliens may have different "entities armor" than 100.

Alex

  • Guest
Damage dealing formula?
« Reply #10 on: May 24, 2007, 01:30:18 pm »
Ok, it's back to maths lessons for me (doh)