Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Nitty-gritty details of how creatures function  (Read 1508 times)

TheFreshPrince

  • Bay Watcher
    • View Profile
Nitty-gritty details of how creatures function
« on: September 30, 2014, 10:17:28 pm »

So I've always wondered what determines how threatening any given creature actually is. In other games for example you can see the exact stats of any given creature and determine exactly what it's capabilities are, obviously I don't want this in DF but it would be really interesting to somehow learn what makes creatures what they are.

Like size for example, what exactly does that correlate to? Increased fat layers for more protection (on bigger creatures)? Speed?

Do creatures have other stats you can view anywhere? Does attack type matter much (as in bites versus claws, etc)?

Do some creatures have "better" teeth/claw attacks inherently, or is the effectiveness of their natural weapons just dictated by the stats powering those weapons like strength and agility?

How can I go over a creature's stats and get the most detailed picture of what defines them, their behaviours and their capabilities?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Nitty-gritty details of how creatures function
« Reply #1 on: September 30, 2014, 10:27:54 pm »

More size means more size, which means more blood, more relative strength and more deadliness. It's a linear stat, sure, but with a bigger coefficient than others.

They do have other stats, in the form of physical and mental attributes.

You could always check out their raws; you can't really see the stats in-game except with DFHack. My scouter script for determining general threat levels is in the DBZ mod, lemme grab it for you...

Code: [Select]
-- Gives power level of selected unit. Type "accurate" for a more linear, but more boring number.

local utils=require('utils')

validArgs = utils.invert({
 'accurate',
 'all',
 'citizens'
})

local args = utils.processArgs({...}, validArgs)

local function unitIsGod(unit)
    local unitraws = df.creature_raw.find(unit.race)
    local casteraws = unitraws.caste[unit.caste]
    local unitclasses = casteraws.creature_class
    for _,class in ipairs(unitclasses) do
        if class.value == "GOD" then return true end
    end
    for _,u_syndrome in ipairs(unit.syndromes.active) do
        local syndrome = df.global.world.raws.syndromes.all[u_syndrome.type]
        for _,synclass in ipairs(syndrome.syn_class) do
            if synclass.value == "GOD" then return true end
        end
    end
    return false
end

--power levels should account for disabilities and such
local function isWinded(unit)
    return unit.counters.winded > 0
end
local function isStunned(unit)
    return unit.counters.stunned > 0
end
local function isUnconscious(unit)
    return unit.counters.unconscious > 0
end
local function isParalyzed(unit)
    return unit.counters2.paralysis > 0
end
local function getExhaustion(unit)
    local exhaustion = 1
    if unit.counters2.exhaustion~=0 then
        exhaustion = 1000/unit.counters2.exhaustion
        return exhaustion
    end
    return 1
end

--blood_max appears to be the creature's body size divided by 10; the power level calculation relies on body size divided by 1000, so divided by 100 it is. blood_count refers to current blood amount, and it, when full, is equal to blood_max.

local function getPowerLevel(saiyan,accurate)
if accurate then
local strength = saiyan.body.physical_attrs.STRENGTH.value/3550
local endurance = saiyan.body.physical_attrs.ENDURANCE.value/1000
local toughness = saiyan.body.physical_attrs.TOUGHNESS.value/2250
local spatialsense = saiyan.status.current_soul.mental_attrs.SPATIAL_SENSE.value/1500
local kinestheticsense = saiyan.status.current_soul.mental_attrs.KINESTHETIC_SENSE.value/1000
local willpower = saiyan.status.current_soul.mental_attrs.WILLPOWER.value/1000
return (strength+endurance+toughness+spatialsense+kinestheticsense+willpower)
else
local strength,endurance,toughness,spatialsense,kinestheticsense,willpower
if saiyan.curse.attr_change then
strength = ((saiyan.body.physical_attrs.STRENGTH.value+saiyan.curse.attr_change.phys_att_add.STRENGTH)/3550)*(saiyan.curse.attr_change.phys_att_perc.STRENGTH/100)
endurance = ((saiyan.body.physical_attrs.ENDURANCE.value+saiyan.curse.attr_change.phys_att_add.ENDURANCE)/1000)*(saiyan.curse.attr_change.phys_att_perc.ENDURANCE/100)
toughness = ((saiyan.body.physical_attrs.TOUGHNESS.value+saiyan.curse.attr_change.phys_att_add.TOUGHNESS)/2250)*(saiyan.curse.attr_change.phys_att_perc.TOUGHNESS/100)
spatialsense = ((saiyan.status.current_soul.mental_attrs.SPATIAL_SENSE.value+saiyan.curse.attr_change.ment_att_add.SPATIAL_SENSE)/1500)*(saiyan.curse.attr_change.ment_att_perc.SPATIAL_SENSE/100)
kinestheticsense = ((saiyan.status.current_soul.mental_attrs.KINESTHETIC_SENSE.value+saiyan.curse.attr_change.ment_att_add.KINESTHETIC_SENSE)/1000)*(saiyan.curse.attr_change.ment_att_perc.KINESTHETIC_SENSE/100)
willpower = ((saiyan.status.current_soul.mental_attrs.WILLPOWER.value+saiyan.curse.attr_change.ment_att_add.WILLPOWER)/1000)*(saiyan.curse.attr_change.ment_att_perc.WILLPOWER/100)
else
strength = saiyan.body.physical_attrs.STRENGTH.value/3550
endurance = saiyan.body.physical_attrs.ENDURANCE.value/1000
toughness = saiyan.body.physical_attrs.TOUGHNESS.value/2250
spatialsense = saiyan.status.current_soul.mental_attrs.SPATIAL_SENSE.value/1500
kinestheticsense = saiyan.status.current_soul.mental_attrs.KINESTHETIC_SENSE.value/1000
willpower = saiyan.status.current_soul.mental_attrs.WILLPOWER.value/1000
end
local exhaustion = getExhaustion(saiyan)
local bodysize = (saiyan.body.blood_count/100)^2
powerlevel = bodysize*((strength*endurance*toughness*spatialsense*kinestheticsense*willpower)^(1/6))*exhaustion
if isWinded(saiyan) then powerlevel=powerlevel/1.2 end
if isStunned(saiyan) then powerlevel=powerlevel/1.5 end
if isParalyzed(saiyan) then powerlevel=powerlevel/5 end
if isUnconscious(saiyan) then powerlevel=powerlevel/10 end
if powerlevel == 1/0 or unitIsGod(saiyan) then
dfhack.gui.showPopupAnnouncement("The scouter broke at this incredible power. Either the power belongs to a god... or it's immeasurable.",1)
qerror("Scouter broke! Oh well, there are more.",11)
end
return math.floor(powerlevel)
end
end

if args.all then
for k,v in ipairs(df.global.world.units.active) do
print(dfhack.TranslateName(dfhack.units.getVisibleName(v))..' has a power level of '..getPowerLevel(v,args.accurate))
end
elseif args.citizens then
for k,v in ipairs(df.global.world.units.active) do
if dfhack.units.isCitizen(v) then
print(dfhack.TranslateName(dfhack.units.getVisibleName(v))..' has a power level of '..getPowerLevel(v,args.accurate))
end
end
else
dfhack.gui.showPopupAnnouncement("The scouter says " .. getPowerLevel(dfhack.gui.getSelectedUnit(silent),args.accurate) .. "!",11)
end

The "accurate" thing is a bit of a misnomer, as it's mostly just a way to check for eligibility for super saiyans (I.E an extremely small usage, mostly made for myself). Try it out.

TheFreshPrince

  • Bay Watcher
    • View Profile
Re: Nitty-gritty details of how creatures function
« Reply #2 on: October 01, 2014, 02:57:03 pm »

I have no idea what that code you posted means, but ty anyways for the reply :p

So I can see the raws in the wiki, but as far as I can tell all creatures seem to have the same or very similar attacks

[ATTACK:BITE:CHILD_BODYPART_GROUP:BY_CATEGORY:HEAD:BY_CATEGORY:TOOTH]
      [ATTACK_SKILL:BITE]
      [ATTACK_VERB:bite:bites]
      [ATTACK_CONTACT_PERC:100]
      [ATTACK_PENETRATION_PERC:100]
      [ATTACK_FLAG_EDGE]
      [ATTACK_PREPARE_AND_RECOVER:3:3]
      [ATTACK_PRIORITY:MAIN]
      [ATTACK_FLAG_CANLATCH]
   [ATTACK:SCRATCH:CHILD_TISSUE_LAYER_GROUP:BY_TYPE:STANCE:BY_CATEGORY:ALL:NAIL]
      [ATTACK_SKILL:STANCE_STRIKE]
      [ATTACK_VERB:scratch:scratches]
      [ATTACK_CONTACT_PERC:100]
      [ATTACK_PENETRATION_PERC:100]
      [ATTACK_FLAG_EDGE]
      [ATTACK_PREPARE_AND_RECOVER:3:3]
      [ATTACK_PRIORITY:SECOND]
      [ATTACK_FLAG_BAD_MULTIATTACK]


That's a dog's natural weapon statistics, but most of the other creatures I have looked at have the exact same stats, the contact_perc is always 100 and if present the penetration_perc is always 100 (what's the difference between these two anyways?). So is it just a creature's size in conjunction with these contact/penetration perc stats that decides how hard a creature's attack hits?

Does anything determine accuracy or attack speed that is viewable? Like this perhaps [ATTACK_PREPARE_AND_RECOVER:3:3]?

And what does this mean [ATTACK_FLAG_BAD_MULTIATTACK]?
« Last Edit: October 01, 2014, 03:02:27 pm by TheFreshPrince »
Logged

smjjames

  • Bay Watcher
    • View Profile
Re: Nitty-gritty details of how creatures function
« Reply #3 on: October 01, 2014, 03:03:52 pm »

And what does this mean [ATTACK_FLAG_BAD_MULTIATTACK]?

Just means that you get a penalty for attacking via dual weilding.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Nitty-gritty details of how creatures function
« Reply #4 on: October 01, 2014, 03:10:09 pm »

No, it means that you cannot multiattack. Dual-wielding is just one part of multiattacks, you can do it with body parts too. What that basically means in this case is that you can't kick with both feet at the same time. The AI won't use multiattacks at all in most cases AFAIK except for hydras, who are scary as hell due to it.

Slogo

  • Bay Watcher
    • View Profile
Re: Nitty-gritty details of how creatures function
« Reply #5 on: October 01, 2014, 03:58:38 pm »

That's a dog's natural weapon statistics, but most of the other creatures I have looked at have the exact same stats, the contact_perc is always 100 and if present the penetration_perc is always 100 (what's the difference between these two anyways?). So is it just a creature's size in conjunction with these contact/penetration perc stats that decides how hard a creature's attack hits?

Some speculation so be cautious taking it at first value...

Contact is the area of contact and penetration is how well the attack penetrations (uh better explanation ahead).

Low contact areas indicate a piercing attack while higher contact areas (> or >= to 50 I think) indicate a slashing or broader hit attack. I believe, but am not sure, that larger contact areas means a successful attack is more likely to severe while a lower contact area means the blow is more concentrated and is more likely to get through armor/hides. Though I'm not sure what a lower contact area means for pulping or anything on blunt attacks, but I do believe higher means more pulping chance if you're swinging the weapon hard enough to cause damage.

Penetration depth is an indication of how deep the strike will go. The higher it is the deeper the cut. I don't think it affects what materials a weapon can get through, but I do think it affects your ability to pierce through to internal organs or "the good stuff" with attacks. So weapons with a lower penetration won't hit the internal organs of larger beasts for example (the attacks won't go deep enough). So, if I understand correctly penetration depth is how/why a spear can strike a giant beast's heart, but a dagger is less likely to do the same. But for something like a humanoid the organs are so 'close' that penetration depth matters less I think except maybe in the case of multiple layers of armors to penetrate.

In the case of the raws specifically I'm not sure how/if those values get translated at all based on creature size or other factors (they may). What I think the RAWS are specifying though is that 100% of the teeth will go in and 100% of the teeth will contact the target on an attack.
« Last Edit: October 01, 2014, 04:06:59 pm by Slogo »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Nitty-gritty details of how creatures function
« Reply #6 on: October 01, 2014, 04:02:57 pm »

They are.

TheFreshPrince

  • Bay Watcher
    • View Profile
Re: Nitty-gritty details of how creatures function
« Reply #7 on: October 01, 2014, 11:27:37 pm »

Hmm, very interesting.

Is there any way to tell how hard a creature's blows are going to hit, as well as how strong and agile/evasive it is?
Logged

Findulidas

  • Bay Watcher
  • [NATURAL_SKILL:OFFTOPIC:5][NOTHOUGHT]
    • View Profile
Re: Nitty-gritty details of how creatures function
« Reply #8 on: October 02, 2014, 05:08:05 am »

Hmm, very interesting.

Is there any way to tell how hard a creature's blows are going to hit, as well as how strong and agile/evasive it is?

I remember there being some force multiplier that you could attach to the raw attacks which increased it. Agility and strength are attributes and the points after show the likely way they are distributed. Increasing strength by a lot can give you impressive results such as a dwarf punching another and the game tells you the head explodes into unrecognizable gore.
Logged
...wonderful memories of the creeping sense of dread...

khearn

  • Bay Watcher
    • View Profile
Re: Nitty-gritty details of how creatures function
« Reply #9 on: October 02, 2014, 01:22:37 pm »

Nobody but Toady One (and possibly Threetoes) knows all of the details of how everything works (and he may have forgotten a bunch of it). Quietust has figured out an awful lot by decompiling the binaries and digging through them, but most of the rest of us are just going by guesswork, or remembering something we read some time ago, which may or may not be applicable to the current release. Some science has been done on various aspects, but exact details of how everything works together are pretty much unknown.

People in the modding forums might have figured out more details about what the various things in the raw do and how they work together, since they have more experience with modifying creatures and creating new ones.
Logged
Have them killed. Nothing solves a problem quite as effectively as simply having it killed.