Skip to content

Official Codebase of 3DCodeVerse

Python

plan_scene: the planner knows every shipped natural-element factory — and that a grove of trees is still an asset

gaoypeng9d2e451d9a24
diff --git a/harness/codeverse3d/prompts/tracks/plan_scene.j2 b/harness/codeverse3d/prompts/tracks/plan_scene.j2
index 96f7c5e0..6c3f52a5 100644
--- a/harness/codeverse3d/prompts/tracks/plan_scene.j2
+++ b/harness/codeverse3d/prompts/tracks/plan_scene.j2
@@ -9,12 +9,18 @@ LANGUAGE CONTRACT THE BUILDERS WILL FOLLOW:
{{ contract }}
SHIPPED NATURAL EFFECTS:
-The scene workspace already contains `src/lib/fire.js` (`makeFire`, `makeCandle`),
-`ocean.js` (`makeOceanSurface`), `stream.js` (`makeStream`), `sand.js`
-(`makeSandTerrain`), `rock.js` (`makeRock`, `makeRockField`) and `meadow.js`
-(`makeMeadow`). When they cover the brief, describe their calls and dimensions in
-the owning zone description / environment / effects. Do not request a separate
-StreamRibbon, Flame, CandleTrio or GrassPatch asset that rebuilds the same effect.
+The scene workspace already contains, under `src/lib/`: `fire.js` (`makeFire`, `makeCandle`),
+`firefield.js` (`makeFireField`), `smoke.js` (`makeSmoke`, `makeSteam`), `cloudvolume.js`
+(`makeCloudVolume`), `ocean.js` (`makeOceanSurface`), `stream.js` (`makeStream`),
+`waterfall.js` (`makeWaterfall`), `ice.js` (`makeFracturedIce`), `sand.js` (`makeSandTerrain`),
+`rock.js` (`makeRock`, `makeRockField`: sandstone / granite / basalt rocks and talus),
+`tree.js` (`makeTree`: oak / birch / willow, for a few near or hero trees; `makeShrub`), `meadow.js` (`makeMeadow`) and
+`paving.js` (`makePaving`). When they cover the brief, describe their calls and dimensions in
+the owning zone description / environment / effects. Do not request an asset that rebuilds
+one of them (a Waterfall, OakTree, BoulderCluster, StreamRibbon, Flame or GrassPatch asset);
+an element they do not cover (a pine, a palm, a carved stone) is still an asset, and so is a
+grove or forest of many trees: each `makeTree` is a full tree, heavy enough that a whole grove of
+them can crash the page.
The standalone asset stage only imports Three.js; shipped effects must be composed
by zone/environment code, which may import `../lib/`. Zone `contents` still lists
only actual asset names; library effects belong in prose, not invented asset ids.
@@ -66,7 +72,7 @@ WHAT TO PRODUCE (JSON, fields: {{ schema_fields }}):
- the VARIATION rule: at least 3 distinct silhouettes for any repeated natural element, with
+/-30 % scale jitter and +/-0.03 hue jitter — never one shape stamped in a ring or grid.
5. `assets` — 4 to 8 reusable things placed in zones. PascalCase `name`; `kind` = `threejs` for
- procedural shapes (fences, lanterns, rocks, benches, trees, boats) or `blender_glb` ONLY for
+ procedural shapes (fences, lanterns, benches, boats, trees the library does not grow) or `blender_glb` ONLY for
1-2 hero objects that need sculpted/bevelled detail (a hero may also carry ONE 2 s keyframed
motion — a swinging lamp, a turning wheel — say so in its description); `description` with construction numbers
and colours; `approx_size_m` = width x height x depth in meters (a stone lantern
diff --git a/harness/tests/scene_runtime/lib/test_library.py b/harness/tests/scene_runtime/lib/test_library.py
index 01f6ad6a..bda56289 100644
--- a/harness/tests/scene_runtime/lib/test_library.py
+++ b/harness/tests/scene_runtime/lib/test_library.py
@@ -256,6 +256,13 @@ console.log(JSON.stringify({ exports, errors }));
called = set(re.findall(r"`([a-z][A-Za-z0-9]*)\(", row))
named = set(re.findall(r"`([a-z][A-Za-z0-9]*)`", row)) - _PROSE
stale += [f"{c} ({', '.join(mods)})" for c in sorted((called - have) | (named - anywhere))]
+ # the scene planner's SHIPPED NATURAL EFFECTS list: every `module.js` (`makeX`, ...) pair is real, else
+ # the planner routes an element to a zone that cannot build it (or, listed short, to a hand-built asset)
+ plan = (PROMPTS_DIR / "tracks" / "plan_scene.j2").read_text(encoding="utf-8")
+ shipped = re.findall(r"`([a-z_]+\.js)`\s*\(([^)]*)\)", plan)
+ assert len(shipped) >= 13, shipped
+ stale += [f"plan_scene.j2: {n} ({m})" for m, calls in shipped
+ for n in re.findall(r"`(make[A-Za-z]+)`", calls) if n not in exported.get(m, ())]
assert not stale, stale