bevyengine / bevyengine/bevy

Add "should I use a timer or a fixed timestep" section to the `bevy_time` docs

Open
#7,637 3 comments 0 reactions 0 assignees View on GitHub
A-Time C-Docs
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## How can Bevy's documentation be improved?

This distinction is a common source of confusion. We should address it in `bevy_time` module docs, and link it from the relevant examples.

Fixed timesteps should be used for:

- physics
- framerate independent gameplay calculations

Timers should be used for:

- cooldowns
- periodic effects
- delays

If you ever want more than one interval of something, you want a timer.

In many cases, you want to run all of your "game logic" inside of the fixed update schedule. and commonly have timers *within* that schedule (which are updated based on the elapsed fixed time).

Transforms should be interpolated from a physics-based source of truth, updated in the fixed timestep.

> [7:31 PM]Joy: all that a fixed timestep does is queue up steps based on how much time has passed
[7:33 PM]Joy: "N steps per second" is an exchange rate
[7:34 PM]Joy: it's not "run each step precisely 1/N seconds apart"
[7:36 PM]Joy: like, it can't control how much time passes between the steps
[7:37 PM]Joy: that's what a timer does, "don't run this until at least X seconds pass"

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.