Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Variable time step — Gideros Forum

Variable time step

Hi I've been trying to find out how to get the box2d stuff to not slow down on low end phones and best I can tell it needs a variable (or mixed variable and fixed) time step in the World:step instead of the fixed 1/60. Does anyone have an example of this or tutorial to point to, all I can find is Unity or Cocos tuts that sort of help but I usually get stuck with the different languages

Comments

  • piepie Member
    @billydb please post a link to one of those tutorials to help helping :)
  • If there's any way someone can translate that to lua / gideros that's be awesome! I am way to dumb for this :)
  • set the step to the delta - here you are (in your frame event):
    local delta=e.deltaTime
    world:step(delta,1,5) -- instead of 1 and 5  use whatever you have now.

    Likes: totebo

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • The problem is it's very unstable and breaks things randomly when your framerate fluctuates. Has anyone seen a lua version of the variable time step setup? I kind of get that you record your previous frame times and create a time step based on the average of the last 10 or frames but my attempts to implement have ended in disaster :)
  • No, you base the movement on the time from the last frame to the current one - the delta. No need to average it out.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • Yeah but I mean basing it on delta time is unstable so there’s some sort hybrid between a fixed time and delta time that isn’t unstable, according to that article, but I’m failing to implement it
Sign In or Register to comment.