Bay 12 Games Forum

Dwarf Fortress => DF Modding => Topic started by: Urist Da Vinci on April 17, 2012, 09:09:44 am

Title: Knockdown (propelled by the blow!) SCIENCE
Post by: Urist Da Vinci on April 17, 2012, 09:09:44 am
I set out to find an explanation of the game mechanics behind "X is propelled away by the force of the blow!" and made some discoveries. Comments or additional information would be appreciated. I put this on the modding forum because the knockback mechanic is too weak to be practical for most fort/adventure players, but you guys might want to create knockback creatures and weapons.

1. Law of cartoon motion
Objects in flight stay at the same elevation and velocity until they run out of momentum, at which point they fall straight down. This may change with soon-to-come updates (parabolic minecart paths).

2. Conservation of momentum
Regardless of the source of the impulse, the distance a creature is propelled is related to its own weight. Most fleshy creatures have similar density, so we can use size instead of finding the weight. If a bronze colossus can kick a dwarf 2 tiles, it can kick a dog 4 tiles, a badger 8 tiles, or a albatross 15 tiles.

60000 x 2 = 30000 x 4 = 15000 x 8 = 8000 x 15 = 120000.

3. Terminology
Many players refer to units of distance or weight in the game as "Urists". Since momentum is mass x velocity, the units would be Urists^2/tick, which is a mouthful. From now on I am going to refer to these units as "Moruls", in honour of the Orc-golfing dwarf of forum legend. In the above example, the bronze colossus kick is 120000 moruls.

4. Minimum distance corollary
The bronze colossus in the above example can't propel anything larger than size 120000 with a kick, since the distance would become less than 1 and the game appears to round distance down. This is true regardless of the source of the impulse.

5. Crossbow modding
If you mod the [SHOOT_FORCE:1000] and [SHOOT_MAXVEL:1000] of a crossbow to 1000000 each, the impulse delivered to the target is around 350000 moruls (there is some random variation). This does scale linearly with changes to the force or maxvel, but is independant of the bolt weight. It appears that heavy bolts and light bolts have the same momentums when launched, but different velocities.

6. Maximum distance cap
All forms of knockback/propelling are capped at a maximum distance of 50 tiles, except for the Throwing wrestling move which appears unlimited.

7. Throwing (wrestling move)
Bronze colossuses can throw creatures at about 11000000 moruls, enough to throw a dwarf 183 tiles. Throwing appears to scale linearly with creature size, as a dwarf can throw a cat 6 tiles or a chicken 11 tiles (33000 = 11000000 * 20000000/60000). Throwing doesn't appear to change with the thrower's density or weight. Throwing doesn't scale with the size of your hands.

8. Chunky salsa rule
Following from step 7 experiments, the following effects were noted when a bronze colossus threw various creatures:
a) hippo-stunned but alive
b) saltwater crocodile-suffered falling damage "takes the full force of the impact"
c) cow-limb seperation instant death "slams into an obstacle and blows apart!"

Similar tests with a Troll throwing kea, chicken, cat, albatross, and badger suggest that if a creature is propelled a distance of 10 or less tiles, it is stunned but unharmed, whereas 11-20 tiles causes falling damage. If a creature was going to be tossed over 20 tiles distance, but a wall intervened, it will blow apart.

9. Punching/kicking
Punching and kicking appears to scale linearly with the weight of the body part used as a weapon. If a creature can propel someone 21 tiles with a normal right hand, a left hand 10x smaller will propel them 2 tiles. The relationship between creature size and kick scaling is kind of strange and more research would be required. Ogres have a 3000 morul kicking power, 1/10 of what would be expected from linear scaling. Smaller creatures are untestably weak.

10. Strength and agility
Strength appears to scale propelling power from various sources both linearly with the strength value, but also linearly with any resulting changes in speed due to muscle mass. Propelling power doesn't scale directly with agility, but does scale with the resulting speed change. The double strength and double agility of vampires lead to a 1.8x increace in speed and 3.5x increase in propelling power in some subjects.

11. Weapons
Weapons really suck right now at propelling creatures. A bronze colossus can put out 6000 moruls with a platinum maul, or 2000 moruls with a platinum mace. Weapon knockback is linearly proportional to weapon weight and attack velocity. The weight of the weapon user doesn't scale the weapon's knockback. I couldn't find a relationship between weapon minsize and 2handedsize and knockback.

Weapon knockback scales very strangely with the size of the user, and more research would be required. In general, creatures over size 1000000 can knock things around with modestly boosted weapons or stats, whereas smaller creatures require ludicrous boosts to get any results.

Despite this, any creature holding a giant sperm whale corpse (301015 urists!) can hit other creatures with it for a 90000 morul knockback. Why a dwarf can throw a whale at a cat to knock it 18 tiles away, yet can only throw the cat itself 6 tiles, and can't even kick or hammer-golf the cat a single tile is beyond me.

12. Target body part
It appears that knockback only happens when a creature is struck in the upper body, lower body, or head.

13. References

Bronze colossus lower body & Platinum maul: Surprisingly bad weapons
http://www.bay12forums.com/smf/index.php?topic=105016.0
18 march 2012

Footkerchief's explanation
http://www.bay12forums.com/smf/index.php?topic=100687.msg3036876#msg3036876
26 feb 2012
also bug report http://www.bay12games.com/dwarves/mantisbt/view.php?id=344

Person Shredding Ammo
http://www.bay12forums.com/smf/index.php?topic=98930.0
12 jan 2012

Two-handed hammers, or "Teaching Goblins to Fly"
http://www.bay12forums.com/smf/index.php?topic=77912.0
20 feb 2011

Presenting: The Most Interesting Dwarf in the World
http://www.bay12forums.com/smf/index.php?topic=34933.msg591273#msg591273
8 june 2009
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Sphalerite on April 17, 2012, 12:54:26 pm
Now that right there is dwarven !!science!! at its finest.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: IT 000 on April 18, 2012, 06:46:59 pm
At 3 o'clock Bomrek McNoble leaves a platinum hammer at 1000000 moruls, meanwhile at 4 o'clock a goblin leaves a steel hammer at 750000 moruls. What time will they meet?

Great work Urist Da Vinci
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: i2amroy on April 18, 2012, 06:55:02 pm
Urist lifted the 10 urist hammer to strike the 10000 degrees urist FB and strike it with 1,000,000 urists of force!

I like the moruls idea. It will be good to have something other then urists and dwarfbucks. Though technically one urist (weight) = 1 kg, so we really only need to use urists for temperature and length now that we have moruls.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: khearn on April 18, 2012, 07:07:32 pm
Wonderful science. I'm just glad my office-mate wasn't around when i got to the sentence that starts "Despite this, any creature holding a giant sperm whale corpse.."

Only in Dwarf Fortress.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Captain Crazy on April 18, 2012, 07:29:40 pm
Wondrous! I've been trying to figure out just how the heck knockback works, and now I have a much clearer idea!
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Old Greg on April 18, 2012, 07:38:18 pm
Awesome stuff. The fact that the knockback of crossbow shots is independent of the bolts is interesting - I could see a few applications of that.

Maybe a "knockback gun," with SHOOT_FORCE and SHOOT_MAXVEL jacked up, that fires bolts of some material that would be relatively innocuous when it comes to bodily harm? Think Force Push, Fus Ro Dah, etc.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Urist Da Vinci on April 18, 2012, 09:55:18 pm
Awesome stuff. The fact that the knockback of crossbow shots is independent of the bolts is interesting - I could see a few applications of that.

Maybe a "knockback gun," with SHOOT_FORCE and SHOOT_MAXVEL jacked up, that fires bolts of some material that would be relatively innocuous when it comes to bodily harm? Think Force Push, Fus Ro Dah, etc.

I don't know if a material breath-ish item (slade glob?) could be heavy enough, if one wanted to experiment with interactions. Throwing the whale at the cat also causes knockback, so normal items work at some point.

I think the whale works because creatures have a minimum speed below which they cannot be penalized further for carrying a large weight. Therefore, you can keep increasing the weight you can swing/throw without decreasing the speed it moves at. It's like the inverse of the "railgun" crossbow.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Urist Da Vinci on April 19, 2012, 09:17:26 am
...Maybe a "knockback gun," with SHOOT_FORCE and SHOOT_MAXVEL jacked up, that fires bolts of some material that would be relatively innocuous when it comes to bodily harm? Think Force Push, Fus Ro Dah, etc.

I just tested various size creatures spitting a slade glob, similar to magma crabs but much heavier. The size, weight, and velocity of the spit glob don't seem to vary by creature size. The slade glob produces a 13000 morul knockback on average, hitting a kea 12-14 tiles backwards (kea are size 1000). The knockback still only happens when the target creature is struck in the head, upper body, or lower body. The slade globs weigh 400 urists. This wouldn't knockback a dwarf or human without more modding.


FYI in all of my testing so far in this thread, I have set the skills I thought were relevant to "Grand Master".
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Talvieno on April 19, 2012, 02:40:01 pm
Maybe a "knockback gun," with SHOOT_FORCE and SHOOT_MAXVEL jacked up, that fires bolts of some material that would be relatively innocuous when it comes to bodily harm? Think Force Push, Fus Ro Dah, etc.

That sounds like Splint's railgun - that's basically what it does.

Awesome science, Urist Da Vinci!! I've been wondering about knockback for a while now.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: expwnent on April 19, 2012, 05:10:52 pm
Thank you for your contribution to ‼science‼.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Urist Da Vinci on April 20, 2012, 10:15:25 pm
Quote from: http://www.bay12games.com/dwarves/#2012-04-20
"The Miner's head skids along the ground, bruising the muscle, jamming the skull through the brain and tearing the brain!" That happened after a minecart full of stone going ten times as fast as the dwarf collided with him and sent him flying. They'll skid on a part if they are moving fast horizontally when they hit the ground. This can end up leaving bloody skid marks intermittently as they repeatedly strike the ground. If the carts aren't going super fast and the dwarf has a space, they'll almost always dodge aside, and even if there is no space, if the cart is going slow enough, they'll just stop it. If they do get hit by a fast cart though, it'll transfer momentum according to the cart's mass and speed as well as the dwarf's, sending the dwarf along. The heaviest fast minecarts will blast through many dwarves before they are slowed significantly. The struck units move in parabolic arcs now  (instead of the old fly straight then fall straight down).

Looks like there is science to be redone in the next version.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: D_E on April 20, 2012, 10:50:19 pm
I just tested various size creatures spitting a slade glob, similar to magma crabs but much heavier. The size, weight, and velocity of the spit glob don't seem to vary by creature size. The slade glob produces a 13000 morul knockback on average, hitting a kea 12-14 tiles backwards (kea are size 1000). The knockback still only happens when the target creature is struck in the head, upper body, or lower body. The slade globs weigh 400 urists. This wouldn't knockback a dwarf or human without more modding.

One thing I've been wondering about is how knockback interacts with CE_MATERIAL_FORCE_MULTIPLIER and similar.  From the name it seems that a high force multiplier should increase the knockback distance.

I'll do some !!SCIENCE!! on this at some point, but I thought I should mention it in case some one else gets a chance to test it sooner.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Urist Da Vinci on April 22, 2012, 03:16:19 am
I managed to figure out a relationship between creature size and knockback while using a weapon. It's similar to the relationship between creature size and meat butchering results. If you look at the table in this post: http://www.bay12forums.com/smf/index.php?topic=78108.msg2013047#msg2013047 you'll see that for creatures over size 1,000,000 they have a "meatsplosion" when they increase in size. It's like DF is checking for muscle mass when it calculates strength based on size.

The size of knockback (in moruls) dealt by a creature using a platinum mace is approximately (size)/(meat returns x 20). It's about 2500 for the largest creatures, so you basically need to be over size 1,000,000 to knock around a kea with a heavy weapon. IRL I could probably knock a kea at least 5 feet (~1 tile in game), so I'd say this could use some bug fixing.

I also tried duplicating shook's research here: http://www.bay12forums.com/smf/index.php?topic=77912.msg2017799#msg2017799
I found that, where he increased the weapon velocity and knockback suddenly stopped, that in fact the knockback was still present, but only for creatures over size 1,000,000. Creatures over size 1,000,000 were able to send things flying up to the 50 tile limit, but creatures under that size couldn't send anything flying at all.

One thing I've been wondering about is how knockback interacts with CE_MATERIAL_FORCE_MULTIPLIER and similar.  From the name it seems that a high force multiplier should increase the knockback distance.
...

It seems to affect damage, but not distance. Too bad. If it had worked, I would have suggested making creatures weak vs. a custom material named "anger" or "thu'um" so that you could "shout" globs at them. As it stands, I can't make the globs heavier than slade due to a cap on the density value.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: rhesusmacabre on April 22, 2012, 04:36:15 am
Yeah, it seems like this'll happen a lot more in future.

Does the mass of the target's inventory get taken into account? A unit wearing full copper armour or hauling an elephant carcass should logically be harder to send flying.

It appears that knockback only happens when a creature is struck in the upper body, lower body, or head.

Are reanimated limbs immune to knockback in that case?
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Urist Da Vinci on April 22, 2012, 12:33:08 pm
Yeah, it seems like this'll happen a lot more in future.

Does the mass of the target's inventory get taken into account? A unit wearing full copper armour or hauling an elephant carcass should logically be harder to send flying.

It appears that knockback only happens when a creature is struck in the upper body, lower body, or head.

Are reanimated limbs immune to knockback in that case?

1. An armored dwarf holding an elephant corpse could still be kicked or thrown around just as much as a regular dwarf (and he had the elephant corpse when he arrived at the other end of flight), whereas an elephant still can't be kicked or thrown away. It's rather illogical.

2. Reanimated limbs were immune to knockback from being struck, whereas you can still grab and throw them. Reanimated limbless torso could still be kicked around.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Kofthefens on May 03, 2012, 09:43:33 pm
Well !!scienced!!
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Urist Da Vinci on May 07, 2012, 09:39:39 pm
A bit more testing shows that Weapon Traps don't cause knockback, even while using absurd trap weapons that cause knockback when wielded by creatures. Many in-game chickens died for this knowledge.

Mostly waiting for the next release to arrive.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Urist Da Vinci on May 14, 2012, 10:11:45 pm
0.34.08 - now with seemingly realistic propulsion.

Throwing - mostly unchanged (see below).

Kicking/punching - more powerful, so a dwarf can kick small birds around a few tiles, or bronze colossus can kick a cow a few tiles (they had a hard time kicking a dog that far before)

Weapons - much more powerful, I'd say they are fixed in a realistic sense. Dwarves can play bat with small birds, but can't send elves flying. Bronze colossi can mace around a few things, subject to the limit below.

Distance limit and mechanics - it's now hard to gauge the strength of a hit, since nobody flies further than ~12 tiles on level ground. This is because they now bounce and skid on the ground, presumably slowing them down. If you kick/throw them from a high place, they now fall in a parabolic path and bounce, so they travel much farther. Did you know that flying (projectile) dwarves will go through fortifications?

I don't feel like replicating the earlier science much right now, but the problems seem fixed to me.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: slothen on May 16, 2012, 01:54:42 pm
Does this new physics affect bridgapults?


Did you know that flying (projectile) dwarves will go through fortifications?


 :o :) :D

Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Tierre on May 17, 2012, 02:20:50 pm
Wow this is corpuscular-wave duality for dwarves:)
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Pirate Bob on September 13, 2012, 09:20:12 am
I am a bit curious about how you determined
1. Law of cartoon motion
Objects in flight stay at the same elevation and velocity until they run out of momentum, at which point they fall straight down. This may change with soon-to-come updates (parabolic minecart paths).
In the real world, launched objects will travel on parabolic paths.  I realize they did not in this version, but it would be reasonable that Toady might try to approximate a parabolic path as moving an appropriate distance and then falling down.

Anyway, if an object travels on a parabolic path, then the distance it travels will be proportional to its energy, not its momentum.  Here is a proof:
Spoiler (click to show/hide)
Toady has a Ph.D. in math, and could certainly work this out (although I have a Ph.D. in physics and it's not immediately obvious to me without thinking about it, so he may not have).  If he wanted to produce such physics without parabolic paths, he could just say that a constant force is applied to objects in flight, and they fall to the ground when they run out of energy.  Then the length they travel would be x=E/F, where E is the energy and F is the force.  If F were a constant which doesn't depend on object size or anything else, then you would have projectile distance proportional to energy, as you would expect in the real world, without the messiness of coding parabolic paths.

All this is a very long-winded and technical way of saying that it is not valid just to assume that pre-minecart projectiles fly a distance proportional to their momentum, as it would be just as easy (and more realistic) for Toady to make it proportional to their kinetic energy.  That being said, it is quite possible that it was proportional to momentum, and I would be very interested to see proof of this.
Title: Re: Knockdown (propelled by the blow!) SCIENCE
Post by: Gentlefish on September 16, 2012, 10:25:16 pm
...what if a dwarf skids when he is inside a fortification?