Jump to content
Search In
• More options...
Find results that contain...
Find results in...
• 0

# Changing player acceleration

## Question

in (G)ZDoom, is there a way to adjust how quickly the player accelerates?  By that I mean how long it takes for a player to go from standing to a full walking/running speed.

## Recommended Posts

• 0

I figured it out.  Turns out someone did something similar on the ZDoom forums, so using their code as a base I was able to get the effect I wanted.

#### Share this post

##### Link to post
• 0

Try changing his friction property, as I believe that acceleration is a function of just 1) his previous velocity, 2) some value directly from user input in the current tic, and 3) the properties speed, forward/side move, and friction (possibly also gravity and mass, not sure here).

Edited by scifista42

#### Share this post

##### Link to post
• 0

Those all have unwanted side effects, unfortunately.  Forward/Side move definitely changes the overall top speeds, though.

#### Share this post

##### Link to post
• 0

You can try messing with ZScript by overriding MovePlayer().

#### Share this post

##### Link to post
• 0

Oh good idea, I'll try that!

#### Share this post

##### Link to post
• 0

Looks like the acceleration happens within the Thrust() function, which (if my limited understanding of ZScript is correct) is defined internally and not in ZScript itself.  Everything I played with had the same effect as changing Player.ForwardMove and Player.SideMove.

#### Share this post

##### Link to post
• 0

What precisely are you trying to do? The way the system works, the harder you push on a thing, the faster it will go overall once its reached peak speed. If you want something that would accelerate to the same top speed but faster, I think you'd have to increase both the acceleration and the friction of the object. I don't have the precise math on hand though.

EDIT: Still no precise math, but here's a quickie explanation to what's going on. The friction in Doom works by lopping off a certain percent of an object's velocity each tick, presumably after performing the move (someone with technical knowledge want to confirm that?). When you accelerate in Doom, you add a specific value to your current velocity, 1.5625. After that's added and you do your move with the new velocity, a bit of your velocity is lopped off. Eventually, though, you will reach a point where the acceleration you're getting is exactly the same as the amount getting lopped off by drag, defining your max speed. As acceleration gets higher, your velocity needs to get larger and larger in magnitude so that the amount lopped off by drag matches the acceleration, increasing max speed.

#### Share this post

##### Link to post
• 0

The goal is exactly as you said, faster acceleration to peak speed.  I'll try toying with both speed and friction together next to see if I can get the results I want.

## 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

## Sign in

Already have an account? Sign in here.

Sign In Now
×