Terrible performance issue with FPS demo on windows

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

Hi everyone.

I wanted to use create a small game however I’m stuck with terrible performances issues. I tried the FPS demo made by calinou however I got sometime freezes and lag when I run the game.

The demo can be downloaded here https://github.com/Calinou/fps-test

CPU: Intel I7 4700
GPU: Nvidia 765m
OS: Windows 10

AT first I thought it was because my laptop was using the Intel HD 4000 GPU, but even after manually forcing to the nvidia one, the problem is still present.

I have no problem running other games. I’m not sure what can be done to improve the performances. I tried to remove stuff in the scene but even with only the terrain the bug happen.

Edit: I tried to export the project with a windows target and the problem is still present. However If I export it using the HTML5 target I have better performance and the problem is gone.

samuncle | 2016-07-11 03:48

I have no problem running the demo on Godot 2.0.3 and 2.0.4.1.
Did you tried to turn off the lighting and shadows to see if it improves the framerate?
Are there messages spamming in the console output?

Zylann | 2016-07-11 12:43

As I said if I export the scene in html and launch it in the browser everything works fine.

I event tried to remove everything including lights except the terrain and it still lags.
I also tried to only have a very basic scene with a small floor and the player and nothing else and it lagged too

I doubt lighting is causing the issue since It runs fine on the browser and I can run more demanding games like gta5 on the same computer

samuncle | 2016-07-11 15:56

I also tested the project on my Windows 10 laptop (Intel HD 5600 + nVidia GeForce 940M), no problem at all.
Is Godot actually slow with any project? I believe the wrong GPU is used, even if you told the OS to use the faster one. Maybe it works in HTML5 because somehow the browser uses the right one.
Is this Godot-made demo running smoothly for you? http://zylannprods.fr/dl/godot/mcgodot_2016_04_27_1827.zip

Zylann | 2016-07-11 22:05

ok so after a few tests it seems godot will use the correct GPU and it’s not really GPU lag but more a lag due to control.

For instance I can explore perfectly the voxel cube demo but after a few movement the game will simply freeze and I have to move a bit the mouse to continue to walk. It’s like at some point the keyboard doesn’t respond correctly :(.

I can reproduce this on any godot 3D demo.

I must precise that I play on a regular basis with the same laptop without any issue.

samuncle | 2016-07-12 00:26

If the demo I sent you slows down after some time it’s normal: it generates terrain endlessly so it should start to lag after 5 or 10 minutes if you always move, depends on the GPU power. If it slows down only after a minute then it’s not great.
You say any Godot demo slows down after some time? That’s really weird… I have no idea what it could be if it’s not the wrong GPU.

Zylann | 2016-07-12 01:14

I did more tests:

  1. It’s not slow after 10 min or 1 min. What happen is:
    → You launch the demo everything is fine
    → You start to walk arround and it randomly “freeze” (aka stop) unless you change the yaw of the camera with the mouse
    → If you don’t change the yaw either everything works perfectly or it’s completly frozen and you can’t move (except the camera). In this situation keyboard keys are unresponsive.
    → If you try to explore by moving the camera + walking then you get a lag feeling (since it stop a bit, you change the camera angle it moves again etc)
    It does this in every demo I even tried a game made for a game jam

  2. I also installed on dual boot on the same computer linux just to check and everything works just fine. I tried on the nvidia GPU and I get 60 FPS without any freeze any lag and I also tried with the intel GPU where I get 50 FPS and again no problem at all.

samuncle | 2016-07-12 01:48

I suggest you post your issue on the tracker, and describe precisely what are your machine specs, Godot version and the problems you encounter with the demos. The fact it works on Linux and not on Windows is probably a driver or OS bug in Godot under very specific circumstances.

Zylann | 2016-07-12 12:54