Skip to content
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

Add a --max-fps command line argument to set a built-in FPS limit on any project #5449

Closed
Calinou opened this issue Sep 18, 2022 · 0 comments · Fixed by godotengine/godot#78012
Milestone

Comments

@Calinou
Copy link
Member

Calinou commented Sep 18, 2022

Related to #1923 and #5448.

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

When playing a game made by someone else, it's sometimes desired to override the FPS limit if the developer doesn't provide any way to control it. This is common in gamejam games, for instance.

Since capping the framerate allows to reduce GPU power draw and decrease input lag noticeably (even on 144 Hz displays), this is something I almost always do when playing games. Lowering GPU power draw has several benefits, such as reduced noise/heat output, improved battery life and more power budget for the CPU to use (on integrated graphics). Also, with electricity prices rising across the globe, reducing system power usage has become even more important lately.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I propose adding a --max-fps CLI argument that handles the project's framerate cap when the project starts:

  --max-fps <fps>    Limit rendering FPS to the specified value (can be used to reduce system power draw).

Question: Why not use an external FPS limiter like RTSS or libstrangle?

External FPS limiters limit GPU power draw, but they don't reduce input lag in GPU-constrained scenarios. Therefore, built-in FPS limiters are preferable whenever they exist and are well-implemented.


Question: Why not use --frame-delay <ms>?

Delaying each frame's rendering by a constant amount in milliseconds is not designed to provide accurate FPS limiting. Instead, frame delay is only meant to simulate CPU-constrained scenarios (therefore leading to stuttering with values that are close to the monitor's refresh rate in milliseconds-per-frame).

This proposal does not suggest removing --frame-delay <ms>, but its use cases are arguably more niche. Its description could however be changed to clarify the difference with between --frame-delay <ms> and --max-fps <fps>.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

main/main.cpp should be modified to accomodate for this new CLI argument.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

It can technically be an add-on, but the point here is that this functionality must be built-in to achieve the desired goal (which is, capping the framerate on any project made with Godot).

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

Successfully merging a pull request may close this issue.

2 participants