Skip to content

run() at fixed timestep intervals #28

@minecrawler

Description

@minecrawler

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    To do

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions