[1.6.1, 32bit] Talents are showing wrong numbers in descs

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
dartom
Wayist
Posts: 27
Joined: Thu Dec 22, 2016 5:27 pm

[1.6.1, 32bit] Talents are showing wrong numbers in descs

#1 Post by dartom »

This started as a tometips bug, but turned out to actually be a game one. I think you're going to love this one.

Apparently, the 64-bit and the 32-bit builds of the game are showing different numbers in talent descriptions. For example, Duelist / Dual Weapon Mastery, at talent level 2, is showing 28% in the 64-bit build, but 29% in the 32-bit build, all other things being equal (same character etc). Assassination / Terrorize shows a 3,3,4,5,5 scaling in the 64-bit version, but 3,4,5,5,6 in the 32-bit one. These are just two examples, pretty much every talent is potentially affected.

Some screenshots:
32bit https://i.imgur.com/BqXNDVn.png
64bit https://i.imgur.com/TN4FTAU.png

As far as I have been able to gather, this is purely a display issue, the actual behavior of the game *seems* to be identical across both builds.

To marrow down the issue, I have tried placing the following code into game/loader/init.lua (it's a copy of combatTalentLimit, as used by dual weapon mastery at level 2):

Code: Select all

limit,low,high=1,0.6,0.80
x_low, x_high = 1,5
tl=2.6
p = limit*(x_high-x_low)
m = x_high*high - x_low*low
ah = (limit*(x_high*low-x_low*high)+ high*low*(x_low-x_high))/(high - low)
res=(limit*tl + ah)/(tl + (p-m)/(high - low))*100
print (([[DEBUG p=%f, m=%f, ah=%f, res=%f]]):format(p,m,ah,res))
print (([[DEBUG DISPLAYED RESULT IS %d]]):format(100-res))
Results:

Code: Select all

game-64bit:
DEBUG p=4.000000, m=3.400000, ah=1.400000, res=71.428571
DEBUG DISPLAYED RESULT IS 28

game-32bit:
DEBUG p=4.000000, m=3.400000, ah=1.400000, res=71.428571
DEBUG DISPLAYED RESULT IS 29
Basically, for whatever reason, string:format in the 64-bit build rounds all floats downwards, whereas the 32-bit build rounds towards the nearest integer. The approach used in the 64-bit build generally gives more accurate numbers, because the game seems to use Math.floor to round numbers.

For weapon damage, this is a minor issue - whether the actual value is 110% or 111% doesn't really matter. For turn-count scaling, however, the issue becomes significant - oftentimes, the talent desc would tell you that +1 level will get you +1 turn of some effect, when in reality, it would not (or vice versa).

Curiously, I have attempted to execute the above lua code in plain lua-5.1 interpreters (64bit and 32bit), and both are giving identical results (28). It seems that the string:format function in the game's lua build is somehow modified, and the modification only affects 32bit builds - which practically means the majority of users, as the windows version is only available in 32bit.

I haven't tested older versions, so I do not know whether they are affected as well.

hauzer
Wayist
Posts: 18
Joined: Sat Jun 28, 2014 4:27 am
Location: Belgrade, Serbia

Re: [1.6.1, 32bit] Talents are showing wrong numbers in desc

#2 Post by hauzer »

Hoo boy, this turned out to be a wild ride. I just wanted to plan Adept on my Rogue accordingly!

Post Reply