fix: render streamed Studio terrain incrementally#340
Merged
Conversation
RSamaium
marked this pull request as ready for review
July 24, 2026 08:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
@rpgjs/studioWhy
Each streamed chunk update changed the global terrain version.
StudioTerrainChunkRenderer.renderMap()consequently recreated every terrain chunk synchronously, including terrain-control masks, morphology, and water overlays. A single movement-triggered stream update could block the browser main thread for hundreds of milliseconds.The renderer now maps consolidated dirty regions to its own chunk grid and only rebuilds those entries. Removed regions destroy only renderer chunks no longer covered by retained stream data.
Closes #339.
Validation
pnpm vitest run packages/studio— 27 files, 190 tests passedpnpm test --run— 152 files, 1,113 tests passed, 19 skippedpnpm test:types— 3 files, 20 tests passed, no type errorspnpm buildandpnpm --filter @rpgjs/studio buildpnpm api:boundarypnpm changeset status@rpgjs/studio, installed it into the v5 starter, and completed a production build127.0.0.1:4179, verified rendering and keyboard movement in Chromium, with no page errors or failed requestsHeadless Chromium emitted only software-WebGL/GPU readback warnings; the rendered game and interaction were correct.