Author Topic: True bomb damage formula  (Read 1693 times)

0 Members and 1 Guest are viewing this topic.

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
True bomb damage formula
We've pinned down the formula for a beam's real DPS - a way to calculate it from the beam's tabled damage.

Similarly, a bomb's tabled damage is an incomplete descriptor of its real power, since its shockwave deals damage too (and this shockwave damage bypasses some common damage restrictors). Is there a trivial calculation to determine a bomb's true damage from its tabled damage value, assuming a direct hit?

My memory was that it may be 2x tabled damage, but that seems a little high.

 

Offline niffiwan

  • 211
  • Eluder Class
Re: True bomb damage formula
I'm 99.9% sure it's twice the tabled damage for a direct hit.  1x tabled damage from the impact and 1x tabled damage from the shockwave at zero distance from the detonation point.

Note: I believe this applies to any weapon with a shockwave radius.
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: True bomb damage formula
I also recall there's player damage scaling when attacking warships - the player's guns do reduced damage as compared to tables/AI. Can anyone remind me precisely which weapons this degradation applies to - non-huge? And what is the reduction formula?

 

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
Re: True bomb damage formula
From weapons.cpp:
Code: [Select]

/**
 * Return a scale factor for damage which should be applied for 2 collisions
 */
float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target)
{
weapon *wp;
int from_player = 0;
float total_scale = 1.0f;
float hull_pct;
int is_big_damage_ship = 0;

// Goober5000 - additional sanity (target can be NULL)
Assert(wip);
Assert(wep);

// sanity
if((wip == NULL) || (wep == NULL) || (target == NULL)){
return 1.0f;
}

// don't scale any damage if its not a weapon
if((wep->type != OBJ_WEAPON) || (wep->instance < 0) || (wep->instance >= MAX_WEAPONS)){
return 1.0f;
}
wp = &Weapons[wep->instance];

// was the weapon fired by the player
from_player = 0;
if((wep->parent >= 0) && (wep->parent < MAX_OBJECTS) && (Objects[wep->parent].flags & OF_PLAYER_SHIP)){
from_player = 1;
}

// if this is a lockarm weapon, and it was fired unlocked
if((wip->wi_flags & WIF_LOCKARM) && !(wp->weapon_flags & WF_LOCKED_WHEN_FIRED)){
total_scale *= 0.1f;
}

// if the hit object was a ship and we're doing damage scaling
if ( (target->type == OBJ_SHIP) &&
!(The_mission.ai_profile->flags & AIPF_DISABLE_WEAPON_DAMAGE_SCALING) &&
!(Ship_info[Ships[target->instance].ship_info_index].flags2 & SIF2_DISABLE_WEAPON_DAMAGE_SCALING)
) {
ship_info *sip;

// get some info on the ship
Assert((target->instance >= 0) && (target->instance < MAX_SHIPS));
if((target->instance < 0) || (target->instance >= MAX_SHIPS)){
return total_scale;
}
sip = &Ship_info[Ships[target->instance].ship_info_index];

// get hull pct of the ship currently
hull_pct = get_hull_pct(target);

// if it has hit a supercap ship and is not a supercap class weapon
if((sip->flags & SIF_SUPERCAP) && !(wip->wi_flags & WIF_SUPERCAP)){
// if the supercap is around 3/4 damage, apply nothing
if(hull_pct <= 0.75f){
return 0.0f;
} else {
total_scale *= SUPERCAP_DAMAGE_SCALE;
}
}

// determine if this is a big damage ship
is_big_damage_ship = (sip->flags & SIF_BIG_DAMAGE);

// if this is a large ship, and is being hit by flak
if(is_big_damage_ship && (wip->wi_flags & WIF_FLAK)){
total_scale *= FLAK_DAMAGE_SCALE;
}

// if the weapon is a small weapon being fired at a big ship
if( is_big_damage_ship && !(wip->wi_flags & (WIF_HURTS_BIG_SHIPS)) ){

// if the player is firing it
if ( from_player && !(The_mission.ai_profile->flags2 & AIPF2_PLAYER_WEAPON_SCALE_FIX)) {
// if it's a laser weapon
if(wip->subtype == WP_LASER){
total_scale *= 0.01f;
} else {
total_scale *= 0.05f;
}
}

// scale based on hull
if(hull_pct > 0.1f){
total_scale *= hull_pct;
} else {
return 0.0f;
}
}
}

return total_scale;
}

For supercaps, it uses a constant scaling factor (SUPERCAP_DAMAGE_SCALE) unless the hull is below 75%, in which case it's 0.

For "big damage" ships, the multiplier for a small weapon is the ship's hull percent unless the hull is below 10%, in which case it's 0.

Also for "big damage" ships, there's a constant multiplier against all flak weapons (FLAK_DAMAGE_SCALE). Again, idk what the constant is but I can look for it. Probably in weapon.h.

Also for big damage ships, only if the "player weapon scale fix" is not applied (it probably is in BP because this is very silly):
if the player's weapon here is a laser, the factor is 1%, else it's 5%. This is multiplied to the hull percent as well.

None of this happens if AIPF_DISABLE_WEAPON_DAMAGE_SCALING or SIF2_DISABLE_WEAPON_DAMAGE_SCALING have disabled damage scaling entirely.


edit: SUPERCAP_DAMAGE_SCALE is 25% and FLAK_DAMAGE_SCALE is 5%. I should clarify that all these values are multipliers so 5% means that damage is 5% of normal, not nerfed by 5%.

 

Offline Fury

  • The Curmudgeon
  • 213
Re: True bomb damage formula
None of this happens if AIPF_DISABLE_WEAPON_DAMAGE_SCALING or SIF2_DISABLE_WEAPON_DAMAGE_SCALING have disabled damage scaling entirely.
Indeed. All this damage scaling is bollocks. In the past I've recommended setting up these AI profiles flags and leaving damage scaling to armor types and weapon damage types. Best form of flexibility without any of this witchcraft nonsense.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: True bomb damage formula
Agreed. Unfortunately if BP hasn't implemented it yet then we need to create a new AI profile in order to avoid rebalancing all our past missions.

 

Offline Fury

  • The Curmudgeon
  • 213
Re: True bomb damage formula
Agreed. Unfortunately if BP hasn't implemented it yet then we need to create a new AI profile in order to avoid rebalancing all our past missions.
Yes, but creating AI profiles is real easy. The bigger headache might come in the form of added or modified armor types and weapon damage types and ensure they don't affect balance of earlier missions. Which could be more involved that it sounds at first, depending on how they are currently set up.