feat(mapeditor): full-planet overview (kill wide-zoom lag) + Smooth Z brush #265

Merged
panda merged 10 commits from feat/map-editor-overview into main 2026-08-03 00:27:18 +02:00
Collaborator

Summary

Two map-editor improvements (#229 slice 4b + a Smooth-Z brush requested by the author):

  • Full-planet overview (kills the wide-zoom lag). The editor canvas was a top-down bitmap of the
    viewport window; at wide zoom that window was huge and rebuilt on every pan (a multi-million-cell fill
    • ~50 MB upload), and MaxWindow/MinCellPx capped it so you could never see the whole 13,344×9,984
      planet. Now, below ~1.5 px/cell the editor blits a tiny per-chunk overview texture (417×312, one texel
      per chunk = its dominant terrain) in a single draw. Built once on open scanning only materialised
      chunks
      (~6% here; the rest is the default at no cost), and refreshed one texel per chunk on a terrain
      stroke. MinCellPx lowered (0.25→0.05) + F fits the whole planet; the chunk/region grid hides at
      wide zoom so it doesn't clutter the overview.
  • Smooth Z brush. A new tool that eases each brushed cell toward its 3×3 neighbourhood average
    (ZSmoother, computed from the OLD heights as a batch so a stroke doesn't bias itself). Repeat the stroke
    to spread a sharp peak into natural slopes — a z200 spike surrounded by sea eases down toward 0 over passes.

Offline authoring tool — no wire/server/persistence/save-format change.

Screenshots / recording

Captured with the editor's own one-shot --screenshot (the debug harness drives the client, not the editor
GUI, but the editor supports --world/--cellpx/--screenshot for exactly this). The whole 13,344×9,984
planet
at 0.1 px/cell — ocean + the drawn continents in biome colours, one blit, no lag, no grid clutter,
and the Smooth Z tool visible in the palette:

whole_planet_overview.png

Command: dotnet run --project tools/IsoMmo.MapEditor -- --world content/worlds/asterra --cellpx 0.09 --screenshot <path>.

How it was tested

  • dotnet build IsoMmo.slnx 0 warnings; dotnet test IsoMmo.slnx all green (new unit tests:
    ChunkedEditModelChunkTests 3, ChunkOverviewTests 4, ZSmootherTests 4); dotnet csharpier check clean.
  • Editor visual gate (above): --screenshot on asterra at --cellpx 0.09 — the whole planet renders
    smoothly as the overview. (Smooth-Z painting is mouse-driven, so unit-tested + wired + present in the UI;
    interactive paint is a manual check.)

Invariants Check (offline authoring tool)

  • Scope ✓ — implements #229 4b overview + the requested Smooth-Z tool; no unrelated system.
  • Server-authoritative / GM / Identity / Protocol / String-catalog / World+Screen gate / Gameplay-Net /
    Persistence / Process-sep / AoI / Assets / Typed-content — N/A: offline tool; no wire/server/World/
    save-format/art-pack touched. The overview is derived in-memory; the region/manifest format is unchanged.
  • Client engine-independence ✓ — ChunkOverview + ZSmoother are pure MapEditor.Core (unit-tested,
    MonoGame-free); only texture upload/blit + the ImGui tool live in the tool.
  • Typed options ✓ — new tunables (OverviewMaxCellPx, SmoothRadius, GridMinCellPx, lowered MinCellPx)
    are consts declared once.
  • Multi-platform ✓ — MonoGame DesktopGL; no OS-specific API.

Checklist

  • just lint passes (CSharpier + analyzers, zero warnings)
  • just test is green
  • The whole solution builds (client and tools included)
  • Multi-platform preserved (server on Win/macOS/Linux, client on Win/macOS)
  • Tests added/updated for this change
  • Linked the related issue (#229) and its Definition of Done is met
## Summary Two map-editor improvements (#229 slice 4b + a Smooth-Z brush requested by the author): - **Full-planet overview (kills the wide-zoom lag).** The editor canvas was a top-down bitmap of the viewport window; at wide zoom that window was huge and **rebuilt on every pan** (a multi-million-cell fill + ~50 MB upload), and `MaxWindow`/`MinCellPx` capped it so you could never see the whole 13,344×9,984 planet. Now, below ~1.5 px/cell the editor blits a tiny **per-chunk overview texture** (417×312, one texel per chunk = its **dominant terrain**) in a single draw. Built once on open scanning **only materialised chunks** (~6% here; the rest is the default at no cost), and refreshed one texel per chunk on a terrain stroke. `MinCellPx` lowered (0.25→0.05) + **`F` fits the whole planet**; the chunk/region grid hides at wide zoom so it doesn't clutter the overview. - **Smooth Z brush.** A new tool that eases each brushed cell toward its 3×3 neighbourhood average (`ZSmoother`, computed from the OLD heights as a batch so a stroke doesn't bias itself). Repeat the stroke to spread a sharp peak into natural slopes — a z200 spike surrounded by sea eases down toward 0 over passes. Offline authoring tool — no wire/server/persistence/save-format change. ## Screenshots / recording Captured with the editor's own one-shot `--screenshot` (the debug harness drives the client, not the editor GUI, but the editor supports `--world`/`--cellpx`/`--screenshot` for exactly this). The **whole 13,344×9,984 planet** at 0.1 px/cell — ocean + the drawn continents in biome colours, one blit, no lag, no grid clutter, and the **Smooth Z** tool visible in the palette: ![whole_planet_overview.png](https://git.homelab.devncode.it/attachments/26c756c5-69ce-4d3f-9d73-05cf71cb7ff8) Command: `dotnet run --project tools/IsoMmo.MapEditor -- --world content/worlds/asterra --cellpx 0.09 --screenshot <path>`. ## How it was tested - `dotnet build IsoMmo.slnx` **0 warnings**; `dotnet test IsoMmo.slnx` **all green** (new unit tests: `ChunkedEditModelChunkTests` 3, `ChunkOverviewTests` 4, `ZSmootherTests` 4); `dotnet csharpier check` clean. - **Editor visual gate** (above): `--screenshot` on `asterra` at `--cellpx 0.09` — the whole planet renders smoothly as the overview. (Smooth-Z painting is mouse-driven, so unit-tested + wired + present in the UI; interactive paint is a manual check.) ## Invariants Check (offline authoring tool) - Scope ✓ — implements #229 4b overview + the requested Smooth-Z tool; no unrelated system. - Server-authoritative / GM / Identity / Protocol / String-catalog / World+Screen gate / Gameplay-Net / Persistence / Process-sep / AoI / Assets / Typed-content — **N/A**: offline tool; no wire/server/World/ save-format/art-pack touched. The overview is derived in-memory; the region/manifest format is unchanged. - Client engine-independence ✓ — `ChunkOverview` + `ZSmoother` are pure `MapEditor.Core` (unit-tested, MonoGame-free); only texture upload/blit + the ImGui tool live in the tool. - Typed options ✓ — new tunables (`OverviewMaxCellPx`, `SmoothRadius`, `GridMinCellPx`, lowered `MinCellPx`) are `const`s declared once. - Multi-platform ✓ — MonoGame DesktopGL; no OS-specific API. ## Checklist - [x] `just lint` passes (CSharpier + analyzers, zero warnings) - [x] `just test` is green - [x] The whole solution builds (client and tools included) - [x] Multi-platform preserved (server on Win/macOS/Linux, client on Win/macOS) - [x] Tests added/updated for this change - [x] Linked the related issue (#229) and its Definition of Done is met
style(mapeditor): csharpier-format ChunkOverviewTests + EditorGame
Some checks failed
ci / Lua content lint (pull_request) Successful in 13s
ci / Lint & Test (pull_request) Failing after 2m38s
dbe04eae76
test(mapeditor): brace nested for loops in ChunkOverviewTests (satisfy S3973 + csharpier)
All checks were successful
ci / Lua content lint (pull_request) Successful in 21s
ci / Lint & Test (pull_request) Successful in 6m29s
222d8d2870
panda merged commit a27566a46c into main 2026-08-03 00:27:18 +02:00
panda deleted branch feat/map-editor-overview 2026-08-03 00:27:18 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marco/IsoMmo!265
No description provided.