I have read a lot about dt, lots of forum questions and the very helpful post:
but every time i try to put it in to practice, I realize that I actually don't understand it.
This is what I'm using, 2 PC's running chrome only with webgl enabled
one PC runs at 60fps, the other 20-40 fps when playing the game
Here are 2 scenarios that I'm struggling with.
I have a sprite animation of 34 frames, its initial animation speed is 40,
so I expect this to run a little faster than a second.
obviously this slows down considerably on the bad fps PC
= so I saw "NewOne" I think his name was, saying that dt basically means 60/1
now i set my animation speed like this:
set sprite speed to 40*60*dt
this looks more or less fine on paper when i log it,
60fps: speed: 40.0079999585
+-30fps: speed: 79.9752000254 OR 60 OR 40.005600079 depending on dt at that time before I start it
so it sounds like they should finish same time, but bad-fps-pc is always lagging behind on screen,
I suppose because I set the speed once before it starts and not update while animating, since dt would be changing right.
also, in the case of speed > 60fps, doesn't it just max to 60fps thus making it animate slower than dt said it should to keep up?
this is getting long, sorry about this, but thank you for your time
and here is scenario 2: (and this is interesting because i read Ashley saying the (Every X second event, is frame independent), but I observe it differently)
I have a SpriteFont that updates it's text to the time that is counting down.
Originally I had:
(int) Timer = 60
Every 1 second -> subtract 1 from Timer
-> SpriteFont set text to Timer
60fps: Runs just fine
+-30fps: lags behind, and the more time passes, the wider the time gap between the two
then I tried:
Every Tick -> subtract 1*dt from Timer
Every Second -> set text to floor(Timer)
makes no difference, or makes too small a difference to say that it works,
Time still lags behind and increases in difference the longer the time
So basically I'm just stupid and don't know how to implement this properly
Or I'm seriously missing something about dt,
or how dt, timers, sprite animations and chrome all fit together.
Thank you for taking the time to read this, if there's any clarity I can provide please let me know
I greatly appreciate any insight and help on this.