I'd like to begin with a short story as to why I made this mod...
I love Torchlight. Runic Games did a great job with the hack 'n slash concept. However, I'm also disappointed that Runic Games isn't taking the responsibility of fixing bugs that should have been fixed a long time ago. I'm talking about being able to enchant over the limits set in globals.dat and the incorrect scaling of item affix values on heirloom items. Seeing how Torchlight II is almost out, I'm afraid those bug fixes will never see the light of day. The modding tools we got from Runic Games unfortunately aren't able to correct these bugs. The fact is that Runic Games did a rush job and released a playable but unbalanced game riddled with bugs. In my opinion the community has been used as a glorified paying beta tester. Brilliant move by Runic Games. They got money for a rushed beta version in order to develop a sequel and we're left with a game still in beta state.
We, the community, reported the bugs mentioned and got ignored by Runic Games. Sure a lot of improvements are made with Torchlight II, but what about Torchlight? Isn't Torchlight important too? When you pay money for a new product, no matter how much, you'd expect some support. I don't expect much because the modding tools allow for much fixes and balancing. But come on! At least fix these enchant and item heirloom bugs! Then the X-Box 360 port got out. Releasing patches for different platforms would now take even more time and resources, so Runic Games simply decides to skip it. Thanks Runic Games! Thanks for showing that you don't care about the hardcore fans who still play Torchlight I'm even playing Torchlight over Diablo III right now. What proof do you need to know we're still playing? This is where it comes to, a fan doing for free what you're supposed to be doing! I'm seriously contemplating weather I will buy Torchlight II seeing the poor support Torchlight got. Runic Games, please get your act together when it comes to Torchlight II support! The fans are counting on you!
Well enough about the good and the bad... Below are the changes and some additional information.
- ENCHANTER_MAX_ENCHANTS now correctly limits the enchants you can get from the enchanter
- ENCHANTSHRINE_MAX_ENCHANTS now correctly limits the enchants you can get from an enchant shrine
- Incorrect scaling affix values on new heirloom items are now correctly scaled (not retroactive)
- Disabled the code that tags your character as a cheater when using certain console commands
The patched binary can be downloaded here. This modded binary will ONLY work with Torchlight 1.15 downloaded from Runic Games. I don't have access to other versions. If any of you do and are familiar with assembly, debugging and hex editing, I can provide the things to look for so you can apply the changes yourself. Testing has been done by myself. I didn't come across any problems while using the modded binary. As I don't have the time to thoroughly test the heirloom item bug fix I kindly ask people to try different items and look at how the affix values scale after several generations. Report any findings/issues you might come across in this thread. Thank you
- Make a backup copy of Torchlight.exe in the folder where you installed Torchlight
- Make a backup copy of your character and stash files in the save folder of Torchlight
- Replace the original Torchlight.exe with the downloaded Torchlight.exe
- Run Torchlight
- No further actions are needed, changes are immediate
For the people interested I will conclude with why certain affixes caused monstrous values on heirloom items. Let's take the bonus HP affix. The affix uses the Health_Player_Destroyer.dat graph. Let's pick the set item Justice Enshrined from the Justice's Convocation set. The item gives a +126 health bonus. The item level of the item is 31. If we lookup X in Health_Player_Destroyer.dat we get 2100 as Y value. The affix value is a min/max percentage of 2100. The item level and scaling value of 2100 remain constant. Now let's examine how the game calculates the affix value and how the game calculates the heirloom affix bonus.
We start with a 6% affix value of 2100. 126 out of 2100 is 6%
The game stores a min/max percentage of 2100, but for fixed affix values both are set to the same value. In this case both are 6%.
Let's retire and heirloom the item and see what happens to the health affix value.
The item affix values get a 10% increase. You would expect to see a 10% increase of 6% and 126.
So the min/max percentage of the affix scale would become 1.1 * 6 = 6.6 %
the affix value would become 1.1 * 126 = 138.6
At first everything seems fine and the 139 increase is shown after retiring.
When you level up the affix value changes to 2911...
How is this possible? It doesn't make sense.
The reason it displays the correct initial increase is because it actually stores the correct affix value besides the wrong min/max percentages.
When you level up the code recalculates the affix values which are now based on the the wrong scaled min/max percentages.
Instead of doing the proper increase on the min/max percentages like I said, the code is using the newly calculated affix value as the new min/max scaling percentages
So both min/max percentages become 138.6% instead of 6.6%
1.386 * 2100 = 2910.6 which is rounded up to 2911.
You can guess what happens when you heirloom the item again...
The new affix value is calculated as 2910.6 * 1.1 = 3201.66.
Initially 3202 is displayed and the min/max percentages are set to 3201.66%.
When you level up 32.0166 * 2100 = 67234.86 and 67235 is displayed.
Below is an overview of what happens after six generations.
- HP scaling value: 2100
- Min/max affix scaling percentage: 6%
- Displayed: 126
- Min/max affix scaling percentage: ~139%
- Displayed: 139
- Displayed after level up: 2911
- Min/max affix scaling percentage: ~3202%
- Displayed: 3202
- Displayed after level up: 67235
- Min/max affix scaling percentage: ~73959%
- Displayed: 73959
- Displayed after level up: 1553126
- Min/max affix scaling percentage: ~1708438%
- Displayed: 1708438
- Displayed after level up: 35877192
- Min/max affix scaling percentage: ~39464912%
- Displayed: 39464912
- Displayed after level up: 828763136
- Min/max affix scaling percentage: ~911639488%
- Displayed: 911639488
- Displayed after level up: -2147483648
The game uses single precision floating point numbers for calculating values, but converts them to 32 bit signed integer values for display on screen.
As you can see the affix value eventually exceeds the largest positive 32 bits integer number (2^31) - 1 = 2147483647
It even exceeds the full range of a 32 bits signed integer, range being -2147483648 to 2147483647 so it just displays the maximum negative number possible, which would be 4294967295 if it were unsigned.