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

Implement Feral GameMode integration on Linux #5453

Open
Calinou opened this issue Sep 18, 2022 · 0 comments
Open

Implement Feral GameMode integration on Linux #5453

Calinou opened this issue Sep 18, 2022 · 0 comments

Comments

@Calinou
Copy link
Member

Calinou commented Sep 18, 2022

Related to #5449 and #5451.

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

Optimized settings for gaming aren't automatically used when running a Godot project on Linux.

This includes using the performance CPU governor to reduce stuttering, and optionally forcing high GPU clocks to reduce input lag and avoid GPU-induced stuttering (similar to NVIDIA Reflex's Boost mode).

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

When the daemon is installed and game engine integration is performed, GameMode automatically kicks in when the project starts, and is automatically disabled when the process exits. The user won't need to manually run the project binary with gamemoderun.

Note that Feral GameMode integration only works if the GameMode daemon is installed on the system. It's available in distribution repositories and may be installed by default on some distributions.

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

  • Add an Application > Run > Use Game Mode project setting (enabled by default).
    • The setting's name is OS-agnostic, which could allow toggling other operating systems' game mode into a single setting (if these are implemented). Documentation should however mention that the setting will only have an effect on Linux at first, and only on systems with the GameMode daemon installed.
    • To preserve battery life on laptops, the editor itself is not affected by this setting, but the project running from the editor is.
    • If needed, we can add a Allow Game Mode editor setting that forcibly disables GameMode integration when running a project from the editor, even if the project has the setting enabled.
  • Integrate libgamemode into the core engine.

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

GameMode can be set up by the user themselves as explained above, but this is less convenient compared to engine-level integration.

Alternatively, a launcher script can be provided that uses gamemoderun if found on the system:

#!/bin/bash

if command -v gamemoderun &> /dev/null; then
  gamemoderun ./the_game.x86_64 "$@"
else
  ./the_game.x86_64 "$@"
fi

To only affect the project running from the editor, the Main Run Args project setting can be edited to gamemoderun %command%. This will however cause the project to fail starting if gamemode is not installed on the system.

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

To my knowledge, GameMode engine integration must be done at a core level, as it hooks into low-level, early main() initialization.

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

No branches or pull requests

1 participant