How to change speed of my game (adding slowmo feature)?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Robotex

How to regulate speed of my game? I want to add ability that makes time flow slower (like in The Matrix movie or Super Hot videogame) or even pause it? How to do it?

Related: Any way to manipulate time scale?

idbrii | 2023-06-11 00:21

:bust_in_silhouette: Reply From: p7f

For simple things, you can try Engine.time_scale. Setting it to 1 means normal speed, to 0.1 means ten times slower, etc. For example

Engine.time_scale = 0.5

Makes the game run at half speed. However, i found that some collisions may show strange behaviours… you should try and see if its enough for you.

BTW, according to reddit, this is what securas used in his github game off jam winner, Sealed Bite.

i found that some collisions may show strange behaviours

Is it continuous collisions?

Robotex | 2020-07-14 08:57

:bust_in_silhouette: Reply From: JimArtificer

If you plan to have many different methods of time control as a central element of your game, such as in Braid, you will probably have to use a custom engine. (Either your own or Godot’s code as a starting point.)

As the other person mentioned, you might be able to modify the Engine.time_scale value for a simple slowdown effect. You could even combine that with some other modifiers if you want the player character to move/act at “normal” speed during the slowdown.

Another option you could try that would give you more control over individual objects is to manipulate the delta value of the process and physics_process functions:

For example, modify the delta value for certain objects by a percentage determined by the player’s movement speed in the case of Superhot.