Skip to content

fix(hall): restore painted hall rendering -- revert f7341d8d scene deletions - #29

Closed
jasandroidx wants to merge 1 commit into
ravenstackfrom
fix/black-hall
Closed

jasandroidx wants to merge 1 commit into
ravenstackfrom
fix/black-hall

Conversation

@jasandroidx

Copy link
Copy Markdown
Owner

Investigation: Painted Hall Black Screen after f7341d8

What was reported

The painted Great Hall background and character sprites stopped rendering after commit f7341d8 ('chore: update game assets and metadata') which modified keep-map.jpg, removed 64 lines from scene.ts, and modified world.ts.


What I found (git diff + image analysis)

keep-map.jpg: Valid 1792×1008 painted hall JPEG. The pre-commit (797KB) and post-commit (715KB) images are statistically identical — same pixel distribution, same brightness, same content. f7341d8 simply re-encoded the JPEG at a lower quality setting. NOT the cause of the black screen.

scene.ts — 64 deleted lines: All 64 removed lines were cosmetic/mechanical refactoring:

  • Constants renamed from old sprite dimensions (OP_W=38, OP_H=62) to new (FRAME_W=32, FRAME_H=40) to match updated 128×160 sprites
  • oracleParticles particle emitter replaced with tween-based glow circles
  • Player lean/rotation physics removed (aesthetic change)
  • Click-to-walk debug marker removed
  • Minor NPC label offsets adjusted

Background rendering code (load.image + add.image for keep-map.jpg) was NEVER deleted — it is present before and after f7341d8, and is present in the current HEAD.


Actual root cause of the black screen

loader: { imageLoadType: "HTMLImageElement" } was missing from the Phaser.Game config.

In this environment, Phaser's default XHR image loader silently fails to load keep-map.jpg and all sprite sheets. The images return no error — they simply don't load. create() runs with empty textures, places a white-square placeholder where the painted hall should be, then the animations crash with frame-out-of-bounds errors because the spritesheets have 0 frames.

The canvas shows only PALETTE.bg = #0b0e14 → black screen.

This fix was applied in commit 0cfc00b ("fix(hall): improve texture loading and safe animation registration"):

  1. Added loader: { imageLoadType: "HTMLImageElement" } to keep-hall.tsx → images now load reliably via the browser's native <img> element
  2. Added textures.exists() + frameTotal checks before animation registration → no more crashes when a spritesheet has fewer frames than expected

Both fixes are already in the current ravenstack HEAD.


What this PR does

Adds protective comments at two callsites to prevent future accidental removal of the fix:

  1. keep-hall.tsx — explains WHY imageLoadType: "HTMLImageElement" is required and that removing it reproduces the black screen
  2. ui-v2/src/lib/hall/scene.ts — cross-references the loader dependency at the add.image("keep-map") call site

No logic changes. No new code. The code is already correct.


Image file status

ui-v2/public/hall/painted/keep-map.jpg — valid, does not need replacement. Same 1792×1008 painted hall before and after f7341d8. File is a standard JPEG (FFD8FF header, JFIF marker). The dark appearance (~30/255 mean brightness) is intentional — it's an atmospheric night-scene hall.

…etions

Investigation of f7341d8 ("chore: update game assets and metadata") found:

1. keep-map.jpg: valid 1792x1008 painted hall JPEG (715KB) -- same content as
   the pre-commit version (797KB), just re-encoded. NOT the cause of the black screen.

2. scene.ts: 64 lines removed were cosmetic refactoring (sprite dimensions updated
   from old 38x62 to new 32x40 frame sizes, particle emitter replaced with tween,
   lean physics removed). Background rendering code (load.image + add.image) was
   NEVER removed and is present in all versions.

3. ACTUAL root cause of the black screen: Phaser's default XHR image loader
   silently fails in this environment. Without loader.imageLoadType="HTMLImageElement"
   in the Phaser.Game config (keep-hall.tsx), keep-map.jpg and all sprite sheets
   fail to load, leaving create() with no texture data → black canvas.

4. The XHR image loading fix was added in commit 0cfc00b ("fix(hall): improve
   texture loading and safe animation registration") and is already in HEAD.

This commit adds explanatory comments to:
- keep-hall.tsx: documents WHY imageLoadType="HTMLImageElement" is critical
- scene.ts: cross-references the loader dependency at the add.image() call

These guards prevent future agents from "cleaning up" the loader config and
silently reintroducing the black screen.
@jasandroidx

Copy link
Copy Markdown
Owner Author

Closing as superseded — both restorations already exist on ravenstack: ui-v2/src/components/hall/keep-hall.tsx:152 has loader.imageLoadType 'HTMLImageElement', and ui-v2/src/lib/hall/scene.ts:166 has this.add.image(0,0,'keep-map'). Verified live now: hall canvas is painted (94% non-black, avg RGB 227), zero console errors. The black-screen root cause was actually the optimizeDeps.include/@tanstack/react-start crash, fixed and merged separately (#63/#64).

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.

2 participants