Wait for driven videos before a run starts so no sprite flashes (#404)
The game view opens a player for each driven video only when it draws, and it draws only while its tab is visible. Without a detour over the Game tab the players came up with the click on Play. Until a video had loaded, its sprite showed its base colour, white in the user's cut. Sharing the players of the scene view would not have helped. From the Animations tab those are discarded after two to four seconds. - Play holds the run at second 0 until every driven video in the game view has its first picture, at most 3 s. The status line says "Loading the videos… · Esc stops". - The game clock stands while it waits. Behaviors and sounds start only after it, so picture and sound stay together. - Load scene in a running game waits the same way. - A driven video without a picture is not drawn at all instead of white. That holds everywhere, also on a switch to the Game tab without Play and at a cut whose video is not ready. - The exported player waits the same way. - __gm.playInfo() reports waiting for the e2e check. Tests: - e2e 66p puts the sprite in front of the camera and waits 4.5 s so the game view has no player left. Then it reads every frame of the run: 14 frames of waiting on #22252c at time 0, then blue, no white. - Against the old code 66p fails: 14 frames #ffffff, then blue. - Unit video-library: 7 passed, 1 new for loading(). - e2e 66 on melektaus-atx: ALL PASSED, 27 checks. - Gate on melektaus-atx: exit 0, 297 files, 4558 tests. - tsc, eslint, Prettier clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
843b110bcb
commit
dd60a795e1
8 files changed
+143
-7
No files matched your search
@@ -33,6 +33,8 @@ const END_SLACK = 1 / 60;
|
||||
const IDLE_MS = 2000;
|
||||
/** Closer than this a seek that waited for the one before it is not worth another. */
|
||||
const SEEK_SLACK = 1 / 120;
|
||||
/** How long a run waits at its start for the driven videos it shows (#404) before it goes anyway. */
|
||||
export const VIDEO_WAIT_MS = 3000;
|
||||
|
||||
/** What the wearer of a driven player (#404) asks of it, see `wear`. */
|
||||
interface Drive {
|
||||
@@ -111,6 +113,21 @@ export class VideoLibrary {
|
||||
return { ...ref, file: key };
|
||||
}
|
||||
|
||||
/** Whether the player behind `key` has its first picture; it does not count as an ask. */
|
||||
hasPicture(key: string): boolean {
|
||||
return this.players.get(key)?.texture != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a driven player (#404) the view `view` wears (see `wear`) is still without its first
|
||||
* picture. A run waits for them at its start: the Game tab opens players of its own at Play.
|
||||
*/
|
||||
loading(view: string): boolean {
|
||||
const mark = `@${view}:`;
|
||||
for (const [key, player] of this.players) if (!player.texture && key.includes(mark)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/** A run begins: every player from its start, heard. A driven one goes where its wearer says. */
|
||||
startRun(): void {
|
||||
this.heard = true;
|
||||
|
||||
Reference in new issue
Block a user