Re: Timing

new topic     » goto parent     » topic index » view thread      » older message » newer message

Here's my method:

tick_rate(25) -- Clock updates 25 time per second

procedure delay()
    atom oldtime
    oldtime = time()
    while oldtime=time() do -- Wait until clock updates
    end while
end procedure

while still_playing = 1 do
    update_game_objects()
    draw_next_gfx_frame()
    ..etc...
    delay()
end while


The only problem with this method is that if the game loop takes more than
1/25th a second (or whatever tick_rate() is set to), then delay() will wait
until the next clock update, slowing the game down to half for that frame.

A better method would be some kind of frame skipper, that doesn't draw the
frame if calculating took to long, and skips to the next frame. (Like 3d
games nowadays do.) But I don't know how to do that... Anybody care to show
us? smile

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu