I have a simple 2D scene (at least I think it is), running at a low 30 fps on my nice laptop... :/

I tried the profiler, and I don't understand where this came from. The IDLE time is 51ms, which make sense for my 30 fps.

In the Script Functions section, I have a inclusive time of 4.03 ms. Is this time includes all the scripts called under it (inclusive) ? There are a couple of other functions near 2 ms, but nothing sum up to 50ms.

Also, I have 570 calls to a specific function, but the total is only 1.35ms

Where the remaining time can come from ?

The Frame Time is the total time ? It includes all the calls ? ( 0.1ms x 100 call = 10ms Frame Time ?)

Thanks for your help.

Can you post a screenshot or some idea of what the complexity of the game is? How many objects, what are they doing, etc?

My scene mostly consist of polygons, about 600 hundreds. No physics, but some script object linked to each node.

I'm planning to reveal my project next week. It is not a game B) It will be in android public Testing next week.

I may have an idea of what is happening. If Godot can't maintains 60fps, does it fallbacks directly at 30fps ? This can explain.

Here is a screenshot. This is the scene last month, running at 60fps. I have added a couple of polygons, maybe 30, and some shaders. And after that, it drops to 30fps.

So the 30 fps thing is VSync. If you miss the sync of the monitor (most monitors are 60 Hz) then it needs to wait for the next VBlank cycle, which will effectively make it run at 30 fps. This is normal and as designed (it has nothing to do with Godot). While you can disable VSync, I would not recommend it as it can cause other issues (tearing or uneven frame updates).

However, that scene looks fairly low poly and simple, I don't understand why it wouldn't run at 60 fps, even on a laptop. There must be some other factor. However, I don't have a lot of experience with the profiler so I'm not sure in your case. What kind of computer do you have?

Yes, it makes sense for the VSync.... Thanks for the reminder.

I'm running on a nice i7, but with a embedded graphic card.

Yes, I think the scene is very simple to render, this is why I find it strange. Mainly, the scene does 2 things. - Call a function on each node (about 600), with a simple check. - Change the colors of almost all polygons. That's about it. There is 10 shaders, but still simple things.

I have an idea to optimize my code, but by looking at the profiler, I'm not sure the code is the problem here.

Are you using GLES3 or GLES2? GLES2 performs better on simple scenes, and is more compatible with mobile devices.

One common problem is bad code in the _physics functions. I see that slow down projects on half of the stuff I see people post on FB.

I'm using GLES2, I mainly target mobile devices. But the problem also happens on my laptop.

And, I don't use the _physic( ) function anywhere. I have no physic, and nothing cpu intesive.

a year later