Skip to content

bugfix(worldbuilder): Draw maps larger than 1024x1024 through the partial terrain window - #3502

Open
tintinhamans wants to merge 3 commits into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/worldbuilder-large-map-draw
Open

tintinhamans wants to merge 3 commits into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/worldbuilder-large-map-draw

Conversation

@tintinhamans

@tintinhamans tintinhamans commented Oct 13, 2026 •

Copy link
Copy Markdown

⚠️ Merge after: #3501


WorldBuilder draws the entire map by default, which keeps a vertex buffer and a system memory copy for every 32x32 tile, about 256 bytes per cell. Past roughly 1200x1200 that alone pushes the 32 bit process out of memory.

Maps larger than 1024x1024 now use the partial terrain window, which follows the camera, and the show entire map option is disabled for them. With the terrain no longer scaling with the map, the new map memory warning moves up to 2048x2048.

1300x1300 map, border 30 Private memory
Before 870 MB
After 400 MB

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ba3558af-bc94-4b90-8598-0294c152f870
📥 Commits

Reviewing files that changed from the base of the PR and between da891f3 and fe68496.

📒 Files selected for processing: 4
  • Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp
  • Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp
  • GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

Walkthrough

Map-size validation now distinguishes playable dimensions from total dimensions, including borders. World Builder validates sizes during creation, resizing, and document initialization. Both World Builder variants restrict full-map terrain rendering to maps within the area limit.

Changes

Map size handling

Layer / File(s) Summary
Validate parsed height-map data
Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h, Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp
The size-check API distinguishes total dimensions from playable dimensions. Both parsing paths validate stored total dimensions.
Validate maps during World Builder editing
Generals/Code/Tools/WorldBuilder/src/{NewHeightMap.cpp,WHeightMapEdit.cpp,WorldBuilderDoc.cpp}, GeneralsMD/Code/Tools/WorldBuilder/src/{NewHeightMap.cpp,WHeightMapEdit.cpp,WorldBuilderDoc.cpp}
Both variants validate map dimensions and borders during creation, resizing, and document initialization. New-map dialogs prompt when the bordered area exceeds 2048² cells. Resize paths adjust buffer allocation and array cleanup.
Limit entire-map terrain rendering
Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp, GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp
Both variants restrict full-map initialization and the menu command to maps with an area of at most 1,048,576 cells.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: wwb2-account, xezon

Merge Risk: ⚪ Minimal · up to fe684

The change lets World Builder open larger maps through the partial terrain window and adds size validation and warnings. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4
Check name Status Explanation
Description check Passed The description clearly explains the memory issue, the partial terrain window change, the disabled full-map option, and the expected memory reduction. It directly matches the changeset.
Title check Passed The title clearly identifies the primary change: larger maps use the partial terrain window instead of full-map rendering. It matches the implementation and objectives.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp Outdated
@Mauller Mauller added WorldBuilder Relates to World Builder Gen Relates to Generals ZH Relates to Zero Hour Memory Is memory related Bug Something is not working right, typically is user facing labels Oct 13, 2026
Comment thread Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp Outdated
@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-large-map-draw branch from 6091bdb to f8bb8fc Compare October 13, 2026 13:17
@tintinhamans tintinhamans changed the title bugfix(worldbuilder): Draw maps larger than 1024 through the partial terrain window bugfix(worldbuilder): Draw maps larger than 1024x1024 through the partial terrain window Oct 13, 2026
@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-large-map-draw branch 3 times, most recently from 93ffa84 to a2b7b04 Compare October 13, 2026 13:44
@tintinhamans
tintinhamans marked this pull request as ready for review October 13, 2026 13:47
@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-large-map-draw branch from a2b7b04 to 415d94a Compare October 13, 2026 13:52
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge after its stated prerequisite.

Summary

Large maps now use a camera-following terrain window in both WorldBuilder versions.

  • Large maps stay in the camera-following terrain window.
  • Map size checks count the border before accepting dimensions.
  • Resizing maps rebuilds their terrain and flag buffers.

No actionable new issues were found. The previous reviewed commit is not an ancestor of the current head, so the full PR diff was reviewed.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Update terrain] --> B{Whole-map option enabled and total area within limit?}
  B -->|Yes| C[Draw entire map]
  B -->|No| D[Draw partial terrain window]
  D --> E[Move window with camera]
Loading

Reviews (14) · Last reviewed commit: "bugfix(worldbuilder): Draw maps larger t..." · Reviewed by Greptile

Comment thread Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp Outdated
@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-large-map-draw branch 5 times, most recently from 9701a1b to e67f7de Compare October 13, 2026 19:23
Comment thread Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp Outdated

@Mauller Mauller left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-large-map-draw branch 6 times, most recently from b6cd311 to 79b8e31 Compare October 18, 2026 12:21
@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-large-map-draw branch 3 times, most recently from 2b23ed6 to da891f3 Compare October 18, 2026 13:30
@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-large-map-draw branch from da891f3 to fe68496 Compare October 18, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals Memory Is memory related WorldBuilder Relates to World Builder ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants