Why's the framerate stuttering ONLY in my projects and not the examples?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gemini
:warning: Old Version Published before Godot 3 was released.

UPDATE: I’ve been investigating the following issue and noticed a couple VERY peculiar things.

  1. If I turn off vsync, both in my video drivers and in Godot, the problem of having stuttering while windowed with certain projects goes away completely… BUT IT’S STILL VSYNCING! I can tell because there’s absolutely no shearing with fast-moving imagery, although CPU usage ramps up too, but not to 100% either as I would’ve expected.

  2. This oddity only seems to work with the “Platformer” example, but if I leave vsync on, run this example fullscreen at my native 1920x1080 screen resolution for a minute, quit, immediately set it down to a 1600x900 window and run it again, the stuttering remains gone for about a minute… then COMES BACK! I tried this trick with my own test projects but it didn’t work with them, with them the stuttering immediately comes back when switching back to windowed.

At this point, I don’t think anything can be ruled out. This could be a Win10 Creators Update thing, this could be a GeForce GTX 1070 thing, this could be a Godot thing, it could be something to do with any combination of those… But again, certain Godot examples don’t have stuttering when windowed so I’m gonna pay attention to if and when the stuttering disappears in my own projects to see what might be the trigger to get it to stop and if I find out anything, I’ll let everyone know!

Original Post Below:

So, I’ve been learning some Godot Engine stuff with the 2.1.x branch over the past while, although up to now I’ve never made a serious attempt to do anything in it. In trying to set up some basic stuff just to make sure I’ve got the basics figured out I ran into a VERY weird issue with the framerate: It’s stuttering, but ONLY in my projects, and ONLY when running windowed! o_O

It tends to be a regular stutter too, happening once every second. I’d almost suspect some external factor to Godot, if not for the fact that the included example programs don’t stutter at all and my initial test stuff is incredibly basic by comparison, consisting of cubes, planes, and only about a dozen lines of code. (Though the stuttering happens without the code too, using only built-in animation playback.)

The point form rundown:

  • Godot Examples + Fullscreen = No Stuttering
  • Godot Examples + Windowed = No Stuttering
  • My Project + Fullscreen = No Stuttering
  • My Project + Windowed = Stuttering

I’ve tried every project setting I could think of, I’ve tried enabling and disabling various things, changing settings around, nothing seems to work. I don’t have an underpowered system by any stretch either, as I’ve got an AMD FX-8350 4 GHz 8-Core CPU, a GeForce GTX1070 GPU, and 16 GB of RAM.

Anyone have even the vaguest idea what might be going on here? The only thing I can think of is that because the examples are more complex than what I’ve got going they might be triggering some internal factor which is eliminating the stuttering I’m experiencing.

Try playing with the Vsync option in the Project Settings – if it’s enabled, try disabling it. You can also force a FPS cap with force_fps in the Debug section.

Note that there is no real fix to this right now, there’s been an issue about it for over two years now.

Calinou | 2017-08-28 09:53

Yeah, messing with those was one of the first things I tried when I looked up info online, plus after going through more of the example programs included with Godot I’ve come across a couple which do have this same problem, but it’s weird that many of them don’t. Maybe someone can identify the commonalities/differences between these?

Examples without Stuttering When Windowed:

  • Platformer 3D
  • Truck Town
  • Kinematic Character 3D
  • Navmesh Demo

Examples with Stuttering When Windowed:

  • Platformer
  • Shader Materials

I’ve tested some other games I have windowed just to make sure it wasn’t my drivers or something and most of them seem fine, so I’m kinda stumped. However, I’m also VERY certain the examples which have stuttering now didn’t back when I first tested out Godot, so SOMETHING has changed since then. (Actually, a few things. I’ve since ended up with the Windows 10 Creators Update and I also upgraded from a GeForce 660 to a 1070.) There are a couple games on my system which have started running worse since right after the Win10 update, specifically Minecraft and the Cube World alpha, but those are even affected fullscreen whereas Godot has zero stuttering for me while fullscreen.

I’m gonna keep developing with it for now and suffering through the stuttering so that if I do something and the stuttering suddenly goes away, I’ll know what it is which is preventing it from happening!

Gemini | 2017-08-28 10:12

Your project have camera? Godots project have camera?. There is an specific issue about camera.

807 | 2017-08-28 13:14

I am using a camera, but then so is the “Platformer 3D” example which I am not experiencing any stuttering with… Unless there’s a particular way the camera has to be used/initialized to prevent stuttering?

Gemini | 2017-08-28 14:45