Search In
• More options...
Find results that contain...
Find results in...

# Monster Mass

## Recommended Posts

Hi, does anyone know what the purpose of a monsters mass is in the game?

##### Link to post

So they have some kind of weight, naturally. Make it very low and the critter goes flying when you shoot it.

##### Link to post

I figured that much, but does anybody know exactly the formula mass is involved in to calculate how far the monster is pushed back?

##### Link to post

I figured that much, but does anybody know exactly the formula mass is involved in to calculate how far the monster is pushed back?

From P_DamageMobj in p_inter.c

`(fixed_t) thrust = damage*(FRACUNIT>>3)*100/target->info->mass;`
This is saying that for a damage d imparted to an object of mass m the object receives a thrust of magnitude 100d/8m map units per gametic (masses are typically multiples of 100, FRACUNIT is a conversion factor for Doom's fixed point arithmetic)

So say for example the player (mass 100) gets hit by a baron of hell for 40 points of damage. He will fly backwards initially at (100*40)/(8*100) = 5 map units per tic (1/35 of a second)

The total distance travelled by the attacked object, provided it doesn't go over a cliff or something, will be determined by the friction of the sector it is in. If I'm reading this correctly, according to P_XYMovement in p_mobj.c velocity is typically reduced by multiplying its X and Y components by about 0.91 (ORIG_FRICTION / FRACUNIT) on each tic. This carries on until the object's speed is less than 1/16 map units per tic at which point it is stopped.

So suppose our hypothetical player is at (0,0) and has been hit by our hypothetical baron which was standing at (-128, 0). His x velocity thus becomes +5 units per tic, at time 0. Following through I got this
```  0   0.000  5.000
1   5.000  4.550
2   9.550  4.141
3  13.691  3.768
4  17.458  3.429
5  20.887  3.120
6  24.007  2.839
7  26.847  2.584
8  29.430  2.351
9  31.782  2.140
10  33.921  1.947
11  35.868  1.772
12  37.640  1.612
13  39.253  1.467
14  40.720  1.335
15  42.055  1.215
16  43.270  1.106
17  44.376  1.006
18  45.382  0.916
19  46.298  0.833
20  47.131  0.758
21  47.889  0.690
22  48.579  0.628
23  49.207  0.571
24  49.778  0.520
25  50.298  0.473
26  50.771  0.431
27  51.202  0.392
28  51.594  0.357
29  51.950  0.324
30  52.275  0.295
31  52.570  0.269
32  52.839  0.245
33  53.083  0.223
34  53.306  0.202
35  53.508  0.184
36  53.693  0.168
37  53.860  0.153
38  54.013  0.139
39  54.152  0.126
40  54.278  0.115
41  54.393  0.105
42  54.498  0.095
43  54.593  0.087
44  54.679  0.079
45  54.758  0.072
46  54.830  0.065
47  54.895  0.059
```
So he stops moving after 47 tics (about a second and a third), having moved nearly 55 map units.

I hope this made sense. Now someone tell me where I inevitably went wrong :)

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account