bitburner-official / bitburner-src

Bitburner source code.
Other
820 stars 269 forks source link

BUG: Effective duplicate application of player multipliers in Bladeburner's Training and Field Analysis #1607

Open cmfrydos opened 2 months ago

cmfrydos commented 2 months ago

Bug Description

Completing Training in Bitburner results in excessively high effective stat gains compared to the console and what appears to be intended in the code.

Issue Details

The problem seems to originate from the following lines:

Those multipliers are then applied again in successive functions:

I believe that the double application of multipliers is not intended. My proposed solution is to remove the multiplier application on the Bladeburner.completeAction function's return value (retValue), but then apply it to the console output to accurately reflect the effective stats in the terminal message.

Additional Information

Note: Removing this bug significantly alters Bladeburner late-game balance. For example, a 300% Combat Stat Multiplier is currently applied twice (900%), so a bug fix would reduce net gains by 66% in this scenario.

Steps to Reproduce

  1. Have some Combat Skill Multipliers on the player or some skill points in Cyber's Edge.
  2. Complete the General > Training Bladeburner action.
  3. Observe the increase in Max Stamina in the Bladeburner Status Window or Combat Skills in Stats.

Version

Screenshots

Note: The screenshots were taken on v2.62 but were checked again in v2.6.3dev, resulting in the same outcomes:

  1. Notice the Maximum Stamina Stat increase of 0.048 from 421.502 to 421.550, whereas the console reports an increase of 0.044. This was observed with 5x Cyber's Edge, resulting in a Player Skill multiplier of 1.1.

    output2

    • Terminal Calculation: 0.040 * 1.1 ≈ 0.044
    • Effective Calculation: 0.040 1.1 1.1 * 1 (Aug. Max Stamina) ≈ 0.048.4
  2. Notice the Maximum Stamina Stat increase of 0.058 from 508.190 to 508.248, whereas the console reports an increase of 0.048. This was observed with 10x Cyber's Edge, resulting in a Player Skill multiplier of 1.2.

    output

    • Terminal Calculation: 0.040 * 1.2 ≈ 0.048
    • Effective Calculation: 0.040 1.2 1.2 * 1 (Aug. Max Stamina) ≈ 0.0576
  3. ToDO: Add Combat Stat Increase Screenshot

Save File in BN7 Bladeburner Training

bitburnerSave_1724100804_BN7x1.json.gz

catloversg commented 2 months ago

Your proposed solution is a balance change. You should be careful when doing that. The "double application" of stat multipliers might be an oversight when we designed Bladeburner, but it's a part of the balance of Bladeburner nowadays. These are things that we should consider:

It's fine to fix the wrong console log, but if you want to make a balance change, you should wait until the maintainers agree.

cmfrydos commented 2 months ago

Good catch that Field Analysis is also affected!

Next, I'll verify whether this issue has existed for a longer time. If it has, we definitely need to discuss how to maintain the balance while untangling the spaghetti in the code / game mechanic.

cmfrydos commented 2 months ago

I believe it was introduced when Sleeves were added, but I need to run some tests in v2.1 first: 2613948bad9f92f6354f2a7dec4057b7ee285005

cmfrydos commented 2 months ago

So, I can confirm, as I assumed, that 2613948bad9f92f6354f2a7dec4057b7ee285005 has the bug regarding player stat increases, but its parent does not (tested in-game). However, the double application of Cyber's Edge is broken in both versions, indicating this part of the issue originates even deeper. I'll continue to investigate, but I'm currently considering just doubling Cyber's Edge Base Effect (2% -> 4% max stamina increase). I agree that the current primary purpose of training is to increase max stamina, and it could use a buff rather than a nerf. However, this ticket is NOT about altering the intended balance. So let's so how long this bug has existed...

cmfrydos commented 2 months ago

The issue where the effect of CyberEdge on maximum stamina is applied twice has existed since Bladeburner was introduced: https://github.com/bitburner-official/bitburner-src/blob/9acc422f0591c185ec320fa9b56f6cb52854eebb/src/Bladeburner.js#L1255 https://github.com/bitburner-official/bitburner-src/blob/9acc422f0591c185ec320fa9b56f6cb52854eebb/src/Bladeburner.js#L882

The effective max stamina gain from CybersEdge has therefore always been quadratic.

Below is a table showing the effective max stamina gain multiplier for the current quadratic 2% formula, as well as for a linear 4% and a linear 5% proposal. CybersEdge Level Quadratic 2% Linear 4% Linear 5%
0 1 1 1
1 1.0404 1.04 1.05
10 1.44 1.4 1.5
25 2.25 2 2.25
50 4 3 3.5
100 9 5 6

With these data points in mind, I propose changing CybersEdge's effect to a linear 5%, which results in a slight buff < Level 25, an unchanged balance at Level 25, and a linear nerf for all levels > 25.

I just played BN6 and BN7, trying a few things, and for me it didn't feel rewarding leveling CybersEdge past Level 10 - 20 or so. Each level costs more than the previous, and all the other possible upgrades were more rewarding.

Note: Saying that the current max stamina formula is quadratic is technically not correct but a usable estimation. In fact, the effect of a past training session on the current max stamina is a product of the level of CybersEdge at the time the training occurred, times the current level of CybersEdge. So saying that the max Stamina is just quadratic in the current level of CybersEdge is slightly overestimating the actual effect.

gmcew commented 2 months ago

To justify the tags, I'll echo Catloversg point - if this bug has existed since Bladeburner was first created this is a balance change now. The pathways are broadly:

@d0sboots and/or @Snarling may have a strong opinion one way or the other on how to handle this.

cmfrydos commented 2 months ago

if this bug has existed since Bladeburner was first created, ...

It has not. It wasn't present from 2018, when Bladeburner was initially introduced, until 2021, when Sleeves were added. This balance-changing bug was silently introduced with this commit: https://github.com/bitburner-official/bitburner-src/commit/2613948bad9f92f6354f2a7dec4057b7ee285005

I strongly suspect that this is not an intended mechanic, neither from this commit nor from the base game design of Bitburner, and is therefore a bug. EXP multipliers are meant to function as multipliers, not roots of multipliers, across all game mechanics.

Removing these bugs (XP and stamina) would not significantly alter the early to midgame of Bitburner (with not all bitnodes beaten), since at that stage you typically don't have multipliers high enough for it to matter. However, it might impact the super-late game of Bladeburner (NFG > 1k), as this would be the only instance where an action’s effects scale quadratically instead of linearly. We all know that O(n²) is much larger than O(n) for large n.

EDIT: Actually, we are dealing with at least three different bugs here, which originated at different times:

So, maybe splitting the issue into a few smaller ones could help? I believe the two (though minor) balance changes would need approval from the maintainer(s), regardless of where the original balance came from, whereas the game texts could be updated beforehand. I'll write a proper justification for the balance-changing fixes in my pull request tomorrow and then look forward to hearing the opinion of the maintainer(s).

gmcew commented 2 months ago

Apologies, I misunderstood your earlier comment on the CyberEdge issue from inception and missed the one prior that there's a separate issue introduced alongside Sleeves - I see that now. I also fully appreciate your points and the reasoning behind it; I'm also mindful that super-lategame Bladeburner is a popular strategy for grinding a lategame skill and the broader impacts on that are worth bearing in mind for this fix - and it's not an area I'm an expert on.

With how long this bug has been present, I've labelled this as documentation and enhancement simply to reflect gameplay impact from any change now rather than committing to either direction on how to resolve it. Your edit seems to align with that approach; documentation can be clarified now with any future balance changes for broader discussion.

d0sboots commented 2 months ago

This is a complicated one for sure. I left some comments on your draft PR; I think they're applicable regardless of how we go forward here. I.e., whether we "fix" the issue and accept a nerf, or "preserve" the weird behavior to keep current balance, IMO restructuring things will make it more clear what's going on.

cmfrydos commented 2 months ago

I like the idea of refactoring it first, but I have some concerns about your proposed solution, which I commented in #1606.

One new issue with the current state of completeAction is that Sleeves are also affected by this strange behavior. They receive their XP bonus in Training and Field Analysis, but unlike the player, their calling function does not apply the bonus a second time. So, we end up in this scenario:

Type Training / Field Analysis Other BB Actions
Player 2 1
Sleeves 1 0

Cells describe how often the XP multiplier is applied.

I haven't played with Sleeves yet, so I can't say how a removal affects balance. Are high sleeve-XP augmentations (or source files) a thing?