Skip to content

Editor: a new scene from blank terrain, baked in the browser - #81

Merged
SamG-Coder merged 2 commits into
mainfrom
claude/editor-blank
Nov 12, 2026
Merged

SamG-Coder merged 2 commits into
mainfrom
claude/editor-blank

Conversation

@SamG-Coder

Copy link
Copy Markdown
Owner

What and why

Phase 2 of the editor (docs/editor.md). The user asked that the editor build scenes from blank terrain, not only edit baked ones; this is the first step of that.

  • New scene. New, or project.new for agents, makes a scene from a template: an island of sand, dirt and grass in a coastal sea. It is baked in the browser in about 2 s and shown. It is kept in the browser as it changes, and editor.html?draft=NAME reopens it after a reload.

  • Scene settings. With nothing selected, the details panel shows the scene's own settings, as Unreal's world settings do:

    • terrain: size, cells, hill height and shore;
    • land bands: sand and dirt;
    • sea: level and a built-in ocean.

    A change is one undo step. The scene bakes again in the browser and is put in place, keeping the camera and the selection.

  • Agent commands. project.new, scene.settings, scene.set, bake.run and bake.status, documented in docs/editor-api.md, including a session that builds an island.

  • One bake, browser or PC.

    • The scene building moves, by git mv, out of apps/bake into a solstice-bake library.
    • apps/bake-web builds that library for wasm (7.7 MB), and a Web Worker loads it only when the editor first bakes.
    • A scene baked in the browser is byte for byte what bake --project makes of the same project natively: the same SHA-256 (b988f966…, 13.1 MB), checked by hand. A unit test compares the browser path's encoding with the native one.
  • Ready-made surfaces.

    • The land's grass, sand and dirt are the same in every scene and take minutes to make, so bake --surfaces DIR makes them once. Each is written as an ordinary scene file holding one compressed layer (4.2 MB each at 1024²), so there is no new format.
    • The bake asks a shared cache for each surface (solstice_bake::textures), so it uses ready-made ones where provided. The compressor leaves already-compressed layers as they are.
    • A native bake provides none, so native bakes are unchanged: a blank-terrain bake was compared byte for byte before and after the move.
  • Build.

    • build-web.sh builds bake-web and makes the surfaces into dist/content.
    • CI and scripts/check-changed.sh build and lint bake-web, and the script now also builds the editor's wasm and runs the editor's Node tests, matching CI.
    • Merging and then running the Pages workflow puts New Scene live on the site. That needs Actions minutes, which the account is out of this month.

Measured on one thread:

Work Native Browser
The three land surfaces at 1024² 2.5 min far longer, so made ahead
A 400 m terrain of 512 cells (524k triangles), clusters only 45 s —
A new scene (256 m, 128 cells, land, sea), surfaces ready-made — 1.7–2.5 s
The same at 256 cells — 15 s

So a new scene uses 2 m cells. Finer terrain waits on a faster cluster builder (about 20k triangles a second on one thread now) or on baking terrain in tiles across workers; both are noted in the design.

Verified

  • Local checks, run because CI may not run this month: bash scripts/check-changed.sh --all on this PR's head (6960de4) passes. That covers fmt, clippy, 1,001 workspace tests including the GPU tests on the RTX 5080, the four wasm32 builds (viewer, play, editor, bake-web) with clippy, and node apps/viewer/web/editor/test.mjs (all passed).
  • In Chrome on the 5080:
    • editor.html?new bakes and shows an island in 2.3 s.
    • Changing hills and shore through scene.set re-bakes in 1.7 s.
    • Undo re-bakes the old terrain.
    • Turning the sea off from its checkbox re-bakes without it.
    • A reload on ?draft=untitled brings the scene back with its changes.
    • Bad values are refused with their range: cells above 1024, an unknown ocean.
    • A change made during a bake ends with the newest terrain shown.
    • project.new refuses an existing draft's name unless told to replace it.
    • There were no GPU errors throughout.

Authorship

Written by: Claude Opus 5.5 through Claude Code

Reviewed by: Claude Sonnet 5.5. No hard blocker. It verified:

  • the moves are pure renames, apart from the texture routing;
  • encode is the old compress, page and encode;
  • the compressor's skip can't misfire on a native bake;
  • the texture cache's keys;
  • undo of scene.set across a swap.

Fixed from its points:

  • A scene that couldn't be opened after a bake left the editor dead. The last scene now comes back.
  • New during a rebake could show the old scene against the new project. New now waits, and old bakes are never shown.
  • A bake that finished after a change showed a stale scene. It is now baked again.
  • Picks waiting on a replaced viewer were never answered, and a stale-pick flag survived a swap.
  • Any ocean name was accepted.
  • The worker cached a failed start.
  • project.new could overwrite a draft, or drop unsaved changes, unasked.
  • scene.set accepted changes on scenes the browser can't bake (those with models).
  • Commands and the mouse acted on no viewer while a scene was being put in place.

Noted, not changed:

  • The ready-made surfaces aren't keyed by a version. After a change to the surface generator or the compressor, a local build reuses old ones until assets/content is deleted (the site's build makes them fresh).

  • A bake can't be cancelled. Terrain limits are generous: up to 1024 cells, which takes minutes.

  • The browser-equals-native check for provided surfaces is by hand (the SHA-256 above); the unit test covers the generated path.

  • All code, text and comments in this pull request were written by a frontier AI model, with no human-written code, and will be reviewed by a frontier AI model before merging, as the Code of Conduct requires.

🤖 Generated with Claude Code

SamG-Coder and others added 2 commits November 13, 2026 09:24
New makes a scene from a template (terrain, land bands and a coastal sea) and
bakes it in the browser in about two seconds; with nothing selected, the
details panel shows the scene's settings, and a change bakes it again and
shows it, keeping the camera and selection. A new scene is kept in the
browser as it changes and reopened by ?draft=NAME. Agents do the same through
project.new, scene.settings, scene.set, bake.run and bake.status.

The scene building moves out of apps/bake into a solstice-bake library, which
apps/bake-web builds for the browser and the editor runs in a Web Worker. The
land's surfaces, which take minutes to make, are made once by
`bake --surfaces` in the site's build and fetched ready-made; the compressor
leaves such layers as they are. A scene baked in the browser is byte for byte
the one `bake --project` makes of it natively.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the review: putting a newly baked scene in place no longer leaves the
editor without one if it can't be opened (the last scene comes back);
commands wait while a scene is put in place, and the viewport's handlers do
nothing then; New waits for a bake in flight and never shows it, refuses to
replace a scene kept in the browser or to drop unsaved changes unless told to,
and writes the scene it leaves first; a bake that finishes after a change is
baked again rather than shown out of date; picks waiting on a replaced viewer
are answered; the sea takes only a built-in ocean; a worker whose start failed
tries again; scene.set is refused where the browser can't bake the scene; and
bake.status no longer says a bake is waiting after it ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SamG-Coder
SamG-Coder merged commit b19edcf into main Nov 12, 2026
1 check 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.

1 participant