Skip to content

Load structure assets concurrently in world placement - #344

Merged
InventivetalentDev merged 4 commits into
mainfrom
fix/structure-load-concurrency
Oct 21, 2026
Merged

InventivetalentDev merged 4 commits into
mainfrom
fix/structure-load-concurrency

Conversation

@InventivetalentDev

@InventivetalentDev InventivetalentDev commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

What

placeMultiBlock on a world with sectionMeshing no longer waits for one asset request at a time.

  • Variant preparation: SectionModels.prepare loads every variant's merged model and atlas at the same time. Results are still read in variant order: the first rejection is thrown, and the first unusable variant makes the state unprepared, as before.
  • Pre-warm: MineRenderWorld.placeBlocks (no executor) starts SectionModels.preload for every distinct non-air palette entry before it places the first chunk. Block entities are skipped, because they keep individual objects and never use section models. It reuses the block states from the existing BlockStates.getAll call and does not await the preloads, so states that first appear in later chunks load while earlier chunks are placed.
  • Block objects: Chunk.replaceBlocks and replaceSection create the blocks that keep individual objects (block entities and other non-merged blocks) concurrently. When a placement repeats an index, only the last one creates an object. Errors are still reported for the earliest failing placement in input order.
  • Positions: the new Chunk.createBlockObject sets the block's position before init, so its models, fluid surface, and block entities are placed where they belong instead of at the origin until the position arrives.

Why

A small schematic took several seconds to appear, because each variant, model, atlas, and block object waited for the previous request to finish. Requests take 30–350 ms each.

Risk

Medium. Placement order of asynchronous work changes for every structure placed without an executor. Blocks with several variants or block entities could show a wrong model or position if a result is matched to the wrong variant or index; the new tests cover both. Placement with a BatchedExecutor is unchanged.

Testing

  • yarn workspace minerender typecheck, yarn build:lib: pass.
  • yarn test: 836 tests pass, including the new SectionModels.test.ts (concurrent start, variant order, missing model, first rejection) and World.test.ts cases (objects created at their positions, last placement at a repeated index, one preload per distinct state, no preload for block entities).
  • Placed a 20×2×2 structure in Node against the live asset CDN (1.21.11) together with the other load-latency changes: cold placement went from 2.7–6.3 s to 1.1–2.0 s, warm from 2.3–3.1 s to 0.6–0.7 s. This PR was not measured on its own.

Note

AI-assisted.

InventivetalentDev and others added 3 commits October 21, 2026 20:45
…k objects

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added library Public minerender package (packages/minerender) fix Bug fix (fix/ branches) labels Oct 21, 2026
@InventivetalentDev
InventivetalentDev marked this pull request as ready for review October 21, 2026 19:08
…object results

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@InventivetalentDev
InventivetalentDev merged commit d814b71 into main Oct 21, 2026
3 checks passed
@InventivetalentDev
InventivetalentDev deleted the fix/structure-load-concurrency branch October 21, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix (fix/ branches) library Public minerender package (packages/minerender)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant