Grimy / Grimy.github.io

Do What The F*ck You Want To Public License
14 stars 22 forks source link

[Rounding Error?] Switching Formations messes with the results #88

Open PenultimateChimera opened 2 years ago

PenultimateChimera commented 2 years ago

As the title says, the calculator gives different results depending on which Formation you're in when you export.

Example: I'm at z88, have stalled in Zone Progression hard enough to switch over to farming

Exporting while in Formation D says I should farm at 86 (110.3) or 87 (107.2) Exporting while in Formation X says I should farm at 86 (110.4) or 87 (107.6) Exporting while in Formation H says I should farm at 86 (110.2) or 87 (107.3) Exporting while in Formation B says I should farm at 86 (110.4) or 87 (107.4)

While the given results here don't have any major differences, the minor differences in the individual zone results has led to the calculator suggesting a Two Zones Difference when I exported in one formation compared to another (I believe the two formations I tested in at the time were B and D in that order).

Perhaps not a major bug in any way, but still noteworthy. What's the method for calculating what the Optimal Formation is for farming? And where might it break down due to rounding? Could possibly change it so it checks if Formation D is available (I don't know any Formations beyond z88), then checks which Formation is currently being used, then translates the necessary values from the Starting Formation to Formation D/Target Formation.

PenultimateChimera commented 2 years ago

Update: Just got this outcome. First one is in Formation X, second one is in Formation D. A good example of a major difference from one formation to another. Formation X Formation D

Grimy commented 2 years ago

zFarm compensates for your stance, so e.g. if you’re in D it divides by 4 to get your true base ATK. However if you change stances while not having an active army (breeding cooldown, or just autofight off), the game doesn’t update your ATK stat immediately. So if you export a save at that point, zFarm will see the new stance with the old ATK, and end up overcorrecting. Unfortunately there’s not much i can do to avoid that: the information I need is simply not in the exported save.

As a workaround, avoid switching stances right before exporting for zFarm.

fweaks commented 2 years ago

I think there is a different reason for this, but haven't been able to test it yet. zFarm only modifies attack and loot for different stances, but not health and block. But the simulation does take downtime from death into account.

This would explain @PenultimateChimera's result. They have significantly more downtime from death when in D stance, so it should report a lower level. However it doesn't actually get the correct health and block stats for this unless they are actually in the correct stance.

Grimy commented 2 years ago

Nice catch. Fixed in f128416.

fweaks commented 2 years ago

I think this wasn't all that needed changing to fix this unfortunately. zone_stats() needs changing too, inside the for each stance loop, like what you have for attack. this will need the global stats object changed to use a different value for base health/block vs current stance health/block like attack does. this knock on would affect either the setup or use of these variables as you split them between setup and use like g.attack/g.atk is.

Grimy commented 2 years ago

No, this isn’t needed. zFarm never even considers farming in H or B, and only considers farming in X if no other formation is available. So the health and block is always the same across all considered formations, which simplifies the logic.

fweaks commented 2 years ago

ohhhh, I see. Interesting, thanks for the explanation.