Skip to content

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Apr 11, 2021

This helps decrease power usage while the project window is unfocused or minimized.

The default FPS limit is 101. It can be disabled by setting the application/run/max_fps_when_unfocused project setting to 0.
The FPS limit is disabled by default when running the project from the editor to avoid interfering with profiling tools.

This closes godotengine/godot-proposals#2001 and closes #19741.

This PR can be remade for the 3.x branch if we reach an agreement on it.

Testing project: test_fps_limit.zip

Footnotes

  1. I've decided to go with 10 instead of 20, because 20 doesn't result in sufficient power savings on low-end machines that already struggle with rendering projects at 30-40 FPS.

@Calinou Calinou requested review from a team as code owners April 11, 2021 21:49
@Calinou Calinou added cherrypick:3.x Considered for cherry-picking into a future 3.x release enhancement topic:core labels Apr 11, 2021
@Calinou Calinou added this to the 4.0 milestone Apr 11, 2021
@Calinou Calinou force-pushed the add-fps-limit-unfocused branch from 9f15d2f to 8040c46 Compare May 5, 2021 20:41
@realkotob
Copy link
Contributor

realkotob commented Dec 9, 2021

I would like this feature 👍

Has it been discussed off-github?
Is there a reason it was not merged (other than that there are thousands of PR 😅)

@Calinou
Copy link
Member Author

Calinou commented Dec 9, 2021

Has it been discussed off-github?

Not that I know of.

Is there a reason it was not merged (other than that there are thousands of PR sweat_smile)

The PR is lacking a review 🙂

The proposal itself seems to have reached consensus (with 18 👍 reactions as of writing and no comments opposing it).

@reduz
Copy link
Member

reduz commented Jan 4, 2022

The problem with this is that if you are profiling, the window it will break the profiler. This would need to be disabled by the editor or via debugger protocol.

@Calinou
Copy link
Member Author

Calinou commented Jan 4, 2022

The problem with this is that if you are profiling, the window it will break the profiler. This would need to be disabled by the editor or via debugger protocol.

Maybe I could add an .editor feature tag override for the unfocused FPS limit, setting it to 0 (no limit) there? This means the unfocused FPS limit would only be used in exported projects by default.

Edit: Done 🙂
I tested it and made sure the unfocused FPS limit no longer applies when running the project from the editor by default.

…ized

This helps decrease power usage while the project window is unfocused
or minimized.

The default FPS limit is 10. It can be disabled by setting the
`application/run/max_fps_when_unfocused` project setting to 0.
The FPS limit is disabled by default when running the project from
the editor to avoid interfering with profiling tools.
@Calinou Calinou force-pushed the add-fps-limit-unfocused branch from f07b6b3 to 3bef215 Compare January 4, 2022 18:40
@akien-mga
Copy link
Member

We discussed this in a PR review meeting and were not fully convinced yet by the approach. It feels like this adds something that can indeed be useful but this might require more thinking to make sure it works well and matches users' expectations (also to be assessed together with the existing low CPU mode option).

@Mickeon
Copy link
Member

Mickeon commented Jun 26, 2024

2 years have passed. Has something changed that would make this PR more robust with the profiler?

@Calinou
Copy link
Member Author

Calinou commented Jun 26, 2024

Has something changed that would make this PR more robust with the profiler?

This PR no longer affects the running project if it's being run from an editor build, so the profiling issue should be resolved for the local profiling scenario now.

However, remote profiling deploys a debug export template which would have the FPS limit applied. Perhaps we should make it only apply to release export templates instead to avoid this.

I think ideally, the editor debugger should signal when the profiler (or visual profiler) starts so the running project disables the unfocused FPS limit (and restore it when all profilers are stopped).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherrypick:3.x Considered for cherry-picking into a future 3.x release enhancement performance topic:core topic:rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a FPS limit for unfocused and minimized windows to decrease CPU/GPU usage Framerate/FPS jumps to 110, wasting CPU, when game is minimized

6 participants