Description
In order to have objects move at the same speed regardless of FPS while still keeping a game's logic deterministic, we need some way to let users mark systems to be run with a fixed timestep. (See the classic Gaffer on Games article here)
Currently a user could achieve this by creating an accumulator resource inside a system and running the system's logic multiple times per call based on that accumulator. However, this stops working correctly when you try it with multiple systems at once. If systems A and B should both run with a fixed timestep, and B is dependent on A, then they should always run one after another (ABABAB); but using this method would first make A run a few times, then B run a few times (AAA...BBB...), so their order would depend on the amount of time in the accumulator, and thus be nondeterministic.
To solve this, I think we should create a second scheduler and push systems to there that a user wants to run with a fixed timestep. On each frame that entire schedule would be executed some number of times based on the amount of time in an accumulator, and it would execute before the main scheduler. This approach of running fixed-timestep logic before other logic is how other engines like Godot and Unity have handled this issue.
Additionally, we'd need some way in the API to configure what the timestep actually is, as well as a way for systems to read that value, ideally through the Time resource. A field containing a float between 0 and 1 indicating how far through the current timestep we are would also be helpful, since this would allow rendered objects to update faster than the fixed timestep through the use of interpolation.