The live loop: change, frame
Skill ferret-live-edit · download all skills · SKILL.md
When to use#
Setting light, sun, fog, sky, post, where things stand, a behaviour's parameters, spawns, zones. Any "make it look like the reference" iteration. Never loop through package rebuild, dist build and browser load for these: that is 20 to 40 minutes a turn; a command is seconds.
The model#
The viewer (tools/viewer) is a headless Chromium on the NVIDIA GPU with an HTTP command API. A level folder opened in it has the editor session "edit" (ferret-level-editor): edit.patch changes the draft and, with live, the level reloads at once. Nothing reaches the files until edit.save, which writes only manifest.json, navmesh.bin, .ferret, .fprj under the served folder.
Steps#
- Start the viewer server on the level folder:
FERRET_GPU=1 node tools/viewer/server.mjs --headless --port <p> --files <repo root> --level /files/<path to the level folder>, started at BelowNormal priority; commandsPOST /api/command {name,args}, frameGET /api/screenshot.png?w=&h=. edit.open {level:"edit", live:true}(for--levelthe name is always "edit"). Look first:camera.set {position,target,fov}orcamera.view, a frame.- Change by command:
edit.patch {ops:[{op:"replace",path:"/environment/sun/intensity",value:2.5}]}(JSON pointers into the manifest:/environment/{sun,ambient,fog,sky,reflection,post,probes},/entities/N/params/...), or the typededit.entity.*,edit.spawn.*,edit.zone.*. Frame at once; compare with the reference (ferret-frame-check). edit.validatemust be empty;edit.difflists what changed;edit.savewrites the manifest.edit.undowhile trying.- Materials are changed live like light:
edit.material.set|get|list|remove {scope: type|instance, uid, material}(seeferret-level-editor); the commandhelplists what exists, do not invent one. - Sources (
tools/*.mjs, the build inputs) are changed after the person's "ok", from the saved manifest. A full rebuild of the package and the dist only when geometry changes, and once at the end.
Check afterwards#
The frame shows the change; edit.validate is empty; the saved manifest.json differs from the old one only by what edit.diff said (git diff); the renderer string is the RTX (WEBGL_debug_renderer_info says "NVIDIA GeForce RTX 3050"); the viewer and its Chromium are stopped when you finish.
What usually goes wrong#
edit.openfails "is not a parameter of this behaviour": the behaviour'sstatic schemamisses that param (add it to the schema in the engine).- A saved test value left in a tracked manifest: keep a copy of the file before experiments and restore it.
- Capture windows over the person's work: headless only.
- A viewer left running after the task: stop it and say so in the report.