Skip to content

feat: add actions to set max and min FPS at runtime #7754

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ArturKrys
Copy link

Summary

This PR adds two new actions under Game scene (Events) in GDevelop that allow developers to dynamically configure the game's maximum and minimum frames per second (FPS) during runtime.

These settings are useful for:

  • Reducing FPS during non-interactive scenes (e.g., cutscenes).

  • Exposing FPS settings in a game’s graphics or performance menu.

Implementation Details

  • Actions are declared in TimeExtension.cpp using .AddAction(...).

  • Mapped to new JS runtime functions:

    • gdjs.evtTools.runtimeScene.setMaximumFPS
    • gdjs.evtTools.runtimeScene.setMinimumFPS
  • FPS values are applied to RuntimeGame._maxFPS and _minFPS, which affect the main game loop behavior.

Demo

2025-08-01.03-20-27.mp4

Related issue

Closes #5362

@ArturKrys ArturKrys requested a review from 4ian as a code owner August 1, 2025 02:26
This adds two new event actions under the Time category that allow
developers to change the game's maximum and minimum FPS during runtime.

These values are applied directly to the RuntimeGame instance and
affect the rendering loop's frame rate capping behavior.

Note: No validation is currently performed. Negative values or setting
minFPS greater than maxFPS may lead to undefined behavior or visual
issues. Future improvements could include IDE-level validation or
runtime warnings.
@ArturKrys ArturKrys force-pushed the feature-max-min-fps branch from 9bcdb31 to 42e57a2 Compare August 3, 2025 20:33
@4ian
Copy link
Owner

4ian commented Aug 3, 2025

Hi! Thanks for this PR :)
I think it would be nice to add:

  • methods to runtimeGame to avoid modifying a "private" property (starting with underscores) (this will be helpful in the future if changing these values imply other operations to be done)
  • validation in these new functions of the value (basically: not negative. 0 is considered unlimited already for maximum FPS).

@rstech-hub
Copy link

Add a small info icon next to the FPS settings that explains what they do

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

Successfully merging this pull request may close these issues.

Add an action to change the maximum and minimum FPS.
3 participants