Hi, I am using Panda3D-184.108.40.206-x64 on Windows 10 and I find it strange of Dt.
I just use globalClock to get Dt, it is about 0.0166(60fps) generally but when the frame count reaches a certain number, next Dt would be 0.33 and then 0.00.
It seems Dt accumulate in that count number.
My code is like this:
And it get:
frame: 55 dt 0.016560396668392485
frame: 56 dt 0.03314417793298219
frame: 57 dt 0.0006871789233406922
frame: 58 dt 0.01618665338530967
frame: 116 dt 0.016262550758932903
frame: 117 dt 0.03332387009323501
frame: 118 dt 0.0006281020487364231
frame: 119 dt 0.01613085855929519
My character can not walk steadly because of this.
So I wonder how it could be solved.
I’m wondering whether it might not be related to the game being V-Synced. Perhaps the game itself completes an update in much less than the 0.0166s required from 60fps–but every so often something causes a momentary slowdown. This results in an unusually-long update, one that ends up finishing just before the next screen-refresh. But because the game’s updates complete quickly, that’s enough time for an update to finish, and thus the long update is followed by a very short update, before a return to the usual 0.0166s-updates.
Of course–but the degree of stability shown in the original poster’s output indicates that V-Sync is likely on, and with the simplicity of the test-program and the reliability of the spikes in frame-time, this specific issue does seem rather odd.
 In fact, note that the “spike” has a frame-time that corresponds to 30fps, if I’m not much mistaken. I’m thus more confident that what I described above seems likely to be what’s happening.
I found it is because I enabled framebuffer-hardware in config file. When it is disabled I get the same result as yours.
So it is due to my GPU?
I am using NVIDIA GeForce GTX 1050.
But when I enable framebuffer-software, the program would report errors like this:
:display:gsg:glgsg(error): at 7890 of c:\buildslave\sdk-windows-amd64\build\panda\src\glstuff\glGraphicsStateGuardian_src.cxx : invalid enumerant
I have GeForce GTX 1050, too, and I can confirm that I also have those “hiccups”. One frame takes too long, then the next frame tries to catch up, and it’s too short. They are noticeable every second or so. This looks rather unpleasant.
I disable framebuffer-hardware and enable framebuffer-software, there are problems with the image, and I also have the following error:
:display:gsg:glgsg(error): GL error 0x500 : invalid enumerant
:display:gsg:glgsg(error): An OpenGL error has occurred. Set gl-check-errors #t in your PRC file to display more information.
And if I enable gl-check-errors, then:
:display:gsg:glgsg(error): at 7890 of E:\Projects\Dev\panda-source\panda\src\glstuff\glGraphicsStateGuardian_src.cxx : invalid enumerant
OK, this seems to be unrelated to the video card. The stuttering appears only when there are many background tasks running. If I close Google Chrome, Visual Studio, PyCharm and some other programs, my Panda3D program gives me steady framerate.
I’m not sure if this is related, but when I’m using the discrete NVIDIA card on my laptop, a simple Panda application (that does nothing intensive) will run with very inconsistent framerate. As I started adding things to the application, the framerate stability markedly improved, however.
I noticed this when I put a print statement in a task that just printed something every frame; my minimal game ran very stably with the print statement added, but it was unstable without the print statement. Though, since you do see the issue with such a print statement, it may not be the same issue.
If this is the same issue, this may be worth investigating. It might have something to do with either the CPU or GPU getting frames done too fast for the other one to be able to keep up with, or something like that.
@Thaumaturge’s guess about V-Sync is not a bad one; have you tried turning off V-Sync in the driver settings and in Panda config?
I closed all applications and restarted and got the same result.
I think it’s related to video card. When I use my integrated graphic(Intel® HD Graphics 630
) to run the game, the dt is very steady of about 0.0166(although it fails to load some textures).
I also test the same program on other cards: GeForce GTX 1050 Ti has the same problem while AMD R5 M330 and graphics have steady dt of 0.0166.
I don’t have integrated graphics on the current PC, but I’ve tried with an old GeForce 740 and got the same results (stutterring when running with Visual Studio debugger).
Does your app have many models/shaders? Note that rdb said that a more GPU-heavy Panda3D app runs steadily for him. You can try running a more complex Panda3D program to test this. I would recommend this game A Door to the Mists--Demo released! by Thaumaturge.
Thank you for trying. Seems that it existed in this card series.
Following rdb I added bunch of models with complicate shader and found that it indeed avoid this problem as long as more than 0.0166s is required to render a frame.
However, when it is not heavy enough it still happen.
By the way, where is Nvidia overlay, I can’t find it anywhere.