Skip to content

Batch dynamic fog canvas fills - #193

Merged
evillollive merged 3 commits into
mainfrom
evillollive-performance-improvements-bd2
Nov 9, 2026
Merged

evillollive merged 3 commits into
mainfrom
evillollive-performance-improvements-bd2

Conversation

@evillollive

Copy link
Copy Markdown
Owner

Performance opportunities identified

  1. Batch adjacent dynamic-fog cells into horizontal fills to reduce canvas calls — implemented here.
  2. Reuse the minimap tile layer across pan and zoom changes instead of rasterizing the whole map again.
  3. Cull notes, tokens, stamps, paths, rivers, and walls outside the requested export region.
  4. Add a spatial index for token, stamp, marker, river, and room-shape pointer hit tests.
  5. Cache fog-boundary cells so feathering does not scan every map cell on every redraw.
  6. Reuse ambient-occlusion and stamp-shadow work when unrelated overlays change.
  7. Separate static tile/art rendering from dynamic overlays so fog and token edits do not redraw the base map.
  8. Explore bounded dirty-region redraws instead of resetting the full canvas for every edit.
  9. Cache hand-drawn grid and cross-hatch geometry until tiles or drawing settings change.
  10. Pre-resolve per-tile theme and semantic-type lookups for the render pass.

Change

The dynamic-fog renderer now classifies each row once and merges adjacent explored or hidden cells into horizontal fills. Fogged state, defog previews, player visibility, light visibility, and explored/hidden styling remain distinct. The focused regression checks that a 4×3 fixture uses four fills for its row runs rather than twelve per-cell fills.

This targets the existing dense-map draw-call bottleneck without changing the map schema or introducing a broader rendering cache.

Validation

  • npm test -- src/components/__tests__/MapCanvas.performance.test.tsx
  • npx eslint src/components/MapCanvas.tsx src/components/__tests__/MapCanvas.performance.test.tsx --max-warnings 0
  • npx tsc -b

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: evillollive <99912227+evillollive@users.noreply.github.com>
Co-authored-by: evillollive <99912227+evillollive@users.noreply.github.com>
@evillollive
evillollive merged commit 42d8dc0 into main Nov 9, 2026
7 checks passed
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