Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Should i multiply my movement speed with DeltaTime(Or something like that)?

Author
Message
Akira_
5
Years of Service
User Offline
Joined: 14th Sep 2019
Location:
Posted: 14th Sep 2019 15:41
Hello, i am new to this game engine and i want to know SetSpritePosition() is multiplies with DeltaTime or something like that?
If not what should i use for getting deltatime?
PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 14th Sep 2019 17:44 Edited at: 14th Sep 2019 17:46
No matter how fast or slow a computer is, or rather on how many FPS your code runs, everything should move at the same speed on any PC when it comes down to games.
In other words, you want to ensure things in your game move at a consistent speed, even if there is a loss of frame rate (lag), or FPS blow through the sky on a high-end machine.

That's called time based movement or frame independent movement.
That goes for EVERY programming language, including AppGameKit.

You might want to read up on that topic. There's tons of videos on youtube about how it works, i.e.


PSY LABS Games
Coders don't die, they just gosub without return
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 16th Sep 2019 19:17
IMAO the best way to get DeltaTime is:


// global variable
DeltaTime = GetFrameTime() * 60; //Put this in SomeEveryFrameFunction

If your monitor is 60fps you'll get DeltaTime around 1.0, so if you already set speeds in your game - nothing will change them.

Login to post a reply

Server time is: 2024-11-22 17:00:37
Your offset time is: 2024-11-22 17:00:37