Page 2 of 3

Re: Miscalculations in enemy difficulty

Posted: Sun Jan 05, 2020 6:06 pm
by QQkp
rijackson741: Looks right to me. H46732f's logic is predicated on the same idea, I think - the termial function (triangular number) provides a way of collapsing the sums into a closed form:
2020-01-05 noncrit damage derivation.jpg
The logic is similar for d_c, with a bit of special handling for the crit multiplier.

Re: Miscalculations in enemy difficulty

Posted: Sun Jan 05, 2020 6:34 pm
by Gonk
H46732f wrote: Sun Jan 05, 2020 10:18 am Rounding can really interfere
Currently the code uses floats for the relevant parts. So there should be only minimal rounding issues.

Re: Miscalculations in enemy difficulty

Posted: Sun Jan 05, 2020 7:09 pm
by Gonk
This should work without a sum formula using the same logic:
formula.png
Edit: reasons for not using sum formulas is that it might make coding or calculations easier

Re: Miscalculations in enemy difficulty

Posted: Sun Jan 05, 2020 11:47 pm
by rijackson741
Actually, strictly speaking, it's this:
Average damage.png
The floor function in dc is necessary to allow for non-integer values of CM.
Getting rid of the summation for dc is harder than getting rid of it for dnc, and perhaps impossible with the floor function. Anyway, to be honest I don't see the point, because the sum is just a simple loop, and N will never even get to 100, so computation time is miniscule. It's also a lot easier to understand where it come from, since it is the general formula for the mean of a discrete probability distribution (something that might be worth adding as a comment in the code).

Re: Miscalculations in enemy difficulty

Posted: Mon Jan 06, 2020 2:05 am
by H46732f
rijackson741 wrote: Sun Jan 05, 2020 11:47 pm Actually, strictly speaking, it's this:
Average damage.png
The floor function in dc is necessary to allow for non-integer values of CM.
Getting rid of the summation for dc is harder than getting rid of it for dnc, and perhaps impossible with the floor function. Anyway, to be honest I don't see the point, because the sum is just a simple loop, and N will never even get to 100, so computation time is miniscule. It's also a lot easier to understand where it come from, since it is the general formula for the mean of a discrete probability distribution (something that might be worth adding as a comment in the code).
I agree with this version. It seems that is enough.
I agree with this rounding in the d_c calculation because it's like a real hit and the hits are always integers at the end.

Re: Miscalculations in enemy difficulty

Posted: Mon Jan 06, 2020 6:02 am
by Fallhaven Sentinel
(*admires the math nerds from a distance*)

Re: Miscalculations in enemy difficulty

Posted: Mon Jan 06, 2020 8:38 am
by Gonk
rijackson741 wrote: Sun Jan 05, 2020 11:47 pm The floor function in dc is necessary to allow for non-integer values of CM.
Good point. Yes, the floor is necessary.
rijackson741 wrote: Sun Jan 05, 2020 11:47 pm Getting rid of the summation for dc is harder than getting rid of it for dnc, and perhaps impossible with the floor function.
I don't think it is worth trying to find a way to get rid of the summation (even though it could be a funny and challenging task). So for the coding in AT we will have to use the loop.

When I was talking about simpler calculations I thought about excel or google spreadsheet e.g. for the rebalancing calculations. Does excel support the mathematical sum function? I know there is a "sum" function but it does something different. On the other hand I don't know if the enemies DR was used in the calculations for the rebalancing at all.

Re: Miscalculations in enemy difficulty

Posted: Mon Jan 06, 2020 1:13 pm
by rijackson741
I don't think you can do a sum like that in Excel unless you resort to VBA. The solution is to use a different tool, such as SMath Studio, which is free.

Re: Miscalculations in enemy difficulty

Posted: Sun Feb 02, 2020 7:07 pm
by Gonk
Finally I found time create the code. Thanks for finding the bug and the productive discussion.

https://github.com/Chriz76/andors-trail ... difficulty

Re: Miscalculations in enemy difficulty

Posted: Wed Apr 08, 2020 8:32 pm
by Gonk
QQkp wrote: Fri Jan 03, 2020 10:25 pm Encountered this earlier today on 0.7.7. Currently doing Colonel Lutarc, round 1 against a lizard. The lizard's difficulty is listed as "Very hard", but the battle was actually fairly easy.
The fix is part of the current beta:
viewtopic.php?f=5&t=6758