Jump height question.

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Jump height question.

Post by Siggi »

The wiki says that the jump height in normal gravity is value*8.
Considering the default value is 8, why is it you can't get onto a platform 64 units higher than where you are standing?

I'm guessing I could just create a new player class and change the player.jumpz value to 9 if I wanted a player to be able to jump onto crates, or whatever else, with a height of 64, but I'd like to know how this works first.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post by randi »

You aren't specifying the maximum height you reach during a jump. You're specifying how fast you push off from the ground. Once your feet leave the ground, you're immediately subject to gravity. If you want to know how high you'll go at a particular gravity level, you'll need to solve an equation. (And it's been too long since my math classes, so I can't think of what it would be.)
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

Yeah, I knew it was basically just a jump force.
I thought that maybe the calculation was working a little differently from what I had assumed, but I see now that it's as I had thought, exactly as I thought in fact. :P

In the back of my mind I was hoping it had been done is such a way that the height of the player at the apex of the jump could be easily calculated. All I can say is I've never liked physics.

Thanks for clearing that up.
User avatar
Biff
Posts: 1061
Joined: Wed Jul 16, 2003 5:29 pm
Location: Monrovia, CA, USA

Post by Biff »

Not quite a jump force. I think Randy means it's a jump velocity.

If you care to dabble in this, you can use the following relationship:

V^2=2gh

This is "V squared" equals two times the acceleration of gravity times height. For example, if you drop from a height of 10 feet (h = 10') at the earth gravity of 32.2 feet per second squared, your velocity will be a bit more than 25 feet per second.

You can use this also to solve for how high something will go when given an initial velocity upward. In this case you will have V and g, and solve for h. Of course air resistance is being neglected.

Don't forget that to jump up on a crate 64 units high, you need only jump 40 units high as you can step up 24 units.
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

Biff wrote:If you care to dabble in this
I care to dabble. :P

If I were to assume that the acceleration of gravity in Doom were to be 0.8 map units per second squared (considering the gravity value is 800, this seems right to me), and the initial velocity of the player were 8 map units per second. Then I'd be left with (8)^2=2(0.8)h, which leaves the height equaling 40.

Now I know from experience in the game that you can't jump onto a crate 64 units high, so then does that mean that stepping in Doom does not apply when jumping? Well I guess we'll see. So let's for the sake of experimentation assume the initial velocity of the player were to be 9 map units per second. Then I'd get 50.625. Now from personal experience I know that works. So obviously something is wrong with the above calculation. If we assume stepping occurs, then both velocities should allow the player to get onto the crate, and if we assume stepping does not occur then neither should allow the player to get onto the crate, but we know only the second does.

However, I do feel that perhaps the gravity value of Doom being 800 is a little misleading. So lets now assume the gravity of Doom is in fact 1 map unit per second squared. In that case my calculation using an initial velocity of 8 map units per second would yield 32 map units, and my calculation using an initial velocity of 9 map units per seconds would yield 40.5.

Now once we've added the stepping effect into account, we'll see that the default player can only jump onto a crate with a height of 56 or less, and my super player will be able to jump onto a crate with a height of 64.5 or less. This is consistent with what I've seen in game.

So, purely for the sake of curiosity, am I correct? Or is something amiss here? :P
User avatar
Biff
Posts: 1061
Joined: Wed Jul 16, 2003 5:29 pm
Location: Monrovia, CA, USA

Post by Biff »

I think you have figured it out nicely. It wasn't at all clear to me what would be the value for acceleration of gravity in doom and I was hopefully assuming that the equations of motion were adequately represented in the game code. It all seems to make sense according to your experiments.
User avatar
Captain Ventris
Posts: 4608
Joined: Mon Jul 31, 2006 4:25 pm
Location: San Antonio, TX

Post by Captain Ventris »

Ow. My head.

So, would quadrupling the velocity quadruple the height of the jump?
User avatar
Biff
Posts: 1061
Joined: Wed Jul 16, 2003 5:29 pm
Location: Monrovia, CA, USA

Post by Biff »

h = V^2 / 2g

Quadrupling V will increase h by a factor of 16. See equation, h is proportional to v squared. 2g remains a constant.
User avatar
Captain Ventris
Posts: 4608
Joined: Mon Jul 31, 2006 4:25 pm
Location: San Antonio, TX

Post by Captain Ventris »

Biff wrote:h = V^2 / 2g

Quadrupling V will increase h by a factor of 16. See equation, h is proportional to v squared. 2g remains a constant.
So, it's then 3 times higher, amirite? Sorry, I hate math.
User avatar
Unknown_Assassin
Posts: 2468
Joined: Wed Apr 12, 2006 5:17 pm
Location: Where dead carcasses lie
Contact:

Post by Unknown_Assassin »

If the 2g remains constant, then the value of h will be the squared amount of v. When Biff said quadrupled, he meant V = 4. So substitute V for 4, and you get h = 4^2 / 2g. The h would then be 16 because the g is constant.
Locked

Return to “Editing (Archive)”