Am I using delta_time correctly?

So Delta Time seems to work differently in game maker than in other engine. I read some stuff and I think I got it working correctly but I am confused if I am doing it right. Mainly the lerp part of the code.

This is how I am calculating delta time.
GML:
global.system_delta_time = (delta_time /1000000) / (1 /60);
This is how I leap with it.
GML:
lerp(pos_x, target_pos_x, global.system_camera_2D_lag * global.system_delta_time);
this is how I move
GML:
y+= speed * global.system_delta_time;
 

Binsk

Member
Looks perfectly fine for me.

Are you sure you aren't already modifying your global.system_camera_2D_lag by the delta time somewhere else by mistake? Same w/ your speed variable? It is easily to modify acceleration by delta-time as well as the actual velocity which causes some really janky movement.

If not, both methods of movement look to be calculated correctly.
 
Looks perfectly fine for me.

Are you sure you aren't already modifying your global.system_camera_2D_lag by the delta time somewhere else by mistake? Same w/ your speed variable? It is easily to modify acceleration by delta-time as well as the actual velocity which causes some really janky movement.

If not, both methods of movement look to be calculated correctly.
Thanks so much.
 

Nobody

Member
Easiest way to test these things is to play with the room_speed and see if it behaves the way you like.

Obviously the slower the room_speed, the chuggier things will get, but if movement still feels basically the same regardless of what the room speed is set to, then you'll know things are working ok.
 
Top