Well my problem is, I'm trying to keep all my movement based on a timestep, which is working great for everything but deceleration. This is what I currently have, and it works great when the time between frames is ~3-4ms.
//Where p1.deceleration = 0.99;
p1.velocityY *= p1.deceleration;
p1.velocityX *= p1.deceleration;
p1.destX += p1.velocityX * FPSTimeAv;
p1.destY += p1.velocityY * FPSTimeAv;
//Velocity increase.
//FPSTimeAv is the average time across 50 frames
p1.velocityX -= (sin(p1.angle * 0.0174532925)) * p1.acceleration;
p1.velocityY += (cos(p1.angle * 0.0174532925)) * p1.acceleration;
However whenever I force the frametime up it obviously decelerates less per second, and so the ship coasts further and further as the Frametime goes up.
//Where p1.deceleration = 0.99 * ~4
p1.velocityX *= p1.deceleration / FPSTimeAv;
p1.velocityY *= p1.deceleration / FPSTimeAv;
p1.destX += p1.velocityX * FPSTimeAv;
p1.destY += p1.velocityY * FPSTimeAv;
//Velocity increase.
//FPSTimeAv is the average time across 50 frames
p1.velocityX -= (sin(p1.angle * 0.0174532925)) * p1.acceleration;
p1.velocityY += (cos(p1.angle * 0.0174532925)) * p1.acceleration;
The problem I run into is if I add a FrameTime modifier then two things happen the first, is deceleration is very very sporadic, sometimes it will slow down within about 64 pixels, other times about 2. The second is, if FPSTimeAv plummits then the modified deceleration actually increases velocity (due to it becoming greater then 0.99).
My question is, how would I add deceleration without having it become sporadic, and unpredictable?