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

Native Tick Timers #1633

Open
alice-i-cecile opened this issue Mar 12, 2021 · 1 comment
Open

Native Tick Timers #1633

alice-i-cecile opened this issue Mar 12, 2021 · 1 comment
Labels
A-Time Involves time keeping and reporting C-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@alice-i-cecile
Copy link
Member

What problem does this solve or what need does it fill?

Tick based timers are timers that operate not on real time, but on the number of state updates that occur. Each state update constitutes a "tick".

For any timer that does not update outside a game session, a tick based timer is preferred. This makes games more consistent and replayable (which also means they are easier to debug).

From the bevy_tick_timers crate.

There are three arguments for moving this in-tree IMO:

  1. Ensure API consistency and stability.
  2. Encourage beginners to use tick-timers for most gameplay, rather than more complex and flaky real-time timers.
  3. Allow us to use tick-timers internally, such as for delayed state chart transitions (see Add remaining State Chart functionalities to States #1597).

What solution would you like?

Borrow from @maplant's solid foundation and create a Bevy drop-in-replacement for ordinary real-time timers.

What alternative(s) have you considered?

Continue to rely on a third-party library. I've argued above why I think this is inferior.

Additional context

None.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Mar 12, 2021
@maplant
Copy link

maplant commented Mar 12, 2021

I'm very glad that you found it useful! Take whatever you need from the repo.
Because you're integrating it directly into Bevy you could consider using it as a wholesale replacement for the current schedule, a notion I wrote up about here: https://github.com/maplant/bevy-tick-timers/blob/master/about-tick-timers.org#a-timer-based-approach-for-scheduling
I think that the effort and amount of changes would probably make it not worthwhile, however it does have the nice property that single use timers can take self: Box<Self> and thus can move items out of their struct without mem::replace, while timers that continuously rerun still take &mut self.

Let me know if you need any help from me!

@alice-i-cecile alice-i-cecile added the S-Needs-Design-Doc This issue or PR is particularly complex, and needs an approved design doc before it can be merged label Apr 23, 2021
@alice-i-cecile alice-i-cecile added A-Time Involves time keeping and reporting and removed S-Needs-Design-Doc This issue or PR is particularly complex, and needs an approved design doc before it can be merged labels Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Time Involves time keeping and reporting C-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants