I have written a game based on another game's original physics. I have all the constants the original game used in the Sega Megadrive. For example:
float ACCELERATION = 0.03287f;
float DECELERATION = 0.4f;
float FRICTION = ACCELERATION;
float TOP_SPEED = 8f;
when the player presses the right button I do:
if (rightPressed) {
speed.x += ACCELERATION * delta; // accelerate
if (speed.x >= TOP_SPEED * delta) {
speed.x = TOP_SPEED * delta; // impose a top speed limit
}
}
...
else { // user is not moving the player (left/right)
speed.x -= Math.min(Math.abs(speed.x), FRICTION * delta) * Math.signum(speed.x);
}
Several lines later:
x += speed.x * delta;
y += speed.y * delta ;
Is the delta here used correctly? Should it appear anywhere as I did or just the moment I set x and y? My understanding is that speed should accelerate according to delta as well.
Another problem I have is that, by using the original game constants, the character moves in slow motion (even if I only have delta at the moment of updating x and y) so I had to multiply all constants by 15000 in order to have normal playing speed. I expected I may have to multiply by 60 (because of the 60 frames per second of Sega Megadrive) but not by 15000.