Advice request - Player Movement

Hi all,

I’m here asking for advice, because I’ve realized that I must be over thinking movement, not in the sense that I can’t get the player to move, but that I’ve tried a variety of changes to get things looking and feeling good…

The basic idea I’m going for is that from stand still, you would accelerate over about a half second before reaching the top speed. If you are running full speed and stop moving that you would slow down to a stop fairly quickly <.5seconds.

Similarly for gravity, while the player is in the air, either by jumping, or walking off an edge, that there should be acceleration until a max velocity is reached.

The problem I’m having, is, at best, I’ve been able to make it so the player is constantly accelerating, when it reaches the top speed, it adjusts to not surpass the max speed, but that winds up being lower than the rate of acceleration, so, at max speed, each frame is a jitter of either accelerating, or having speed reduced to the max speed…

So, for the purpose of the question, let’s just stick with y movement, I can figure it out from there…

The few possibilities I thought up, but haven’t been able to try, but since I can’t do much while at work, figured I’d see if anyone has some better suggestions.

1 - Tie the acceleration rate to the max speed, possibly using the same variable, as in : if speed.y > -gravity then add gravity, else speed.y = -gravity

2 - Using interpolation, as in start at the initial speed (walking off edge would be 0) and then interpolate to the max speed over a certain time frame. I was concerned this might cause grief since the interpolation call would occur each frame

3 - Go through the elaborate calculations of what the max speed and acceleration to work out where the acceleration will line up with the max speed.

(Part of the issue is the changing deltaTime, where, even where I get things close, the main frames (the fixed time step frames) might be what I want, but in the interpolation frame (the remainder of deltaT), will drop the speed lower than the max, and therefore the next frame will begin with acceleration)

I know, this is something of a mundane question, but I would appreciate any advice.