Skip to content

Conversation

@Cautami
Copy link

@Cautami Cautami commented Oct 30, 2025

As such, I've added the following methods:

Engine.get_delta_time()
Engine.get_unscaled_delta_time()
Engine.get_physics_delta_time()
Engine.get_unscaled_physics_delta_time()

get_delta provides the exact same information the _process method provides.
get_physics_delta is the same way but for _physicsProcess

The unscaled methods provide the user a unscaled version of both of these deltas, as they are never multiplied by timescale in the first place, this is the most accurate and convenient way of getting unscaled deltas.

Notes

This is a similar to #86766, just with the extra granularity, and I guess also slightly opinionated, it seemed like the consensus on the proposal was to refer to them as Deltas, makes sense to me and matches what the average user would expect I think.

As far as implementation goes, I'm aware im duplicating process_step here, but I'm not entirely sure how to cleanly handle this.

  1. I could remove the get_process_step function (its only used a handful of times internally) and replace it with the new get_unscaled_delta, but I'm worried this will break compatibility with something else.
  2. Don't add get_unscaled_delta, and have it live through get_process_step (while still being exposed to the scripting api as get_unscaled_delta, but it feels silly to have get_process_step live alongside the more conventionally named deltas.
  3. Rename all the _deltas internally to _step to match process_step, this would internally make the most sense but it could be confusing to have it exposed under a different name.
  4. Just abandon hope and call them all "steps", which would make the exposed api and the internal api match, at the cost of just being a little more confusing to the average user.
Screencast_20251029_210032.webm

@Chaosus Chaosus added this to the 4.x milestone Oct 30, 2025
@Cautami Cautami force-pushed the global-delta-time branch 2 times, most recently from 2ac82a5 to 8838aec Compare October 31, 2025 22:18
@Cautami
Copy link
Author

Cautami commented Oct 31, 2025

Added proper documentation (mostly taken from #86766, thank you Calinou), and I believe its functional and ready to review now. I'm still not certain which way I should take the implementation, but as far as my testing is concerned it works and I'm ready to make any changes to the implementation.

@Cautami Cautami marked this pull request as ready for review October 31, 2025 22:22
@Cautami Cautami requested review from a team as code owners October 31, 2025 22:22
@fire fire changed the title Global way of accessing Delta time and Unscaled Delta time Add global way of accessing Delta time and Unscaled Delta time Nov 1, 2025
@Cautami Cautami force-pushed the global-delta-time branch 2 times, most recently from 55913d3 to d4927b8 Compare November 15, 2025 17:14
Have unscaled_delta just take from process_step, slightly fixes duplication

change it all to delta_time :(

Add proper documentation for the new methods (Courtesy of Calinou)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add improved support for unscaled time

2 participants