Discord
Login
Community
DARK THEME

What about delta time?

Is there a way I can make my own delta time or this should be moved to the suggestions category :)

Just wondering how can I get delta time

Thanks in advance, mrBoi

Gilles mentioned 'somewhere' on the discord that he might add a settings that would allow to change the default FPS. As in, the default fixed 60 FPS for the update loop. Not sure about the draw loop though.

You will already know, but others reading this might not, you can read the FPS by from system.fps.

So if you need the dt (DeltaTime) for any FPS related calculations you just do this: dt = 1000/system.fps

On the other hand, if you would like to force your 'draw' or 'update' to a specific FPS, maybe use a custom thread?

init = function()
   fps = 20
   dt  = 1000/fps

// custom draw loop
myDraw = every dt milliseconds do
  screen.clear()
  screen.drawText("FPS :"+fps,0,90,10,"#ff0")
  // do more draw stuff thingies =)
end

end

Maybe the the experts here know more (in case there is some undocumented stuff)

Live Long and Tinker

Thanks for the help with dt! And the extra info that I will def look into:)

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community