Make the editor run, open shooter worlds, and edit water/rivers/lights#1
Conversation
- Declare perry.allow.nativeLibrary so the editor compiles without the PERRY_ALLOW_PERRY_FEATURES escape hatch. - Wire the promised --test flag (Perry does expose process.argv/process.exit). runSelfTests now prints failing assertions plus a summary and exits nonzero. - gitignore the Windows binaries; refresh the README build/status sections.
The editor had never started on Windows. Four independent causes, each surfacing as `TypeError: Expected number for native f64 parameter` when an `undefined` reached a native call (Perry does not type-check missing members on the engine's const enums, so none of this failed at compile time): - Key constants were camelCase (Key.LeftControl, Escape, Delete, Space, LeftShift/RightShift); the engine spells them LEFT_CONTROL, ESCAPE, DELETE, SPACE, LEFT_SHIFT, RIGHT_SHIFT. Plain letters were correct, which hid it. - MouseButton.Left/Right/Middle -> LEFT/RIGHT/MIDDLE. - widgets.ts:separator() called drawLine with the colour's four channels splatted as loose numbers; the signature takes a Color. - setSceneNodeTransform/updateSceneNodeGeometry were unreachable from TypeScript (fixed engine-side; see engine fix/scene-scalar-ffi). Beyond bring-up: - Entities whose model is missing or is the `_gizmo_box.glb` sentinel now render as colored, pickable placeholder cubes sized from the halfExtents userData convention — without this, ~20 of arena_02's gameplay entities were invisible and unselectable. - userData is editable: key/value rows with add/delete, undoable and coalesced. This is the bridge for game-defined data (spawners, wave plans, colliders). - Ctrl+Y only redoes; tool hotkeys no longer fire under a chord or while a text field has focus. Delete no longer doubles as Backspace. - Terrain creation is explicit and undoable (a stray brush click used to add a 128x128 heightmap to worlds that ship with terrain: null). - Environment edits apply: sky colour and fog were silently ignored, and the sun accumulated a new directional light on every edit. - Water/river ids persist in world.metadata, so reopening a world and adding a volume can no longer mint a duplicate id and make undo delete the wrong one. - Entity tints were passed 0-1 into a 0-255 API; prefab registry is cached. AssetCatalog and HandleMap are classes, not interfaces: Perry 0.5.x miscompiles Map fields on an interface. Full repro table and the rules to work within: docs/perry-map-size-av.md. Self-tests extended to cover the new commands, id counters, and userData semantics: 41 passing.
Placed water volumes and rivers used to be undoable-only: drawn as debug cubes
and line strips, impossible to select, inspect, edit, or delete once created,
with every parameter frozen at whatever the tool hardcoded.
- Render through the engine's shared spawnWaterVolume/spawnRiver, the same
helpers instantiateWorld uses, so the editor shows what the game will. The
tools now draw only the in-progress preview.
- Selection carries a kind ('entity' | 'water' | 'river') — ids are only unique
within their own array. Entity-only paths (gizmos, entity inspector,
duplicate, frame-on-selection, selection outline) go through
selectedEntityId(), which returns null for a water/river selection, so a
selected river can never reach code that assumes world.entities.
- Outliner gets Water and Rivers sections, listed above Entities: the panel does
not scroll, and a world with 66 entities would bury them below the fold.
- Inspector gets water and river property panels (center, size, surface height,
wave amplitude/speed, depth, flow, width, colour, opacity), all undoable and
coalesced per drag.
- Delete removes the selected volume or river; undo restores it at its original
index so ordering round-trips through the file unchanged.
- Toolbar gains Water and River buttons (previously hotkey-only), and creation
defaults replace the hardcoded parameters.
Self-tests cover edit coalescing, index-preserving removal, and the selection
guard: 50 passing.
Follows the engine's schema v2, where point lights moved out of userData and into world.lights. - Light tool: click the ground to place a point light. - Lights section in the outliner; inspector for position, colour, intensity and range; delete with index-preserving undo; edits coalesce per drag. - applyWorldLights runs every frame alongside sun/ambient/fog, so the editor previews a world's actual lighting instead of guessing at it. - A light has no mesh, so draw a marker at each one, plus a wire sphere at its range when selected — otherwise you cannot see or click a light, and "how far does this reach" needs arithmetic on the inspector numbers. Self-tests cover the v1 -> v2 migration end to end (light lifted out of entities, colour/range/intensity parsed from the old userData strings, non-light entities untouched, v2 worlds left alone, migrated world validates): 62 passing.
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (44)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
The editor had never actually started on Windows. It does now, and it opens
arena_02from the shooter project with every entity visible and editable.Why it never ran
Four independent causes, each surfacing as
TypeError: Expected number for native f64 parameterwhen anundefinedreached a native call. Perry does not type-check missing members on the engine'sconstenums, so none of this failed at compile time:Key.LeftControl,Escape,Delete,Space,LeftShift. The engine spells themLEFT_CONTROL,ESCAPE,DELETE,SPACE,LEFT_SHIFT. Plain letters (Key.Z) happened to be correct, which hid the pattern.MouseButton.Left/Right/Middle→ the engine hasLEFT/RIGHT/MIDDLE.drawLinearity —widgets.ts:separator()splatted the colour's four channels as loose numbers; the signature takes aColor. It only fires on the first panel that draws a separator, which is why it surfaced last.setSceneNodeTransform/updateSceneNodeGeometrywere unreachable from TypeScript — fixed engine-side (Scene FFI reachable from TS; water/rivers render; point lights become schema (v2) engine#90).Perry's reported stack line was flatly wrong throughout (it blamed
sync.ts:383for a fault inmain.ts's input block). Trustconsole.errorbreadcrumbs — and note Perry's stdout is block-buffered and lost on a native crash.Beyond bring-up
_gizmo_box.glbsentinel now draw as coloured, pickable cubes sized from thehalfExtentsconvention. Without this, ~20 ofarena_02's gameplay entities (spawners, pickups, colliders) were invisible and unselectable.userDataediting — key/value rows with add/delete, undoable and coalesced. This is the bridge for game-defined data; the editor stays game-agnostic.spawnWaterVolume/spawnRiver(so the editor shows what the game will show), selectable, inspectable, deletable. Selection carries akind(entity | water | river | light) because ids are only unique within their own array; entity-only paths go throughselectedEntityId(), so a selected river can never reach code that assumesworld.entities.applyWorldLightsruns every frame). A light has no mesh, so markers are drawn, plus a range sphere when selected.terrain: null).A real Perry bug, documented
AssetCatalogandHandleMapare classes, not interfaces, and that is load-bearing: Perry 0.5.x miscompilesMapfields declared on an interface once a program declares more than one. Reading.sizeaccess-violates. Full repro table and the rules to work within:docs/perry-map-size-av.md. Worth reporting upstream.That bug was not what broke the editor — it was introduced by a debug line printing
map.sizewhile chasing cause #1, and then masked it for hours. Recorded so nobody re-pays for it.Verification
62 self-tests pass (commands, id counters, userData semantics, water edit-coalescing, index-preserving removal, the selection guard, and the full v1→v2 light migration). Verified visually against the shooter's
arena_02.Known gaps
Startup blocks ~20 s loading every GLB synchronously. Gizmo-dragging a water volume and per-control-point river handles are not wired (both are editable numerically today). See
PLAN.md.