Compensating for framerate fluctuations

Blitz3D Forums/Blitz3D Programming/Compensating for framerate fluctuations

Cousin Gilgamesh(Posted 2005) [#1]
I'm looking into implementing some sort of variable framerate system in my next game, since without one, the whole time inside the game fluctuates based solely on the frames per second. I used to use wait functions at the end of the main loop to make it always run the same speed, but that's really inefficient and won't take advantage of higher speed computers. the last thing I tried was taking a "change in time" variable and adding it to every calculation of movement in the form of DeltaT/AverageDeltaT, which would be some number relatively close to one. I multiplied every movement calculation by DeltaT/AverageDeltaT and it seems like that should have worked perfectly, but it didn't... at all. movements became jolty, and the test character just sped up to incredible speeds. I'm sure other people have tried or succeeded at such an idea. Does anyone know what I did wrong or have another idea that would have the desired effect? Thanks


Mustang(Posted 2005) [#2]
"Delta time" is the correct way to do movement - binding movement to framerate is REALLY bad idea... you're doing something wrong if it doesn't work for you. Check code archives, it's full of delta time exampes like this:

http://www.blitzbasic.com/codearcs/codearcs.php?code=193


trb(Posted 2005) [#3]
http://www.blitzbasic.com/Community/posts.php?topic=50289

I had a thread somewhat along the same line, check the above link for a few methods that were suggested to me..then check this link

http://www.blitzbasic.com/Community/posts.php?topic=50558

The "retro64" timing method Steve Elliot mentions works like a charm for me


Bouncer(Posted 2005) [#4]
Use rendertweening. It's da bomb.


ozak(Posted 2005) [#5]
Actually noone knows what exactly gets tweened in the rendertween loop :)
It would appear that texture scroll etc. does not, so you'll have to do some sort of delta timing anyway :)