Work Amounts

Started by SheiFoxy, May 08, 2017, 05:38:38 AM

Previous topic - Next topic

SheiFoxy

This is driving me crazy. Trying to mod the amount of work it takes to build certain things (granite wall) for example, and I'm running into an issue with the numbers. They don't make a lick of sense to me. :)
Can anyone help me understand how the work amount numbers actually work? I found that if I compare them as ratios, the math doesn't hold up, and if I reduce them to the numbers I want in game, I don't get the result expected. If I reduce them too low, in fact, it breaks the game. I know there's gotta be some math here I'm missing so I hope someone understands this better than I do!
SheiFoxy's Mods on Steam Workshop
SF Grim Reality ⚝ SF Materials Rebalanced ⚝ SF Traits Expansion ⚝ SF Cave Life

Zhentar

In the def XML, WorkAmount is the number of ticks required at 100% work speed. In game, the displayed work amount is the number of real seconds (at 1x game speed) required at 100% work speed. Since there are 60 ticks per real second, the in game displayed work amount is Def WorkAmount divided by 60.

SheiFoxy

Thank you SO MUCH.

Now I have to figure out why when I change it to 60, it's not displaying as 1 in game. >_<
SheiFoxy's Mods on Steam Workshop
SF Grim Reality ⚝ SF Materials Rebalanced ⚝ SF Traits Expansion ⚝ SF Cave Life

Zhentar

If you're using stuff, the stuff applies a factor to the work amount

SheiFoxy

Stuff such as... granite?
Thus, there's a factor I need to find in granite's variables for work amount?
SheiFoxy's Mods on Steam Workshop
SF Grim Reality ⚝ SF Materials Rebalanced ⚝ SF Traits Expansion ⚝ SF Cave Life

jamaicancastle

Quote from: SheiFoxy on May 08, 2017, 08:23:51 PM
Stuff such as... granite?
Thus, there's a factor I need to find in granite's variables for work amount?

"Stuff" is the technical term for the system the game uses to build objects out of different materials. For instance, you've no doubt noticed that there's one Wall def, but you can build wooden walls, stone walls, steel walls, etc. with different stats.

To generate those stats, the game uses data found in the def of the material used. Most of these can be found in ThingDefs_Items/Items_Resource_Stuff; stone is for whatever reason found in ThingDefs_Misc/Various_Stone. Towards the bottom of the def (usually) you'll find a <stuffProps> tag. Inside of that, along with some other data like the color of things made with that material, you'll find <statOffsets> and <statFactors>.

When the game builds or encounters an object made with a stuff, it adjusts that object's stats according to the statOffsets and statFactors. StatFactors are multiplicative; a value of 2.0 will double the stat, 0.5 will halve it, and so forth. StatOffsets are additive; the value is added directly onto the stat (after multiplying, I think, but I'm not 100% sure).

The relevant stat in this case is WorkToBuild. You can see in the base stone def that most stone buildings take 6x as much work as normal, plus 140 ticks. Sandstone objects are 5x as much, marble 5.5x. Granite doesn't have a specific value, so it uses the default.

If you adjust WorkToBuild, you should see the change in all objects built with that type of material (walls, doors, etc.). Note however that WorkToBuild only covers built objects from the Architect menu; made objects from workbenches use (logically) the WorkToMake factor.

SheiFoxy

Thank you so much!
I figured it out and found the stuff I needed to edit. Now I'm just tweaking numbers to find the right balance.
Thanks so much for explaining the statfactors vs statoffsets. I needed to know this stuff!

Ty ty ty
SheiFoxy's Mods on Steam Workshop
SF Grim Reality ⚝ SF Materials Rebalanced ⚝ SF Traits Expansion ⚝ SF Cave Life