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

run() at fixed timestep intervals #28

Open
minecrawler opened this issue Nov 10, 2020 · 1 comment
Open

run() at fixed timestep intervals #28

minecrawler opened this issue Nov 10, 2020 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@minecrawler
Copy link
Collaborator

Since world.run() is the core of the whole game loop, it should support features which are expected of any good game loop executing logic, and I think one of the missing pieces is the ability to run the logic at fixed intervals. Usually, that means at 60 steps per second.

I think using setInterval() would be a good fit for this instead of coming up with custom timing logic - but we'll have to see how it works out, especially with browsers currently scaling down precision because of security concerns.

I think, making run() use fixed steps should be configured via the configuration parameter - there could be a field which sets the frequency. At the same time, logic has to be in place which makes sure that every step waits for the previous step to finish first and then execute, so that things don't go to undefined land at every hickup. Plus this has to be logged, because it might mean that the logic is too slow and developers have to optimize the code to run at the target frequency, or decrease the frequency.

@minecrawler minecrawler added the enhancement New feature or request label Nov 10, 2020
@minecrawler minecrawler added this to the 1.0 milestone Nov 10, 2020
@vmwxiong
Copy link

just my 2 cents, but this feels like something that belongs outside of the ECS framework itself. I think the only thing the framework should provide is some method to easily access deltaTime from one tick to the next. How and when the ticks run seems like something up to the specific implementation that might use the framework.

@minecrawler minecrawler added this to To do in New Features Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To do
Development

No branches or pull requests

2 participants