Skip to content

perf(engine): build TileMaps lazily on first scene use#217

Merged
JumpLink merged 1 commit into
mainfrom
perf/lazy-tilemap-build
Jun 12, 2026
Merged

perf(engine): build TileMaps lazily on first scene use#217
JumpLink merged 1 commit into
mainfrom
perf/lazy-tilemap-build

Conversation

@JumpLink

Copy link
Copy Markdown
Contributor

MapResource.load() eagerly built the per-tier Excalibur TileMaps —
one Tile object per cell per tier, ~1.25M objects across the 19
oot2d-2014 maps — although project preloading only needs the parsed
mapData (atlas previews, snapshots, agent projections). Opening that
project took ~19 s and repeated opens could OOM GJS.

  • load() now parses + validates the JSON and resolves sprite sets;
    ensureTileMaps() builds the tilemaps + editor shadow on first
    addToScene (idempotent; the map cache makes re-entries free)
  • isLoaded() gates on the parsed map data (Loadable contract)
  • syncShadowToMapData() already guarded the never-built case
  • GameProjectResource.load() logs per-phase timings at info level

Measured: oot2d-2014 open is now ~1.3 s to the atlas (worst case,
right after app start), scene open + engine render verified intact.

MapResource.load() eagerly built the per-tier Excalibur TileMaps —
one Tile object per cell per tier, ~1.25M objects across the 19
oot2d-2014 maps — although project preloading only needs the parsed
mapData (atlas previews, snapshots, agent projections). Opening that
project took ~19 s and repeated opens could OOM GJS.

- load() now parses + validates the JSON and resolves sprite sets;
  ensureTileMaps() builds the tilemaps + editor shadow on first
  addToScene (idempotent; the map cache makes re-entries free)
- isLoaded() gates on the parsed map data (Loadable contract)
- syncShadowToMapData() already guarded the never-built case
- GameProjectResource.load() logs per-phase timings at info level

Measured: oot2d-2014 open is now ~1.3 s to the atlas (worst case,
right after app start), scene open + engine render verified intact.
@JumpLink JumpLink merged commit 68850d0 into main Jun 12, 2026
1 check 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.

1 participant