delta_time question

F

FeNniX

Guest
So, I want to implement delta_time in game that has moving objects. Main reason for that is to maintain same speed if fps drops.

All objects have in creating code: motion_add(direction, speed); and step event is empty.

So, best thing would be to add speed in step event and update every frame right?
 
Last edited:

samspade

Member
So, I want to implement delta_time in game that has moving objects. Main reason for that is to maintain same speed if fps drops.

All objects have in creating code: motion_add(direction, speed); and step event is empty.

So, best thing would be to add speed in step event and update every frame right?
If you want to use delta_time you can't use speed or motion_add or any of the built in GML functions that rely on the built in movement variables. Game Maker updates these automatically once per step and it is completely outside of your control.

If you want to use delta time, you'll need to use your own variables.

It might not be worth worrying about. Delta time is great for many things but it isn't a necessity. It will also complicate a lot of other things (e.g. probability calculations, sprite animation, etc.). I wouldn't use it unless you have a specific reason to. Off the top of my head, the two main reasons to do it would be you want to implement slow motion or some version of something like that, or your game is going to be complicated enough to be worth the extra headache.
 
Top