Forums

Giants Foundry metal score

Quick find code: 317-318-844-66283740

midi trumpet

midi trumpet

Posts: 2 Bronze Posts by user Forum Profile RuneMetrics Profile
[Edit: Oops, this should've gone into the OSRS forum]

This is a more obvious case of a general bugbear about how interpolation works across OSRS, and not having seen the dev tools I can't say how easy any of this is to change, but:

The current metal score calculation does a lot of flooring at intermediate steps in the calculation, and the final score curve can get very distorted as a result. Here's a Desmos page exploring it: https://www.desmos.com/calculator/d9vu8vbkgp

At present, it's very lossy. I'll (try to) include a screencap showing the behaviour for iron/mithril combinations below.


You can see for the total score (black) that the integer function has two peaks with a trough between them, unlike the continuous function, and the value has a habit of unexpectedly decreasing when it should intuitively increase.

It's possible to get around this without doing any real-valued arithmetic, just by rearranging the existing formula to do all the multiplication and summation first followed by one final division step. I've made another Desmos page for that here: https://www.desmos.com/calculator/2ewy4ytefx

Which gives the following iron/mithril graph:


The equation is written in the Desmos page, but is a little hard to parse. Here's the pseudocode:


v1 := 28*tier(1)*amount(1)*10;
v2 := 28*tier(2)*amount(2)*10;
vAlloy := tier(1)*amount(1)*tier(2)*amount(2)*10;
total := (v1 + v2 + vAlloy) / (28 * 28);


The maximum possible intermediate value before division is for 14 adamant/14 rune, which comes out to 101,920 - this fits into 17 bits, but not 16. If it needs to be 16-bit, you can remove the *10 from v1, v2, and vAlloy and do it later:

v1 := 28*tier(1)*amount(1);
[ . . . ]
inter := (v1+v2+vAlloy)/28
total := (10*inter)/28

This is slightly lossier, but still preserves the gradient.

18-Jul-2023 13:56:50 - Last edited on 18-Jul-2023 14:13:41 by midi trumpet

midi trumpet

midi trumpet

Posts: 2 Bronze Posts by user Forum Profile RuneMetrics Profile
For what it's worth, I think this is more noticeable for two reasons:

1 .The interpolated values are multiplied, so the phenomenon of one value decrementing when the other doesn't increment causes a bigger overall change than in skilling chances. Skilling chances only use summation for interpolated values, so the deviation is at most 1 per sum operation and at most 1/256 in the final calculation - not something a player is going to notice. Here, a deviation of 1 point in v1 can cause a deviation of up to v2 in the product, which can be quite large. The result is up to 7 points of deviation out of a maximum of 130 points, which is definitely noticeable (especially in a minigame where you're aiming for a particular integer score if you're minmaxing)

2. The value used as a denominator isn't a power of a prime or double a power of a prime, so the resulting multiplicative group of integers isn't cyclic (the 98 used in skilling calculations does form a cyclic group, as it's 7*7*2). This makes it much less likely for values to inadvertently "line up" and increment/decrement simultaneously after flooring - deviations happen when the downward-sloped line in the interpolation steps down when the upward-sloped line isn't stepping up, and when this happens is governed by some very complicated number theory. 28 is just kind of an awkward number to do division by if you're trying to get integer approximations of everything. It's technically possible to avoid any gradient reversals while still doing a lot of intermediate flooring, but it's a lot more effort than just avoiding any division until the last minute.

This might be a non-issue, but I had fun trying to solve it and thought I'd make a post about it anyway. Maybe the real video game was the group theory we did along the way.

18-Jul-2023 14:10:33

Daddy Roshi
Jan Member 2018

Daddy Roshi

Posts: 3,348 Adamant Posts by user Forum Profile RuneMetrics Profile
[quote id=74-75-787-66283717-0-347556357][Edit: Oops, this should've gone into the OSRS forum]/quote]u can ask a forum mod to move it to the right forums for u :P or I'm sure onell see it soon and move it for u
200m defence 08-10-2021


comp cape 12-19-2021

18-Jul-2023 18:30:18

Quick find code: 317-318-844-66283740 Back to Top