Repository navigation
Conversation
The built-in effects handler commits a render state as soon as the host's render returns, and the engine builds the next state's BGM audio effects from the committed state. A host that holds a state back while its assets load, and then draws only the latest held state, was left with effects for music it never drew: after two quick section changes the second state faded out the first section's music, which a strict renderer rejects. A host render can now return false for a state it holds back. The handler leaves that state uncommitted, and the host commits it with effectsHandler.commitRenderState(renderState) when it draws it. Held states that are skipped for a later one, or held before a reset, are never committed. Hosts that return nothing keep the current behaviour.
Contributor
Author
|
Closing: the problem this addressed is fixed in the host, which now draws held render states in order, so nothing needs this API. The branch is kept in case a host that draws only the latest held state needs it later. |
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.
Problem
createEffectsHandlercommits a render state as soon as the host'srenderreturns, and the engine builds the next state's BGM audio effects from the committed state.A host may be unable to draw a state at once, for example while the state's assets load. If such a host draws only the latest state it held back, the engine and the screen disagree about which music is playing:
audioEffects[0].targetId "bgm:..." does not resolve to an audio node.Fix
A host can now tell the handler that it held a state back:
routeGraphics.render(renderState)returningfalseleaves the state uncommitted.effectsHandler.commitRenderState(renderState)commits it when the host draws it. It returnstruewhen it committed the state.reset()ordispose().Hosts whose
renderreturns nothing (or any value other thanfalse) behave exactly as before. A host that draws every held state later, in order, needs no change and must not returnfalse;docs/RouteEngine.mddescribes both choices.Tests
spec/createEffectsHandler.heldRenderStates.test.js(new):undefined,trueand other values; a held state committed once by the host; a skipped held state; a held state dropped when a later state is drawn at once; held states committed in order; an unknown state; states held beforereset()anddispose().bun run test(2607 tests),bun run lintandbun run buildpass.This changes the host contract only; no render state output changes, so there is no visual test for it.
Version
Bumps
route-engine-jsto 1.51.1.