Rapid game-content flicker on open / idle 10 Hz UI redraw #8

Open
opened 2026-09-20 22:55:27 +02:00 by alexander · 1 comment
Owner

Symptom

On opening Loopbound, the visible game content can flicker rapidly, appearing to disappear and reappear.

Verified repository state

  • Forgejo repository: alexander/Loopbound
  • Current main: def85e6c9880335b310747d2098bbd22d0c821df
  • Active Slice-7 implementation PR #6 was inspected separately; it does not introduce a rapid hide/show animation or visibility toggle.
  • The behavior below exists on both main and the Slice-7 branch.

Strong implementation suspect

The engine timer runs every 100 ms:

const TICK_MS = 100;

Game.onInterval() ends every non-paused tick with an unconditional this.notify().

The React UI subscribes through useGameRev(); App and many child views subscribe independently, so the visible tree is refreshed at approximately 10 Hz.

For Loopbound specifically, LoopboundGame.advanceLoop() immediately returns when there is no active task:

if (!task) return;

That means an idle screen showing “Time is waiting” still receives ~10 UI notifications/re-render requests per second even though no visible in-world state should change.

The task progress bar also uses a 0.1 s CSS width transition, matching the 100 ms tick cadence, which may amplify repaint/compositor churn while an activity is running.

Why CI did not catch it

Current E2E coverage verifies that the idle message is visible and that world time does not advance while idle, but it does not assert UI/render stability, DOM continuity, frame stability, or notification rate.

Investigation / fix direction

Treat this as a small cross-lane defect (engine notification cadence + UI rendering), without changing gameplay timing semantics.

Please verify on the affected browser/WebView and then prefer the smallest coherent change that:

  1. preserves the authoritative 100 ms simulation clock where required;
  2. avoids notifying/re-rendering the whole UI when an idle tick produced no player-visible change;
  3. keeps active-task progress smooth enough for the intended UX;
  4. does not break tick-driven events, generator output, dialogue, autosave, offline progression, or persistence;
  5. adds regression coverage for idle render/update churn and browser-visible stability.

Do not solve it by changing Loopbound's time semantics or by disabling React StrictMode without evidence that StrictMode is the cause.

## Symptom On opening Loopbound, the visible game content can flicker rapidly, appearing to disappear and reappear. ## Verified repository state - Forgejo repository: `alexander/Loopbound` - Current `main`: `def85e6c9880335b310747d2098bbd22d0c821df` - Active Slice-7 implementation PR #6 was inspected separately; it does not introduce a rapid hide/show animation or visibility toggle. - The behavior below exists on both `main` and the Slice-7 branch. ## Strong implementation suspect The engine timer runs every 100 ms: ```ts const TICK_MS = 100; ``` `Game.onInterval()` ends every non-paused tick with an unconditional `this.notify()`. The React UI subscribes through `useGameRev()`; `App` and many child views subscribe independently, so the visible tree is refreshed at approximately 10 Hz. For Loopbound specifically, `LoopboundGame.advanceLoop()` immediately returns when there is no active task: ```ts if (!task) return; ``` That means an idle screen showing “Time is waiting” still receives ~10 UI notifications/re-render requests per second even though no visible in-world state should change. The task progress bar also uses a 0.1 s CSS width transition, matching the 100 ms tick cadence, which may amplify repaint/compositor churn while an activity is running. ## Why CI did not catch it Current E2E coverage verifies that the idle message is visible and that world time does not advance while idle, but it does not assert UI/render stability, DOM continuity, frame stability, or notification rate. ## Investigation / fix direction Treat this as a small cross-lane defect (engine notification cadence + UI rendering), without changing gameplay timing semantics. Please verify on the affected browser/WebView and then prefer the smallest coherent change that: 1. preserves the authoritative 100 ms simulation clock where required; 2. avoids notifying/re-rendering the whole UI when an idle tick produced no player-visible change; 3. keeps active-task progress smooth enough for the intended UX; 4. does not break tick-driven events, generator output, dialogue, autosave, offline progression, or persistence; 5. adds regression coverage for idle render/update churn and browser-visible stability. Do not solve it by changing Loopbound's time semantics or by disabling React StrictMode without evidence that StrictMode is the cause.
Author
Owner

Full-investigation update — 2026-09-21

The original 10 Hz finding is confirmed, but the broader investigation weakens it as the primary trigger for the newly observed whole-content flicker.

What is confirmed in Loopbound

  • Game ticks every 100 ms and calls notify() after every non-paused interval.
  • LoopboundGame.advanceLoop() returns immediately when no task is active, so idle gameplay still causes revision notifications even when no visible game state changes.
  • useGameRev() passes a newly-created subscribe function to useSyncExternalStore on every render, so React re-subscribes on each revision; this is unnecessary churn.
  • Multiple nested visible components subscribe independently.
  • The idle character sprite is a two-frame canvas animation that repaints every 420 ms.
  • Active-task progress mutates/animates width every 100 ms.
  • Current E2E coverage verifies semantics and visibility but not frame/render stability.

These are worth fixing and can amplify renderer/compositor problems.

Why they are unlikely to be the new sole trigger

Repository history shows the core 100 ms subscription/render pattern has been present since at least 2026-07-02. The sprite animation is also not a recent Slice-6/Slice-7 introduction. No whole-page opacity/display animation, remount key, repeating dialogue/event loop, or repeated save/load cycle was found. Active Slice-7 PR #6 is not the origin.

BookWave / Android WebView seam

The embedded BookWave host was inspected separately.

  • It remembers one WebView instance for the route.
  • AndroidView.update only calls loadUrl() while view.url == null; it does not blindly reload on every Compose recomposition.
  • The host WebView is hardware-rendered with a transparent background and sits inside BookWave's Compose/haze rendering hierarchy.
  • BookWave's host lifecycle destroys the WebView only when the route leaves composition.
  • Therefore a repeated page-load or route-remount loop was not found.

External renderer evidence

Chromium currently tracks P1 issue 513436623 — “WebView continuous flickering caused by DefaultPassthroughCommandDecoder Finch experiment on Android WebView 147”. Independent reports describe blank/blue/black/corrupted Android WebView frames, including Android 16/Samsung reports; some reports say WebView 146 is unaffected while 147 and later development builds reproduce the problem.

This currently makes an Android System WebView/GPU-compositor regression the strongest trigger hypothesis when the symptom occurs in BookWave's embedded game. Loopbound's 100 ms React churn and 420 ms canvas repaint are plausible amplifiers, not yet proven root cause.

Diagnostic acceptance matrix

The next device acceptance should compare the exact same bundled Loopbound snapshot in:

  1. BookWave embedded WebView;
  2. standalone browser/static hosting on the same device;
  3. BookWave with Loopbound Reduce Motion enabled;
  4. exact installed Android System WebView provider/version recorded.

If standalone browser is stable while embedded WebView flickers, and the provider is in the affected renderer family, ownership is primarily BookWave/platform mitigation plus upstream WebView, with Loopbound render-churn cleanup as a secondary resilience improvement.

## Full-investigation update — 2026-09-21 The original 10 Hz finding is confirmed, but the broader investigation weakens it as the **primary trigger** for the newly observed whole-content flicker. ### What is confirmed in Loopbound - `Game` ticks every 100 ms and calls `notify()` after every non-paused interval. - `LoopboundGame.advanceLoop()` returns immediately when no task is active, so idle gameplay still causes revision notifications even when no visible game state changes. - `useGameRev()` passes a newly-created subscribe function to `useSyncExternalStore` on every render, so React re-subscribes on each revision; this is unnecessary churn. - Multiple nested visible components subscribe independently. - The idle character sprite is a two-frame canvas animation that repaints every 420 ms. - Active-task progress mutates/animates width every 100 ms. - Current E2E coverage verifies semantics and visibility but not frame/render stability. These are worth fixing and can amplify renderer/compositor problems. ### Why they are unlikely to be the new sole trigger Repository history shows the core 100 ms subscription/render pattern has been present since at least 2026-07-02. The sprite animation is also not a recent Slice-6/Slice-7 introduction. No whole-page opacity/display animation, remount key, repeating dialogue/event loop, or repeated save/load cycle was found. Active Slice-7 PR #6 is not the origin. ### BookWave / Android WebView seam The embedded BookWave host was inspected separately. - It remembers one `WebView` instance for the route. - `AndroidView.update` only calls `loadUrl()` while `view.url == null`; it does **not** blindly reload on every Compose recomposition. - The host WebView is hardware-rendered with a transparent background and sits inside BookWave's Compose/haze rendering hierarchy. - BookWave's host lifecycle destroys the WebView only when the route leaves composition. - Therefore a repeated page-load or route-remount loop was not found. ### External renderer evidence Chromium currently tracks P1 issue **513436623 — “WebView continuous flickering caused by DefaultPassthroughCommandDecoder Finch experiment on Android WebView 147”**. Independent reports describe blank/blue/black/corrupted Android WebView frames, including Android 16/Samsung reports; some reports say WebView 146 is unaffected while 147 and later development builds reproduce the problem. This currently makes an Android System WebView/GPU-compositor regression the strongest trigger hypothesis when the symptom occurs in BookWave's embedded game. Loopbound's 100 ms React churn and 420 ms canvas repaint are plausible amplifiers, not yet proven root cause. ### Diagnostic acceptance matrix The next device acceptance should compare the exact same bundled Loopbound snapshot in: 1. BookWave embedded WebView; 2. standalone browser/static hosting on the same device; 3. BookWave with Loopbound Reduce Motion enabled; 4. exact installed Android System WebView provider/version recorded. If standalone browser is stable while embedded WebView flickers, and the provider is in the affected renderer family, ownership is primarily BookWave/platform mitigation plus upstream WebView, with Loopbound render-churn cleanup as a secondary resilience improvement.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
alexander/Loopbound#8
No description provided.