GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

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

Open ArturKrys opened this issue 4 months ago • 2 comments

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

https://github.com/user-attachments/assets/17b036c3-9840-4078-aab8-11cf2fb9e0da

Related issue

Closes #5362

ArturKrys avatar Aug 01 '25 02:08 ArturKrys

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).

4ian avatar Aug 03 '25 21:08 4ian

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

rstech-hub avatar Aug 08 '25 19:08 rstech-hub