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
|