Page 1 of 1

Need help with App.DeltaTime

Posted: Wed May 21, 2008 4:42 pm
by turshija
I think I'll never figure out how to use App.DeltaTime :)
Whatever I try, I can't make the game work similar at different FPS-s...
On my laptop I have 210 - 240 FPS, and the game works excelent, but on desktop I have 380 and the game runs very fast ... To be precise, I run forward and backward much faster, and rotate much slower ... :S
I'm posting my project file, and I'm asking anyone here to help me ...

thank you ;)

Boris

Posted: Wed May 21, 2008 4:58 pm
by VilleK
Hi!

From your "up arrow" code:

Code: Select all

distance += 0.1;
AngleView += 0.0005;
CameraHeight += 0.1;
I'm not sure how those variables are used, but in general this kind of variable update should take deltatime into account.

For example:

Code: Select all

distance += CameraSpeed * App.DeltaTime;
Where CameraSpeed is a constant. To set a good value for the speed, remember that thanks to the multiply with deltatime which is in seconds the unit of the CameraSpeed value is also in seconds. In other words CameraSpeed=amount to move the camera in one second. So it could be set to 1.0 for example.

Hope that helps! I like the movement of the camera in your project.

Posted: Wed May 21, 2008 5:31 pm
by turshija
I think I did something ...
Thanks VilleK ! :)