Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Wrong firing range formula with High Scatter Amplification ?  (Read 584 times)

Vyserk

  • Ensign
  • *
  • Posts: 5
    • View Profile
Wrong firing range formula with High Scatter Amplification ?
« on: October 11, 2021, 12:50:26 PM »

Hello,

i think there is an error on how the malus for the hullmod "High Scatter Amplification" is calculated.
I did 3 tests with the same ship except this hullmod and by twiking the mod by using this technic from this topic : https://fractalsoftworks.com/forum/index.php?topic=17445.0

Here the results :
1) A paragon with tachyon lance and max range mods : 18 traits of range
2) The same paragon + HSA installed : 8 traits of range
3) The same paragon + HSA "de-activated" installed (i put the malus to 0 in the java file) : 9 traits of range

1) 18 traits :


2) 8 traits :


3) 9 traits :


Maybe it is working as intended... Maybe i didn't understand how java works (never used it, usually i only do VB)... Maybe i did a mistake but there is something fishy how the range malus is working.
Normaly i should have others possible results :

A) the formula is multiplicative on the total range bonusied :
For the second screenshot, i should have 9 traits.
For the third, i should have 18 traits.

B) The formula is additive and based on the normal range (as the others formulas on this game seems to use) :
For the second screenshot, i should have between 9 and 18 traits.
For the third, i should have 18 traits.

There is really something fishy but i can't say why. Can someone confirm this ?
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Wrong firing range formula with High Scatter Amplification ?
« Reply #1 on: October 11, 2021, 01:15:46 PM »

There are three separate ways to modify a value in Starsector:
Percentage, Total, and Multiple.
The formula is "((Base value * (1+Percentage))+Total)*Multiple".

Vyserk

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Wrong firing range formula with High Scatter Amplification ?
« Reply #2 on: October 11, 2021, 01:30:53 PM »

There are three separate ways to modify a value in Starsector:
Percentage, Total, and Multiple.
The formula is "((Base value * (1+Percentage))+Total)*Multiple".

Yes i agree but even without looking at the code, there is something strange.
And it starts to be even weirder with the code of this mod :

Code
	public static float RANGE_PENALTY_PERCENT = 50f;


public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
stats.getBeamWeaponRangeBonus().modifyMult(id, 1f - RANGE_PENALTY_PERCENT * 0.01f);

// test code for WeaponOPCostModifier, FighterOPCostModifier
// stats.addListener(new WeaponOPCostModifier() {
// public int getWeaponOPCost(MutableShipStatsAPI stats, WeaponSpecAPI weapon, int currCost) {
// if (weapon.getWeaponId().equals("amblaster")) {
// return 1;
// }
// return currCost;
// }
// });
// stats.addListener(new FighterOPCostModifier() {
// public int getFighterOPCost(MutableShipStatsAPI stats, FighterWingSpecAPI fighter, int currCost) {
// if (fighter.getId().equals("talon_wing")) {
// return 20;
// }
// return currCost;

Even by changing the value of RANGE_PENALTY_PERCENT by 0, the range go from 8 to 9. It should go to 18 (or maybe i am an idiot trying to understand java for the first time without a training :s ).
I think the formula only use the base range and ignore all the other bonus (by erasing it). And to check that, you need a macro vision of how the code works.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Wrong firing range formula with High Scatter Amplification ?
« Reply #3 on: October 11, 2021, 01:43:54 PM »

I'm not quite sure what you mean by "traits". Those little pairs of dots on the weapon arc overlay, right? If so: the spacing between them is not going to be the same - it's adjusted to divide evenly into the weapon range. Counting them to figure out what the range is isn't going to give you accurate results.
Logged

Vyserk

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Wrong firing range formula with High Scatter Amplification ?
« Reply #4 on: October 11, 2021, 02:02:25 PM »

I'm not quite sure what you mean by "traits". Those little pairs of dots on the weapon arc overlay, right? If so: the spacing between them is not going to be the same - it's adjusted to divide evenly into the weapon range. Counting them to figure out what the range is isn't going to give you accurate results.

Sorry, i am french and forgot to translate "traits" in my head ^^ Indeed, i should have use "lines"

I did a comparison between the 8 and 9 lines (max out zoom) so same scale (it is not perfect, done fast but you can see the difference) :



And you said it yourself. It is adjusted "by the game" into the weapon range. The results should be no change (because i did something wrong with my modification of the code) or going back to full range (18 lines).
But if i did a mistake how it is working, my bad...
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Wrong firing range formula with High Scatter Amplification ?
« Reply #5 on: October 11, 2021, 02:20:49 PM »

1) A paragon with tachyon lance and max range mods : 18 traits of range
2) The same paragon + HSA installed : 8 traits of range
3) The same paragon + HSA "de-activated" installed (i put the malus to 0 in the java file) : 9 traits of range

...

There is really something fishy but i can't say why.

Hmm - that you're not getting the same result with 1 and 3 guarantees that your "de-activated" version of HSA is somehow incorrect, I think. Either the code is wrong, or it's not being compiled, or ... something. Going to move this out of bug reports and into Modding since that seems more appropriate.
Logged