Skip to content

Add a top-down .lvl grid preview with a configurable render scale

Mike Boyer requested to merge dungeon486-level-preview into main

Gives .lvl files a real Preview panel render: walls, floor, doors, exits, boards, props, and item/weapon pickups all composite from their actual referenced art (resolved via the campaign-root machinery from the previous session), not placeholder colors. Enemies use a fixed placeholder sprite since real directional art is a separate, already-tracked body of work; no door_style/item style= recoloring yet -- both stated directly in the preview's own caption.

New hand-built fixtures for assets that didn't exist anywhere in the repo yet: textures/door.pgm, textures/exit.pgm, board textures, item pickup/key sprites, a prop sprite. debug_demo.lvl extended with a prop so it now exercises every renderable element in one fixture.

Render scale is user-configurable (a Settings panel dropdown: 64 native / 128 / 256), riding the same generic opts channel CSV's preview row cap already established. An independent output-size cap (_LVL_MAX_OUTPUT_DIM) protects against a large map at max zoom trying to allocate a multi-gigabyte image -- the effective scale for that render is automatically reduced to fit instead, stated in the caption.

Real bug caught by actually rendering and looking at the output, not just checking pixel counts: nearest-neighbor downsampling aliased textures/stone.pgm's periodic mortar pattern into a flat wrong color. Fixed with area-averaging for opaque assets (walls/doors/boards/exits), keeping nearest-neighbor for small transparent sprites.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

Merge request reports