Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 4 5 [6] 7 8 ... 10

Author Topic: Modding material properties vs. how the properties are used by the game[0.34.11]  (Read 25804 times)

Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #75 on: February 16, 2014, 04:12:15 pm »

Fair enough. I presume when you say non-solid you are also counting SOLID_POWDER and similar? I say this because SOLID_POWDER has bits breaking off with every attack also.
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

This is not a link

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #76 on: February 16, 2014, 05:33:59 pm »

Unless you'd call a pile of sand a solid object, yes.

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #77 on: February 17, 2014, 01:38:34 am »

Updated my combat calculator lua script to include creature body parts. Since we can't currently see the ATTACK data, I can't do teeth/horns/etc., but just assume that stances and grasps are attacks.

Code: (combat.lua) [Select]
--Calculates combat info for weapons/armor. Alpha version!

--Future goal is to calculate info for body part weapons (using attack info), wounded tissue layers
--ranged weapons
--misc objects?

unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting!")
return
end

print("Creature size (base/current): ", unit.body.size_info.size_base, unit.body.size_info.size_cur)
print("Creature strength (base): ", unit.body.physical_attrs.STRENGTH.value) --should update to use curse strengths etc.
print(" ")

for k,v in pairs(unit.inventory) do

--print(v.mode)
--enum-item Hauled 0
--enum-item Weapon 1
--enum-item Worn 2
--enum-item InBody 3
--enum-item Flask 4
--enum-item WrappedAround 5
--enum-item StuckIn 6
--enum-item InMouth 7
--enum-item Shouldered 8
--enum-item SewnInto 9

vitype=df.item_type[v.item:getType()]
print(vitype)
material=dfhack.matinfo.decode(v.item)
matdata=material.material.strength
vmatname=material.material.state_name.Solid
--print(vmatname, v.item.subtype.name) --WOULD ENABLE THIS BUT BUG ON QUIVERS, OTHER ITEMS W/O SUBTYPES!

vbpart=unit.body.body_plan.body_parts[v.body_part_id]
print(vbpart.name_singular[0].value)

if vitype=="WEAPON" then
print(vmatname, v.item.subtype.name)
v.item:calculateWeight()
effweight=unit.body.size_info.size_cur/100+v.item.weight*100+v.item.weight_fraction/10000
actweight=v.item.weight*1000+v.item.weight_fraction/1000
if v.item.subtype.flags.HAS_EDGE_ATTACK==true then
print("shear yield, shear fracture: ", matdata.yield.SHEAR, matdata.fracture.SHEAR)
print("Sharpness: ", v.item.sharpness)
end
print("NAME", "EDGE", "CONTACT", "PNTRT", "WEIGHT", "VEL", "MOMENTUM(+100%/-50%)")
for kk,vv in pairs(v.item.subtype.attacks) do
vvel=unit.body.size_info.size_base * unit.body.physical_attrs.STRENGTH.value *

vv.velocity_mult/1000/effweight/1000
vmom=vvel*actweight/1000+1
vedge="blunt"
vcut=""
if vv.edged==true then
vedge="edged"
vcut=100
end
print(vv.verb_2nd, vedge, vv.contact, vv.penetration, actweight/1000, math.floor(vvel), math.floor(vmom))
end
actvol=v.item:getVolume()
print("Blunt deflect if layer weight more than:", actvol * matdata.yield.IMPACT / 100 / 500)

end


if vitype=="ARMOR" or vitype=="HELM" or vitype=="GLOVES" or vitype=="SHOES" or vitype=="PANTS" then
print(vmatname, v.item.subtype.name)
actvol=v.item:getVolume()
v.item:calculateWeight()
actweight=v.item.weight*1000+v.item.weight_fraction/1000
vbca=actvol*matdata.yield.IMPACT/100/500/10
vbcb=actvol*(matdata.fracture.IMPACT-matdata.yield.IMPACT)/100/500/10
vbcc=actvol*(matdata.fracture.IMPACT-matdata.yield.IMPACT)/100/500/10
deduct=vbca/10
if matdata.strain_at_yield.IMPACT >= 50000 or v.item.subtype.props.flags.STRUCTURAL_ELASTICITY_WOVEN_THREAD==true or

v.item.subtype.props.flags.STRUCTURAL_ELASTICITY_CHAIN_METAL==true or v.item.subtype.props.flags.STRUCTURAL_ELASTICITY_CHAIN_ALL==true

then
vbcb=0
vbcc=0
end
print("Full contact blunt momentum resist: ", math.floor(vbca+vbcb+vbcc))
print("Contact 10 blunt momentum resist: ", math.floor((vbca+vbcb+vbcc)*10/actvol))
print("Unbroken momentum deduction (full,10): ", math.floor(deduct), math.floor(deduct*10/actvol))
print("Volume/contact area/penetration: ", actvol)
print("Weight: ", actweight/1000)
vshyre=matdata.yield.SHEAR
vshfre=matdata.fracture.SHEAR
if v.item.subtype.props.flags.STRUCTURAL_ELASTICITY_WOVEN_THREAD==true and vmatname ~= "leather" then
if vshyre>20000 then vshyre=20000 end
if vshfre>30000 then vshfre=30000 end
end
print("shear yield, shear fracture: ", vshyre, vshfre)
end

print(" ")
end    --end of unit inventory loop


--printall(unit.body.body_plan.attacks) --wait for next DFHack version?
--print(" ")

print("BODY PART ATTACKS (some assumptions!)")
print("NAME", " ", "SIZE", "CONTACT", "PNTRT", "WEIGHT", "VEL", "MOMENTUM(+100%/-50%)")
for k,v in pairs(unit.body.body_plan.body_parts) do
if v.flags.STANCE==true or v.flags.GRASP==true then
--ASSUME THAT ALL GRASP/STANCE PARTS ARE COMBAT
partsize = math.floor(unit.body.size_info.size_cur * v.relsize / unit.body.body_plan.total_relsize)
contact = math.floor(partsize ^ 0.666)
partweight = math.floor(partsize * 500 / 100) --bone, change to 8250 for bronze colossus etc.
vvel = 100 * unit.body.physical_attrs.STRENGTH.value / 1000 --some assumptions
vmom = vvel * partweight / 1000 + 1
print(v.name_singular[0].value, partsize, contact, partsize, partweight/1000, vvel, vmom)
end
end


An amusing footnote is that organic creature punches and kicks use the "bone" material of the hand/foot for attack purposes. This also determines the part weight during combat, so unless your hand is made of a single material, it will hit with a different weight than you'd see if you severed the hand and examined it. Fingers, gloves, and gauntlets don't count for anything. Not only do heavy/large body parts hit for more momentum, there is no penalty in the "swing speed" or "vel" for doing so. Giant sponges "push" with their single massive body part. Since body part sizes/weights don't benefit melee (equipped) weapon usage, a giant or colossus will do far more damage with its natural attacks than it will with any equipped weapon.

scamtank

  • Bay Watcher
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #78 on: March 09, 2014, 11:47:39 am »

Never stop doing good things, Urist.

I've finally started looking at these equations to plan stuff and I'm a little stumped by the momentum deduction thing. What does "max(shear cost 1, blunt cost 1)" mean?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #79 on: March 09, 2014, 11:52:56 am »

Shear cost 1 or blunt cost 1 is used, whichever is higher.

Melting Sky

  • Bay Watcher
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #80 on: April 04, 2014, 02:47:09 am »

Very interesting read. Nice work. I'll have to come back to this when I have a little more time.
« Last Edit: April 04, 2014, 03:25:23 am by Melting Sky »
Logged

Melting Sky

  • Bay Watcher
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #81 on: April 04, 2014, 03:00:53 am »

An amusing footnote is that organic creature punches and kicks use the "bone" material of the hand/foot for attack purposes. This also determines the part weight during combat, so unless your hand is made of a single material, it will hit with a different weight than you'd see if you severed the hand and examined it. Fingers, gloves, and gauntlets don't count for anything. Not only do heavy/large body parts hit for more momentum, there is no penalty in the "swing speed" or "vel" for doing so. Giant sponges "push" with their single massive body part. Since body part sizes/weights don't benefit melee (equipped) weapon usage, a giant or colossus will do far more damage with its natural attacks than it will with any equipped weapon.

In a way it does sort of makes sense that an absolutely massive titan sized creature would do far more damage simply buy punching you than hitting you with a relatively tiny weapon. It would be a bit like if a person came up and punched you vs trying to beat you to death with a tooth pick rather than a proper sized staff. The punch would do more damage simply because the weapon's size is so mismatched with the wielder that they couldn't get the proper leverage on it to deliver the full power of the blow through the tiny toothpick. I do see what you are getting at, though. A large man leaning his weight into a blow with a long sword would do more damage than a smaller man doing the same thing or how a fist with a 5lb iron gauntlet on it would deliver a more powerful blow than an ungloved fist.

As for a large heavy body part not suffering a velocity penalty, creatures tend to develop sufficient musculature to compensate for the weight of their limbs. In other words, a big heavy man's leg will naturally be stronger than a thin light man's leg simply because it has adapted to carrying his weight over the course of his life. A man with shorter, lighter arms can generally punch at a faster rate than a big, long armed and heavy muscled man but the speed at which their firsts are actually traveling aren't that different. The taller, heavier man with the longer arms simply has a longer distance over which his fist must travel before reaching full extension. Similarly a man with very long legs will sprint with less strides per minute than a shorter man but can usually run as fast or faster than the shorter man of the same fitness. The actual velocity at which the tall man's feet are moving isn't less than that of the short man's. If anything it will actually tend to be higher. Taking this to an extreme a mythical giant might only take a single step every ten seconds or so but that stride would cover half a football field. His foot would actually be traveling very quickly, he just wouldn't be taking many strides per minute.

Hmmm, your discovery concerning natural attacks has given me a hilarious idea. I wonder how hard it would be to mod in platinum bones for all creatures.
« Last Edit: April 04, 2014, 04:06:56 am by Melting Sky »
Logged

Hugo_The_Dwarf

  • Bay Watcher
  • Modding Mentor
    • View Profile
    • Regeneration: Forced Evolution
Re: Modding material properties vs. how the properties are used by the game
« Reply #82 on: April 04, 2014, 08:55:56 am »

...

Hmmm, your discovery concerning natural attacks has given me a hilarious idea. I wonder how hard it would be to mod in platinum bones for all creatures.
by make them platinum you mean just the solid density (aka weight?) you can just change the bone_template for materials to have bone as heavy has platinum all the time, it will then quickly transfer to all bone bearing creatures.
Logged

Melting Sky

  • Bay Watcher
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #83 on: April 04, 2014, 02:27:10 pm »

...

Hmmm, your discovery concerning natural attacks has given me a hilarious idea. I wonder how hard it would be to mod in platinum bones for all creatures.
by make them platinum you mean just the solid density (aka weight?) you can just change the bone_template for materials to have bone as heavy has platinum all the time, it will then quickly transfer to all bone bearing creatures.

That's a nice elegantly simple solution, thanks. It's not quit the same as actually turning their bone's to platinum but as far as combat goes it will work great.
Logged

Hugo_The_Dwarf

  • Bay Watcher
  • Modding Mentor
    • View Profile
    • Regeneration: Forced Evolution
Re: Modding material properties vs. how the properties are used by the game
« Reply #84 on: April 04, 2014, 03:09:43 pm »

well if you really wanted to inject platinum bones, make a custom Tissue_Template that is a copy of the BONE_TEMPLATE however instead of [TISSUE_MATERIAL:LOCAL_CREATURE_MAT:BONE] change it to INORGANIC:PLATINUM
Add in your new tissue in the STANDARD_TISSUES body detail plan "[ADD_TISSUE:PLAT:PLAT_BONE_TEMPLATE]"
then change the VERTEBRAE_TISSUE_LAYERS body detail plan and overwrite all  ARG4:# with PLAT:#

done now all creatures that use those two body detail plans have platinum for bones
Logged

Melting Sky

  • Bay Watcher
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #85 on: April 06, 2014, 12:02:05 am »

well if you really wanted to inject platinum bones, make a custom Tissue_Template that is a copy of the BONE_TEMPLATE however instead of [TISSUE_MATERIAL:LOCAL_CREATURE_MAT:BONE] change it to INORGANIC:PLATINUM
Add in your new tissue in the STANDARD_TISSUES body detail plan "[ADD_TISSUE:PLAT:PLAT_BONE_TEMPLATE]"
then change the VERTEBRAE_TISSUE_LAYERS body detail plan and overwrite all  ARG4:# with PLAT:#

done now all creatures that use those two body detail plans have platinum for bones

Thank you for that. :)
I am quite new to modding so I know very little about it and it would have likely taken me quite a while to figure it out on my own. I was lured into the modding part of the forum from a foreign weapons thread and now I find myself unable to leave this fascinating place. Modding is quite addictive.
Logged

Zorbeltuss

  • Bay Watcher
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #86 on: April 15, 2014, 08:13:26 am »

I'm assuming that whips use their full weight to add to their momentum unlike a real flexible weapon would use. Is this correct?

/Zorbeltuss
Logged
Kun hölmöllä on moottorisaha, jokainen häviää. / Kaikki jotuvat tappiolle kun hölmöllä on moottorisaha.

scamtank

  • Bay Watcher
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #87 on: April 15, 2014, 08:59:45 am »

Well, yeah. Vanilla whips behave more like magic picks with supernatural momentum.
Logged

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #88 on: April 15, 2014, 09:07:19 am »

I'm assuming that whips use their full weight to add to their momentum unlike a real flexible weapon would use. Is this correct?

Correct.

The real killer though is that the contact area stays small throughout the thickness of the hit (like an edged stab wound). A thin blunt weapon IRL would not "chip" bones, as the contact area would expand conically with depth. No chipping on leg bones at least - fingers might chip because of thinner tissue covering the bone.

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: Modding material properties vs. how the properties are used by the game
« Reply #89 on: April 18, 2014, 01:30:20 pm »

Updated the combat script to consider non-weapon items held in the hands as misc weapons:
Code: (combat.lua) [Select]
--Calculates combat info for weapons/armor. Alpha version!

--Future goal is to calculate info for body part weapons (using attack info), wounded tissue layers
--ranged weapons


unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting!")
return
end

print("Creature size (base/current): ", unit.body.size_info.size_base, unit.body.size_info.size_cur)
print("Creature strength (base): ", unit.body.physical_attrs.STRENGTH.value) --should update to use curse strengths etc.
print(" ")

for k,v in pairs(unit.inventory) do

--print(v.mode)
--enum-item Hauled 0
--enum-item Weapon 1
--enum-item Worn 2
--enum-item InBody 3
--enum-item Flask 4
--enum-item WrappedAround 5
--enum-item StuckIn 6
--enum-item InMouth 7
--enum-item Shouldered 8
--enum-item SewnInto 9

vitype=df.item_type[v.item:getType()]
print(vitype)
material=dfhack.matinfo.decode(v.item)
matdata=material.material.strength
vmatname=material.material.state_name.Solid
--print(vmatname, v.item.subtype.name) --WOULD ENABLE THIS BUT BUG ON QUIVERS, OTHER ITEMS W/O SUBTYPES!

vbpart=unit.body.body_plan.body_parts[v.body_part_id]
print(vbpart.name_singular[0].value)

if vitype=="WEAPON" then
print(vmatname, v.item.subtype.name)
v.item:calculateWeight()
effweight=unit.body.size_info.size_cur/100+v.item.weight*100+v.item.weight_fraction/10000
actweight=v.item.weight*1000+v.item.weight_fraction/1000
if v.item.subtype.flags.HAS_EDGE_ATTACK==true then
print("shear yield, shear fracture: ", matdata.yield.SHEAR, matdata.fracture.SHEAR)
print("Sharpness: ", v.item.sharpness)
end
print("NAME", "EDGE", "CONTACT", "PNTRT", "WEIGHT", "VEL", "MOMENTUM(+100%/-50%)")
for kk,vv in pairs(v.item.subtype.attacks) do
vvel=unit.body.size_info.size_base * unit.body.physical_attrs.STRENGTH.value *

vv.velocity_mult/1000/effweight/1000
vmom=vvel*actweight/1000+1
vedge="blunt"
vcut=""
if vv.edged==true then
vedge="edged"
vcut=100
end
print(vv.verb_2nd, vedge, vv.contact, vv.penetration, actweight/1000, math.floor(vvel), math.floor(vmom))
end
actvol=v.item:getVolume()
print("Blunt deflect if layer weight more than:", actvol * matdata.yield.IMPACT / 100 / 500)

else
if v.mode==1 then
--item held in hands treated as misc weapon
--1000 velocity mod, power math for contact and penetration
print(vmatname, "(misc weapon)") --v.item.subtype.name quiver bug
actvol=v.item:getVolume()
v.item:calculateWeight()
actweight=v.item.weight*1000+v.item.weight_fraction/1000
effweight=unit.body.size_info.size_cur/100+v.item.weight*100+v.item.weight_fraction/10000
misccontact=math.floor(actvol ^ 0.666)
miscpene=math.floor((actvol*10000) ^ 0.333)
print("NAME", "EDGE", "CONTACT", "PNTRT", "WEIGHT", "VEL", "MOMENTUM(+100%/-50%)")
vvel=unit.body.size_info.size_base * unit.body.physical_attrs.STRENGTH.value/effweight/1000
vmom=vvel*actweight/1000+1
vedge="blunt"
print("strike", vedge, misccontact, miscpene, actweight/1000, math.floor(vvel), math.floor(vmom))
print("Blunt deflect if layer weight more than:", actvol * matdata.yield.IMPACT / 100 / 500)
print(" ")
end
end


if vitype=="ARMOR" or vitype=="HELM" or vitype=="GLOVES" or vitype=="SHOES" or vitype=="PANTS" then
print(vmatname, v.item.subtype.name)
actvol=v.item:getVolume()
v.item:calculateWeight()
actweight=v.item.weight*1000+v.item.weight_fraction/1000
vbca=actvol*matdata.yield.IMPACT/100/500/10
vbcb=actvol*(matdata.fracture.IMPACT-matdata.yield.IMPACT)/100/500/10
vbcc=actvol*(matdata.fracture.IMPACT-matdata.yield.IMPACT)/100/500/10
deduct=vbca/10
if matdata.strain_at_yield.IMPACT >= 50000 or v.item.subtype.props.flags.STRUCTURAL_ELASTICITY_WOVEN_THREAD==true or

v.item.subtype.props.flags.STRUCTURAL_ELASTICITY_CHAIN_METAL==true or v.item.subtype.props.flags.STRUCTURAL_ELASTICITY_CHAIN_ALL==true

then
vbcb=0
vbcc=0
end
print("Full contact blunt momentum resist: ", math.floor(vbca+vbcb+vbcc))
print("Contact 10 blunt momentum resist: ", math.floor((vbca+vbcb+vbcc)*10/actvol))
print("Unbroken momentum deduction (full,10): ", math.floor(deduct), math.floor(deduct*10/actvol))
print("Volume/contact area/penetration: ", actvol)
print("Weight: ", actweight/1000)
vshyre=matdata.yield.SHEAR
vshfre=matdata.fracture.SHEAR
if v.item.subtype.props.flags.STRUCTURAL_ELASTICITY_WOVEN_THREAD==true and vmatname ~= "leather" then
if vshyre>20000 then vshyre=20000 end
if vshfre>30000 then vshfre=30000 end
end
print("shear yield, shear fracture: ", vshyre, vshfre)
end

print(" ")
end    --end of unit inventory loop


--printall(unit.body.body_plan.attacks) --wait for next DFHack version?
--print(" ")

print("BODY PART ATTACKS (some assumptions!)")
print("NAME", " ", "SIZE", "CONTACT", "PNTRT", "WEIGHT", "VEL", "MOMENTUM(+100%/-50%)")
for k,v in pairs(unit.body.body_plan.body_parts) do
if v.flags.STANCE==true or v.flags.GRASP==true then
--ASSUME THAT ALL GRASP/STANCE PARTS ARE COMBAT
partsize = math.floor(unit.body.size_info.size_cur * v.relsize / unit.body.body_plan.total_relsize)
contact = math.floor(partsize ^ 0.666)
partweight = math.floor(partsize * 500 / 100) --bone, change to 8250 for bronze colossus etc.
vvel = 100 * unit.body.physical_attrs.STRENGTH.value / 1000 --some assumptions
vmom = vvel * partweight / 1000 + 1
print(v.name_singular[0].value, partsize, contact, partsize, partweight/1000, vvel, vmom)
end
end


So now you can check the combat data for shields, socks, crutches, etc.

This is currently not able to give data for:
- Stabbing someone with arrows/bolts in melee
- Using a tool that has an attack (i.e. knives)
- Shooting with a ranged weapon
- Throwing an object

As previously mentioned, some averaging assumptions had to be made, and circumstantial bonuses/penalties are neglected.
Pages: 1 ... 4 5 [6] 7 8 ... 10