Hi, I've encountered something odd concerning attributes in both adventure mode and fortress mode. I'm aware that the attribute caps are much higher than in vanilla but there's an inconsistency going on with certain attribute caps, namely Agility and Toughness (possibly more but I haven't encountered any issue with the others as of now).
The cap values for these attributes are either vanilla-like or just as they would be for a dragon ball character. For instance, in fortress mode, I have 19 saiyan units and 6 of them have an agility cap that's dbz tier, the highest cap being at 17.9 million and the lowest (in their category) being at 2.8 million.
The 13 other units have their agility cap between about 6k and 7k, pretty much like in vanilla. The toughness attribute cap goes through the exact same thing.
The Strength cap appears to be 100k for all units, normal I guess?
Is there something wrong or is everything working as intended?
Edit: After a couple days things got clearer. In vanilla dwarf fortress your units can increase their attributes up to 2x their initial value, in this mod's files, it's set up to 10,000x on specific attributes, strength goes up to 1,000x normally but strength is capped at 100,000 units for fixing reasons (I don't quite get that decision and I'd be nice to hear about it because the 1,000x scaling works fine unlike the 10,000x one which I'm about to get into).
IE: if an unit spawns with 2,050 Agility, it'll have 20,500,000 as its max Agility (10,000x modifier).
Problem: If an unit starts with a value over 2,147 in an attribute with a 10,000x modifier, the attribute cap is reset (which makes 21,470,000 the highest possible attribute cap when an unit is created in this context).
IE: unit spawns with 4,250 toughness, gets 6,500 toughness cap
My observations:
It's possible to make an attribute cap much higher than 21,470,000 via a dfhack script through a simple assignation ([...].AGILITY.max_value=50,000,000), so the variable type is adequate. The way in which the error happens is akin to an overflow and 21,470,000 looks somewhat like 2,147,483,647 (32-bit signed integer's max positive value). An interesting fact is that the Attribute Cap modifier is actually set as a percentage, so 10,000x becomes 1,000,000%. It's possible to have a signed 32 bit integer overflow while calculating the attribute cap perc : attribute_cap_perc = starting_attribute_value * cap_percentage
if you take 2,148 as the starting attribute value and 1,000,000 as cap percentage:
- 2,148 * 1,000,000
- 2,148,000,000 -- overflow
I guess that's an issue with the game itself, but it's possible to accommodate the mod to the problem, I'll be looking into proposing a fix for it since I've got time.
This was all done on DF/Hack 0.47.04-r1
Here:
https://github.com/Nasfuture75/SPARKING-Dwarf-Fortress-DBZ-mod/releases/tag/1.4.1-Overflow_Workaround_UNOFFICIALRequires a new world.