So - I have made a very simple test scene for this problem:
A rocket is resting on the ground, under gravity, with a thrust force applied to it as soon as the scene starts. The rocket slowly rises, and after 10 seconds, the thrust cuts out and the rocket altitude is printed in the console window.
I tested this with the default, out of the box demoSandbox, and the rocket altitude reaches around 320 meters. The FPS counter displays around 3000 fps.
Then, I inserted a
Sleep(50) instruction just after
window->RenderScene(); in void
DemoEntityManager::RenderDrawListsCallback(ImDrawData* const draw_data):
- Code: Select all
window->RenderScene();
Sleep(50); // 50 miliseconds is 20 frames per second
This effectively restricts the visual frame rate to below 20 fps. This time, the rocket in my scene reached only 66 meters, and the frame rate was shown (accurately) as between 16 and 20 fps.
Now... unless my understanding of game physics is completely wrong, the physics should NOT be affected by the VISUAL frame rate caused by the scene complexity (which I have simulated by the "Sleep()" instruction)... it should always give the same result. In both cases, my rocket should have reached exactly 320 meters, except in the later case where the visual experience would look "choppy".
If the Sleep(50) instruction is the wrong way of simulating low frame rate due to scene complexity, I can insert thousands of objects into the scene, which would then represent a truly complex scene, and run the rocket test with and without the extra objects and compare altitudes.
Somebody please enlighten me on this. I have not changed anything in demoSandbox code, except the addition of the
Sleep(50) instruction.