The Wiki for Tale 6 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

McArine/Incense

From ATITD6
Jump to navigationJump to search

This contains a brief description of what I'm trying to find out, why I think it's right, and other odds and ends regarding my incense work.

The Theory and some Math

In T4(and T5) all incense coords was registered as a float like (35.2515, 166.233).
I think this is wrong, mainly because Teppy generally likes discrete or integer values. So this is my primary standpoint, that all coordinates for starting points, attribute points and additive points, are located at a discrete value, like (35, 166)
Now I might be totally wrong regarding this, and if I am, none of my approaches will end up giving the result I want.

Rounding, since all results from the scent lab are integer values, it is safe to assume that some sort of rounding is applied. I'm going to assume Teppy has used a floor function, meaning that 35.677 becomes 35. I think this is a safe bet, again, Teppy has used it in other systems.

Now to look at the starting points, and how distances are calculated. The formula for calculating quality is determined by the distance from the current coordinates in each of the planes, to the closest attribute coordinates. dResin, dHerb and dRose. The final quality is then:

Quality = 1000 - (dResin + dHerb + dRose)

Now this formula has to contain some rounding(flooring), or we would not get an integer value, it could be done like this:

Quality = 1000 - floor(dResin + dHerb + dRose)

Or like this:

Quality = 1000 - (floor(dResin) + floor(dHerb) + floor(dRose))

If the formula is like the first one, we would not be able to calculate all possible starting locations as easily. Because sometimes the decimal part of the distances would sometimes add 1 or 2 extra to the total distance. And that is not the case. So, the formula has to be the second.

The distance calculation is like this:

dResin = floor(sqrt(power(Xcur - Xattr, 2) + power(Ycur - Yattr, 2)))

If Teppy is calculating the distance in some other obscure way, then he didn't pay attention in his geometry classes ;-)
Xcur is the X coordinate of the current location, and Xattr is the X coordinate of the closest attribute location. In this case, in the Resin plane.

So far, I believe my guesses in the math are correct. I think it's the right formula for quality, and I don't see why one would use a more complex calculation for distances.
So now to calculate the value of Xcur, Ycur.
I think it is safe to say, that this coordinate set, is also integer. The reason for this assumption is that sometimes we can get quality that gives the following values: 555, 554, 555, 554, 555. Now, if we didn't use some kind of rounding, this could not happen. Because of the way the formula works, moving us in a straight line from the starting point, to the resin point. We would be moving closer and closer to the attribute, and then we'd start moving away from it again. Now if a rounding function is used, we're no longer moving in a straigt line, between the starting point and the resin point. But are able to jump both closer and father away from the attribute point, depending on where the rounding function puts us. Again, I'm going to use a floor function.

The formula for calculating the current location has been determined to be the following. (or at least very near to)

Xn = (Xstart x 7 + Xresin x n) / (7 + n)

Where Xn is equal to the current location for the n'th add of a resin.
But how is it implemented, how's the flooring done, and is it the location calculated between the starting point and the resin point each time, or is it calculated between the last location and the resin point? This gives us 4 different implementation possibilities. With 4 results that differs more the more resin is added.

If all my assumptions are correct, and I've found the right implementation of the current location formula, I should be able to find a set of coordinates, that gives me an exact match, against the observed qualities.
First approach, flooring it all:

Xn = floor((Xstart x 7 + Xresin x n) / (7 + n))

I'm pretty sure, that this isn't it. I've done several tests, and they didn't give the exact even match.

Second approach, floor it, seperately:

Xn = floor((Xstart x 7) / (7 + n)) + floor((Xresin x n) / (7 + n))

Third approach, based on last position:

Xn = floor((Xn-1 x (7 + n - 1) + Xresin) / (7 + n))

Fourth approach, last position, floored seperately:

Xn = floor((Xn-1 x (7 + n - 1) / (7 + n))) + floor(Xresin / (7 + n))

How do we then determine which is the right location? I've been constructing some programs, that lets me calculate all the possible locations, and compare them to the actual numbers. The problem with this approach is, that there's (if we assume a 2000x2000 coordinate grid) 6.4 x 10^19 possible combinations to check. And that isn't possible to check, before the end of the Tale. So we'll probably going to have to settle for the second best result...

I'm currently trying the third approach, on a simplified coordinate grid, which leaves me 10^12 possible combinations. And I can calculate that in approx 20 hours.