Bug: Deploy Defender - Black screen on start, game does not load #170

Closed
opened 2026-05-22 17:51:52 +00:00 by Zhekrom · 1 comment
Title: C# Bug: Deploy Defender - Black screen on start, game does not load
Severity: Critical
Mode: Deploy Defender
Lesson ID / File: Deploy Defender (C# course game)
Environment: Browser (specify version), OS (specify version)
Date/Time: 2026-05-22

Source Code

(Not applicable � game loading/rendering issue)

Steps to Reproduce

1. Launch the Deploy Defender game.
2. Wait for the game to initialize.
3. The screen remains completely black.
4. No content loads or appears.

Expected Output

The game should load and display the playable content (menus, game world, or UI elements).

Actual Output

The screen stays completely black from launch. No game content, menus, or UI elements are visible. The game never initializes.

Suggested Priority

Critical � Completely blocks gameplay. The game is unplayable.

Additional Notes

Similar to the Space Game white screen issue (#169), but in this case the screen remains black instead of white. Both suggest a rendering or scene initialization failure after the game starts.

Title: C# Bug: Deploy Defender - Black screen on start, game does not load Severity: Critical Mode: Deploy Defender Lesson ID / File: Deploy Defender (C# course game) Environment: Browser (specify version), OS (specify version) Date/Time: 2026-05-22 Source Code (Not applicable � game loading/rendering issue) Steps to Reproduce 1. Launch the Deploy Defender game. 2. Wait for the game to initialize. 3. The screen remains completely black. 4. No content loads or appears. Expected Output The game should load and display the playable content (menus, game world, or UI elements). Actual Output The screen stays completely black from launch. No game content, menus, or UI elements are visible. The game never initializes. Suggested Priority Critical � Completely blocks gameplay. The game is unplayable. Additional Notes Similar to the Space Game white screen issue (#169), but in this case the screen remains black instead of white. Both suggest a rendering or scene initialization failure after the game starts.
Zhekrom changed title from C# Bug: Deploy Defender - Black screen on start, game does not load to Bug: Deploy Defender - Black screen on start, game does not load 2026-05-22 18:09:20 +00:00
Owner

Root cause identified and fixed in spikerj/spikersoft-angular#11 (auto-merge scheduled once CI passes).

Cause: The app is zoneless and the game canvas is rendered inside the *transloco structural directive. On a direct navigation / hard refresh of the game route the games translation scope loads asynchronously, so the canvas element doesn't exist yet when the component's static @ViewChild query runs. Accessing canvasRef.nativeElement then threw during ngAfterViewInit, which tore down the view and left only the near-black host background — the reported black screen with no UI.

Fix: Game start is now deferred until the canvas is actually in the DOM (requestAnimationFrame poll + host querySelector fallback), so it loads correctly regardless of when translations resolve. Additionally, a null 2D context and any render-loop exception now surface a recovery prompt instead of a silent dead canvas. Regression tests added.

Root cause identified and fixed in spikerj/spikersoft-angular#11 (auto-merge scheduled once CI passes). **Cause:** The app is zoneless and the game canvas is rendered inside the `*transloco` structural directive. On a direct navigation / hard refresh of the game route the `games` translation scope loads asynchronously, so the canvas element doesn't exist yet when the component's `static` `@ViewChild` query runs. Accessing `canvasRef.nativeElement` then threw during `ngAfterViewInit`, which tore down the view and left only the near-black host background — the reported black screen with no UI. **Fix:** Game start is now deferred until the canvas is actually in the DOM (requestAnimationFrame poll + host `querySelector` fallback), so it loads correctly regardless of when translations resolve. Additionally, a null 2D context and any render-loop exception now surface a recovery prompt instead of a silent dead canvas. Regression tests added.
Sign in to join this conversation.