I lean toward a model with a variable frame rate, but inside the system some systems are marked with a fixed time. This is fairly easy to do using a time saver. Physics is one system that runs best with a fixed time interval and is marked several times per frame, if necessary, to avoid loss of stability and maintain smooth simulation.
A bit of code to demonstrate battery usage:
const float STEP = 60.f / 1000.f; float accumulator = 0.f; void Update(float delta) { accumulator += delta; while(accumulator > STEP) { Simulate(STEP); accumulator -= STEP; } }
This is not ideal, but it is the main idea - there are many ways to improve this model. Obviously, there are problems that need to be sorted when the input frame rate is indecently slow. However, the big advantage is that no matter how fast or slower the delta occurs, the simulation moves at a smooth speed during the “player’s time” - in this case, users will perceive any problems.
Actually, I don’t get into the scope of graphics and sound, but I don’t think that they are affected in the same way as physics, input and network code.
Paul
source share