Need help with App.DeltaTime

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
turshija
Posts: 127
Joined: Sat Feb 17, 2007 9:26 am
Location: Novi Sad, Serbia
Contact:

Need help with App.DeltaTime

Post 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
Attachments
game.zgeproj
(28.73 KiB) Downloaded 474 times
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post 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.
User avatar
turshija
Posts: 127
Joined: Sat Feb 17, 2007 9:26 am
Location: Novi Sad, Serbia
Contact:

Post by turshija »

I think I did something ...
Thanks VilleK ! :)
Post Reply