Skip to content

fix(startup): show the game window when the intro is disabled - #29

Open
Alx8g wants to merge 2 commits into
mainfrom
fix/reveal-game-window-without-intro
Open

Alx8g wants to merge 2 commits into
mainfrom
fix/reveal-game-window-without-intro

Conversation

@Alx8g

@Alx8g Alx8g commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Problem

With Launch Animation turned off, some launches went permanently black: the window appeared but Krunker never loaded, and the only recovery was killing the client.

Cause

The game window is created hidden. With the intro enabled, the intro's opaque reveal shows it unconditionally about 1.5s in, which also stops Chromium treating the renderer as a hidden window. With the intro disabled, the first and only reveal was ready-to-show. A hidden renderer receives no compositor frames, so Krunker's load can stall before that event fires. The 25s failsafe then shows a window whose renderer never painted: a black screen for the rest of the session.

Two further crashes were reproduced on every launch while diagnosing this (from the renderer console log):

  • whenDOMReady reached observer and poll before their declarations whenever the body already existed, killing the reload/did-finish-load applyClientVisuals pass, so theme, custom identity and the keyframe fix never ran.
  • Menu declutter called every/filter on NodeLists returned by querySelectorAll, producing a repeating Uncaught TypeError: cards.every is not a function.

Fix

  • Show the hidden game window as soon as the navigation starts when the intro is not running (main.ts). The preload's splash covers the unstyled page, so there is no visual seam.
  • Declare observer/poll before run and guard the interval id (preload.ts).
  • Spread NodeLists into arrays before every/filter (menu-declutter.ts).

Verification

  • pnpm run validate: lint, typecheck, 586 tests pass.
  • Local launch with introAnimation: false plus the release smoke harness: outcome success, window visible, game usable at 8.3s, non-uniform pixels. Both renderer console errors are gone (0 occurrences vs repeating before).

A hidden renderer receives no compositor frames, so with Launch Animation
off Krunker's load could stall before ready-to-show and the launch
deadlocked behind a black screen. The intro path always shows the window
at its opaque reveal; the no-intro path now does the same as soon as the
navigation starts.

Also fixes two renderer crashes hit on every launch:

- whenDOMReady reached observer and poll before their declarations
  whenever the body already existed, killing the reload/fallback
  applyClientVisuals pass (theme, identity and keyframe fix never ran).
- menu declutter called every/filter on NodeLists returned by
  querySelectorAll, throwing a repeating Uncaught TypeError on the menu.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant