Def (xml) content explanation?

Started by LittleGreenStone, December 09, 2015, 02:12:49 PM

Previous topic - Next topic

LittleGreenStone

I've been trying to modify Defs, and some things are self-explanatory, but some things aren't really.

Is there a site where things are explained?
Or are some things hard-coded?
e.g. I'm trying to add a creature, and so I copied an existing creature's def, and am modifying it now.
What is <baseBodySize>? What does it affect? How do I increase or decrease meat yield? And total "health", the resilience of a creature? Offspring count?
How do I change carrying capacity? Because there's nothing like <carryCapacity> or <meatYield> to find.

Answering these questions would be appreciated, but again, I'm primarily looking for a site, or a downloadable Readme or something, where such things are explained. If there's such a thing.

Thank you!

Jimyoda

I researched this already in order to provide stats on the wiki.
Base meat yield is 90.
Base leather yield is 20.
Multiply those by <baseBodySize> to determine optimum yields. I say 'optimum' because the actual yield depends on the butcher's cooking skill.
A Warg has <baseBodySize> of 1, so normal meat yield is 90 and normal leather/fur yield is 20.
A Hare has <baseBodySize> of 0.2, so normal meat yield is 18 and normal leather/fur yield is 4.

Base body health is 30. That in turn determines how much hit points each body part has, but I can't/won't get into that. The multiplier for health is <baseHealthScale>. A Warg has <baseHealthScale>=1.15 and so 35 (rounded) health and a Hare has <baseHealthScale>=0.5 and so 15 health.

Carrying capacity is determined by the stat we first talked about, <baseBodySize>. The base carrying capacity is 75. So as before, just multiply the creature's <baseBodySize> by 75 to get their carrying capacity. I kinda recall there was a minimum body size to be able to haul.

I don't believe you'll find this already posted elsewhere. I figured this out by studying the xml files and the creature stats until it all became apparent that the game heavily employs base stats and multipliers.

Did that answer all your questions?
Quote from: Rahjital on July 09, 2015, 03:09:55 PM
"I don't like that farmers chop people up."

Obviously she has already played Rimworld :P

Read the wiki. Edit the wiki. Let the wiki be your guide.
http://rimworldwiki.com/

LittleGreenStone

#2
Quote from: Jimyoda on December 09, 2015, 03:05:17 PM
I say 'optimum' because the actual yield depends on the butcher's cooking skill.

Well of course, I am aware of that. Still there must be a number cooking skill increases/decreases -baseBodySize it is.

You've answered most of my questions, except one: Exactly what defines offspring count? Or is it hard-coded?

Thank you for your answers, it has been most useful!

Alistaire

#3
If you're really interested in specific parts of the systems, best way to figure it out is by decompiling the source code. The meaning of "hard-coded" is vague in C# since you can usually overwrite anything anywhere in some way and decompiling the assembly provides you with the exact code or at least a very close representation of it.

Offspring is defined in the creature's race, afaik.
/Core/ThingDefs/races_****.xml contains <litterSizeCurve>. I don't know how it works but this would be a nice opportunity for decompiling source code.

milon

See the link in my signature. I made an auto-documented list of the XML usage for Core.  It won't tell you how everything gets used in each circumstance, but it tracks parents & children etc for each tag.  It's a good start.  Less thorough than decompiling the source, but much easier to access.

LittleGreenStone

Quote from: Alistaire on December 09, 2015, 03:23:50 PM
Offspring is defined in the creature's race, afaik.
/Core/ThingDefs/races_****.xml contains <litterSizeCurve>. I don't know how it works but this would be a nice opportunity for decompiling source code.

I am unsure. For all "dogs" (Yorkshire Terrier, 2-3 offspring - Warg, 1-2 - Labrador - 2, Husky - 2-3) the litterSizeCurve is the same:
           <li>(0.5, 0)</li>
          <li>(1, 1)</li>
          <li>(2, 1.7)</li>
          <li>(3, 0.7)</li>
          <li>(3.5, 0)</li>

I have thought of that, but I can't see how the very same numbers would have different results.

Fluffy (l2032)

#6
I'm not sure how you came to the conclusion that they have different results? As you say, identical values should, in the long term, lead to identical results. Ofcourse, its a probability distribution so in small samples your results may vary.

The curve is a very awkward representation of a weighted selection procedure. The first element in each item is the size of the litter, the second the selection weight for that size. For some reason the halves need to be there to mark the 'boundaries' of the curve, I have no clue who thought that was a good idea, or why.

If you're unsure what weighted selection is, imagine it as a bag of coloured marbles. If red had a weight of 1.5, and blue a weight of .5, you'ld put 15 red marbles in the bag and 5 blue ones. Then draw a marble at random, and thats the colour you use. The litter curve works the same way.

(as a statistician by day, I must say this is perhaps the most convoluted way of representing a distribution I have seen to date, even if it's a discrete distribution.)