Skip to content

perf(worldbuilder): Skip object refresh while painting terrain tiles - #128

Merged
Andreas-W merged 1 commit into
mainfrom
claude/project-thread-yemcpu
Oct 26, 2026
Merged

Andreas-W merged 1 commit into
mainfrom
claude/project-thread-yemcpu

Conversation

@Andreas-W

Copy link
Copy Markdown
Owner

Requested by Andreas · project thread

Why

Painting terrain tiles in WorldBuilder gets slow on real maps. On every mouse move, the tile tool's partial terrain update ends in WbView3d::updateHeightMapInView, which calls invalObjectInView(nullptr). That call:

  • walks every map object, looks up its team/side/color by string, recomputes its transform from the ground height and re-adds it to the scene
  • refreshes every build list entry
  • sets m_needToLoadRoads, so the next redraw (forced right away by UpdateWindow) rebuilds all roads and bridges
  • recreates every point light (updateLights) and rebuilds all scorches (updateScorches)

The cost grows with the number of objects, roads and lights on the map, not with the size of the brush. None of it is needed while painting, because painting textures or pathing never changes heights.

What

  • CWorldBuilderDoc::updateHeightMap and WbView::updateHeightMapInView take an optional invalObjects flag (default true, so every other caller behaves as before).
  • WbView3d::updateHeightMapInView skips invalObjectInView(nullptr) only for partial updates with invalObjects == false. Full rebuilds always refresh objects.
  • TileTool::mouseMoved (also covers the big tile tool) passes false.

Testing

Not compiled yet: the change was written in a Linux container without the MSVC/MFC toolchain. It needs a z_worldbuilder build and a quick paint test on a map with many objects and roads.


Generated by Claude Code

@Andreas-W Andreas-W self-assigned this Oct 26, 2026
Every mouse move of the tile tool refreshed the terrain and then refitted
every map object, build list entry, light and scorch to the ground, and
flagged all roads and bridges to be rebuilt on the next redraw. Painting
textures or pathing never changes heights, so the tile tool now skips that
refresh. Full terrain rebuilds and height edits still refresh as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTMNjbth2DjLNN9Vz87n2v
@Andreas-W
Andreas-W force-pushed the claude/project-thread-yemcpu branch from a8267a8 to 51fd387 Compare October 26, 2026 06:54
@Andreas-W Andreas-W changed the title perf(worldbuilder): skip object refresh while painting terrain tiles perf(worldbuilder): Skip object refresh while painting terrain tiles Oct 26, 2026
@Andreas-W
Andreas-W merged commit 51fd387 into main Oct 26, 2026
1 of 2 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