-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heavy stuttering issue in simple 2D game [Windows 10, Nvidia] #19783
Comments
Hi, I have updated my report because I tested it on my other computer (home) and the issue is here at the same as I change the animation. So, this is not the animation that causes the issue. I think I believed it because when I saw that it was on my laptop, it has a small screen. Here's a video of the issue (the video is at 60 FPS) : |
If the video is an accurate representation of what's on screen in real time, then it's a hell lot more stutter than I've ever seen mentioned in any stutter-related issue here. There must seriously be something wrong with this Windows 10 / GTX 1060 setup (I see quite a few articles on the Internet detailing performance issue on Windows 10 / Nvidia after major Windows updates, but can't tell if it's related). |
Here's a video of the test project on my system, Mageia 6 x86_64 (Linux), Nvidia GTX 670MX with recent proprietary drivers (390.59). No stutter at all (on Openbox - on KWin the compositor messes things up and there's a very light stutter every 10 s or so). BTW here's a fixed version of the demo project firstGame_fixed.zip, the original one had files split over three different folders somehow ("firstgame", "firstGame" and "FirstGame"). |
The game gives me the same amount of stuttering as in the video. |
I also tested as @Zylann suggested here and got the same results. I too have Win10 x64 and nVidia GTX 1060. Edit: I use these drivers from nVidia: |
Win 7 64 bit GLES2 and GLES3 tested, GeForce GTX 660/PCIe/SSE2... no stutters. Turning on Aero, with the 2d editor of godot behind the game results in some little stutter (Godot editor render interfere with the rendering of the game). However, Godot stuttering is the giant invisible enemy, we all know it is there but we do not want to look very closely because we know that the solution is not simple. Your issue seems like different physics fixed fps with monitor refresh rate, i see this kind of stutter in monitors that have not same hz that editor configured physics fps, but can be other thing. |
The demo doesn't uses physics, only a simple |
True... i say that i only see that heavy stutter in this case, but it´s true that there is no physics process involved. I test changing hz of one of the monitors and no differences, 0 stutter in my gear. Edit: I got win 7, win 8.1 and win 10 in this computer and take the time to test all. No stutters in win 8.1. I´m testing in win 10 now and is very smooth... no windows problem. Godot is angry with your 1060? |
Here's the same test with my laptop. As you can see the problem is here too. But it seems that's less visible but it's here. Laptop Specs : Windows 10 - Geforce 940M Here's the Laptop video (it's a 60 FPS video) : |
Can anyone with the stutter problem try to execute the demo changing in Player.gd _process with _physics_process? |
I will test this evening on my home PC this is where I have the problem all the time. But I have a weird thing : This morning, I gave you a video with the project on my laptop and as you can see you have the same kind of stuttering. The problem is that now, if I run it again I don't have this stuttering again, like it's random. And I didn't change anything on my laptop, I worked on it all the morning on a TSE session. Warning : I talk only for my laptop. On my home PC with GTX 1060 the problem is always here. But on my laptop the problem seems to occur randomly. That's why I think that for now, I will let my laptop on the side for testing purpose and I will test only on my home PC that have the problem all the time, to be able to isolate the "bug". |
@Ranoller I tested it and got the same result. The stutter is still there and it pretty much looks the same. |
This not look well.... To exactly specify the bug I would do this tests:
Your cards run well other games? ... Reading the first post about the animation -> stutter / no animation -> no stutter i read the code and i see some stuff that i don´t think it´s correct... exactly: changing animation every frame. I think that code should check current animation. Probably it didn´t change nothing, but if someone want test to change Player.gd in this way:
This is the last idea... probably nosense for the problem, but... your graphic card is very common in players, so godot should execute well in it. |
For :
|
Just tested your code and it doesn't change anything :( |
Although this problem may not be directly related to godot, godot must revise well stuttering issues... it´s not true that all games stutters as it was said in another thread. Today i was playing n++, full screen, windowed, trying to see any stutter and no.... no stutters at all. Same with Ori and the blind forest, to many bad things have to do to have any stutter in this game (windowed with other programs in background, etc.... and only 2 o 3 frame skips in a hour...). Godot, on starting execution, always stutter x number of seconds, later it stabilizes, but every X seconds you are going to have frame skips (if you don´t have the problem of the gtx1060 of course). We shouldn´t treat this issue as a minor problem. |
I try to do my best to isolate the problem but at my level it's a bit difficult. I tried testing different setups but without result. I also tested to but a background image instead of use a color with clearscreen. I've already seen (don't remembre witch) an engine with this problem because of rendering a 2D sprite on a "void screen" causes this problem, but it seems that's not the case here. So I don't have any idea for now. |
Out of curiosity, try to profile how long |
If someone that knows the sources of Godot could test that I'm interesting in the result (sorry for my english...) |
I was playing with this issue yesterday and I it magically resolved itself after the game windows was running for about 60 seconds. Then it was smooth, this tells me that it could be a caching thing? |
Maybe could be helpful to know if the problem happends in GLES2, we don´t test that |
I tried to play with options in Godot about it, but it doesn't change anything for me, may be I don't know exactly what to change ? Tried to let the game for more than 2 minutes but the problem is always here not solved for me after 60 s. |
I had a similar issue with 3.0.3. (Win10 64 bit, Nvidia 660) I didn't notice it with 3.0.2. I think it has something to do with the AnimatedSprite Node because I see the performance issues with levels which have this node. I get the shuttering when running from the IDE or if I export to Win 32bit, but If I export to Win 64bit everything runs as it should, no stuttering. |
.. interestingly, I don't have the issue with the example project 'FirstGame.zip'... but still do with my game, FPS drops to 5 when run from the IDE and 32bit version, GPU sits about 2%... but, with the 64bit export GPU is at 30% and everything is fine. |
Hi there, is any news about this problem ? I've just tested with the pong demo (I didn't do that before, just with the tutorial game) and it seems the problem is here with this sample project too. I use the last version of Godot on Steam to test it. Updating Nvidia drivers didn't change anything, so I come to take some news about this issue. I didn't find how to get ride of it yet. |
@TerminalJack The fork is no longer available (or it's set to be private), could you make it available again please? |
@Calinou Sorry. I jacked the repository up so I deleted it. I will fork it again and re-commit the changes here shortly. |
@TerminalJack Your fix seems to be only for Windows but I face the same issue on Ubuntu. |
Yes, this is definitely a Windows-only fix. Sorry. I don't know if it is necessary to do something similar on Ubuntu or not. I'm not even sure if it uses a compositor. |
It does, in fact, there's no way to disable it on some window managers (including Ubuntu's default) 🙂 |
@TerminalJack Might also need some logic for when Aero is disabled in e.g. Windows 7 (IIRC it doesn't v-sync, so Godot probably should still v-sync itself in this case) |
@starry-abyss I'm hoping that case will be caught. I have an old laptop that has Windows 7 on it. If it still works I'll do some testing with it and see if any changes are necessary. |
I fired-up my 10-year old laptop that has Windows 7 on it and tested my changes. I had to use the simplest of projects for testing. (Laptop GPUs were extremely bad back then.) I used the project from this post. I added the following so that I could switch into/out-of full screen.
I ran the project both with my changes and without and there weren't any noticeable differences either way. With my changes, the compositor would be used for v-syncing when expected (windowed mode, compositor enabled) and OpenGL double-buffering would be used in all other cases. The good news is that there won't be any changes necessary to the code. The code detects whether the compositor is enabled or not like it should. It even handles the case where you enable or disable the compositor while the app is running. This is a case that I didn't foresee, however, so I didn't include it in the comments in |
One of the things brought up on irc today discussing this (and TerminalJack's PR) is isolating error in the measured input delta from error in the output delta. Calinou pointed out we can test this to an extent by running with the command line switch It would be very helpful if those having the problem (especially on windows) could let us know if this has any effects on jitter. |
@lawnjelly I tried quickly with and without the command line option, but sadly I can't repro the issue today %) Except OBS case, which is still the same. |
No, it's only a command-line argument (which is stateless). |
OK. Also, BTW, is the option available in Godot 3.1.1 (the version on which I do most of the testing here)? |
If you are using 3.1.1 to test this, you will need to be moving objects a distance proportional to the delta during _process, as there is no fixed timestep interpolation. |
@starry-abyss That command-line argument was added in 3.1, so it should be available in 3.1.1 as well. |
So, And also tried both at once, in case the The difficulty to reproduce yesterday was because I had v-sync off in options from previous tests. :/
Of course, I'm testing methods one by one, not all at once (not like interpolation plugin + dwmflush + any new idea). |
I understand as it isn't mentioned in the docs, and there is no fixed timestep interpolation in core. Perhaps I should try and write something on this for the docs, I've not added documentation before. The upshot is this: The 'jitter fix' method was an attempt to bodge around this aliasing by making it occur in a less pronounced way (it will still occur). Think staircase aliasing. In order to prevent this 'base level' jitter you currently either need to
These are the prerequisites BEFORE you start investigating jitter. They will give a linear relationship between the position of an object and time, which is what we want. An alternative (more newbie friendly) method of achieving this is with semi-fixed timestep, which I've had a PR in for since July #30798. This is the basis of scientific investigation and hypothesis testing. The idea is reduce as many of the confounding effects as possible and examine one at a time. There are 3 main factors at play here:
Eliminate (1) as above. Eliminate (2) by using the command line argument, then you can examine (3) in isolation. Also, for any investigation of jitter, you should be moving objects directly, not via physics, as physics can potentially add jitter itself. Edit: |
@lawnjelly I see. I was under impression that interpolation plugin is still also something tested only by a few guys, and may be buggy (and even add to jitter). So I took what's stable (3.1.1), that's how "scientific" works for me.
I'm using my own version of the project, as the original one is using animations (can mask the jitter) and has grey sprite over grey background. I'll adjust it so it meets your criteria. |
That is very useful info. This does seem to move the pointy finger of blame towards the output delay (and the compositor), and lend weight to the kind of approach in the PR. This is assuming its using double / triple buffering and keeping the pipeline fed, and not dropping frames. Is this also the case for @TerminalJack with the command line argument? |
Ah good, thank you! 👍
A little off topic, but it should be fine (I haven't touched it in a few weeks), shouldn't introduce jitter. If you find any bugs let me know on the issue tracker or even make a PR. 👍 Am intending to put it on the official addons for 3.2 when I get around to it 😄 . |
Sorry, I haven't had a chance to try your suggestions out. I kind of went down a rabbit hole on the issue that I'm working on. |
@lawnjelly Per our discussion in the PR thread, I just thought that I would mention that you were correct about the I've been using that option along with my changes to establish that using |
Godot version:
Godot 3.1-dev / Godot 2.X
OS/device including version:
PC - Windows 10, GeForce GTX 1060 6 GB, 16 GB RAM.
Issue description:
Stuttering / jitters when moving a 2D Sprite. Reproduced on 2 computers (with nvidia graphic cards, the one above and a laptop), a friend of mine reproduce this issue too.
Steps to reproduce:
I just download the "First project" that we can make in the documentation. I have tested to reproduce the first part of this tutorial to only have the player and nothing else. If I run it without change anything. I have some stuttering at the same as the game run with 60 FPS. The motion is not smooth. I collaborate with a dev to try to reproduce this problem and try to understand the issue. I have made a lot of test (Run from editor, run after compilation without debug mode etc...But when I deleted the animation, all run smoothly.
PS : it seems that physic behaviour make sprite stuttering too (try with kinematic and Area2D node with collision). If I desactivate collision and replace Area2D with a simple node2D there is no stuttering (if I don't play any animation on the player).
Minimal reproduction project:
Here's a minimalist project (that comes from the first game project of the documentation). If I run it, I have some stuttering. If I delete the player animation I have no more stuttering.
FirstGame.zip
The text was updated successfully, but these errors were encountered: