Skip to content

feat(schedulers): system schedulers#68

Merged
ripel2 merged 44 commits intomainfrom
66-system-update-scheduler
Dec 8, 2024
Merged

feat(schedulers): system schedulers#68
ripel2 merged 44 commits intomainfrom
66-system-update-scheduler

Conversation

@ripel2
Copy link
Contributor

@ripel2 ripel2 commented Nov 30, 2024

(as the critcal label is not setup yet please consider this PR as critical)

Related to:

I have modified the way we handle system running by adding schedulers.

The schedulers work by implementing a common interface that simply needs the call operator operator()(Registry &reg). Each scheduler is responsible for running the systems the way intended.
We can get a scheduler by using the GetScheduler method from the registry. This is useful if the scheduler is based on time, for example, the FixedTimeScheduler.

I have implemented two basic schedulers Startup and Update : startup will only execute the systems once and update is the classical way of running systems (each time we call the RunSystems function).

I have also implemented two time based schedulers FixedTimeUpdate and RelativeTimeUpdate.

Fixed time works by only calling the systems when needed and doing multiple runs if the framerate doesn't meet the tick rate of the scheduler. By default the tickRate is 20ms (frame time when running at 50FPS). With this scheduler, the systems will only run 50 times per second even if the framerate is higher. There is a method to get the FixedDeltaTime.

Relative time works by calling the systems based on a target tickRate. If the client manages to run at the given tickRate or higher, the systems will always run once, but if the target tickRate isn't met the systems will run multiple times, taking into account the whole deltaTime the frame took. With this scheduler, systems always run at least once and will run multiple times if needed. There is a method to get the current deltaTime we should use for computations.

I have also modified the soft body simulations to use the RelativeTimeScheduler, as I find it the most appropriate.

@ripel2 ripel2 linked an issue Nov 30, 2024 that may be closed by this pull request
@ripel2 ripel2 self-assigned this Nov 30, 2024
@ripel2 ripel2 added the enhancement New feature or request label Nov 30, 2024
@MasterLaplace MasterLaplace marked this pull request as ready for review December 2, 2024 23:59
Copy link
Contributor

@Miou-zora Miou-zora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it's nice 👍🏼 but the fact that we use time management along multiple scheduler with different context (resource RealTimeProvider and scheduler RelativeTimeUpdate::GetCurrentDeltaTime) may be disturbing.

@Miou-zora
Copy link
Contributor

Also, putting implementation of schedulers inside of header file is questionable

@ripel2 ripel2 changed the title feat(scheduler): system schedulers feat(schedulers): system schedulers Dec 5, 2024
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2024

@ripel2 ripel2 requested a review from Miou-zora December 6, 2024 09:17
@ripel2 ripel2 requested a review from MasterLaplace December 6, 2024 18:05
@ripel2 ripel2 requested a review from Miou-zora December 7, 2024 13:10
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 7, 2024

@ripel2 ripel2 merged commit 433582d into main Dec 8, 2024
@ripel2 ripel2 deleted the 66-system-update-scheduler branch December 8, 2024 09:29
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

None yet

Development

Successfully merging this pull request may close these issues.

System Update Scheduler

3 participants