Repository navigation
Life 15: the engine in a worker thread [LIFE15-Worker-069] - #90
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update 069: the Life engine runs in a Web Worker, so frames no longer wait for it.
What changed
engineWorker.tsruns the engine. The page keeps the clock and asks for a goal 0.1 s ahead at the speed shown. The worker runs in slices of at most 50 ms and sends a view copy every stride (the speed over 60 minutes, at least one).viewCopy.tsbuilds the view copy, which keeps only what the page reads:It travels as its changes from the last copy, and
engineLink.tsapplies them on the page.Playback functions in
valleyViewModel.tsreplace the per-frame engine step. The page draws the newest copy at or before the clock. When the worker is behind, the clock waits and the page keeps drawing.The loading card stays until the worker has built its valley.
The engine is unchanged, so every fingerprint stays the same.
Measured (off-screen Chrome, production builds, main → this branch)
Not settled
npm run agent:checkpasses.