time_step
time_frame
The duration of the last frame cycle in ticks, i.e. sixteenths of a second. A
speed multiplied by time_step
gives the distance to be covered per frame. On a frame rate of 16 fps both
variables
have a value of 1. time_step
is limited by fps_min, 'smoothed out' by
time_smooth and 'stretched' by time_factor. time_frame is
not post-processed and always
gives
the
precise
time
of
the last frame cycle.
Range:
0.1 .. 10 (time_step)
0..unlimited (time_frame)
Type:
var, read-only
Remarks:
time_step is to be used for movement and frame rate compensation,
rather than time_frame.
'Jerks' in the game play can happen when time_step suddenly
changes between two frames - or in other words, when one frame lasts
remarkably longer
than the next or previous one. This can be caused by background tasks or hard
disk operations. If time_step changes suddenly, speeds become
inaccurate during the next frame, adding to the noticeable jerk. This can be
prevented
by the time_smooth variable.
Example:
while(1) {
c_move(me,vector(5 * time_step,0,0),nullvector,USE_AABB);
my.skin += time_step / 16; // change one skin per second
my.skin %= 10; // 10 Skins
wait(1);
}
See also:
time_smooth, time_factor,
fps_max, fps_min, fps_lock,
total_ticks, total_frames,
wait
► latest
version online