Page 2 of 2

Re: Doom gravity metrics

PostPosted: Sun Nov 21, 2021 2:15 pm
by determin1st
ooke, i've measured velocity change by stepping off the roof of the "map test" in brutal doom.
the result is:

0
-2
-3
-4
-5
-6
...

at each tick it adds -1 to the z-velocity, G = 1 is the acceleration based on tick (1/35) and unit, to translate it to meters and seconds, some substitutions have to be done:

G*(m/s*s) = 1

1meter = 32units, 1second = 35ticks

G*(32/35*35) = 1
G = 35*35/32 = 1225/32 = 38.28125 (in meters/second^2)

so the doom Gravity=1.0 is more than Earth gravity in x3.9 times.


After 1 second of falling from a standstill, a typical gravity 1.0 actor will be falling at a speed of 35 units per tic.

This translates to 35x35 units per second - 1225.


35 units per second, and the second is 35 ticks, so it's 1 unit per tick.

Is Doom's gravitation acceleration really up to four times what we see in real life!?


yes, 38.28125/9.8 = 3.90625 a bit more precisely.

those are my calculations, maybe wrong somewhere, but i've made some projectile fall tests from 10 meters (320units) and it looks and feels quite natural with the g=9.8 :P

Re: Doom gravity metrics

PostPosted: Sun Nov 21, 2021 4:54 pm
by Caligari87
This is actually a known factor: Gravity
the wiki wrote:The gravity in ZDoom works as normal in the Doom engine: it corresponds to a value which is added to a thing's vertical velocity linearly each tic. During the first tic of free fall, that value is added twice.
[...]
Internally, the default values are all 1.0, so a fall lasting one second (35 tics) gives an accumulated speed of 36 in the default conditions.


There's no reason for scaling things down to try and make something match. You can just change the gravity value in mapinfo. Now, 32units == 1m works for Doomguy's physical actor height. In fact, it makes him perfectly physically average. It's actually almost too convenient, which leads me to wonder if it's intentional and then got forgotten with later design decisions.

Now, based on what I hashed out on Discord a little while ago with some smarter people than me: If we take 32 units == 1m, mapinfo gravity should probably be about 205 to simulate earth gravity. (9.81 * 32 * 800) / (35^2) = 205

The problem isn't that the scaling is wrong. The problem is that the scaling is inconsistent.
  • Vertical scaling is at a 1.2 factor, so 32 units vertical is 26.6 units horizontally. Changing this requires changing virtually every asset in the game.
  • Doomguy's viewheight is in his chest, so players only feel as if they were 1.28m (41 units) tall, not 1.75m.
  • Doomguy is ridiculously fast for his height, regardless of scale factor.
  • Average doors are approximately 4m (13ft) wide (roughly a 2-car garage).
  • Small doors are 2m (6.5ft) wide. By comparison, a standard residential door in the US is .9m (3ft) wide.
That's just off the top of my head.

Basically, you can make it right if you change literally everything to be consistent. It's not impossible. it's just not really worth the effort and would break Doom's normal gameplay expectations. For something like HD or a standalone game this is generally fine. As a general purpose mutator it'll feel really weird.

8-)

Re: Doom gravity metrics

PostPosted: Sun Nov 21, 2021 5:32 pm
by determin1st
Now, based on what I hashed out on Discord a little while ago with some smarter people than me: If we take 32 units == 1m, mapinfo gravity should probably be about 245 to simulate earth gravity. (9.81 * 32 * 800) / (35^2) = 245


to simulate earth gravity, per tick, it should be 0.256, using the formula: 9.8 * 32 / 35*35
where 32 units is the vertical meter, and 35*35 is the second (squared)

this number (0.256) could be tested by spawning a projectile at 10m (320u) above the floor. with initial zero velocity it should reach the ground in 50 ticks, from the free-fall formula

t = sqrt(2 * h / g), h=10, g=9.8

t = sqrt(2 * 10 * 9.8) = 1.4285 seconds = 50 ticks

Re: Doom gravity metrics

PostPosted: Sun Nov 21, 2021 5:33 pm
by Caligari87
If you're doing it per actor or per sector, yes. In MAPINFO, no, since the scale is on 800, not 1.0.

EDIT: Also corrected my math above slightly. My formula should have been 205, not 245. But we're both right since 800 * .256 = 204.8

8-)

Re: Doom gravity metrics

PostPosted: Mon Nov 22, 2021 3:54 am
by Marisa Kirisame
When modding I've always wondered why is it that gravity-affected projectiles "feel wrong" unless they use a 0.25 gravity factor. Now I know why...

Re: Doom gravity metrics

PostPosted: Tue Nov 30, 2021 1:32 am
by Matt
Marisa Kirisame wrote:When modding I've always wondered why is it that gravity-affected projectiles "feel wrong" unless they use a 0.25 gravity factor. Now I know why...
Exactly!

I remember many, many years ago when I first did HD's grenade launcher that I'd arbitrarily reduce the gravity, which I thought I was doing because that was the only way I could have a projectile that
1. had gravity
2. didn't go so fast that it ran into collision glitches
3. still had decent enough range to let you adjust for drop while still looking at your target

and only had to relent when all my bizarre excuses for why the grenades fell slower than everything else were debunked (and I learned that I could just have a fastprojectile that called A_ChangeVelocity every frame).

Meanwhile I was looking at Ghost Recon gameplay vids and wondering why the grenades there were so visibly slow...

Re: Doom gravity metrics

PostPosted: Tue Nov 30, 2021 8:37 am
by Caligari87
Just wanted to update that I did finally do some proper in-game testing and confirmed the formula that we (me, phantombeta, and gutawer) settled on earlier, works.

Code: Select allExpand view
MAPINFO gravity value = (9.81 * DoomUnitsPerMeter * 800) / (GameTicRate*GameTicRate)

64 units per meter
(9.81 * 64 * 800) / (35*35) = 410

Console.Printf ("%f: %f", level.maptime/35.0, (vel.z/64.0) * 35);

// console output
14.400000: 0.000000
]fly
Gravity weighs you down
14.428571: -0.008008
14.457143: -0.016016
14.485714: -0.024023
[...]
15.400000: -0.280273  < velocity per tic at one second
15.428571: -0.288281
15.457143: -0.296289

// per second
0.280273 * 35 = 9.809555

Re: Doom gravity metrics

PostPosted: Tue Nov 30, 2021 11:14 am
by determin1st
your meter is too long man :P also, i don't get what does 800 magic number means.

i've figured out some horizontal metrics, applied to speed. maybe it's tweaked in BD tactical mode, but without sprinting, doomguy runs about 8 m/s which is not supernatural, well, Usain Bolt runs 100 meters at 9.9 m/s..

those are for 32 units per meter, if it's 64, then, doubled 2*8 = 16 m/s no human runs..

Re: Doom gravity metrics

PostPosted: Tue Nov 30, 2021 12:00 pm
by Caligari87
As I mentioned previously in this thread, I'm working on a standalone game and chose 64 units / meter as my scale. Adjust as needed for whatever scale you're using and plug it into the formula.

800x = 1.0 is the default gravity scale set in MAPINFO, as also mentioned several times in this thread and on the wiki page: Gravity.

8-)

Re: Doom gravity metrics

PostPosted: Tue Nov 30, 2021 4:31 pm
by Reactor
Hm. Is it possible to set gravity so low that people can moon-jump all over the level/so high that people are unable to jump at all? The game Skyroads has this feature on some levels, I remember a run where the grav-o-meter showed 1700, and you couldn't even jump.

Re: Doom gravity metrics

PostPosted: Tue Nov 30, 2021 10:15 pm
by Matt
Definitely doable, whether by altering level gravity or actor gravity or both.

Re: Doom gravity metrics

PostPosted: Wed Dec 01, 2021 3:48 am
by Gez
Technically all jumping does is give you a upward vertical velocity. By default it's 8, but Hexen classes have 9 instead.

So if you set gravity to be 8 (or 9) times the normal, that would fully negate the upward velocity from jumping right from the first tic.


As for doing moon jumps over the level -- keep in mind that those are Doom levels. The ceiling is usually quite low. Even in exteriors. But if you build a level for moon jumps, with a sufficiently high ceiling, then sure.

Re: Doom gravity metrics

PostPosted: Wed Dec 01, 2021 4:28 pm
by Reactor
Ye, that's what I had in mind, making a moon-jump level. An asteroid city or such :) Chaging the gravity for one or two levels would be a fine addition IMHO. Using sector-wind, it would even be possible to re-create Skyroads levels, at least to some extent.