Author Topic: [Missing feature?] Base Defences - Damage range  (Read 12304 times)

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8596
    • View Profile
[Missing feature?] Base Defences - Damage range
« 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
« Last Edit: August 20, 2014, 09:15:25 pm by Meridian »

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: [Missing feature?] Base Defences - Damage range
« Reply #1 on: August 12, 2014, 09:47:30 pm »
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?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: [Missing feature?] Base Defences - Damage range
« Reply #2 on: August 13, 2014, 02:48:31 am »
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.

Offline chi.code

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: [Missing feature?] Base Defences - Damage range
« Reply #3 on: August 17, 2014, 05:26:15 am »

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)?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Missing feature?] Base Defences - Damage range
« Reply #4 on: August 17, 2014, 01:50:01 pm »
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.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [Missing feature?] Base Defences - Damage range
« Reply #5 on: August 18, 2014, 05:39:03 pm »
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 )

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8596
    • View Profile
Re: [Missing feature?] Base Defences - Damage range
« Reply #6 on: August 20, 2014, 09:17:50 pm »
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)

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: [Missing feature?] Base Defences - Damage range
« Reply #7 on: August 23, 2014, 09:38:51 pm »
all sorted.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8596
    • View Profile
Re: [Missing feature?] Base Defences - Damage range
« Reply #8 on: August 24, 2014, 07:58:37 am »
all sorted.

Thanks.
So the original had 50-150%?

Offline neube

  • Sergeant
  • **
  • Posts: 11
  • Mr. n
    • View Profile
Re: [Missing feature?] Base Defences - Damage range
« Reply #9 on: August 24, 2014, 03:14:52 pm »
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?)?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Missing feature?] Base Defences - Damage range
« Reply #10 on: August 24, 2014, 04:23:34 pm »
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.

Offline neube

  • Sergeant
  • **
  • Posts: 11
  • Mr. n
    • View Profile
Re: [Missing feature?] Base Defences - Damage range
« Reply #11 on: August 24, 2014, 04:43:07 pm »
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 ;).

Offline RSSwizard

  • Commander
  • *****
  • Posts: 748
    • View Profile
Re: [Missing feature?] Base Defences - Damage range
« Reply #12 on: August 25, 2014, 12:16:34 am »
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?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8596
    • View Profile
Re: [Missing feature?] Base Defences - Damage range
« Reply #13 on: August 25, 2014, 08:42:30 am »
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...

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: [Missing feature?] Base Defences - Damage range
« Reply #14 on: August 26, 2014, 10:07:53 am »
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.