UFO:Alien Invasion
Technical support => FAQ => Topic started by: Woreczko 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
-
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.
-
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.
-
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.
-
Eh, I`m no coder, could you explain this to me?
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... :?
-
Eh, I`m no coder, could you explain this to me?
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
-
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
?
-
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.
-
Gentlemen, please take a closer look at what I wrote.
I didn't wrote damage = damage * 1 - [...]
I wrote damage = damage * (1 - [...])
-
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.
-
Ok, it's back to maths lessons for me (doh)