-
-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Add game speed controls to the embedded game window #107273
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
base: master
Are you sure you want to change the base?
Add game speed controls to the embedded game window #107273
Conversation
Love this functionality! But the UX of this needs work – because if the user wants to slow down a lot to see a specific thing in slow motion and then resume normally, it needs a LOT of clicks with this interface. Perhaps a dropdown (probably), a small slider, or a small field where one can enter a percentage. |
Cool! Without the |
Do you think the speed reset button is needed? 2025-06-08.05-49-17.mp4 |
Arguably it would be great to be able to reset to 1.0x using a little reset button (like the one used to reset variables to their default in the inspector!), but we wouldn’t want the bar to grow or shrink in width. maybe there’s a clean solution to this? |
I have two solutions, the first is to reset the value by right-clicking on the menu button, the second is to add a button to reset it, when the value is one, the button is not hidden and only disabled. |
as right clicking is hidden, the button is probably a better idea? |
The current implementation changes several values directly. Instead, they should override those temporarily (and add up to those that have been changed in the game itself) and go back to their original values once done. |
Let me give you a example:
This is how it's done for the mouse mode behavior as well. |
The reason I wanted those buttons is to have keyboard shortcuts for them, but we can replace it with a toggle that enables the speed override instead. This means you could toggle between slow motion and full speed, or full speed and fast-forward. It would use remember the last selected speed to toggle back to every time you press the shortcut (on startup, it'd default to 2×). Emulators generally have a key you can press (or hold, like in Dolphin) to enable turbo mode. They sometimes have a separate slow motion key though (as well as frame advance). |
0732f18
to
dd5849c
Compare
I updated the code so that |
dd5849c
to
6083546
Compare
They can also be changed by the user, so yes. |
6083546
to
b46b8c2
Compare
b46b8c2
to
addc7bc
Compare
addc7bc
to
b233c0c
Compare
b233c0c
to
9bb5cb0
Compare
2025-06-11.05-48-48.mp4There's a problem, don't I? |
I haven't tested yet, but this should be effecte. |
2e6004a
to
fd6292e
Compare
fd6292e
to
9754672
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as expected (including with run-time time speed controls coming from the project itself, using godotengine/godot-demo-projects#1234). Great work 🙂
I've made some review comments that improve the display of the time speed control to look like this:

Notice the Unicode multiplication symbol and rounding being improved to show the correct game speed for the slowest setting.
Do I need to set a minimum size because different size values will cause the controls to move? |
Yes, it's a good idea to increase the minimum width of the MenuButton to cater for its longest possible string Alternatively, you could display speeds lower than 1× as fractions to be shorter, e.g. |
it's not appear well for |
You could display that one as |
Yeah I know, but I mean inside for loop to do math stuff |
I have a suggestion : |
I tested the slider previously; the UI became weird. |
9754672
to
a08e749
Compare
a08e749
to
c32d907
Compare
c32d907
to
4fa91bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this can be done using |
There is also |
Ok, looks like I found a solution. float min_size = 0;
for (String lbl : time_scale_label) {
min_size = MAX(speed_state_button->get_minimum_size_for_text_and_icon(vformat(U"%s×", lbl), Ref<Texture2D>()).x, min_size);
}
speed_state_button->set_custom_minimum_size(Vector2(min_size, 0)); With this you don't need unreliable |
4fa91bd
to
1e5a271
Compare
Done |
closes godotengine/godot-proposals#12555
preview.mp4