Skip to content
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

Add Maximum Timeouts per Tick property to Timer #89786

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

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Mar 22, 2024

This allows Timers to be configured to emit the timeout signal multiple times per process or physics tick. This is useful for timers with a low wait time (< 0.05 seconds), or to ensure they stick closer to real time when framerate is highly variable.

Keep in mind that high values will allow the function to be called dozens of times or more in a single frame, which can have a performance impact if the method connected to the timeout signal is slow.

The default value is 1 to preserve existing behavior. We could perhaps consider increasing this to 8 (to match the default Max Physics Steps per Frame project setting value) to improve out-of-the-box Timer usability at low wait times, but this will change behavior in some projects.

Testing project: test_timer_maximum_timeouts_per_tick.zip

Preview

MTPT: Max Timeouts Per Tick

timer_max_timeouts_per_tick.mp4

@Calinou Calinou added this to the 4.x milestone Mar 22, 2024
@Calinou Calinou requested review from a team as code owners March 22, 2024 18:37
@Calinou Calinou force-pushed the timer-add-maximum-timeouts-per-tick branch 2 times, most recently from 458df9e to 34f9d1b Compare March 22, 2024 19:54
This allows Timers to be configured to emit the `timeout` signal
multiple times per process or physics tick. This is useful for timers
with a low wait time (< 0.05 seconds), or to ensure they stick closer
to real time when framerate is highly variable.

Keep in mind that high values will allow the function to be called
dozens of times or more in a single frame, which can have a performance
impact if the method connected to the `timeout` signal is slow.
@Calinou Calinou force-pushed the timer-add-maximum-timeouts-per-tick branch from 34f9d1b to 20e503a Compare March 23, 2024 17:11
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 a Timer property to synchronize time elapsed to delta/FPS
2 participants