OpenXcom Forum
Contributions => Programming => Topic started by: Meridian on August 12, 2014, 04:28:16 pm
-
Hello,
reading the code (BaseDefenseState.cpp, line 190), I didn't find any range for the damage of base defence facilities.
I am also not sure if the range is 50-150% or 0-200% (in the original xcom). If someone knows, please post it here. If nobody knows, I will try to make a patch, which takes the value from the TFTDDamage configuration setting.
Or, if somebody would like to implement it instead of me, feel free.
UPDATE: pull request is here: https://github.com/SupSuper/OpenXcom/pull/937
Regards,
Meridian
PS: more info here: https://www.ufopaedia.org/index.php?title=Talk:Base_Defense_Measures
-
I'm not sure the base defense damage follows the same rules as the battlescape damage... AFAIK, it was never clear if it does so in the original.
What does Warboy say? I think there is nobody who knows the original game code better than him.
For that matter, what about craft weapon damage?
-
i wasn't as intimate with the game code when i made the base defence screen, so there may indeed be inconsistencies. i'll have a dig around and see what i come up with.
-
Base defence always seemed quite useless to me, either you 100% won by repelling the UFO, or you are playing normal battle.
So why invest in defences, I will have to have a squadron there anyway.
How about adding an option so that damage done during air-defence phase results in less and/or wounded alien troops (but same loot), would it make sense (as mod or adv option)?
-
How about adding an option so that damage done during air-defence phase results in less and/or wounded alien troops (but same loot), would it make sense (as mod or adv option)?
There was an XComUtil option which did this. It was useful.
-
Same loot as from undamaged UFO sounds cheaty-cheaty, please play nice :)
But +1 in general (It was tackled in greater detail here: https://openxcom.org/forum/index.php?topic=2780.0 )
-
I'm not sure the base defense damage follows the same rules as the battlescape damage... AFAIK, it was never clear if it does so in the original.
What does Warboy say? I think there is nobody who knows the original game code better than him.
For that matter, what about craft weapon damage?
Craft weapon damage is already randomized.
(50-100% when XCOM shoots at UFO; 0-100% when UFO shoots at XCOM)
-
all sorted.
-
all sorted.
Thanks.
So the original had 50-150%?
-
For that matter, what about craft weapon damage?
Craft weapon damage is already randomized.
(50-100% when XCOM shoots at UFO; 0-100% when UFO shoots at XCOM)
I'm not sure if Moriarty meant what Meridian answered to, but maybe this:
What about the damage the Battleship sustained before reaching the base defences? Shouldn't it stack with the base defences if my Avengers were just one shot short of getting it cooked?
And, for that matter, does the UFO damage taken actually carry over between fights with different X-Com craft (supposing the fight was not of the 2+ vs 1 minimise-until-simultaneous type?)?
-
And, for that matter, does the UFO damage taken actually carry over between fights with different X-Com craft (supposing the fight was not of the 2+ vs 1 minimise-until-simultaneous type?)?
Yes. I damaged a Battleship over Europe and later downed it with a craft launched from a US base when the UFO approached it. It went down fast.
-
Does the damage sustained during a dogfight carry over to a base defence, though? If someone had a definite answer, that would be a good place to start doing the "less base-raid crew alive" mod ;).
-
Slightly off topic question but . . .
The Damage Randomization code . . .
Is it a straight linear roll or is it a "two dice" roll?
Original XCOM 1 always used a linear roll . . . Rand * (2 * Damage)
However TFTD used a double roll . . . Damage * (Rand + Rand)
So like if you have a Plasma Pistol it would do Rand * (52x2) possible damage, but if you used the TFTD method it would do (52 * Rand) + (52 * Rand).
This is the reason the damage values were usually so uniform in TFTD, it wasnt because it was restricted to 50-150% (though Explosion damage always was).
I very much like and prefer the double roll precision from TFTD and im wondering if thats what you guys are using from the "TFTD style" damage dice rolls.
If so is there any way to Mod this as a normal change without doing any kind of actual cpp coding?
-
Slightly off topic question but . . . The Damage Randomization code . . . Is it a straight linear roll or is it a "two dice" roll?
I very much like and prefer the double roll precision from TFTD and im wondering if thats what you guys are using from the "TFTD style" damage dice rolls.
If so is there any way to Mod this as a normal change without doing any kind of actual cpp coding?
It's a single roll:
1. Firing guns:
int dmgRng = Options::TFTDDamage ? 50 : 100;
int min = power * (100 - dmgRng) / 100;
int max = power * (100 + dmgRng) / 100;
const int rndPower = RNG::generate(min, max);
2. Firing craft weapons:
a) xcom
int damage = RNG::generate(p->getDamage() / 2, p->getDamage());
b) aliens
int damage = RNG::generate(0, _ufo->getRules()->getWeaponPower());
3. Firing base defences:
_ufo->setDamage(_ufo->getDamage() + (dmg / 2 + RNG::generate(0, dmg)));
Can't be modded afaik, requires some coding first...
-
Slightly off topic question but . . .
The Damage Randomization code . . .
Is it a straight linear roll or is it a "two dice" roll?
Original XCOM 1 always used a linear roll . . . Rand * (2 * Damage)
However TFTD used a double roll . . . Damage * (Rand + Rand)
So like if you have a Plasma Pistol it would do Rand * (52x2) possible damage, but if you used the TFTD method it would do (52 * Rand) + (52 * Rand).
This is the reason the damage values were usually so uniform in TFTD, it wasnt because it was restricted to 50-150% (though Explosion damage always was).
I very much like and prefer the double roll precision from TFTD and im wondering if thats what you guys are using from the "TFTD style" damage dice rolls.
If so is there any way to Mod this as a normal change without doing any kind of actual cpp coding?
Do you mean for craft damage? I don't know about that, but for weapon damage there's the "TFTD damage rules" advanced option that does exactly what you want.
-
Do you mean for craft damage? I don't know about that, but for weapon damage there's the "TFTD damage rules" advanced option that does exactly what you want.
He meant damage in general (all types).
The "TFTD damage rule" does NOT do exactly what he wants. It changes the damage range, but it is still a "single roll", not "double roll"... as illustrated by the code snippets I have posted earlier.
-
should be easy enough to change IMHO
but are there any sources for the double dice calculation?
from https://www.ufopaedia.org/index.php?title=Damage
Random Weapon Range
This is the random number roll that alters how much damage is to be dealt. For EU firearms, a value between 0% and 200% is rolled, while TFTD weapons and EU explosives will perform a 50% to 150% roll. However in TFTD, damage from all sources has been equalized to 50-150%.
-
should be easy enough to change IMHO
but are there any sources for the double dice calculation?
from https://www.ufopaedia.org/index.php?title=Damage
I don't know if there are any sources... I don't even know if TFTD is really doing "double roll" or not... I guess RSSwizard should answer this question... i.e. from where he has this information.
(I have only answered that OpenXcom is not doing "double roll" anywhere at the moment)
And yes, it is easy to change... once it is confirmed.
-
"Double dice" basically means a Gaussian curve; 0-200% damage with a gaussian curve would indeed yield more predictable results... but I'm not sure if that makes for a better gameplay, i like my rnd :) Certainly it is a much better solution that single-dice 50-150%, though. afaik all dice rolls use simple (rnd) function.