Esta página ainda não foi traduzida para português, por isso a versão em inglês é exibida abaixo.
GuiasEditor & Scene Format
game/cmd/editorExperimentalgame/pkg/editorExperimentalgame/pkg/editor/editorcmdExperimentalgame/pkg/sceneformatExperimental
This document records the scope decision for NSGo's game editor (#159) and specifies the version 1 YAML scene format (#160) implemented in github.com/nsgo-dev/game/pkg/sceneformat.
Prebuilt desktop installers for NSGo Game Editor (cmd/editor)—signed and notarized .dmg images for macOS (arm64 / x64), -setup.exe installers for Windows (x64 / arm64), and .deb / .pkg.tar.gz / .AppImage packages for Linux (x64 / arm64)—are published on GitHub Releases, alongside one-line installers (install.sh / install.ps1). You can also launch the editor directly via nsgo game editor or go run ./cmd/editor.
Editor Scope Decision (#159)
NSGo takes option (b) growing into (c): keep Go code and Tiled first-class, define a clean human-editable YAML scene format shared by hand-authored scenes and tooling, and build a lightweight NSGo-native scene editor on top of it.
Why this scope
- Code and Tiled stay first-class. A game written purely in Go—or authored with Tiled
.tmjmaps and TexturePacker/Aseprite atlases—never has to go through an editor.sceneformatis an ordinary library package with zero runtime lock-in. - One text format, readable diffs. Scenes are plain versioned YAML (
version: 1) with deterministic 2-space encoding. Hand-editing a scene in a text editor and saving it from a visual editor produce the same diff-friendly structure. - Dogfooding NSGo. Rather than wrapping a third-party desktop shell or building a monolithic IDE, the lightweight scene editor is an NSGo app built with NSGo's own
uiviews andCanvas. Every improvement to inspectors, tree views, shortcuts, or canvas tooling benefits NSGo itself.
Planned lightweight editor capabilities
The NSGo-native editor operates directly on sceneformat.SceneDoc files and focuses on the workflows where visual feedback beats hand-editing coordinates:
- Object placement & transforms: place, drag, rotate, scale, flip and Z-order objects across world and screen layers.
- Tile painting: paint inline tile grids, and the tile layers of layered grids with flipped tiles, or preview referenced Tiled
.tmjand LDtk.ldtkmaps. - Typed property & component editing: inspect and edit
componentsandpropertieswith validation against the scene schema. - Undo / redo: command-based editing history over scene documents.
- Play-in-editor: run the live
game.LoopandBuiltScenedirectly inside the editor'sCanvaswithout leaving the tool. - Asset browsing: browse project atlases, frames, animations and tilemaps and drag them into layers.
Out of scope for the initial editor: custom scripting languages, bespoke shader/material graphs, and proprietary binary project formats.
Scene Format (version: 4) (#160)
import "github.com/nsgo-dev/game/pkg/sceneformat"
Top-level fields
| Field | Type | Description |
|---|---|---|
version |
int |
Required schema version: 4 (CurrentVersion), 3 for a scene using version 3 parallax/repeat layers without version 4 3D lights/environment/cameras, 2 for version 2 features without version 3/4 fields, or 1 for none of the fields added in versions 2–4. Encode writes it back unchanged. |
uid |
string |
Optional stable ID that stays the same when the file is renamed or moved, written by nsgo game index (all versions; see Stable references). Resolve keeps the scene's own uid, not its base's. |
inherits |
string |
Optional slash-separated path from the project root to a base scene this one inherits (version 2+, see Instancing and inheritance below). |
name |
string |
Optional human-readable scene name. |
navMesh |
string |
Optional slash-separated path from the project root to the scene's baked navigation mesh file, which nsgo game navmesh writes (all versions). In a scene that inherits another, it replaces the base's. |
virtualWidth, virtualHeight |
float32 |
Virtual viewport size in points. Must both be 0 or both positive. |
backgroundColor |
string |
Optional CSS color string parsed by core.ParseColor (for example "#141824"). Filled over (0, 0, virtualWidth, virtualHeight) before layers draw. |
ambientColor |
string |
Optional CSS color string parsed by core.ParseColor (for example "rgba(12, 16, 30, 0.85)"). Sets the ambient darkness tint of the scene's 2D lighting pass (lights2d.Scene.Ambient, both versions). |
camera |
object | Optional default 2D camera for world-space layers (x, y, zoom, rotation, optional bounds). |
environment |
object | Optional 3D scene environment (version 4): sky (kind: color, gradient, or hdr with color / zenith, horizon, ground / hdr path), ambientColor, ambientIntensity, iblIntensity, fog (mode: off, linear, exp, exp2; color, start, end, density, maxOpacity, height fog heightEnabled, heightBase, heightFalloff, heightDensity), tonemapping (none, reinhard, aces, neutral, agx), and exposure. |
tilemaps |
map | Optional named tilemaps referenced from layers via tilemap.ref. |
layerOverrides |
map | Changes to inherited layers by name: space, order, visible, tilemap (version 2+), plus parallaxX, parallaxY, repeatX, repeatY, repeatWidth, repeatHeight (version 3, requires inherits). |
overrides |
map | Changes to inherited objects by ID (version 2+, requires inherits). |
layers |
list | Ordered list of layers drawn lowest order first, preserving document order on ties. |
connections |
list | Optional connections from one object's events to another object's handlers, written after the layers (all versions, see Connections). |
Camera
x,y: world coordinates placed at the center of the virtual viewport(virtualWidth/2, virtualHeight/2)(or(0, 0)when virtual dimensions are0).zoom: positive zoom factor; defaults to1when omitted.rotation: camera rotation in radians (clockwise on screen); world layers rotate by-rotationaround(x, y).bounds: optional{x, y, width, height}world rectangle clamping the visible area (width > 0,height > 0).- When
camerais omitted, world layers draw with the identity transform.
Tilemaps
A tilemap entry (in top-level tilemaps or inline on a layer) uses exactly one mode:
- Reference (
ref, layers only): names an entry in top-leveltilemaps. - External map (
source): a slash-separated path from the project root to a Tiled map (.tmjor.tmx) or an LDtk project (.ldtk); for LDtk,levelnames the level to build (version 2), and without it the project's first level is built. - Inline grid:
tileWidth,tileHeight,width,height, eithertileset(atlas name whose frames are keyed"1","2", …) ortilesetFile(version 2+, path of a YAML tileset*.tileset.yaml), optionaloffsetX/offsetY(version 3, shifting cell(0, 0)in layer points), and row-majordataof lengthwidth * height(0is an empty tile; when usingtilesetFile, IDnplaces local tilen - 1). - Layered grid (version 2):
tileWidth,tileHeight,width,height, optionaloffsetX/offsetY(version 3),tilesetFile, the path of a YAML tileset (*.tileset.yaml, see YAML tilesets) whose tiles the cells place, andtileLayers, up toMaxTileLayersnamed layers drawn in order.
The tileset of a layered grid defines each tile once, with its flags, properties, collision shapes, animation and terrain, so the map only places tiles, as a Godot TileSet does for its TileMapLayers. Each tile layer has a name, optional visible (default true) and opacity (default 1), and rows: height rows from the top, each width cells separated by spaces. A cell is . when empty, or the tile's local ID in the tileset (0, 1, …) followed by any of h, v and d to flip it horizontally, vertically or across its diagonal, as Tiled's flip bits do, so 3hv is tile 3 turned half a turn. A row may align its cells with extra spaces and write the letters in any order; Encode writes single spaces and the order h, v, d, so each row is one line in a diff.
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/scene.v2.json
version: 2
name: Cave
virtualWidth: 320
virtualHeight: 180
layers:
- name: ground
tilemap:
tileWidth: 16
tileHeight: 16
width: 4
height: 2
tilesetFile: tilesets/cave.tileset.yaml
tileLayers:
- name: floor
rows:
- 0 0 0 0
- . . 1h 3hvd
- name: deco
opacity: 0.5
rows:
- 2 . . .
- . . . .
TileLayerDoc.Cell, SetCell and Cells read and write a layer's cells as tile values, the GIDs they have once built: 0 for an empty cell, otherwise the local ID plus 1 with tilemap.FlipHorizontal, FlipVertical and FlipDiagonal set; ParseTileRow and FormatTileRow do the same for one row.
Build turns a single grid of atlas frames into a sprite batch (BuiltLayer.Tilemap), and a layered grid, an inline grid with tilesetFile, or an external map into a tilemap.Tilemap (BuiltLayer.Map). The map carries the tileset's flags, properties, shapes, animations and terrains, so in the layer's coordinates it answers FlagsAt, TileProperties, TilesInRect and Raycast, collides directly with physics.MoveAndSlide, and serves tileshape.New for slopes and occluders. BuiltScene.Draw draws only the map tiles inside the virtual viewport, seen through the camera for a world-space layer, unless the scene has no virtual size or DrawAllTiles is set, as the editor sets it for its edit view; BuiltScene.Update(dt) advances animated tiles.
Build reads YAML tilesets, Tiled maps with their external tilesets and LDtk projects through the resolver's FileResolver (ReadFile), with paths in a Tiled or LDtk file taken from that file's directory, and loads their images through an ImageResolver (Image) when the resolver has one, or names them by path (core.ImageSource{URI: path}) otherwise. FSAssets reads a project's files from an fs.FS, so a scene that names a .tmj, .ldtk or .tileset.yaml builds with no resolver of the game's own. A resolver that implements TilemapResolver still loads every source itself into a TilemapDoc, as before, except a source that names an LDtk level: Tilemap(source) cannot receive the level, so Build reads that one through the FileResolver.
Layers and Objects
Each layer has:
name(required, unique within the scene)space:"world"(default when omitted, draws under camera) or"screen"(draws in canvas coordinates, ignoring camera)order: integer draw order (lowest first)visible: boolean, defaults totruewhen omittedparallaxX,parallaxY(version 3): optional finite scroll factors applied to the camera position on"world"layers, matchingscene.Layer; omitted defaults to1,0pins the layer against camera translation,0.5scrolls at half speed, and values above1scroll faster for foregrounds.layerOverridescan override them on inherited scenes.repeatX,repeatY(version 3): optional booleans that tile a"world"layer seamlessly across the camera's visible region usingrepeatWidth/repeatHeight(non-negative layer points;0falls back to the layer's tilemap pixel size, then the scene's virtual viewport size).layerOverridescan override them on inherited scenes.tilemap: optional tilemap drawn beneath the layer's objectsobjects: placed objects in the layer
Each object has:
id(required, unique across the entire scene)name,prefab(optional)- Transform:
x,y,originX,originY,rotation(radians, clockwise),scaleX(default1),scaleY(default1),flipX,flipY,alpha([0, 1], default1),z(layer-local draw order, lowest first) sprite: optional{atlas, frame}referencing asprite.Atlasand frame nameparticles: optional{file, atlas}(version 2) placing a 2D particle emitter YAML file (fileis a slash-separated path from the project root; optionalatlasresolves the emitter'sframeNames).sceneformat.BuildloadsfilethroughParticlesResolverwhen implemented, falling back toFileResolver+particles.UnmarshalConfigYAML(soFSAssetsworks automatically), createsBuiltObject.Emitter(collected inBuiltLayer.Emitters), positions it at the object's composed world transform (updated byBuiltObject.Sync), advances it inBuiltScene.Update(dt), and draws it in Z-order interleaved with sprites inBuiltScene.Draw(d)material: optional slash-separated path from the project root to a shared material file, such asmaterials/stone.material.yaml, resolved at build time throughMaterialResolver(see resource)- 3D look:
mesh, one of the built-in primitivesbox,sphere,plane,capsuleandcylinder,model(version 2), the slash-separated path from the project root to a glTF 2.0 file (.gltfor.glb), optionally narrowed to one of its nodes bymodelNodeor one of its meshes bymodelMesh, orgridMap(version 2), the slash-separated path from the project root to a*.gridmap.yaml/*.gridmap.ymlfile; an object'smaterialreplaces the model's or grid map's materials or gives the primitive its surface; optionaloccluder(version 2) marks the object as a 3D occluder (mode: modelormode: boxwith optionalcenter,size, anddoubleSided).scenemodel.Buildturns them into geometry, LODs, and occluders (scenemodel).CheckObjectModelchecks these fields on one object, and the editor'sPlaceObjectrefuses an object it refuses; the inspector's Mesh and GridMap fields are mutually exclusive with each other and withmodel - 3D light (
light, version 4): optional 3D light attached to the object's transform (kind:directional,point, orspot; CSScolor,intensity,range, spotinnerConeandouterConehalf-angles in degrees, andshadows). Directional and spot lights aim along the object's local-Zaxis.CheckObjectLightvalidates one object's light. - 3D camera (
camera, version 4): optional 3D camera attached to the object's transform (projection:perspectiveororthographic,fovin degrees ororthoHeight,near,far, andcurrent). At most one 3D camera in a scene may setcurrent: true.CheckObjectCamera3Dvalidates one object's camera. components: optional mapping from a component type name to its fields; free-form unless a component registry is given (see Component types)properties: optionalmap[string]anyfor custom metadatascene: optional slash-separated path from the project root to a scene file this object instances (version 2, see Instancing and inheritance below)overrides: optional changes to the instanced scene's objects by ID (version 2, requiresscene)children: optional list of objects attached to this one (see Node tree below)
Node tree (#484)
An object can hold child objects under children, nested up to MaxObjectDepth (64) levels. A child's transform is local to its parent: x, y, rotation, scaleX and scaleY (and in 3D posZ, rotX, rotY, rotZ and scaleZ) compose with every ancestor's, and its alpha multiplies theirs. originX, originY, flipX and flipY stay the object's own, and z orders the whole layer, children included, with ties drawing each parent before its children. Children belong to their parent's layer, and their IDs share the scene-wide namespace, so an ID used anywhere in the tree is refused anywhere else.
layers:
- name: ships
objects:
- id: ship
x: 100
y: 50
rotation: 1.5707964
scaleX: 2
scaleY: 2
sprite: { atlas: actors, frame: hull }
children:
- id: turret
x: 10 # lands at (100, 70): a quarter turn and twice the size of ship
sprite: { atlas: actors, frame: turret }
children:
- id: barrel
x: 5 # lands at (100, 80)
The same tree loads three ways:
Buildlinks eachBuiltObjectto itsParentandChildren, setsWorldto the composed 2D affine transform andWorldAlphato the composed alpha, and draws each child's sprite at its world position, rotation and scale. A sprite whose composed transform is sheared (a rotated child under a non-uniformly scaled parent) cannot be drawn as a sprite, soValidaterefuses it, and with itParse,EncodeandBuild;CheckObjectTreemakes the same check, and the nesting limit, for a single tree. A parent collapsed to zero size along one axis (such asscaleX: 0) is not a shear: its child sprites draw at zero scale. Objects without a sprite keep the exact matrix inWorld.BuiltLayer.Objectslists a layer's top-level objects, andBuiltScene.Objectsindexes every object by ID. After changing a built object's document fields,BuiltObject.Syncrecomposes itsWorldandWorldAlphaand its sprite, and its descendants', and reports false for a sprite the change would shear.SpawnEntities(doc, world)spawns one entity per object into anentities.World, parented in itsHierarchy2Das the objects nest, with the object's localTransform2Dand anObjectRefcomponent naming the object and its layer. The top-level objects of a hidden layer spawn hidden, so their subtrees are not world-visible.BuildNodes3D(doc, scene.Root())builds ascene3dnode tree: one group node per layer (carrying the layer's visibility), and one node per object named by its ID, withUserDatapointing at itsObjectDoc.ObjectLocalTransform3Dgives each node's local transform;rotX,rotYandrotZapply in that order about fixed axes, the same order the editor's 3D viewport uses.scenemodel.Build(doc, scene.Root(), assets)builds the same tree and attaches to each object's node the geometry and materials of itsmesh,modelorgridMap, with the node'sLocalBoundsset from the geometry, ready forrender3d.Queue(scenemodel).
spawned, err := sceneformat.SpawnEntities(doc, world)
if err != nil {
return err
}
world.Hierarchy2D().Sync()
wt, _ := world.Hierarchy2D().WorldTransform(spawned["barrel"]) // wt.X == 100, wt.Y == 80
nodes, err := sceneformat.BuildNodes3D(doc, scene.Root())
if err != nil {
return err
}
pos := nodes.Objects["barrel"].WorldTransform().Pos
Moving, deleting or undoing an object in the editor carries its children along, and the editor never hands out an ID that a nested child already uses. It refuses to place a tree deeper than MaxObjectDepth or holding a sheared sprite, and refuses a scale or rotation that would shear a sprite, the object's own or a descendant's, under the transforms of its ancestors. Both viewports draw, pick and edit nested children, and the scene tree selects, reparents, reorders and renames them.
Instancing and inheritance (#483)
A version 2 scene reuses other scene files the way Godot's scenes do. Every reference is a slash-separated path from the project root, like a material's, and Parse and Encode keep references and overrides exactly as written: a level of instances saves as the same instances, never as copies of their objects.
An object with scene instances that file. The top-level objects of every layer of the instanced scene, in document order, become the object's first children, ahead of its own children, so the object's transform places the whole instance. Their IDs are prefixed with the object's ID and a slash, so ten instances of one enemy hold enemy_1/body to enemy_10/body. overrides changes the instanced objects, keyed by their IDs inside the instanced scene; a scene instanced inside it is reached by its prefixed ID, such as gun/barrel. The instanced scene's layer settings, camera, background and virtual size do not carry over, and a scene whose layers hold a tilemap cannot be instanced.
# scenes/enemy.scene.yaml
version: 2
name: Enemy
layers:
- name: root
objects:
- id: body
sprite: { atlas: actors, frame: hero }
properties: { health: 3, speed: 40 }
children:
- id: torch
x: 6
sprite: { atlas: actors, frame: torch }
# level.scene.yaml
version: 2
layers:
- name: actors
objects:
- id: enemy_1
x: 32
"y": 40
scene: scenes/enemy.scene.yaml
overrides:
body:
alpha: 0.5
- id: enemy_2
x: 64
"y": 40
scene: scenes/enemy.scene.yaml
overrides:
torch:
x: -6
A scene with inherits starts as a copy of its base and changes only what it declares:
name,backgroundColor, the virtual size andcamerareplace the base's when set, andtilemapsentries are added or replaced by name.overrideschanges inherited objects by ID, nested children and instanced objects (enemy_1/body) included.layerOverrideschanges inherited layers by name.- A layer named like one of the base's adds its objects to that layer and may set nothing else; any other layer is added after the base's layers.
An inherited object or layer cannot be removed, and its ID cannot change.
# scenes/fast_enemy.scene.yaml: the enemy above, twice as fast
version: 2
inherits: scenes/enemy.scene.yaml
overrides:
body:
properties:
speed: 80
An override sets any object field except id, children, scene and overrides; a field it leaves out keeps the base's value, and a value of 0 or false is still a change. components and properties are replaced key by key, keeping the object's other keys.
Resolve(doc, scenes) loads the referenced files through a SceneResolver, such as FSScenes{FS: os.DirFS(root)}, and returns a self-contained copy in which no object instances anything and nothing is inherited. It loads each file once per call and never changes doc or the documents the resolver returns. It refuses a cycle of scenes that instance or inherit each other, a chain deeper than MaxSceneNesting files, a result of more than MaxResolvedObjects objects, an override that names no object or layer of the scene it changes, and a result that does not validate, such as one whose prefixed IDs collide with other IDs. Build resolves a scene itself when its AssetResolver also implements SceneResolver, and BuiltScene.Doc is then the resolved copy; SpawnEntities and BuildNodes3D refuse a scene that still refers to others, so resolve it first.
type assets struct {
sceneformat.AtlasMap
sceneformat.FSScenes
}
built, err := sceneformat.Build(level, assets{atlases, sceneformat.FSScenes{FS: os.DirFS("project")}})
In the editor, PlaceScene(layer, path, x, y) places an instance of a scene file as an undoable command, with an ID named after the file (also triggered by dragging a scene file from the File Browser onto the viewport, clicking its + button, or pressing Place with a scene file selected; registered prefabs in the Asset Browser can likewise be clicked or dragged onto the viewport via PlacePrefab). The editor's Resolver must implement SceneResolver; PlaceScene, and PlaceObject for any object tree that names a scene, resolve the scene as it would be with the instance placed and refuse it when that fails: a missing or invalid file, an override that names no object or holds a bad value, or IDs that collide once instances are expanded. Set the editor's ScenePath to the open scene's path from the project root (OpenYAML clears it) so that an instance leading back to the open scene, directly or through other files, is refused as a scene cycle before the saved file instances itself. Placing an instance raises a version 1 scene to version 2 (which Undo restores). New IDs are checked against the IDs the scene gets from its base and its instances as well as its own.
Both the 2D and 3D viewports and the scene tree (SceneTreeView) let you select any instanced child or inherited object directly (shown muted in the scene tree with an inst/base tag and an override dot when modified). Editing its transform, sprite, material, particles, 3D light/camera/occluder/mesh/model/GridMap, custom properties, or component fields records an undoable override on the owning instance (ObjectDoc.Overrides, keyed by its ID inside the instanced scene) or on the inheriting scene (SceneDoc.Overrides, leaving the base file unchanged), and refuses edits whenever sceneformat.Resolve fails. Editing an inherited layer's visibility, space, parallax, or repeat records SceneDoc.LayerOverrides. The inspector shows an instance/inherited bar with the source scene path, instance count, and override count, marks each overridden field with a warning dot (whose tooltip shows the source value) and a per-field Revert button (RevertObjectOverrideField / RevertLayerOverrideField), and offers Revert All (RevertObjectOverrides / RevertLayerOverrides, pruning empty override maps so the saved YAML stays clean), Open Scene / Open Base Scene (OpenSourceScene / OpenInstancedScene / OpenBaseScene), Apply to Source (ApplyOverridesToSource, writing an instance's overrides back to its source scene file and clearing them on the instance in one undo step that restores the source file on Undo), and Make Local (MakeInstanceLocal, replacing a scene instance with a local copy of its resolved objects and prefixed connections in one undo step). Play runs a resolved copy of the scene, so changes made through BuiltObject.Doc show in the editor's document until Stop restores it.
Example
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/scene.v2.json
version: 2
name: Cave Room
virtualWidth: 320
virtualHeight: 180
backgroundColor: "#141824"
camera:
x: 160
y: 90
zoom: 1
bounds:
x: 0
y: 0
width: 320
height: 180
tilemaps:
floor_grid:
tileWidth: 16
tileHeight: 16
width: 4
height: 2
tileset: cave_tiles
data: [1, 2, 2, 1, 1, 0, 0, 1]
layers:
- name: floor
space: world
order: 0
tilemap:
ref: floor_grid
- name: actors
space: world
order: 10
objects:
- id: hero
name: Hero
prefab: prefabs/hero
x: 48
y: 40
originX: 8
originY: 8
z: 5
sprite:
atlas: actors
frame: hero
components:
collider: { w: 12, h: 14 }
properties:
spawn: true
- name: hud
space: screen
order: 100
objects:
- id: heart_1
x: 8
y: 8
sprite:
atlas: ui
frame: heart
Loading, building and drawing in Go
doc, err := sceneformat.Parse(yamlBytes)
if err != nil {
return err
}
built, err := sceneformat.Build(doc, sceneformat.FSAssets{
FS: os.DirFS(projectDir), // YAML tilesets, Tiled and LDtk maps
Atlases: sceneformat.AtlasMap{
"cave_tiles": tilesAtlas,
"actors": actorsAtlas,
"ui": uiAtlas,
},
})
if err != nil {
return err
}
// Each update step:
built.Update(dt)
// In a core.Canvas's Draw callback:
built.Draw(d)
Parse rejects unknown YAML keys, trailing documents, unsupported versions, newer-version fields in older scene versions (version 2 fields in version 1, version 3 parallax/repeat fields in versions 1 and 2, version 4 environment/light/camera fields in versions 1–3), multiple current: true 3D cameras, scene references that are not slash-separated paths from the project root, overrides without the scene or inherits they change, duplicate layer names or object IDs (nested children included), object trees deeper than MaxObjectDepth, invalid spaces, malformed colors, and non-finite or out-of-range transforms, light/camera/environment parameters, parallax factors, or repeat periods. Encode validates and emits deterministic 2-space YAML that round-trips through Parse without loss.
Schema
The scene format's JSON Schemas are published at https://game.nsgo.dev/schemas/scene.v1.json (sceneformat.SchemaURL), https://game.nsgo.dev/schemas/scene.v2.json (sceneformat.SchemaURLV2, for scenes that instance or inherit other scene files, name glTF models, or hold layered grids or LDtk levels), https://game.nsgo.dev/schemas/scene.v3.json (sceneformat.SchemaURLV3, for version 3 scenes with parallax and repeating layers), and https://game.nsgo.dev/schemas/scene.v4.json (sceneformat.SchemaURLV4, for version 4 scenes with 3D lights, environment, and 3D cameras). Encode starts every file with the # yaml-language-server: $schema=… line for its version (sceneformat.SchemaCommentFor), so VS Code's YAML extension and other editors with a YAML language server validate and complete a scene as it is written. See Schemas for YAML files.
Merging scene files in Git (#1058)
sceneformat.Merge(base, ours, theirs) performs an identity-based three-way merge of scene documents: layers are matched by name, objects by id anywhere in the tree (including across reparenting and layer moves), tilemaps and overrides by key, and connections by (from, event, to, handler). Individual fields—including nested components, properties, overrides, camera and args maps—merge one by one, and clean merges are validated with Validate and written with Encode.
When both sides edit the same field differently, one side deletes what the other modified, both add different items under the same ID, reparenting conflicts or forms a cycle, or the combined scene fails Validate, MergeResult.ConflictDoc(path) produces a versioned, deterministic YAML ConflictDoc (version: 1, read and written with ParseConflict / EncodeConflict) naming every conflict's object, field, and base/ours/theirs values alongside the list of cleanly merged items. Projects wire this into Git through .gitattributes (*.scene.yaml merge=nsgo-scene) and go tool game merge -setup (see game merge and Scene merge conflict report).
Component types
A ComponentRegistry declares, in Go and without reflection, the component types scene files may use: each type's name and documentation, and each field's name, kind (FieldBool, FieldInt, FieldFloat, FieldString, FieldStringList, FieldPoint, FieldRect, FieldCircle or FieldPolygon), optional allowed Enum values (for FieldString fields), default, optional inclusive range, optional Step for the inspector and documentation. Register refuses empty or duplicate names, ranges or steps on non-numeric fields, Enum on non-FieldString fields, a minimum above the maximum, a fractional range or step on a FieldInt, a negative step, and a default of the wrong kind or out of range.
The four 2D shape kinds (FieldKind.IsShape) describe world geometry in an object's local coordinate space and are also published as Point, Rect, Circle and Polygon definitions in scene.v1.json, scene.v2.json and scene.v3.json:
| Field kind | Go type | YAML form | Validation |
|---|---|---|---|
FieldPoint |
sceneformat.Point |
{x, y} |
Finite x, y; unknown keys refused |
FieldRect |
sceneformat.Rect |
{x, y, width, height} |
Finite numbers, width >= 0, height >= 0; unknown keys refused |
FieldCircle |
sceneformat.Circle |
{x, y, radius} |
Finite numbers, radius >= 0; unknown keys refused |
FieldPolygon |
[]sceneformat.Point |
[{x, y}, ...] |
Sequence of valid finite points |
ParsePoint, ParseRect, ParseCircle and ParsePolygon normalize decoded YAML values into their Go types, and MarshalYAML emits alphabetical keys so saved shape fields round-trip unchanged.
reg := sceneformat.NewComponentRegistry()
reg.MustRegister(sceneformat.ComponentType{
Name: "body",
Doc: "A moving body that collides with the level.",
Fields: []sceneformat.Field{
{Name: "solid", Kind: sceneformat.FieldBool, Default: true, Doc: "Blocks other solid bodies."},
{Name: "speed", Kind: sceneformat.FieldFloat, Default: 32.0, Min: sceneformat.Float64(0), Max: sceneformat.Float64(500), Doc: "Top speed in points per second."},
{Name: "layer", Kind: sceneformat.FieldInt, Default: 1, Min: sceneformat.Float64(0), Max: sceneformat.Float64(31), Doc: "Collision layer."},
},
})
doc, err := sceneformat.ParseWith(data, sceneformat.ParseOptions{File: "scenes/room.scene.yaml", Components: reg})
With a registry, ParseWith checks the components of every object, nested children included, and refuses an unregistered component type, a misspelled or unknown field, a value of the wrong kind (a FieldInt refuses 3.0; a FieldFloat accepts an integer), a non-finite number and a value out of range. The error is a *ComponentError carrying the file, line and column of the offending key or value, the object ID, component and field, and lists the registered names:
scenes/room.scene.yaml:11:13: sceneformat: object "hero" component "body" field "sped": unknown field (registered: solid, speed, layer)
Defaults are not written into the document, so loading and saving a scene changes nothing; reg.Resolve("body", fields) returns every field with its default filled in. ValidateComponents checks a document built in Go (without positions), and CheckField checks one value and normalizes it to bool, int, float64 or string. Parse without a registry keeps components free-form.
In the editor, Editor.SetComponentRegistry(reg) checks the open scene's components and, as OpenFile does, its connections, then makes OpenFile report component errors with the file and line, and makes SetComponentField and PlaceObject refuse fields the registry does not allow. Changing the registry clears undo/redo history, so an undone edit the new registry refuses cannot be redone. The inspector lists every registered field of a component in declaration order, including fields the scene leaves unset, which show their default; the label's tooltip gives the field's documentation, kind, range and default, enum fields show a selector, string-list fields edit comma-separated items, and numeric inputs are bounded by the range and step by the field's Step (1 for an int, 0.1 for a float when unset). Floats are shown at full precision, and an edit the registry refuses is reported in the status bar. Components without a registered type, or every component when no registry is set, are shown from the values in the file as before (with the built-in physics component schemas available automatically in the inspector).
Built-in physics components (#817)
sceneformat ships six versioned built-in physics components (PhysicsComponentVersion = 1), registered together with RegisterPhysicsComponents(reg) or PhysicsComponentRegistry():
| Component | Dimension | Key fields |
|---|---|---|
body2d |
2D | version (1), kind (static, kinematic, dynamic), mass, gravityScale, vx, vy, friction, restitution, linearDamping, angularDamping, material |
collider2d |
2D | version (1), shape (box, circle), width, height, radius, offsetX, offsetY, layer, mask ([]string), isTrigger; declares events enter, stay, exit |
trigger2d |
2D | version (1), shape (box, circle), width, height, radius, offsetX, offsetY, layer, mask ([]string); declares events enter, stay, exit |
body3d |
3D | version (1), kind (static, kinematic, dynamic, trigger), mass, gravityScale, vx, vy, vz, friction, restitution, linearDamping, angularDamping, lockRotation, layer, mask ([]string), material, physicsMaterial; declares events enter, stay, exit |
collider3d |
3D | version (1), shape (box, sphere, capsule, cylinder, convex, trimesh, heightfield), width, height, depth, radius, offsetX, offsetY, offsetZ, rotX, rotY, rotZ, terrain, maxVertices, layer, mask ([]string), isTrigger; declares events enter, stay, exit |
trigger3d |
3D | version (1), shape (box, sphere, capsule, cylinder, convex), width, height, depth, radius, offsetX, offsetY, offsetZ, rotX, rotY, rotZ, maxVertices, layer, mask ([]string); declares events enter, stay, exit |
- Named collision layers:
layerandmaskreference human-readable layer names declared underphysics.layersingame.yamlinstead of raw bitmasks (oncollider2d,trigger2d,body3d,collider3d, andtrigger3d). PassParseOptions{File: ..., PhysicsLayers: proj.PhysicsLayerTable()}tosceneformat.ParseWith(done automatically byproject.File.LoadAutoloadsandEditor.OpenProject): any misspelled or unknown layer name fails to load with a*loaderr.Errorcarrying the exact file path, 1-based line, column, field path, and allowed layer names. - Building and stepping (
BuildPhysics):ps, err := sceneformat.BuildPhysics(built, proj.PhysicsSettings(), lib)constructs the matchingphysics.World,physics.RigidWorld, andphysics3d.World(applying project gravity, solver iterations, namedLayer/Maskbitmasks, optional*.physics.yamlfiles viaPhysicsMaterialResolver, glTF/primitive meshes forconvexand statictrimeshcolliders viaModelResolverorFileResolver, and*.terrain.yamlheightfields for staticheightfieldcolliders viaTerrainResolverorFileResolver, recorded inps.Bodies3D,ps.TriMeshes3D, andps.Heightfields3D). Callingps.Step(dt)steps 2D kinematic and rigid bodies, 2D triggers, and 3D bodies and triggers, writes updated local poses back ontoBuiltObject.Doc, and dispatchesPhysicsTriggerEvent(TriggerEnter,TriggerStay,TriggerExit) tops.OnTriggerand any attachedps.Signals(enter/stay/exit). - Play-in-editor, viewport debug outlines, 3D collider handles & fit to bounds (#902):
Editor.PlayInautomatically builds and stepsPhysicsScene(Editor.PlayPhysics,Editor.PlayTriggerEvents,Editor.OnPlayTrigger) so a scene with a player body, wall colliders, and a coin trigger plays in the editor with collision and trigger events without writing game collision code. WhileEditor.ShowPhysicsDebugis enabled (the default; toggle withSetShowPhysicsDebug), both the 2D and 3D viewports render wireframe outlines for everycollider2d,trigger2d,collider3d, andtrigger3d(including cylinders, convex hulls, triangle meshes, and terrain heightfields). Switch the 3D gizmo toGizmo3DCollider(toolbar Collider,View > 3D Gizmo > Collider, or shortcutshift+c) to drag collider size handles (ColliderHandles3D,PickGizmo3D,BeginGizmoDrag3D,UpdateGizmoDrag3D,EndGizmoDrag3D), committing each drag as a single undo step; press Fit to Model Bounds in the Inspector (or callEditor.FitCollider3DToBounds) to fit a collider's size and local offset to its mesh or glTF model bounds in one undo step.
Built-in 2D lighting and occluder components (#887)
sceneformat ships two versioned built-in 2D lighting components (Lights2DComponentVersion = 1), registered together with RegisterLights2DComponents(reg) or Lights2DComponentRegistry() (and available automatically in the editor's inspector):
| Component | Key fields |
|---|---|
light2d |
version (1), kind (point, spot), color (CSS color), radius, intensity, falloff, direction (radians, added to object rotation), angle (spotlight cone spread in radians), castShadows, enabled, offsetX, offsetY |
occluder2d |
version (1), shape (rect, polygon, tilemap), width, height, offsetX, offsetY, points ([][2]float64, flow YAML [[x, y], ...]), layer, tileLayers ([]string), enabled |
- Automatic
lights2d.Scenebuild:sceneformat.BuildturnsSceneDoc.AmbientColor, everylight2dandoccluder2don visible world-space layers, and anyshape: "tilemap"occluders (derived from tilemap collision shapes viatileshape.View) intoBuiltScene.Lights2D(*lights2d.Scene).BuiltScene.DrawrendersLights2Dover world-space layers under the scene camera transform (before screen-space HUD layers) unlessSkipLights2Dis set; callBuiltScene.SyncLights2D()after moving lights or occluders at runtime. - 2D lighting preview & interactive handles: The 2D viewport toolbar provides a Lighting toggle (
Editor.ShowLightingPreview,SetShowLightingPreview, commandCmdToggleLightingPreview) that previews the exact samelights2d.Sceneshadows and ambient darkness live in edit mode. Selecting alight2dobject shows interactive handles for its radius (Handle2DLightRadius), spotlight cone angle (Handle2DLightSpotAngle), and spotlight aim direction (Handle2DLightSpotDirection). Selecting anoccluder2dobject shows edge handles forrectoccluders (Handle2DOccluderRectN/E/S/W) and draggable vertex (Handle2DOccluderVertex) and edge-midpoint insertion (Handle2DOccluderEdgeMid) handles forpolygonoccluders (SetOccluderPolygonPoints,InsertOccluderVertex,RemoveOccluderVertex,ConvertOccluderToPolygon). Every drag records one undoable step, Escape cancels it, andSetAmbientColor(or the Scene Lighting section in the Inspector) editsambientColorundoably.
Built-in 2D navigation region components (#888)
sceneformat ships a versioned built-in 2D navigation region component (NavRegion2DComponentVersion = 1), registered with RegisterNavRegion2DComponent(reg) or NavRegion2DComponentRegistry() (and available automatically in the editor's inspector and scene.v1.json / scene.v2.json / scene.v3.json):
| Component | Key fields |
|---|---|
navregion2d |
version (1), mode (walkable, obstacle), points ([][2]float64, flow YAML [[x, y], ...]), offsetX, offsetY, subtractTileCollision (bool), tileLayer (string), tileLayers ([]string), agentRadius (float, >= 0), enabled (bool) |
- Automatic
ai.NavMeshbuild (BuildNavMesh2D):sceneformat.Buildcollects every enablednavregion2don visible world-space layers (normalizing polygon winding so overlapping walkable regions union and obstacle cutouts subtract cleanly), optionally subtracts solid tile collision geometry from scene tilemaps (viatileshape.Viewand non-rectangular solid tile shapes), attaches any authored 2Dnav_linkcomponents, bakes convex polygons withgame/navbake, and populatesBuiltScene.NavBake2D(*navbake.Mesh) andBuiltScene.NavMesh2D(*ai.NavMesh). Scenes with nonavregion2dcomponents keep both fieldsnil; callBuiltScene.SyncNavMesh2D()after runtime edits. - 2D NavMesh overlay, polygon handles & Test Path tool: The 2D viewport renders the built
NavBake2Dconvex polygons, shared portals, and authorednavregion2doutlines wheneverEditor.ShowNavMesh2Dis enabled (defaulttrue, toggled via toolbar buttonview-navmesh2d-overlay,SetShowNavMesh2D, orCmdToggleNavMesh2D). Selecting anavregion2dobject exposes draggable vertex handles (Handle2DNavRegionVertex) and edge-midpoint insertion handles (Handle2DNavRegionEdgeMid) plusPlaceNavRegion2D,InitNavRegionPolygon,SetNavRegionPoints,InsertNavRegionVertex, andRemoveNavRegionVertex; dragging updates the built mesh overlay live and commits one undoable step on release (Escape cancels). Selecting the Test Path tool (ToolNavTestPath, toolbar buttontool-nav-test-path, commandCmdToolNavTestPath) lets you press start and end points in the viewport to draw the exact pathBuiltScene.NavMesh2D.FindPathfinds (recomputed live as vertices or tiles change, and cleared with Escape orClearNavPathPreview2D).
Connections (#490)
A scene file connects an event one object emits to a handler of another object, as Godot's [connection] entries in a .tscn file do, so a button opens a door with no Go code that names either of them:
layers:
- name: props
objects:
- id: button
components:
button: {}
- id: door
components:
door: {}
connections:
- from: button
event: pressed
to: door
handler: open
args:
speed: 2.5
| Field | Type | Description |
|---|---|---|
from |
string |
Required ID of the object that emits the event. |
event |
string |
Required event name, such as pressed, or button.pressed to say which component when several components of the object declare it. |
to |
string |
Required ID of the object whose handler runs; it may be from itself. |
handler |
string |
Required handler name, such as open, or door.open. |
args |
map | Optional values for the handler's params by name, each a bool, a number or a string; a param left out takes its default. |
once |
bool |
Disconnects after the first time the event fires, as Godot's one-shot connections do. |
The events and handlers come from the component registry: a ComponentType lists the Events an object with that component emits and the Handlers it can run, each handler with typed Params (declared and checked like fields) and the Func that runs it. The game registers what each kind of component does once; the scene files decide which objects are wired together.
reg.MustRegister(sceneformat.ComponentType{
Name: "button",
Events: []sceneformat.Event{{Name: "pressed", Doc: "The player pressed the button."}},
})
reg.MustRegister(sceneformat.ComponentType{
Name: "door",
Fields: []sceneformat.Field{{Name: "open", Kind: sceneformat.FieldBool}},
Handlers: []sceneformat.Handler{{
Name: "open",
Params: []sceneformat.Field{{Name: "speed", Kind: sceneformat.FieldFloat, Default: 1.0, Min: sceneformat.Float64(0)}},
Func: func(c sceneformat.Call) {
c.Target.Components["door"].(map[string]any)["open"] = true
},
}},
})
doc, err := sceneformat.ParseWith(data, sceneformat.ParseOptions{File: "scenes/hall.scene.yaml", Components: reg})
signals, err := sceneformat.Connect(doc, reg, game)
// Where the game handles a press on an object with a button component:
err = signals.Emit(objectID, "pressed", nil)
Connect(doc, reg, ctx) checks the scene's components and connections and returns a *Signals. Signals.Emit(from, event, payload) calls the handler of every connection from that event in the order the file lists them, skipping a once connection that has run. Each handler gets a Call: the Signals (so it can emit further events, nested at most MaxEmitDepth levels), the ctx given to Connect (such as the game's state or a *BuiltScene), the source and target *ObjectDoc in the scene, the components and names of the event and handler, Args holding every param (the connection's value or the default) and the payload. Emit refuses an object the scene does not hold, an event none of its registered components declares, and a bare name two of its components declare (write component.event). Signals is a snapshot of the scene's objects as Connect finds them: after adding or removing objects in doc, which may also move the others in memory, call Connect again. A scene that instances or inherits other scene files is connected after Resolve (or through BuiltScene.Doc), and Signals is not safe for concurrent use.
Parse checks a connection's form: all four names set, event and handler written as a name or component.name, arguments that are bools, finite numbers or strings, no connection repeated, and, in a scene that refers to no other scene file, from and to naming its objects. With a registry, ParseWith also checks the names against it and reports a *ConnectionError with the file, line and column: an event or handler no registered component of the object declares, a bare name two of its components declare, an argument the handler has no param for, and an argument of the wrong kind or out of range. The error lists what the object does declare:
scenes/hall.scene.yaml:16:14: sceneformat: connection 0 ("button" pressed -> "door" opne): no registered component of object "door" declares handler "opne" (it has: door.open)
ValidateConnections makes the same checks on a resolved document without positions. Register refuses an event or handler with an empty name, a dot in its name or a name its type already uses, and handler params on the same terms as fields; a registry used only to check files, such as an editor's, may leave Func unset, which Connect refuses.
Resolve carries connections along: an instanced scene's connections come with the instance, the objects they name prefixed like its objects' IDs (door_1/button), so every copy of a prefab keeps its own wiring; an inheriting scene keeps its base's connections and adds its own after them. A scene may connect objects of the scenes it instances or inherits, and those names are checked once it is resolved. In the editor, DeleteObject also removes the connections from or to the deleted object and its descendants, and undoing the delete puts them back.
Queued events
Emit runs the handlers before it returns, so a handler that emits runs the next handlers inside itself. To keep a step's order plain, emit with Signals.Enqueue(from, event, payload) instead and call Signals.Flush() once per step, such as at the end of game.Loop's Update:
loop.Update = func(dt time.Duration) {
updateSystems(dt) // the game's own input and systems, which call signals.Enqueue
if err := signals.Flush(); err != nil {
log.Print(err)
}
}
Enqueue refuses what Emit refuses before it holds anything, so a misspelled event fails where it is raised. Flush runs the events enqueued before it began, in the order they were enqueued, each as Emit runs it; an event a handler enqueues, its own included, waits for the next Flush, so one Flush always ends and a handler never re-enters itself. Flush from a handler is refused, and Pending says how many events wait. A handler's panic passes through Flush, and the events after the one that panicked stay queued for the next Flush. Once the queue has grown to a step's events, a step allocates nothing more than emitting them would.
Spawning connected entities
SpawnConnected(doc, world, reg, ctx) checks the scene as Connect does and spawns its objects as SpawnEntities does, then returns each object ID's entity and the *Signals that connects those entities. Every check runs before the first entity is spawned, so a scene whose connection names a missing object, event, handler or Func, or whose components break their types, spawns nothing. EmitEntity(e, event, payload) and EnqueueEntity address an object by its entity, Entity(id) returns an object's entity, and each Call carries SourceEntity and TargetEntity, so a handler reaches the target's components with entities.Get. A destroyed entity emits nothing: Emit, Enqueue and their entity forms refuse it, Flush drops the events it enqueued, and connections to it are skipped. A scene that instances or inherits others is spawned after Resolve, its instances' connections reaching the instances' entities (west/door).
Checking connections
nsgo game check resolves each scene that instances or inherits others. It fails on a scene that does not resolve, such as a cycle or an override naming no object, at the instance or inherits line, and on a connection whose from or to names no object of the resolved scene, at the line that names it. The events and handlers are declared in Go, which the command cannot load, so a game checks them in its own tests with assetcheck.CheckWith and its registry. That reports, at the file and line, a connection naming an event, handler or argument its objects do not declare and a component that breaks its type; in a scene that instances or inherits others, it also checks the components its overrides write and every connection of the resolved scene, so an override that breaks a connection the instanced or inherited scene brings, such as one adding a second component that declares the same event, fails at the override:
func TestScenesCheck(t *testing.T) {
report, err := assetcheck.CheckWith(os.DirFS("."), assetcheck.Options{Components: Components})
if err != nil {
t.Fatal(err)
}
for _, p := range report.Problems {
t.Error(p)
}
}
scenes/level.scene.yaml:12: sceneformat: connection 0 ("lever" held -> "west/door" open): no registered component of object "lever" declares event "held" (it has: button.pressed)
A fault that a scene brings unchanged from a scene it instances or inherits is reported on that file, and one that its overrides cause on the override, so each fault is reported once. Problems carry the line, not the column.
Inspector (#865)
The inspector sets up an object without editing YAML. Every edit it makes is one undoable step, and each has a method on Editor that does the same in Go; while Play is on, the methods return ErrPlaying and the controls are disabled. An edit the editor refuses is reported in the status bar.
- Sprite: the Sprite field picks an atlas frame from those the asset browser lists (
Assets), grouped by atlas and searchable, and its clear button unbinds it; the button beside it takes the frame selected in the asset browser.SetObjectSprite(id, ref)needs both an atlas and a frame, and with a resolver set the atlas must resolve and hold the frame; a nilrefunbinds the sprite. - Origin and flip:
originXandoriginY, the pivot inside the sprite's frame, are set withSetObjectOrigin(id, x, y), which refuses values that are not finite, andflipXandflipYwithSetObjectFlip(id, flipX, flipY). - Material: the Material field picks one of the open project's
*.material.yamlfiles and its clear button names none;SetObjectMaterial(id, path)takes a slash-separated path from the project root, or an empty one. A material must load through the editor's resolver, which therefore has to implementsceneformat.MaterialResolver(asresource.Librarydoes), since the scene could not be built otherwise; with any other resolver the field lists no files and stays enabled only to clear a material the object already names. - Model (#893): in 3D the inspector shows a MODEL summary card (
ObjectModelSummary3D: offscreen thumbnail, project-relative path, triangle count, and distinct material count) above the searchable Model field (ProjectModels: the project's.gltfand.glbfiles and the outputs ofgame.yaml's model targets) whose clear button names none, a MATERIAL summary (ObjectMaterialSummary3D: material file name with roughness and metallic readouts), a COLLIDER summary (ObjectColliderSummary3D: e.g.Convex hull · static), a CHILDREN summary card (ObjectChildrenSummary3D) when inspecting a group, and Ask to add a component… (OpenComponentAgentPrompt).SetObjectModel(id, path)refuses a model that does not load and a model on an object that draws a built-in primitive, as the Mesh field is disabled on an object that draws a model; changing the model clearsmodelNodeandmodelMesh, which named parts of the old one, and naming one raises a version 1 scene to version 2, the first that has models, and leaves a later one as it is. Undo puts back all three fields and the version. - Properties: Add Property takes a key and a kind (
string,int,floatorbool) and adds the property holding that kind's zero value (AddProperty(id, key, kind)); the field trims the key, and an empty key, one with leading or trailing whitespace or one the object has, is refused. A whole-number float property is saved with a decimal point (2.0), so it opens again as a float. Each property's delete button removes it (DeleteProperty). - Components: the Add Component field filters the registered types the object lacks, and pressing one adds it holding every registered field at its default, so the file shows what the component does (
AddComponent(id, name)). Enter adds the type the field names, or the one type it matches. A component the object already has, a name the registry does not know, and a name with leading or trailing whitespace or a.(which connections use incomponent.event) are refused; without a registry the field adds a component of any name with no fields. Adding a component is refused, too, when it would declare an event or handler that a connection names bare and another of the object's components declares as well, since the connection would no longer say which it means: write it ascomponent.eventfirst. In a scene that instances or inherits others, the check runs on the scene as resolved through the editor's resolver, the connections of the scenes it refers to included; it is skipped when the resolver cannot load scene files or the scene does not resolve and bind even without the new component. Each component's remove button removes it (RemoveComponent(id, name)) with every connection that needs it, from the object with an event the component declares or to the object with a handler it declares, named bare or ascomponent.name; a bare name is attributed through the component's registered type, so without a registry, or for a type the registry does not know, only connections written ascomponent.nameare removed.ComponentConnections(id, name)lists them, and Undo puts the component and its connections back where they were. A component without a registered type keeps its fields editable from the values in the file; having no schema, a whole-number float in one of its fields is saved as2and opens again as an int. - Connections (#872): the Connections section lists the events declared by the selected object's registered components (
ObjectEvents) and every outgoing and incoming connection touching it (ObjectConnections). Pressing Connect opens an inline form to pick an event, choose a target object from the searchable object list (SceneObjectIDs) or pick it directly from the 2D/3D viewport or scene tree (BeginConnectionPick/CancelConnectionPickwithout losing the current selection), pick one of the target's registered handlers (ObjectHandlers), fill the handler's params with typed controls from the component registry, and toggleonce. Each connection row lets you jump to its other end (JumpToConnectionOtherEnd), edit it (UpdateConnection), or remove it (RemoveConnection). Adding, editing and removing connections (AddConnection,UpdateConnection,RemoveConnection) are undoable commands checked withsceneformat.Validateandsceneformat.ValidateConnectionsbefore reachingHistory: an invalid connection (such as naming a handler the target lacks, a duplicate connection, or a wrong param type or out-of-range value) is refused with the reason shown in the status bar, leaving the scene and undo history unchanged. Without a component registry, existing connections remain visible, jumpable, editable and removable. - Scene settings (#871, #884): when no object, room, layer, or asset file is selected (
ShowingSceneSettings), the inspector displays the open scene's own settings instead of an empty state: scenename(SetSceneName),virtualWidthandvirtualHeight(SetVirtualSize),backgroundColorvia NSGo's color picker (ui.ColorWell) and CSS hex input with a clear button (SetBackground), and the default 2Dcamera(SetCamera,SetCameraPosition,SetCameraZoom,SetCameraRotation) with toggleable clampbounds(SetCameraBounds,ClearCameraBounds). Each change is validated againstsceneformat.Validatebefore touching the document or history—refusing non-positive virtual sizes, zoom, or bounds and invalid color strings in the status bar—updates the viewport live, saves and reloads unchanged, and participates in Undo/Redo. While scene settings are shown in 2D edit mode, the viewport highlights the camera's start view frame and dashed bounds, draws a draggable camera position handle (CameraHandleCanvasPos,HitTestCameraHandle,BeginCameraDrag,UpdateCameraDrag,EndCameraDrag,CancelCameraDrag), and draws 8 corner/edge resize handles oncamera.bounds(CameraBoundsHandleCanvasPos,HitTestCameraBoundsHandle,BeginCameraBoundsDrag,UpdateCameraBoundsDrag,EndCameraBoundsDrag,CancelCameraBoundsDrag) so dragging a handle resizescamera.bounds(and dragging the border or empty interior moves it) live, cancels on Escape, and commits as a single undoable step. - Room maps (
*.rooms.yaml, #884): open an existing*.rooms.yamlfile beside the scene from the file browser (OpenRoomsProjectFile,OpenRoomsFile,OpenRoomsYAML) or create one from the Scene Settings inspector (NewRoomMap). All rooms draw over the 2D scene viewport with their IDs, display names, transition tags, and 8 resize handles on the selected room. Create rooms by toggling Draw Room (SetRoomCreateMode) and dragging in the viewport or pressing Add Room (AddRoom,AddRoomAtViewCenter); select, move, and resize rooms with handles (HitTestRoom,HitTestRoomHandle,BeginRoomDrag,UpdateRoomDrag,EndRoomDrag,CancelRoomDrag) and delete them with the Delete button or Delete/Backspace key (DeleteRoom). When Grid Snap is enabled (default on,SetRoomSnapToGrid), room edges snap to the scene's tile grid (RoomGridSize, from the scene's inline or external tilemap or an explicitSetRoomGridSize). Selecting a room opens the Room Inspector to edit itsid(SetRoomID),name(SetRoomName), bounds (SetRoomRect), and per-roomtransition(SetRoomTransition: inherit,cut,slide, orfadewith duration, easing, and fade color), as well as the map-level default transition (SetRoomMapTransition). All room edits go throughEditor.History, participate inHasUnsavedChangesandSave, and save deterministically viarooms.Encode(SaveRooms,SaveRoomsFile,SaveRoomsYAML) so files load withrooms.Parseand round-trip unchanged. - Layer inspector (#885, #877): when a layer is selected with no object selected (for example after pressing a layer's row in the scene tree, choosing Inspect Layer in the layers panel context menu, pressing Set Up Tilemap in an empty tile palette, or calling
SetActiveLayer), the inspector shows that layer's parallax factors (Parallax X,Parallax Y), tiling settings (RepeatX/Y,Repeat W,Repeat H), and Tilemap setup. In Go,SetLayerParallax(layer, x, y)andSetLayerRepeat(layer, repeatX, repeatY, width, height)edit parallax and repeat, andAddLayerTilemap(layer, tileset, tileW, tileH, w, h),SetLayerTilemapTileset(layer, tileset),SetLayerTilemapTileSize(layer, tileW, tileH),ResizeLayerTilemap(layer, left, right, top, bottom),ExtractLayerTilemap(layer, refName),InlineLayerTilemap(layer), andRemoveLayerTilemap(layer)set up and edit the layer's tilemap—all undoable throughHistory. Growing or shrinking from the left or top edge shifts painted cells and updatesoffsetX/offsetYso every painted tile keeps its world position (raising version 1 or 2 scenes to version 3 when a non-zero offset is written, restored by Undo). Invalid sizes and tilesets missing frames for painted tile IDs are refused with a status message. Moving a tilemap into top-leveltilemapscreates aref, and moving it back inline removes the top-level entry once no other layer orlayerOverridesreferences it. Parallax and repeat controls are disabled on screen-space layers; inherited base-owned layers disable all layer inspector edits.
Projects
The editor also opens a game's project file: OpenProject reads game.yaml and opens its main scene, EditProject changes it as an undoable step, and SaveProject writes it with the nsgo.yaml beside it in step. nsgo game editor <dir> opens a project directory. With ProjectAssets set, as the editor commands of package editorcmd set it, opening a project makes Resolver a project.Resolver over the project's directory: the scene draws the project's own sprite atlases, found by name nearest the open scene as game check finds them, the asset browser lists them, PlaceScene instances the project's scene files, and materials, physics materials, YAML tilesets and Tiled and LDtk maps load from the project, the tilesets and maps through its ReadFile as FSAssets reads them. An atlas a scene names is found nearest the file that names it, so a scene file instanced or inherited from another directory draws the atlas game check finds for it. The editor reads the atlases and material files again whenever it makes a change that may add, remove or rewrite them, such as installing or removing a pack, moving files, ReloadAssets or RefreshSearch; saving a scene keeps what it has read. OpenProjectScene(path, scene) opens the project with the scene file scene in place of its main scene, which nsgo game editor does for a scene file inside a project's directory, so ScenePath names it and an instance of it in itself is refused as a cycle. MoveFile(from, to) moves a file or directory of the project and rewrites every reference to it, on disk and in the open scene and project, as nsgo game mv does (Stable references), as one step that Undo takes back and Redo makes again. Undo puts each file the move rewrote back byte for byte, unless it changed since, in which case only its references are rewritten back.
While a project is open, the file browser below the asset browser (FilesView) lists its files and directories (ProjectFiles), leaving out the directories that game index and game mv skip too: those whose names start with . or _ and those named testdata. Pressing one selects it and puts its path in the field below the list; edit the path and press Move to rename or move it through MoveFile, press Open Table on a .yaml/.yml file to open it in the Data Table editor (OpenDataTableProjectFile), or press Find Refs to list every reference to it across the project (ShowReferences). Refresh lists the files again and rescans the project search and references index (RefreshSearch) after something outside the editor changed them.
Data Table editor (#918)
The Data Table panel (DataTablePanelView) opens versioned YAML data tables (tooling/datatable) from the file browser as a spreadsheet-style grid below the viewport:
- Columns and kinds: columns are the union of every row's keys in deterministic first-appearance order (plus any fields declared by a registered Go row type that no row currently sets). Each column's value kind (
string,number,bool,duration, orlist) is inferred from its cell values or taken from the registered Go row type; boolean cells render as toggle buttons and scalar/list cells commit on Enter or blur. - Row operations and view controls: add (
AddDataTableRow), delete (DeleteDataTableRow), and reorder (MoveDataTableRow) rows, sort by clicking any column header (SetDataTableSort), and filter visible rows by case-insensitive substring match (SetDataTableFilter). Sorting and filtering affect only the view and never reorder or modify the underlying YAML document. - Undo and lossless round-trip: opening, closing, adding, deleting, reordering, and editing cells all go through the editor's shared
History. Opening and saving a table without edits leaves the file byte-for-byte identical, and editing a single cell changes only that line while preserving comments, formatting, and each row's key order. - Go row-type validation and panel states: a game's own editor command can bind Go struct row types to slash-separated path or filename patterns with
editor.RegisterDataTableType[T](ed, pattern)(orEditor.RegisterDataTableRowType). Matching tables are checked on open and on every cell or row edit with the exact same rulesdatatable.LoadYAMLapplies, refusing unknown columns, duplicate fields, and invalid cell values in the grid and showing the*datatable.CellErrorin the dismissible panel banner (DataTableError/ClearDataTableError) and status bar. Asynchronous table loaders can also toggle the loading card withDataTableLoading/SetDataTableLoading.
if err := editor.RegisterDataTableType[Enemy](ed, "data/enemies/*.yaml"); err != nil {
log.Fatal(err)
}
Reviewing an agent's data table changes (#1033)
When an agent proposes changes to one or more data table files (through Editor.OpenDataTableReview or the datatable_review_propose MCP tool), the editor opens a full-window row-by-row Data Table review (DataTableReviewView) using exclusively the editor's design spec tokens:
- Turn files and empty tables: the left sidebar lists every data table touched in the turn (
27 of 40 changed,new · 0 records); selecting a newly created empty file shows"No records — ask the agent to add some". - Filter chips, search, and sorting: switch between All, Changed, Unchanged, Reverted, and Yours chips with live counts (
SetDataTableReviewFilter), search across all fields (SetDataTableReviewSearch), and click any column header (CycleDataTableReviewSort) to cycle ascending, descending, and back to file order (reportingaria-sortviaDataTableReviewAriaSort). Numeric columns with changes show aΔheader and sort by percentage delta without mutating file order. - Old → new cells, in-place edits, and drag-to-reorder: changed cells render in the Spec
changeddashed pill showing struck-through old value→new value andΔ%, while numeric zeros render as—(FormatReviewCellValue). Each changed record has its own Revert / Restore button (ToggleDataTableReviewRecord). Clicking a cell value edits it in place (StartDataTableReviewCellEdit,SetDataTableReviewCellText,StepDataTableReviewCellNumber) and dragging a row's grip handle reorders it (ReorderDataTableReviewRecord); both join the review under Yours with a solid accent border and ayoutag in the right-hand YAML diff pane (DataTableReviewFocusedYAML). - Agent's check figures: the agent attaches named figures (
DataTableReviewCheck: label, value, optional value before the request, and basis) viaSetDataTableReviewChecksor thedatatable_review_checksMCP tool. Any person revert, restore, in-place edit, or row reorder marks those figures Out of date (DataTableReviewChecksOutOfDate) until the agent refreshes them. - Pause, lossless Keep, and single-step Undo: pressing
Escor Editor pauses the review (PauseDataTableReview), keeping autosave paused (HasOpenReview) and showing a"Review paused"toast with Resume plus a pending review card in the Agent panel (ResumeDataTableReview). Keep N of M (KeepDataTableReview,⌘↵) starts from the original parseddatatable.Documentbytes and patches only the kept and edited lines so untouched and reverted lines stay byte-for-byte identical, committing every file in one atomic Undo step (Undorestores all files byte for byte and removes newly created files). Revert all (RevertAllDataTableReview,⌘⌫) closes the review cleanly without modifying disk and stays undoable with⌘Z.
2D viewport navigation (#864)
The 2D viewport's canvas fills its panel and shows the scene through the editor's own view (View2D: the world point at the canvas's center, a zoom and a rotation), separate from the scene's camera, so a level larger than one screen can be seen and edited anywhere. The view is never saved to the scene nor recorded in the undo history.
- A mouse wheel, a pinch, or a touchpad scroll with Control or Command held zooms about the pointer, keeping the world point under it fixed (
ZoomView2DAt), betweenMinView2DZoomandMaxView2DZoom. - A touchpad's two-finger scroll, a mouse wheel's sideways scroll (Shift+wheel or a tilting wheel), a middle-button drag, a drag with Space held or a two-finger drag on a touch screen pans (
PanView2D). - F, or the Frame Selection button, frames the selected object (
FrameSelection2D, which frames everything when nothing is selected); Home, or Frame All, frames every object of the visible layers, their inline tilemaps and the camera's frame (FrameAll2D); Mod+0, or Scene Camera View, returns to the scene camera's view (ResetView2D).
Until the author pans or zooms, and again after ResetView2D or opening another scene, the view is the scene camera's view: the virtual screen centered in the canvas at the camera's zoom and rotation, following the camera as the scene changes (View2DFollowsCamera). In edit mode the whole canvas takes the scene's backgroundColor, so objects far from the camera are seen against the game's clear color; it outlines the camera's frame, the virtual screen as the player sees it, and draws the camera's bounds dashed. Screen-space layers draw inside that frame. In Play mode only the frame shows, centered at the camera's view whatever view the author left, as in the game; the view does not pan or zoom until Stop brings the author's view back.
Hit testing, placing, moving, tile painting, the selection outline and plugin tools all go through the view, applying each world-space layer's parallax offset (and previewing its repeat tiling) smoothly as the 2D view pans. CanvasToWorld and WorldToCanvas convert between canvas points and the world; CanvasToScreen and ScreenToCanvas between canvas points and the scene's virtual screen, where screen-space layers live; ScreenToWorld and WorldToScreen apply the scene's camera alone, as the game does. CanvasSize is the canvas's laid-out size, the scene's virtual size until the viewport lays out (SetCanvasSize); the 3D viewport fills the same canvas.
2D transform gizmo (#863)
With the Select or Move tool, the 2D viewport edits an object's transform by dragging, as Godot's and Unity's 2D transform tools do:
- A drag on any object selects it and moves it, keeping the offset from where it was grabbed, so the object does not jump to the pointer.
- The selected object carries a gizmo drawn at a fixed size on the canvas: a square at its origin moves it freely; a red and a green arrow move it along its own X and Y axes, which turn with its rotation; a ring around it turns it about its origin; and, once its outline is at least 24 points on a side on the canvas (zoom in on a small object), handles on its corners and edges scale it about its origin, the edges one axis and the corners both. A handle that sits on or next to the origin's line along an axis it scales is left out, as the top and left handles of a sprite whose origin is its top left corner are, and where the move square and a handle overlap, the square is taken. Holding Shift while scaling keeps the aspect ratio. Dragging a scale handle through the origin mirrors the object with a negative scale.
- Each drag is one undoable step, recorded when it ends ("Move hero", "Rotate hero", "Scale hero"); Undo restores the object's fields exactly, an unset
scaleXorscaleYstaying unset, and an edge handle leaves the other axis's field alone. A drag that ends where it began records nothing. - Escape, a gesture the system cancels or a second finger coming down puts the object back as it was before the drag and records nothing; the rest of that gesture does nothing. Undo, Redo, Play, Save, Delete, Duplicate, or changing the tool or the view mode during a drag cancels it first.
- A scale that would be zero or nearly so (below 0.001), or a scale or rotation that would shear a sprite in the object's tree, its ancestors included (a rotated child under a non-uniformly scaled parent, which
ScaleObjectandRotateObjectrefuse too), is not taken: the object keeps its last valid transform and the status bar says why. - A nested child carries the gizmo too and is dragged in its parent's space, so it follows the pointer under a turned or scaled parent. An object hidden or locked in the scene tree, or under one that is, has no gizmo and is not dragged, even while it is selected.
Drags map through the object's layer: a world-space layer's objects move by the world distance the pointer travels, whatever the 2D view's or the scene camera's zoom and rotation, and a screen-space layer's by the distance on the virtual screen. A tap still selects, and with the Move tool still puts the selected object where it is pressed. A drag with Space held, or a middle-button drag, pans the view instead.
In Go, BeginDrag2D(x, y) starts a drag at a canvas point and returns the handle it took (GizmoHandle2D), UpdateDrag2D(x, y, keepAspect) follows the pointer, and EndDrag2D or CancelDrag2D finishes it; PickGizmo2D names the handle under a canvas point, Dragging2D the one held, and Gizmo2DShown says whether the gizmo is drawn.
2D component shape handles (#882)
In 2D edit mode, the viewport draws every registered shape field (FieldPoint, FieldRect, FieldCircle and FieldPolygon) of the selected object in its local space (accounting for parent transforms, rotation, scale, layer space and parallax). Toggling Shapes in the 2D view toolbar (SetShowAllShapes, CmdToggleAllShapes, Editor.ShowAllShapes) draws shape fields of all visible objects in the scene at once, keeping the selected object highlighted on top.
With the Select or Move tool, interactive handles appear on the selected object's shape fields:
- Point: drag the handle to move
(x, y). - Rectangle: drag any of the 4 corner or 4 edge handles to resize (dragging past the opposite edge flips smoothly while keeping
width >= 0andheight >= 0), or drag the center handle when it does not overlap the object's origin move square. - Circle: drag any of the 4 cardinal rim handles to change
radius(clamped>= 0), or drag the center handle when offset from the object's origin. - Polygon: drag any vertex handle to move it; click or drag an edge midpoint handle to insert a new vertex (
AddPolygonVertex); right-click or Alt+click a vertex handle to remove it (RemovePolygonVertex, keeping at least 3 vertices). - Grid snapping: toggle Snap in the 2D view toolbar (
SetSnapToGrid,CmdToggleSnapGrid,Editor.SnapToGrid) or configure snapping in the Snap popover (view-snap-settings) to snap handle edits and inserted vertices toEffectiveGridStep(or whole points when pixel snapping is enabled; holdingCtrl/Cmdinverts snapping during a drag).
Every drag, vertex addition, and vertex removal commits through SetComponentField as one undoable step, and Escape, a cancelled gesture, a second finger, Undo/Redo, Play, Save or switching tools cancels an in-progress drag and restores the pre-drag field unchanged. In Go, VisibleShapes2D, ShapeHandles2D, PickShapeHandle2D, BeginShapeDrag2D, UpdateShapeDrag2D, EndShapeDrag2D, CancelShapeDrag2D, DraggingShape2D, ActiveShapeHandle2D, AddPolygonVertex, RemovePolygonVertex and HandleCanvasSecondaryPress expose the same workflow, and the inspector displays editable controls for every shape field kind.
Snapping and 2D grid overlay (#869)
The editor provides unified snapping across object placement, dragging, 2D handles (transform gizmo, component shapes, 2D lights/occluders, and 2D navigation regions), and 3D gizmos (translate, rotate, and scale):
- Snap settings in the toolbar: toggle grid snapping directly with the magnet button (
view-snap-grid,SetSnapToGrid,CmdToggleSnapGrid) or open the compact Snap Settings popover (view-snap-settingsin 2D,view3d-snap-settingsin 3D) to switch each mode independently:- Grid snap (
SnapToGrid,SetSnapToGrid): snaps positions toEffectiveGridStep(), which defaults to the active layer's tilemap tile size (supporting non-square tiles) whenGridSizeis0, falling back to8when the active layer has no tilemap. Setting an explicit step (SetGridSize) overrides the tile size until Auto (ResetGridSize) is pressed. - Pixel snap (
SnapToPixel,SetSnapToPixel,CmdToggleSnapPixel): snaps positions to whole points (1-unit increments) when grid snap is off. - Rotation snap (
SnapRotation,SetSnapRotation,CmdToggleSnapRotation): snaps 2D and 3D rotation drags to multiples ofRotationSnapDegdegrees in radians (SetRotationSnapDeg, default15°). - Scale snap (
SnapScale,SetSnapScale,CmdToggleSnapScale): snaps 2D and 3D scale drags to multiples ofScaleSnapStep(SetScaleSnapStep, default0.25) without collapsing scales to zero. - Modifier inversion: holding
CtrlorCmdduring a drag or placement press temporarily inverts snapping—disabling active snapping for free precision edits, or enabling snapping when it is off (SetSnapInvert).
- Grid snap (
- Optional 2D grid overlay (
ShowGrid,SetShowGrid,CmdToggleShowGrid): draws a hairline grid across the visible 2D canvas at the active snap step even outside tile tools, followingView2Dpan, zoom, rotation, and active-layer space/parallax, doubling drawn spacing automatically when zoomed far out so the grid never obscures the canvas. - Multi-object selection moves as a whole: select multiple objects with
SelectObjects,ToggleSelectObject, or Shift-click in 2DToolSelect(SelectedIDs). Dragging any selected object (or using the Move tool or 3D Translate gizmo) snaps the primary anchor and moves every other non-descendant selected object by the exact same snapped delta, preserving relative offsets and recording one undoable step (Escape cancels and restores all objects). - Per-project preferences: snap settings (
SnapSettings,SetSnapSettings) are editor preferences saved per project in.game/editor.yaml(ViewStateFile), never written to scene files and never marking a scene dirty. Switching scenes within the same project keeps the project's snap settings; switching projects saves and restores each project's own preferences.
3D viewport (#890)
In 3D the viewport shows the scene as the game draws it: a gpu.View fills the panel and draws the scene's 3D build with render3d, and the canvas over it draws the ground grid, the origin axes, the selection outline and the gizmo. The build is scenemodel.Build's (Scene3D): every object's built-in primitive (mesh) or glTF model (model, modelNode, modelMesh) with its materials and textures, the objects that instanced scenes add included. Models, material files and images load through the editor's Resolver when it implements scenemodel.ModelResolver, sceneformat.MaterialResolver or scenemodel.ImageResolver, and from the open project's files otherwise. When the scene does not build, such as when a model it names does not load, a line in the viewport's corner says why (Viewport3DError) and every object keeps a box.
- Lights and sky: when a version 4 scene defines lights or an
environment, the viewport renders the scene's own lights, shadows, sky (solid color, gradient, or HDR cubemap viascenemodel.HDRResolver), ambient/IBL, fog, tonemapping, and exposure throughscenemodel.Renderer(PrepareScene,RecordShadows,DrawSky,ClearColor), matching the game's render path pixel for pixel. When a scene defines neither lights nor an environment, the viewport falls back toDefaultLights3Dunder a gradient sky. An editor built on this package can still override lighting withSetLights3D(Editor.Lights3D), which draws overbackgroundColor. - Shading: the toolbar's 3D Shading group,
View > 3D Shadingand the commandsview.shading.lit,view.shading.unlitandview.shading.wireframeswitchShading3D(SetShading3D): Lit, Unlit (each surface's textured base color plus its emissive color, without lights), and Wireframe, which lights the geometry and draws the edges of its triangles over it. Shading is a view setting: it is not undoable and is not saved. - Picking and nested children (#894): every nested object up to 64 levels deep—including children added by instanced and inherited scenes—draws at its composed world transform (
ObjectLocalTransform3Dcomposed up the parent chain, matchingBuildNodes3Didentically) across meshes, wireframes, light/camera/probe icons, physics debug wireframes, occluders, and component gizmos. A press selects the deepest hit object under the pointer: an object that draws a mesh or model is hit on its triangles throughscene3dpicking, while an object without geometry is hit on its world-space box only where no geometry is hit (with a hit descendant winning over its enclosing ancestor). Pressing a second time on an already-selected nested child steps selection up to its parent—and through to the owning scene instance root—before cycling back to the deepest child; holdingAlt/Optionwhile clicking (Select3DAtWithModifiers,HandleViewport3DPressWithModifiers,HandleCanvasPressWithModifiers) directly selects the owning scene instance root for an instanced child or the immediate parent for a locally nested child (and composes withShiftto add andModto toggle). Hidden and locked objects (with their descendants) are passed over. - Parent-space gizmo editing and instance overrides (#894): when a nested child is selected, the 3D transform gizmo (
Translate,Rotate,Scale, single- or multi-selection) draws at the child's composed world position and orientation; dragging moves or turns the child under the pointer in world space while inverting the parent chain to write the child's local transform in parent space. Dragging an object that comes from an instanced scene or base scene writes an override entry under the owning instance'soverrides(orSceneDoc.Overridesfor inherited scenes) without touching the source scene file, round-trips through YAML, and commits as one undoable step. - Live edits: the build is made again only when what the scene looks like changes (an object's look, its place in the tree, an instanced scene or an override, or the project's files). A gizmo drag, an undo of a move, the open animation clip's pose at the playhead and a playing game's changes move the built nodes in place, so a drag rebuilds and uploads no mesh.
ObjectCorners3DandObjectAABB3Dgive an object's box as the bounds of its geometry when it has any, and Frame Selection (f) frames those bounds, so a model a meter across fills the view. - Without a GPU: on a target where the GPU view is not supported, before its first frame and after a device loss, the canvas draws the whole wireframe view instead: the scene's background, the grid, a box around every object (its geometry's bounds when it has any) and the gizmo.
Viewport3DOnGPUreports which one shows.
OrbitCamera3D.SceneCamera turns the editor's orbit camera into the scene3d.Camera the GPU view draws through, with the same eye, projection and clip planes the canvas projects with, so the overlays line up with the geometry.
Navigating the 3D view (#891)
Navigating moves only the editor's camera (Camera3D, an OrbitCamera3D): it is never an edit, never goes into the undo history and never changes the scene file. The camera jumps where it is told without animating.
| Do | With a mouse | With a touchpad or touch screen | With the keyboard or a button |
|---|---|---|---|
| Orbit about the target | Drag | Drag with one finger | The Orbit 15° left and right buttons under the axis widget |
| Pan | Middle-button drag, or Shift+drag | Two-finger scroll, or a two-finger drag on a touch screen | |
| Zoom toward the target | Wheel | Pinch, or scroll with Control or Command held | |
| Fly | Hold the right button: move the pointer to look, W, A, S, D to move, Q and E down and up, Shift to go faster, the wheel to change the speed | ||
| Focus the selection | f or the bottom bar's Focus F button, framing its bounds, or the whole scene with nothing selected |
||
| Axis views | Click an axis button (X, Y, Z or negative ends) on the orientation widget in the top right corner |
1 Front, ctrl+1 Back, 3 Right, ctrl+3 Left, 7 Top, ctrl+7 Bottom, or Tab/Enter on the orientation widget |
|
| Perspective or orthographic | 5, or Persp and Ortho in the top-left viewport bar |
||
| Shading mode | The top-left viewport bar's Shading menu (Lit, Unlit, Wireframe) |
||
| Transform space (Local / Global) | t, Local / Global in the bottom bar, or command gizmo.3d.space |
||
| Back to the default view | The top-left viewport bar's Reset view button |
- The viewport HUD and status bar follow the editor's design spec tokens: the top-left bar pairs Persp/Ortho, the Shading menu (
Lit,Unlit,Wireframe), the current view name (ViewName3D: an axis view name orPerspective, with· orthoin orthographic andUser · orthowhen orbited off-axis), Reset view, and Camera/Env toggles, with the keycap help line (Drag orbit · Middle pan · Right WASD fly · F focus) directly underneath. The top-right circular orientation widget exposes clickable, keyboard-focusable buttons for all six axis ends above the Orbit 15° left and right buttons. The bottom bar holds theLocal/Globaltransform space toggle (GizmoSpace3D,SetGizmoSpace3D), Snap settings popover, andFocus Fbutton. The status bar adds the view's yaw and pitch in degrees (· yaw N° · pitch M°) and the active gizmo space (· Localor· Global). - Orthographic (
SetOrthographic3D,OrbitCamera3D.Orthographic) projects in parallel. The view isOrthoHeighthigh, the height the perspective view shows at the target, so switching keeps what lies there the same size, and zooming changes that height.Project,ScreenRay,SceneCamera, picking and the gizmo work the same in both: in orthographic every pixel's ray runs along the view, so a press picks what lies under it and a gizmo drag moves the object by the distance the pointer travels along the axis. An axis view in orthographic is a true plan or elevation. - Flying (
BeginFly3D,FlyLook3D,FlyMove3D,EndFly3D) turns the camera about its eye and moves eye and target together. While it flies, W, A, S, D, Q and E, with or without Shift, move the camera instead of running their usual shortcuts (the gizmo's W and E, Erase Tile's E), and the pointer is locked to the viewport where the platform can lock it. A flight looks in perspective, so an orthographic view switches to perspective; a right-click that neither turns nor moves the camera leaves it orthographic. Its speed,FlySpeed3Din world units a second, starts at the camera's distance from its target and the wheel doubles or halves it (AdjustFlySpeed3D). - Axis views (
SetView3D, the commandsview.3d.front,view.3d.back,view.3d.right,view.3d.left,view.3d.topandview.3d.bottom, andview.3d.orthographicfor the projection) keep the target and the distance. Front looks along -Z, Right along -X and Top straight down with -Z at the top of the view. - Saved per scene: each scene of a project opens at the camera it was left at. The editor writes the views to
.game/editor.yamlin the project (ViewStateFile, described on File Formats) as another scene opens, as the scene is saved and as the window closes, and an app that ends the editor another way callsSaveViewState. A scene it has no view of opens atDefaultOrbitCamera3D. Creating the.gamefolder, the editor writes a.gitignorethere that ignores the folder, so the views stay out of version control. A file a newer editor wrote, with a higherversion, is neither read nor written over.
3D transform gizmos (#892)
The 3D viewport's transform gizmo reuses render3d.Gizmo for drawing, picking, and constrained drags in Global (world) or Local space:
- Modes and shortcuts: press
w(Translate,Gizmo3DTranslate),e(Rotate,Gizmo3DRotate), andr(Scale,Gizmo3DScale) in the 3D viewport (ScopeViewport3D, without clashing with 2D tile tools'e), or choose them in the 3D toolbar orView > 3D Gizmo. - Global / Local space toggle: toggle
Editor.GizmoSpace3D(GizmoSpaceGlobal/GizmoSpaceLocal) via the 3D bottom bar's Local / Global toggle (view3d-space-local/view3d-space-global), shortcutt(CmdGizmoSpace3D),View > 3D Gizmo > 3D Gizmo: Local / Global Space, orSetGizmoSpace3D/ToggleGizmoSpace3D. In Local mode, handles orient to the selected object's Gram-Schmidt orthonormalized world orientation—including its ancestors for nested children (GizmoOrientation3D). - Exact rotation about the drawn axis: dragging any rotation ring (X, Y, or Z) composes the drag around the exact world-space axis the drawn ring represents and converts the child-local result (
RParentᵀ · RDeltaWorld · RWorldStart) back to scene Euler XYZ (Rz·Ry·Rx), so even on an object already rotated about multiple axes or nested under a rotated or scaled parent, every ring turns strictly about the axis drawn. - Plane handles, screen-space center handle, and uniform scale: Translate exposes
Axis3DXY,Axis3DXZ, andAxis3DYZplanar squares (moving strictly within the active two-axis plane, with grazing-ray guards) and a centerAxis3DAllhandle (translating in the camera view plane). Scale exposes a centerAxis3DAllcube that scales all three axes proportionally. - Snapping and live drag delta: 3D translate, rotate, and scale drags share the editor's snap settings (
SnapSettings,EffectiveGridSize,EffectiveRotationSnapDeg,EffectiveScaleSnapStep) and temporaryCtrl/Cmdmodifier inversion (SetSnapInvert). While dragging, the status bar displays the live delta (GizmoDragDelta3D:dx/dy/dz, degrees°, or scale factorx) alongside the active space (Global/Local), and every completed drag commits as one undo step that round-trips cleanly through scene YAML (Escapecancels and restores the pre-drag transform).
Placing models in 3D (#893)
The asset browser lists, under its atlases, the models to place in 3D (Models): the built-in primitives, then the open project's glTF models by path, the outputs of game assets model targets included before they are built (ModelEntry.Output). Each has a thumbnail rendered offscreen (ModelThumbnail): the model alone, framed from above and in front and lit by DefaultLights3D, drawn through scenemodel on NSGo's software GPU. Each model loads on the UI goroutine the first time its thumbnail is drawn, as everything the editor's Resolver serves loads, and apart from the scene's own cache of models; the rendering runs off the UI goroutine, so the list shows at once and the pictures follow. A model that does not load gets none.
- Place tool: pressing a model selects it (
SelectModel,SelectedModel) and, in 3D, turns on the Place tool, which the 3D toolbar shows beside Select. In 3D a press then adds an object drawing the model, named after it, where the pointer's ray hits the scene's geometry, or where it crosses the ground plane, the horizontal plane atPlaceHeight3D, when it hits none (PlacementAt3D,PlaceModelAt3D). The object rests on that point: it is raised along the surface's normal by how far its geometry reaches below its origin, so a unit box on the floor sits on it rather than half under it. Hidden and locked objects are passed over, as picking passes over them. - Snap and Align: the toolbar's Snap snaps the X and Z of a point on the ground plane to the spacing of the grid the viewport draws (
PlaceSnap3D); a point on the scene's geometry is not snapped, since the grid's spacing can be wider than the object under the pointer, Align turns a model placed on the scene's geometry so that its +Y axis follows the surface's normal (PlaceAlign3D), and the ground height field setsPlaceHeight3D. They are view settings, not edits (SetPlaceOptions3D). - Drag and drop: dragging a model from the asset browser onto the 3D viewport places it where it is dropped, through the Place tool's rules, whatever the active tool. A
.gltfor.glbfile dropped on the viewport from another app is placed when it lies inside the project's folder, outside the folders the asset browser leaves out (names starting with.or_, andtestdata) (DropModelFiles), several files as one step; a file outside the project, of another kind or from the web, which names no path, is refused with the reason in the status bar. A file drop carries no position, so dropped files land where the view's middle points. - Bottom MODELS strip: in 3D view (outside Assets drawer mode), a MODELS strip (
Viewport3DModelsStripView,StripModels) sits along the bottom of the 3D viewport ("drag in"), showing offscreen-rendered thumbnails of the project's models first followed by built-in primitives, each with the tooltip"Drag into the viewport to place <name>", click-to-select and drag-into-viewport placement, and a pinned Or ask for one button (OpenModelAgentPrompt) that opens an inline agent prompt ("Describe a model… e.g. a low stone planter, 1 × 0.5 m, same stone as the walls") dispatchingViewport3DAgentRequesttoEditor.OnAskAgent3D(SubmitViewport3DAgentPrompt). - One step: every placement is one undoable step, which Undo takes back and Redo makes again. It is refused while playing, on a locked active layer and on a screen-space one, and for a model that does not load; placing a model in a version 1 scene raises it to the current version, as
PlaceObjectdoes.
3D lights, environment and scene cameras (#895)
Version 4 scenes carry their own 3D lighting, environment, and 3D camera objects, edited directly in the 3D viewport and panels:
- Icons and picking: visible directional, point, and spot lights and 3D cameras draw crisp, color-tinted icons in the 3D viewport overlay instead of generic marker cubes; clicking an icon selects its object (
Pick3D). - Interactive undoable handles: selecting a light or 3D camera reveals wireframe guides and draggable handles (
Handle3DKind,HandlePosition3D,PickHandle3D,BeginHandleDrag3D,UpdateHandleDrag3D,EndHandleDrag3D,CancelHandleDrag3D):- Directional light: direction arrow and aim handle (
Handle3DLightDirection). - Point light: three orthogonal range circles and range radius handle (
Handle3DLightRange). - Spot light: aim handle (
Handle3DLightDirection), range distance handle (Handle3DLightRange), and separate outer (Handle3DLightOuterCone) and inner (Handle3DLightInnerCone) cone rim handles. - 3D camera: frustum wireframe with vertical FOV / orthographic height handle (
Handle3DCameraFOV) and far plane handle (Handle3DCameraFar). Every drag updates the live GPU viewport in place without rebuilding meshes and commits as one undoable step onEditor.History.
- Directional light: direction arrow and aim handle (
- Scene Environment panel (
EnvironmentPanelView): toggled from the 3D viewport bar's Env button,View > Scene Environment, orCmdEnvironmentPanel(EnvironmentPanelOpen/SetEnvironmentPanelOpen), editing sky (none,color,gradient,hdr), ambient color and intensity, IBL intensity, distance and height fog, tonemapping (none,reinhard,aces,neutral,agx), and exposure throughSetEnvironment(validated and undoable, upgrading scenes below version 4 to version 4 and restoring the prior version on Undo). - Inspector and creation helpers: in 3D view (or on any object with a light or 3D camera), the inspector exposes
LIGHT 3D(SetObjectLight) andCAMERA 3D(SetObjectCamera3D, switchingcurrentatomically across cameras in one undo step). In Go,AddLight3D(kind)andAddCamera3D(proj)place pre-configured lights and 3D cameras on the active world layer, andProjectHDRs()lists.hdr/.picskies in the open project. - Look Through Scene Camera: press
0, click Camera in the 3D viewport bar, or runCmdView3DCamera(SetLookThroughCamera3D/ToggleLookThroughCamera3D) to view the 3D viewport through the scene's active 3D camera (ActiveSceneCamera3D), matching the game's first frame pixel for pixel. Orbiting, panning, zooming, flying, or choosing an axis view exits camera preview cleanly.
Reflection probes and light probe grids (#903)
Version 4 scenes also support local 3D reflection probes (ObjectDoc.ReflectionProbe) and 3D light probe grids (ObjectDoc.LightProbeGrid) baked directly from the editor so runtime shading in scenemodel matches the editor 3D viewport pixel for pixel:
- Placement & inspector: place probes with
AddReflectionProbe3D/AddLightProbeGrid3D(or command paletteCmdAddReflectionProbe/CmdAddLightProbeGrid) and edit their local box bounds (center,size), blend distance, intensity, priority, box projection, cubemap resolution, grid counts, and baked file paths in the inspector (REFLECTION PROBEviaSetObjectReflectionProbe,LIGHT PROBE GRIDviaSetObjectLightProbeGrid) as undoable steps. - Viewport icons, wireframes, and 3D bounds handles: reflection probes draw a cyan chrome-sphere icon, outer influence wireframe box, and inner blend wireframe box; light probe grids draw an amber dot-grid icon, bounds wireframe box, and projected sample points. Selecting either exposes six draggable face-center bounds handles (
Handle3DProbeBoundsPosX..Handle3DProbeBoundsNegZ) that resize the box while anchoring the opposite face, commit as a single undoable step (EndHandleDrag3D), and cancel cleanly with Escape (CancelHandleDrag3D). - Baking: click Bake Cubemap / Bake Probes in the inspector, Bake Probes in the Scene Environment panel, or run
CmdBakeProbes3D(BakeReflectionProbe3D,BakeLightProbeGrid3D,BakeAllProbes3D). Reflection probes render the 3D scene from the probe origin and write a lossless 6×1 Radiance.hdrcubemap strip (render3d.EncodeCubemapHDR); light probe grids sample the scene at every grid point and write L2 spherical harmonic irradiance coefficients as deterministic versioned YAML (*.probes.yaml,render3d.EncodeLightProbeGrid, schemahttps://game.nsgo.dev/schemas/lightprobes.v1.json). Output paths are validated against traversal/symlinks/reserved filenames, written atomically, linked onto the probe undoably, and loaded byscenemodel.Buildandscenemodel.Rendererso game and editor shading match identically.
Tile palette (#874)
While the Paint, Erase, Fill, Pick or Terrain tool is active in 2D, the tile palette shows right of the viewport. It shows the tiles of the active layer's tileset as a grid in tile ID order, each at the tilemap's tile size (a tile wider than the panel is scaled down to fit it). The tiles are the tileset atlas's frames whose names are tile IDs ("1", "2", …), as the scene format looks tiles up; other frames are left out. Pressing a tile, or moving between tiles with the arrow keys, makes it the tile Paint and Fill write (SetActiveTileID); every arrow key steps through the tiles in ID order, Left and Up to the previous tile and Right and Down to the next, not by rows of the grid. The selected tile is ringed, and with Paint or Fill the status bar shows its ID. Choosing a tile is not an edit and does not go into the undo history; the paint that follows is one undoable step.
The palette follows the active layer: when it changes, the palette shows the new layer's tileset, and if that tileset has no tile with the selected ID, its first tile is selected. A layer with no inline tilemap (none, or an external Tiled or LDtk map), a tileset the resolver cannot resolve and a tileset without tile frames each show a message saying so instead of an empty grid. In Go, TilePalette() returns what the palette shows for the active layer: its tileset, tile size and tiles, or the message.
For an inline or layered grid naming a tilesetFile, the palette shows the tiles of its YAML tileset, read through the resolver's sceneformat.FileResolver (such as FSAssets), with IDs from 1 as PaintTile takes them: tile ID n paints the tileset's local tile n - 1. The palette's labels and the status bar name each tile by its local ID, the number the rows and the tileset's tiles[].id write (PaletteTile.Number), and a footer note reminds you that collision, terrain and variant rules live in the tileset file. Above the tiles, a toggle per tile layer (for layered grids) picks the one Paint, Erase, Fill and Terrain change (SetActiveTileLayer, ActiveTileLayer, the first by default), the H, V and D toggles set the flips Paint and Fill place tiles with (SetActiveTileFlip, ActiveTileFlip), the terrain toggles pick the terrain set Terrain paints (SetActiveTerrain, ActiveTerrain), and Edit Tileset opens the layer's *.tileset.yaml in the Tileset Editor. While a 2D tile tool is active on a YAML tileset layer with no object selected, the right-side Tile Inspector shows the picked tile's swatch, display name and source cell, a COLLISION toggle (Solid, One-way, None), its terrain/collision/variant-weight rules, and a button to open the full Tileset Editor. The edits write the layer's rows in the form Encode saves, one undoable step each, and Fill joins cells whose tile and flips both match.
Painting, erasing and picking tiles (#875)
With Paint or Erase, a drag with the mouse or one finger paints or erases every cell it crosses, however fast it moves, and the whole stroke is one undoable step, so one Undo takes back a row painted in one drag. A click or tap paints or erases its one cell. With Paint, a right-button drag erases. A stroke that starts off the map paints once it reaches it, a stroke that changes nothing records nothing, and a drag with Space held pans the view instead. A second finger cancels a one-finger stroke and puts its cells back, so a two-finger pan never paints.
While a tile tool is active, the cell under the mouse is outlined, snapped to the grid: with Paint and Fill it shows the selected tile faded in the cell, with Terrain it shows the autotiled tile faded in emerald, with Erase it is tinted red, and when a press would pick it is outlined in amber.
Picking takes the tile in a cell as the tile to paint, and the palette selects it: Alt+click (or Alt+drag) with any tile tool, or the Pick tool, which then hands over to Paint. An empty cell leaves the selected tile as it was. Picking is not an edit and does not go into the undo history.
In Go, BeginTileStroke(mode, x, y), ContinueTileStroke and EndTileStroke draw a stroke (TileStrokePaint, TileStrokeErase, TileStrokePick, TileStrokeTerrain or TileStrokeEraseTerrain) at canvas points, CancelTileStroke puts it back and TileStrokeActive reports one under way; painting and erasing refuse locked or hidden layers, and choosing a tool or layer, changing layers, switching views, saving, Undo, Redo and Play end a stroke under way first (while Revert cancels it). PickTile(layer, col, row) picks, SetTileHover and ClearTileHover move the outline and HoveredTile returns the cell it is on.
Terrain painting and tileset editor (#878, #879)
Inline and layered tilemaps backed by *.tileset.yaml share their tile flags, collision shapes, animations, custom data and autotiled terrain sets between the runtime (tilemap.ApplyTerrain, tilemap.SetTerrainTile, physics.MoveAndSlide, tileshape.New) and the editor:
- Terrain brush (
ToolTerrain, shortcutt): drags place terrain (TileStrokeTerrain) and right-button drags erase terrain (TileStrokeEraseTerrain), updating each touched cell and its surrounding neighbors with the exact same 4-bit cardinal (cardinal) and 8-bit corner-gated (blob) rules astilemap.Tilemap.SetAutotile. The entire stroke — both placed/erased cells and every updated neighbor — is recorded as one undoable step, so one Undo restores the stroke cleanly. In Go,PaintTerrain(layer, col, row, terrain)andEraseTerrain(layer, col, row, terrain)perform single-cell edits. - Tileset Editor (
TilesetEditorPanelView): open any*.tileset.yamlfrom the tile palette's Edit Tileset button (OpenActiveLayerTileset), the Tile Inspector, double-clicking or pressing Open / Edit Tileset in the file browser (OpenTilesetProjectFile), orOpenTilesetFile/OpenTilesetYAML. The left atlas grid previews every tile with badges for solid/one-way collision, custom shapes, animation, terrain masks and default tiles, while four tabs edit each tile:- Terrain: create or delete 4-bit (
cardinal) and 8-bit (blob) terrain sets (AddTilesetTerrain,RemoveTilesetTerrain,SetTilesetTerrainMode), set an explicit fallback default tile (SetTilesetTerrainDefault), and assign each tile's neighbor bitmask by clicking its center, edges (N,E,S,W) and — in 8-bitblobmode — corners (NW,NE,SW,SE) (ToggleTilesetEdgeOrCorner,ToggleTilesetTileCenter,SetTilesetTileMask). Corner clicks enforce corner-gating automatically (enabling a corner enables both adjacent edges; clearing an edge clears dependent corners). If an intermediate click matches a mask owned by another tile, the editor leaves that tile intact so you can keep clicking or press Reassign (ReassignTilesetEditMask). - Collision: toggle
Solid,One-way,None, or custom flag bits (SetTilesetTileCollision,SetTilesetTileFlags,ToggleTilesetTileFlagBit), and draw rectangular (rect) or multi-vertex (polygon) collision shapes directly over the magnified tile canvas (AddTilesetTileShape,UpdateTilesetTileShape,RemoveTilesetTileShape,AddTilesetDraftPolygonPoint,CommitTilesetDraftPolygon). - Animation: build and reorder per-tile animation frames with durations (
AddTilesetTileAnimFrame,UpdateTilesetTileAnimFrame,RemoveTilesetTileAnimFrame,SetTilesetTileAnimation) alongside a live playing/pausable frame preview (SetTilesetAnimPlaying,TilesetAnimPreviewTile). Animated tiles advance live in the 2D editor viewport as well as in Play mode and the game (StepTileAnimations). - Data: edit each tile's display
name, variantweight, and typed custom properties (bool,int,float,string) (SetTilesetTileName,SetTilesetTileWeight,SetTilesetTileProperty,DeleteTilesetTileProperty). - Every tileset edit goes through the editor's
History(undoable/redoable), takes effect immediately in the viewport, Play mode and Terrain brush before saving, and saves back as canonical YAML (SaveTileset,SaveTilesetYAML). Agents can read and edit the same fields atomically via the editor MCP toolstileset_readandtileset_edit(MCP).
- Terrain: create or delete 4-bit (
3D GridMap painting (#899)
In 3D view (ViewMode3D), the editor opens and paints modular 3D *.gridmap.yaml files directly on an editable floor grid:
- Opening and attaching: set an object's
gridMapfield in the inspector (SetObjectGridMap) or open a*.gridmap.yamlfile (OpenGridMap,OpenGridMapFS,OpenGridMapDoc,NewGridMap). Switching to a GridMap tool in the 3D toolbar (Paint, Erase, Pick, or Box) automatically opens the selected object'sgridMapwhen none is open yet, andMoveFiletracks the open GridMap's path andmeshLibraryreference. - Palette with 3D thumbnails: while a GridMap tool is active in 3D view,
GridMapPaletteView(GridMapPalette()) appears right of the viewport, rendering an isometric shaded 3D thumbnail for every tile in the glTFmeshLibraryalongside controls for the active floor height and 24-orientation index. - Floor height and 24 orientations: press
]/PageUpand[/PageDown(SetGridMapFloor,StepGridMapFloor) to move the active horizontal painting plane up or down by one cell. PressX,Y,Z(withShiftfor reverse) orQ/Shift+Q(RotateGridMapOrientation,StepGridMapOrientation,SetGridMapOrientation) to rotate the active tile through all 24 axis-aligned cube orientations (world3d.RotateGridOrientation). - Painting, erasing, picking and box fill: hovering in the 3D viewport projects the pointer ray onto the active floor (
ScreenToGridMapCell) and draws a live hovered cell preview (and a dashed rectangular preview while dragging Box fill). Clicking or dragging paints or erases every cell crossed as a single undoable stroke (BeginGridMapStroke,ContinueGridMapStroke,EndGridMapStroke,CancelGridMapStroke,Escapecancels), Pick (or Alt+click) adopts the tile and orientation under the pointer, and Box drags out a filled rectangle on the active floor (FillGridMapBox). - Undo and canonical save: every paint stroke, erase stroke, box fill, and cell rotation (
PaintGridMapCell,EraseGridMapCell,FillGridMapBox,RotateGridMapCell) goes through the editor's sharedHistory(Undo/Redo).Save(SaveGridMap,SaveGridMapFile) writes canonical deterministic.gridmap.yamlviaworld3d.GridMap.ToDocandworld3d.EncodeGridMap, so saved files round-trip byte-for-byte and instance identically inscenemodel.Build.
Rectangle, line, stamp and random tile brushes (#876)
Four additional tile brushes extend inline and layered tilemap painting, each showing a live preview in the 2D viewport before release, cancelling cleanly on Escape (or a second touch) without mutating the scene, and committing every changed cell as one undoable step in Editor.History:
- Rectangle (
ToolRectTile, shortcutu): drag between two cells to fill the rectangle withActiveTileID(TileStrokeRect,FillTileRect), or right-drag to erase the dragged rectangle (TileStrokeRectErase,EraseTileRect). - Line (
ToolLineTile, shortcutl): drag between two cells to draw a Bresenham line ofActiveTileID(TileStrokeLine,DrawTileLine), or right-drag to erase along the line (TileStrokeLineErase,EraseTileLine). - Stamp and region clipboard (
ToolStampTile, shortcutc): paint a rectangularTileStamppattern anchored to the click or pattern-aligned across a drag (TileStrokeStamp,StampTiles), preserving per-cell flip bits on layered tilemaps and empty (0) cells from copied regions. Build a stamp either by selecting a rectangle of tiles in the tile palette (SelectPaletteStamp,SelectPaletteStampRange, or clicking an anchor tile and pressing Rect or holding Shift before clicking the opposite corner) or by right-dragging a map region (TileStrokeSelectRegion,SetTileSelection) and using Copy (mod+c,CopyTileRegion,CopySelectedTileRegion), Cut (mod+x,CutTileRegion,CutSelectedTileRegion, one undo step) and Paste (mod+v,PasteTileRegion). - Random (
ToolRandomTile, shortcutn): paint a deterministic weighted pick from multiple tiles (SetRandomBrushTiles,SetRandomBrushTileWeight,ToggleRandomBrushTile) controlled by a fixed seed (SetRandomBrushSeed,RandomBrushSeed). In the tile palette, clicking tiles toggles them in the weighted pool with per-tile-/+weight controls and a Seed field; right-drag erases.
In Go, TilePreview() inspects the live preview cells of an in-progress brush stroke before EndTileStroke, TileStamp / TileClipboard / TileSelection manage patterns and regions, and all four brushes work identically on single-grid and layered YAML tilemaps while keeping deterministic YAML round-trip saves.
Agent tile tools and region-based tile edit review (#1064)
Coding agents connected to the editor's MCP server (MCP) can inspect and paint inline and layered tilemaps while the author reviews changes by connected region rather than individual cells:
- Query and paint tools:
tile_query(Editor.QueryTiles) finds matching cells or empty pockets by tile ID, YAML tilesettileName, or sub-rectangle (for example,"an 11 × 5 pocket at columns 2–12, rows 12–16").tile_paint(Editor.AgentPaintTiles) paints explicit cells, inclusive rectangles, or deterministic seeded weighted tile picks (with optionalnoAdjacentDuplicates).tile_autotile(Editor.AgentAutotile) re-edges or places a YAML tileset terrain set using the same 4-bitcardinal/ 8-bitblobrules asToolTerrain.tile_erase(Editor.AgentEraseTiles) clears cells or rectangles. Each call applies as one undoable edit and joins the active tile review by default (review: true). - Region-based review (
TileReviewPanelView): pending agent changes are grouped into connected regions by kind — painted (+, green dashed outline), replaced (~, amber dashed outline), and erased (−, red solid outline) — each showing its cell count, bounding rect, and human-readable detail (such as"from 4 cave tiles"). Clicking a region focuses it in the 2D viewport; each region can be independently toggled between Revert and Restore (SetTileReviewRegionReverted,ToggleTileReviewRegion). Before / After and holdB(SetTileReviewViewMode,SetTileReviewPeekBefore,TileReviewHandleKeyEvent) preview the pre-review tilemap live. Keep N of M (KeepTileReview) commits all kept regions cleanly as one undoableHistorystep (so one Undo restores the exact pre-review tilemap), and Revert all (RevertAllTileReview) restores the original tilemap immediately. Agents and tests can also drive reviews viatile_review_status,tile_review_revert_region,tile_review_restore_region,tile_review_keep, andtile_review_revert_all. - Palette & viewport caption: while a tile layer is selected in 2D, the viewport shows a top-left layer dimension caption (
ActiveTileLayerCaption, e.g.,World · 24 × 20 cells · 16 px), and the tile palette displaysTILESET <file>with a selected-tile readout showing the picked tile's swatch, name, atlas cell coordinates, collision rule, and terrain set.
Scene tree (#861)
The scene tree panel (SceneTreeView), at the left of the editor, lists the open scene's layers and, under each, its objects with their children nested, as Godot's Scene dock and Unity's Hierarchy do. It follows every edit and every undo. Pressing an object's row selects it, and selecting an object in either viewport selects its row and opens the rows above it; pressing a layer's row makes it the active layer. Every object edit works on a nested child as on a top-level object: FindObject and SelectObject find an object by ID anywhere in the tree, the inspector edits the selected child, and its transform is edited in its parent's space, so the Move tool puts its origin under the press and the 3D gizmo moves it along the world axis.
- Moving in the tree: drag a row onto another to make it that object's last child, or near the top or bottom edge of the row to put it before or after it; drop it on a layer's row to move it to the top level of that layer. A row's context menu moves it up or down among its siblings, makes it a child of the sibling above, moves it out of its parent, or moves it to another layer. In Go,
ReparentObject(id, parentID, index),MoveObjectToLayer(id, layer, index),ReorderObject(id, index)andDropObject(id, targetID, place)do the same, each as one undoable step; an index below 0 or past the end puts the object last. - World transform: a moved object keeps its world transform. Its local transform is computed again under its new parent in 2D (
x,y,rotation,scaleX,scaleY), and Undo puts every field back exactly; a flipped object keeps its negative scale on the axis it had. When the object or one of its old or new ancestors sets a 3D field, its depth (posZ,scaleZ) is kept too. When one of them sets a 3D rotation (rotX,rotY,rotZ), the 2D and 3D views no longer agree on wherexandylead, and only the 3D world transform is kept: the object stays in place in the 3D viewport, and may move in the 2D one. The move is refused when it would put an object under itself or one of its descendants, nest deeper thanMaxObjectDepth, or leave a transform that cannot be written as a translation, rotation and scale under the new parent, as a sprite under a turned parent stretched along one axis would be. A move between a world and a screen layer keeps the numbers, not where the object appears on screen. - Rename: F2, a double press or the context menu's Rename edits the selected object's name in its row; Return or leaving the field keeps it, and Escape drops it. Change ID edits its ID through
SetObjectID(oldID, newID), which rewrites the scene's connections that name the object, and the objects of a scene it instances (enemy_1/bodybecomesboss/body), in the same step, as well as the open animation clip's target and the targets of its tracks, and refuses an ID the scene already uses, including one an instanced or inherited scene adds. Another scene file that instances or inherits this one and overrides the object by its old ID is not rewritten; move such references withgame mvor edit them by hand. - Eye and lock: the eye button of a row hides the object, and with it its descendants, in both viewports, and the lock button stops a press in either viewport from picking it, so the press reaches what lies under it (
SetObjectHidden,SetObjectLocked). Neither viewport moves a hidden or locked object: its 3D gizmo is not shown and the Move tool leaves it where it is. Both belong to the editing session: they are not edits, Undo does not touch them, they are never written to the scene file, Play draws every object, and opening another scene clears them. A hidden or locked object can still be selected from the tree and edited in the inspector.
The 3D viewport draws and picks every object, nested children included: Objects3D lists them depth first, each with its parent's ID, and a child's geometry and box are placed by its ancestors' transforms (3D viewport).
Object context menu (#1039)
Secondary-clicking or Control-clicking an object in the 2D viewport, the 3D viewport, or a Scene Tree row—or pressing Shift+F10 or the Context Menu key (contextmenu) on the active selection—opens a unified ui.ContextMenu headered with the object's display name and kind/layer subtitle (for example, Sprite · layer actors). Right-dragging in the 3D viewport still flies the camera, right-dragging with 2D tile tools still erases or selects a tile region, and right-clicking a polygon collider vertex still removes that vertex; actions whose feature does not apply to the target object or session are omitted rather than shown disabled.
- Copy as YAML (
mod+c) and Paste (mod+v):CopyObjectYAML/CopySelectedYAML(ObjectYAML) encodes the object as a canonicalsceneformatYAML document onto the clipboard (core.Scope.SetClipboardorEditor.WriteClipboard) thatsceneformat.Parseround-trips back to the exact same object, and shows a floating viewport toast (Copied <name> as YAML · N lines).Paste/PasteObjectYAMLpastes from the clipboard onto the active layer with a fresh unique ID in one undo step. - Duplicate (
mod+d) and Group (mod+g):DuplicateObjectsclones the selected object(s), andGroupObjects/GroupSelectedwraps them under a new parent object in one undo step while preserving world transforms. - Move under: the submenu (
MoveUnderCandidates,MoveObjectUnder) lists valid candidate parent objects—excluding the object itself, its descendants, and moves that would exceedMaxObjectDepth—annotated with current parent, locked state, child count, or layer, and reparents in one undo step so a single Undo puts the object back. - Select same prefab: when the object sets
prefaborscene,SelectSamePrefabselects every object in the scene sharing that reference (SelectedIDs,SelectObjects,IsObjectSelected). - Hide / Show (
h), Lock / Unlock, Find usages (shift+f12), Rename (f2), and Ask the agent (mod+l): toggle session visibility (ToggleObjectHidden) and lock (ToggleObjectLocked), find usages in the open project (FindObjectUsages/ShowObjectUsages, opening the Find Usages review screen for scene/prefab-path targets or Search for plain IDs, omitted without an open project), start inline renaming in the Scene Tree (RequestRenameObject), or send anAgentPromptRequestdraft toEditor.OnAskAgent(AskAgentAboutObject). Context menus read live custom shortcuts (EffectiveShortcut), expose scene-instance and inherited-object override actions (Open Instanced Scene,Make Local,Apply Overrides to Source,Open Source Scene,Revert Overrides) while guarding local-only structural edits on foreign objects, and retain Scene Tree order, Cut, Paste as Child, Ungroup, Change ID, Move to Layer, and Delete actions. - MCP parity (
pkg/editor/editormcp): every context menu action calls an exportedEditormethod that the editor MCP server exposes (object_copy_yaml,object_paste_yaml,object_duplicate,object_group,object_move_under,object_select_same_prefab,object_visibility, andobject_find_usages, alongsidescene_editandselection_get'sselectedIds).
Multi-object selection and batch editing (#867)
The editor tracks an ordered selection set with Editor.SelectedID as the primary object (SelectedIDs, SelectionCount, IsSelected, SelectedObjects, SelectObjectsWithPrimary, AddToSelection, RemoveFromSelection, ToggleSelection, ClearSelection):
- Viewport selection and marquee: In 2D and 3D,
Shift+click adds an object to the selection andMod(Cmd/Ctrl)+click toggles membership (HandleCanvasPressWith,HandleViewport3DPressWith). In 2D with Select, dragging on empty canvas draws a marquee box (BeginMarquee2DWith,UpdateMarquee2D,EndMarquee2D,CancelMarquee2D,SelectMarquee2D) that selects enclosed objects by default, or touching objects whenAltis held (MarqueeEnclose,MarqueeTouch);Shiftadds andModtoggles marquee matches.Escapecancels an active drag or marquee first, and clears selection at rest. - Scene tree synchronization:
SceneTreeViewfollows and drives the same multi-selection set withShift+click andMod+click, expanding ancestors of selected objects. - Common-center transforms, Delete and Duplicate: Move, rotate, and scale gizmos in both 2D and 3D act on the whole selection about its combined bounding-box center (filtering out descendants whose ancestor is also selected so children never double-transform), and
DeleteSelected/DuplicateSelectedact on the whole selection; each operation records one undo step viaHistory.Group.FrameSelectionframes all selected objects together. - Shared-field inspector: When multiple objects are selected,
InspectorViewshows"N selected"and only the sections shared by every selected object (Transform, Sprite when all have sprites, shared Properties and shared Components). Differing values display as"Mixed"(or indeterminate for checkboxes), and editing any field writes every selected object in one undo step (EditSelected,SetSelectedComponentField,SetSelectedProperty,SetSelectedX, …) so a single Undo restores each object's own prior value.
Copy, paste, duplicate and group objects (#868)
The scene tree supports multi-object selection (SelectObjects, SelectedIDs, ToggleSelectObject, IsObjectSelected), and object clipboard, duplication, and grouping actions live in the Edit menu, Scene Tree context menu, Command Palette, and keyboard shortcuts:
- Copy (
mod+c,CopyObjects,CopySelected) and Cut (mod+x,CutObjects,CutSelected): serialize the selected object(s) — including nested children, components, properties,overrides, and every connection whose endpoints both belong to the copied subtrees — as canonicalsceneformatYAML onto the system clipboard (core.Scope.SetClipboard, or the injectableEditor.WriteClipboardhook), so they paste into another scene or a text editor. Cut removes the originals and their connections in one undoable step. When a 2D tile region selection is active under a tile tool,mod+candmod+xcontinue to copy or cut the tile region instead. - Paste (
mod+v,Paste,PasteWith,PasteYAML,PasteYAMLWith) and Paste as Child (mod+shift+v,PasteInto): parse scene-format YAML from the system clipboard (core.Scope.ReadClipboard/Editor.ReadClipboard) and place the objects onActiveLayer(or underParentID) at the hovered viewport pointer (SetViewportPointer2D/SetViewportPointer3D) or offset next to originals when IDs are already taken in the scene. Original IDs are kept when unused in the target scene and allocated fresh unique IDs when taken, rewriting internal connections and scene overrides (including instanced"enemy_1/body"paths) to the new IDs and clearing duplicatecurrentflags on pasted 3D cameras. Every paste runsPlaceObject's checks (sceneformat.Validate,ValidateComponents,ValidateConnections,ValidatePhysicsLayers, andResolvefor instanced scenes) and commits as one undo step; unparseable or invalid YAML is refused in the status bar without modifying the scene or history. - Duplicate (
mod+d,DuplicateObject,DuplicateObjects,DuplicateSelected,DuplicateSelectedObjects): clones the selected object(s) next to the originals on the same layer and parent in one undo step, allocating unique IDs and rewriting internal connections and overrides to the copies without overwriting the system clipboard. - Group (
mod+g,GroupObjects,GroupSelected) and Ungroup (mod+shift+g,UngroupObject,UngroupSelected): Group wraps the selection under a new empty parent placed at their common 2D/3D world centre without moving any object on screen (converting child local transforms viakeepWorldTransform), in one undo step. Ungroup lifts direct children out into the parent's slot while preserving their world transforms in one undo step, removing an empty unconnected group container automatically while keeping non-empty parents intact.
3D navigation mesh baking (#901)
In 3D view mode, the editor can bake a Recast-style 3D navigation mesh directly from the open scene's static geometry (navbake3d) and preview it over the 3D viewport:
- NavMesh bake panel (
NavMeshPanelView, toggled by the 3D toolbar's NavMesh button, View > 3D NavMesh Bake..., orCmdNavMeshPanel/SetNavMeshPanelOpen): configures the agent name, radius, height, step height (MaxClimb), maximum walkable slope (MaxSlope), voxel cell size (CellSize), cell height (CellHeight), and output.navmesh.yamlpath (NavMeshBakeConfig/SetNavMeshBakeConfig). When a project with anavigationsection is opened, the panel seeds its defaults fromgame.yaml. - Baking and scene link (Bake button,
CmdBakeNavMesh3D, orBakeNavMesh3D): collects static 3D geometry from the open scene's glTF models (includingmodelNodeandmodelMesh), built-inmeshprimitives, static non-triggercollider3dshapes (skipping dynamic/kinematicbody3dobjects, triggers, and screen-space layers), plus any extra terrain heightmaps,GridMaps, or physics colliders supplied byEditor.OnBakeNavMesh3DGeometry. Writes a deterministic, byte-identical.navmesh.yamlatomically, updatesSceneDoc.NavMeshas one undoable step (SetSceneNavMesh, also editable in the Scene Settings inspector), and loads the baked mesh for immediate viewport preview. Reopening a scene whosenavMeshfile exists on disk automatically loads it (LoadNavMesh3D). - 3D viewport overlay (Nav Overlay toolbar toggle, Overlay panel switch, View > Show 3D NavMesh,
CmdNavMeshOverlay, orShowNavMesh3D/SetShowNavMesh3D): draws translucent cyan walkable polygons, detail edges, and crisp polygon boundary outlines over the 3D scene viewport throughCamera3D.
Scene tabs, scene files and unsaved changes (#866, #873)
The editor keeps each open scene in its own tab in the tab bar above the viewport (SceneTabsView), so an author can edit an instanced or base scene beside the level that uses it without losing undo history:
- Per-tab state: each tab (
Tabs,ActiveTab,TabCount,SelectTab,SelectTabByID) keeps its ownSceneDoc,BuiltScene,History, selection (SelectedID), active layer and tile selection, 2D and 3D view transforms (View2D,Camera3D), scene-tree visibility/lock session flags,OnSavecallback, and dirty marker (TabDirty). Switching tabs never clears any tab's undo history; undoing in one tab never changes another. - Opening and deduplicating tabs: opening a scene from the file browser (a
*.scene.yamlor*.scene.ymlfile, or one listed underautoload.scenes), the Problems panel, the Search and References panel, the Command Palette,NewScene,OpenScene, orOpenFileopens a new tab (replacing an untouched initial untitled tab) or switches to the existing tab when that scene is already open. Open Instanced Scene (OpenInstancedScene, available in the inspector for an instancing object, the scene tree context menu, the File menu, and the Command Palette) and Open Base Scene (OpenBaseScene, available in the Scene Settings inspector for an inheriting scene, the File menu, and the Command Palette) open the referenced scene in a tab or switch to it when already open. - Live instance and inheritance updates on save: saving a scene (
Save,SaveFile,SaveSceneAs,SaveTab,SaveAll) rebuilds every other open tab that instances or inherits scenes (BuiltSceneandScene3D), so instances and inherited objects show the change immediately without reopening those tabs.MoveFilerewrites paths and references across every open tab. - Shared project, plugins, Play, and closing tabs: the project file (
game.yaml), plugins, and Play mode stay shared across tabs, with plugins and Play acting on the active tab (tab switching and closing are disabled while Play runs). Closing a clean tab (CloseTab,RequestCloseTab,CmdCloseTab/mod+w, or the tab's close button) closes it immediately; closing a dirty tab prompts to Save (saving only that tab and rebuilding dependent tabs), Discard (discarding only that tab while keeping shared project edits intact), or Cancel. Closing the last remaining tab replaces it with a clean untitled scene.
The toolbar's File menu holds New Scene, which writes a minimal valid scene (named after its file, as large as the project's display or window, with one world layer) to a path from the project's root (NewScene), Save As, which saves the active scene under another path and makes that file the tab's (SaveSceneAs), Revert, which puts back the active scene as its file holds it (RevertScene), Open Instanced Scene, Open Base Scene, and Close Tab. A path without a .yaml or .yml extension gets .scene.yaml (one ending in .scene gets .yaml), the name game check and game index find scenes by. Neither New Scene nor Save As overwrites another file or writes a scene under the project's own file names, game.yaml and nsgo.yaml. Revert is one undoable step, so Undo brings the reverted edits back.
SceneDirty reports whether the active scene differs from what it was opened from or last saved to, comparing encodings as ProjectDirty does for game.yaml and ClipDirty does for the open animation clip, so undoing back to the saved state makes the scene, project or clip clean again; TabDirty checks a specific tab and AnySceneDirty reports whether any open tab is dirty. A MoveFile that rewrites an open scene's file leaves it as clean or dirty as it was; one that rewrites references in an open scene but not in its file, as for a scene game mv does not read (no .scene.yaml name and nothing names it), leaves the scene dirty so that saving it keeps the new paths. Each dirty tab displays a * marker, the toolbar shows the active scene's path (SceneLabel) and a * while any open tab, the project, open clip or another auxiliary document has unsaved edits (HasUnsavedChanges), and the window title follows (WindowTitle). EditorView owns the window title, so an editor built on the package, such as a game's own, names itself with Editor.AppName rather than setting the title, and the title ends with that name ("NSGo Scene Editor" while it is empty). The Save button, File > Save in the menu bar, the Command Palette's Save and Mod+S (Save, the CmdSave command) save what was edited in the active scene and the shared project; an unedited file is left as written, comments included. Switching projects (RequestOpenProject), quitting the editor, and closing its window ask first while any open tab, the project or open clip has unsaved edits: Save saves all dirty tabs and the project (SaveAll) and goes on, Discard drops them and goes on, and Cancel keeps them and stays. Discarding the project's edits puts back what follows from the project, as undoing them does: an audition through an audio bus the edits added stops, for example. A forced quit, as at logout, cannot wait for an answer and does not ask.
Reloading files changed on disk and save conflict guard (#906)
While a UI scope is attached, the editor watches the open scene (FilePath), the open animation clip (ClipPath), game.yaml (ProjectPath) and the project directory tree (DiskWatchInterval, default 250ms; PollDiskChanges performs an immediate check in Go):
- Clean files reload automatically: when an open scene, clip or
game.yamlchanges on disk without unsaved edits, the editor reloads it automatically as one undoableHistorystep (batching multi-file git branch switches such asSwitched branch · main → boss-room · 2 files), updates the saved snapshot so the file stays clean, and shows a dismissible reload notice (DiskReloadNotice) with object-level diff details (Show diff). - Dirty files never reload under the author: when an open file with unsaved edits changes on disk, the editor keeps the in-memory edits intact and shows an external-change conflict bar (
DiskConflicts,PrimaryDiskConflict) offering Reload from disk (ReloadFromDisk, keeping the author's edits inHistoryas"Unsaved edits before reload"), Keep mine (KeepLocalVersion, keeping the disk version inHistoryas"Changed outside the editor"and acknowledging the disk snapshot so a subsequent Save succeeds), and for scenes Compare (SetDiskCompareOpen,SetSceneConflictChoice,ApplySceneConflictMerge) to pick Mine or Disk per overlapping object while taking single-side changes automatically. - Save conflict guard:
Save,SaveFile,SaveProjectandSaveClipFilecompare the on-disk SHA-256 snapshot recorded at open or last save before writing and refuse to overwrite externally modified files withErrDiskConflict(*DiskConflictError). InEditorView, hitting a conflict opens a confirmation dialog (Cancel, Reload from disk, or Overwrite viaConfirmOverwriteSave/ForceSave). - Automatic file browser refresh: adding, removing or renaming files in the open project directory automatically updates the file browser (
FilesView) and invalidates the project index and Problems check without pressing Refresh.
Layers panel (#862)
The layers panel (LayersView), under the scene tree, lists the open scene's layers in draw order, the first drawn at the top, each with its space (world or screen) and its tilemap: the tileset and size of an inline grid (tiles 16x12), the name of the top-level tilemap it refers to, or the path of an external Tiled map. Pressing a layer's row makes it the active layer, which the Place tool and the tile tools work on, the tile palette shows and the status bar names, with hidden and locked after it when they apply; pressing a layer's row in the scene tree does the same. In Go, Layers() returns what the panel shows.
- Add and remove: the + button adds a world layer named
layer_Nthat draws over every other layer and makes it active (AddLayer(name, space), which takes the highest order of the layers the scene draws, those of a scene it inherits included, and puts the layer last in the file). The bin button removes the active layer (RemoveLayer(name)), with its objects and tilemap and with the scene's connections from or to its objects; Undo puts all of them back where they were, and the scene is saved byte for byte as before. When the active layer is removed, the layer that takes its place in the file, or the one before it, becomes active. - Rename: a double press or the context menu's Rename edits the name in the row; Return or leaving the field keeps it, and Escape drops it (
RenameLayer(oldName, newName)). An empty name and one another layer has are refused. The active layer and the layer's lock follow the new name. - Order: drag a row onto the top or bottom half of another to put the layer before or after it, or use the context menu's Move Layer Up and Move Layer Down (
MoveLayer(name, index), where index is the position in the draw order). The layer moves in the file next to the layer it is to draw after or before, and itsorderchanges only when the value it has would not draw it there, to that neighbour's value; the other layers keep their place and their orders. - Space: the context menu's World Space and Screen Space set the layer's
space(SetLayerSpace(name, space)); its objects keep their coordinates. - Visibility: the eye button hides or shows the layer by writing its
visiblefield (SetLayerVisible(name, visible)). Hiding writesvisible: false; showing leaves the field unset, its default, so hiding and showing a layer gives back the same file. This is the scene's own setting, which the game reads too, and an undoable edit. A hidden layer is not picked in either viewport, and its objects are not moved there even when they are selected (no 3D gizmo, no Move-tool drag), as for an object hidden in the scene tree. - Lock: the lock button locks the layer against the viewports for the session (
SetLayerLocked(name, locked)): a press passes over its objects to what lies under them, its objects are not moved there (no 3D gizmo, no Move-tool drag), and the Place, Paint, Erase and Fill tools change nothing while it is the active layer and say so in the status bar. Like the scene tree's object lock, it is not an edit, is not undone, is never written to the scene file, and opening another scene clears it; the panels and the inspector still edit the layer and its objects.
In a scene that inherits another (inherits), a layer named like one of the base's extends it: its name and draw order belong to the base scene, so renaming or moving it, renaming a layer to a base layer's name, and adding one with a base layer's name are refused, while hiding it, changing its space, or editing its parallax and repeat records undoable entries under layerOverrides (with per-field Revert and Revert All in the inspector and layer context menu), and removing it removes only the objects the scene adds to it. Other scene files that inherit the open one and name its layers are not rewritten by a rename. Every layer edit that would leave a scene that does not validate, or does not resolve with the scenes it instances or inherits, is refused before it reaches the history.
Animation editor
The editor's animation panel keys any registered property on a timeline and saves the clip as an animation resource file, played in the game by animclip (an AnimationPlayer equivalent). The panel shows below the viewport while a clip is open.
- Opening a clip: the toolbar's Animate button starts a new one-second clip on the selected object. In Go,
NewClip(target, name, length)does the same,NewClipFromAsepriteTag(target, tag)builds a clip matching an Aseprite tag's frames, exact durations and loop setting from the target object's atlas,NewClipFromFrames(target, name, frames, fps, loop)builds a flipbook clip from a run of atlas frames at a fixed frame rate,OpenClipFile(path, target)andOpenClipYAML(data, target)open a clip file, checked against the component registry (a misspelled property fails to open with the file name), andCloseClipcloses it. The panel's Flipbook row also lets you pick an Aseprite tag (From Tag) or a frame rate (From Frames) directly when the target object has a sprite atlas.nsgo game editor scene.yaml clip.animation.yaml [object-id]opens a scene and selects the objectobject-id(the scene's first object when it is left out), opens the clip on it when the file exists, and the panel's Save Clip button writes that file. - Keying: pick a property (an object field such as
x,alphaorsprite.frame, or a registered component field such asbody.speed) and press Key to key the value it has in the scene at the playhead;KeyProperty(target, property, at)does the same. Choosingsprite.framereveals a frame picker listing the target object's atlas frames (ClipTargetFrames) so you can key any frame directly (KeySpriteFrame(target, frame, at)). With another object selected, the key goes to a track that targets it. A track that names the clip's own object is the same track as one with an empty target, and a clip with two tracks driving the same property of one object is refused. A bool key holds its value until the next key, andsprite.framealways steps discretely without interpolation. - Editing keys: each track is a lane of its keys; a
sprite.frametrack displays each keyed frame as a thumbnail cell spanning its duration (ClipFrameEntry). Press a key to select it and move the playhead to it, then edit its time and value/interpolation (linear,smoothorstep) for numeric tracks, or its atlas frame (SetKeyFrame) and duration (-10ms/+10ms,FrameDuration,SetFrameDuration) forsprite.frametracks, or delete it;SetKeyValue,MoveKey,SetKeyInterp,DeleteKeyandRemoveClipTrackdo the same in Go. Values are checked against the property: 0 or 1 for a bool, a whole number for an int, inside the field's range, and a frame name present in the target's atlas forsprite.frame. - Clip settings and events: the panel edits the clip's name, length and loop (
SetClipName,SetClipLength,SetClipLoop), and adds named events at the playhead (AddClipEvent,DeleteClipEvent). - Scrubbing and preview: the scrubber moves the playhead (
SeekClip; at the end of a looping clip it shows the last keys) and Play plays the clip on agame.Loop(PlayClip,PauseClip, orStepClipto step it by hand). The viewport, in 2D and 3D, then shows a copy of the scene posed by the clip with the sameanimclip.PlayerandBindScenethe game uses, so the scene being edited never takes animated values and a clip plays the same in the game. A clip the scene cannot play, such as one whose track targets a deleted object, stays open andClipErrorsays why. Asynchronous clip loaders can toggle the panel's loading card withClipLoading/SetClipLoading. - Undo: every clip edit, opening and closing included, goes through the same undo/redo history as scene edits.
SaveClipYAML and SaveClipFile write deterministic YAML, so a clip that is opened and saved again does not change.
Sprite state machine graph (#1054)
Opening a *.states.yaml file (from the file browser, command palette, or OpenStatesFile / OpenStatesYAML / OpenStatesProjectFile) opens the State Machine graph panel below the viewport:
- Graph and active state: every state appears as a node card showing its name, clip metadata (frame count, frame duration, loop/once) and sprite thumbnail, with directed labelled transition edges and an
Any statewildcard badge. During preview, the active state node highlights live and the preview card renders the active clip frame. - Drive with keys: toggling Drive with keys binds the preview to the project's input actions (such as
move_left,move_right,jump,attack,hurt) through the sameanimclip.InputDriverandanimclip.StateMachinethe game uses, advancing on fixed steps ongame.Loopso interactive preview and runtime playback match frame for frame. - Outgoing transitions (
LEAVING <STATE>): selecting any state displays its outgoing transitions (includingAny stateinterrupts) and their conditions, and graph edits (AddStatesState,RemoveStatesState,AddStatesTransition,RemoveStatesTransition,SetStatesEntry,SetStatesNodePos,SetStatesDoc) go through the editor's undo/redo history and save back to deterministic canonical YAML (SaveStatesYAML/SaveStatesFile).
Editor plugins (#492, #898)
A plugin extends the scene editor with its own panels, an inspector for its own component types, 2D and 3D viewport tools, and per-component 3D gizmos, as Godot's EditorPlugin does. Go cannot load code at run time on every platform, so a plugin is Go code built into the editor binary: the binary registers it with Editor.RegisterPlugin, and a project turns it on by naming it in its project file:
editor:
plugins: [health]
A registered plugin the open project does not name stays off, and the order of editor.plugins is the order its panels and tools appear in. OpenProject names in the status bar the plugins the project lists that this binary was built without (MissingPlugins). nsgo game editor registers no plugins and no component types, so a game that has its own builds its own editor command. nsgo game generate editor writes one into a game's main package, built with the gameeditor tag in place of the game, that calls editorcmd.Main with the game's Components and its plugins, and nsgo game editor runs it on the project (Command Line). Package editorcmd is the command line both share: New(Options) builds an editor with the component types, plugins, name and library given and ProjectAssets set, checking scenes against the component types together with the built-in physics components (body2d, collider2d, trigger2d and their 3D forms) the registry does not register itself, Open(ed, args) opens a project, a scene or a clip as nsgo game editor does, and Main and Run parse the command line, open the project in the working directory without arguments and show the window, 1120 by 680 points unless Options.WindowWidth and Options.WindowHeight set another size. An editor command written by hand calls editorcmd.Main the same way:
// cmd/editor/main.go: the game's own editor command.
package main
func main() {
editorcmd.Main(editorcmd.Options{
Components: health.Components(),
Plugins: []editor.Plugin{healthplugin.Plugin()},
AppName: "Field Medic Editor",
RequirePlugins: true, // refuse a project that lists a plugin this command lacks
})
}
An editor.Plugin has a Name, which follows the rule of other names in game.yaml (no spaces or control characters), and lists of extensions:
- Panels (
Panel): a view docked left of the viewport (DockLeft, after the asset browser), right of the inspector (DockRight) or below the viewport (DockBottom), under itsTitle.View(cx, ed, rev)builds it once when it appears, and the panel stays mounted, with its state, while its plugin is on, however other panels come and go; it readsrevinside reactive functions, as the editor's own panels do, to follow every change to the editor's state. A dock without panels takes no space. - Inspectors (
Inspector): the inspector draws the componentComponentnames withView(cx, ed, rev, objectID)below the component's title, in place of its generic fields.Editor.ComponentFieldreads a field, with its registered default when the scene leaves it unset, and reports false for an object without the component. Like the generic fields, the inspector's controls should be disabled whilePlayingreports true, and an edit the editor refuses should go to the status bar withEditor.Report. When two plugins that are on draw the same component, the one listed first ineditor.pluginswins. - Tools (
PluginTool): a button in the 2D and/or 3D viewport tool bar depending on which hooks the tool implements. While it is the active tool (SetPluginTool;Toolis thenToolPlugin):- 2D hooks: a press on the 2D viewport calls
Press(ed, x, y)with canvas coordinates (CanvasToWorldconverts them to the world,CanvasToScreento a screen-space layer), drags callOnDragBegin(ed, x, y)(returningtrueto claim the drag),OnDragMove(ed, x, y),OnDragEnd(ed, x, y)andOnDragCancel(ed)(BeginPluginDrag2D,UpdatePluginDrag2D,EndPluginDrag2D,CancelPluginDrag2D,PluginDragging2D), pointer motion callsOnHover(ed, x, y, active)(SetPluginHover2D,ClearPluginHover2D), andDraw, when set, draws over the 2D scene in edit mode. - 3D hooks (#898): a press on the 3D viewport calls
Press3D(ed, ray)with the camera's world-spacemath3d.Ray(PickRay3D), drags callOnDragBegin3D(ed, ray)(returningtrueto claim the drag instead of orbiting the camera),OnDragMove3D(ed, ray),OnDragEnd3D(ed, ray)andOnDragCancel3D(ed)(BeginPluginDrag3D,UpdatePluginDrag3D,EndPluginDrag3D,CancelPluginDrag3D,PluginDragging3D), pointer motion callsOnHover3D(ed, ray, active)(SetPluginHover3D,ClearPluginHover3D), andDraw3D(ed, d, proj)draws over the 3D viewport usingProjection3D(Camera,Width,Height,ViewProj,Project,ProjectSegment,ScreenRay,GizmoLength,DrawPoint,DrawLine,DrawBox). - A tool must provide at least one of
Press,OnDragBegin,Press3D, orOnDragBegin3D. Tools with only 2D hooks appear only in the 2D tool bar and stay idle in 3D; tools with 3D hooks appear in the 3D tool bar and activate 3D view automatically when run from the Command Palette or menu bar. Choosing another tool, or turning the plugin off, ends it.
- 2D hooks: a press on the 2D viewport calls
- 3D Component Gizmos (
Gizmos3D []ComponentGizmo3D, #898): registers per-component-type 3D handles in object space (GizmoHandlePoint3D,GizmoHandleLine3D,GizmoHandleBox3D, optionallyDisplayOnly) returned byHandles(ed, objectID)and an interactiveDrag(ed, drag GizmoDrag3D) errorfunction. The editor transforms handles from object space through the object's full ancestor hierarchy, hit-tests them in screen space (PickComponentGizmo3D,BeginComponentGizmoDrag3D,UpdateComponentGizmoDrag3D,EndComponentGizmoDrag3D,CancelComponentGizmoDrag3D), and passesGizmoDrag3D(with world and object-space rays plusAxisDelta,PlanePoint,PlaneDelta, andViewPlaneDeltahelpers). Edits written insideDragthroughEditor(such asSetComponentFieldorEditor.History) preview live on every pointer move, roll back cleanly onEscapeor cancel without polluting history, and commit as one undo step when the drag ends. When two active plugins register a 3D gizmo for the same component, the first ineditor.pluginswins. The editor's built-in 3D transform gizmo (Translate,Rotate,Scale) and built-incollider3d/trigger3dhandles share this same 3D handle API.
A plugin changes the scene only through the editor's methods, such as SetComponentField, PlaceObject and MoveObject, or by executing its own Command on Editor.History, so every edit it makes is undone and redone with the rest. History.Group(label, fn) records the edits fn makes as one step that one Undo takes back, and when fn fails it undoes them and records nothing; the editor's MCP server (mcp) applies each agent request that way. RegisterPlugin refuses a plugin without a name or with a name already registered, a panel, inspector or tool missing its ID, title, label, component or function, an ID or component name with control characters, an unknown dock and two panels, inspectors or tools with the same ID or component. Test IDs join the plugin name and the ID with - (plugin-panel-<plugin>-<id>, tool-<plugin>-<id>, inspector-plugin-<plugin>-<component>), so plugins used together should have names and IDs that do not join to the same string.
SetPluginEnabled(name, on) adds a registered plugin to editor.plugins or removes it, as one undoable edit of the project that the toolbar's Save button writes; removing the last plugin removes the editor section when nothing else is left in it, including an editor: {} the author wrote, and Undo puts it back. RegisteredPlugins, ActivePlugins and PluginEnabled report which plugins the binary has and which are on.
Shipping an editor with plugins
A game ships its editor as one more command in its own module, beside the game, and runs it with go run ./cmd/editor from the project directory. Keep the plugin in a package of its own that only the editor command imports, so the shipped game does not link the editor, and the component types in a package that both import, so the game and the editor check scenes against the same fields:
| Package | Imports | Holds |
|---|---|---|
| the component package | sceneformat |
the component types (ComponentType), a registry for ParseWith and SetComponentRegistry, and helpers that read a component with its defaults (ComponentRegistry.Resolve) |
| the plugin package | editor and the component package |
Plugin(), returning the editor.Plugin |
the game (main) |
the component package | loads its scenes with sceneformat.ParseWith and the registry |
cmd/editor |
editor, the component and plugin packages |
registers the component types and the plugin, then opens the project |
game.yaml names the plugin under editor.plugins, so the plugin is on whenever the game's editor opens the project. An editor command that should not start without its plugins sets editorcmd.Options.RequirePlugins, or checks MissingPlugins after OpenProject and fails when it is not empty. nsgo game editor on a project with a cmd/editor main package runs that command with go run ./cmd/editor, as it runs the one game generate editor writes, and passes it the same command line, -library and a project, scene file, clip and object ID, so a cmd/editor should parse it with editorcmd.Main or editorcmd.Run. A cmd/editor that does not import editorcmd is not run: nsgo game editor says so and opens the project itself.
Field Medic (examples/fieldmedic) is a runnable game laid out this way. Its patients carry a health component (package health), and its cmd/editor registers the health plugin (package healthplugin): a Ward panel docked right of the inspector that lists every patient's hit points, with a Heal All button that heals them all in one undoable step it executes on Editor.History; an inspector for the health component with hit point and max fields and a bar of what is left; and an Admit tool that places a patient where the viewport is pressed and outlines every patient while it is active. Its tests open the game's own project in the editor and drive the panel, the inspector and the tool. The editor's own tests hold a smaller health plugin as well (pkg/editor/plugin_test.go).
Library panel (#493)
With Editor.Library set to a pack library (library.Open), as nsgo game editor -library <index> sets it, a panel beside the asset browser lists every pack in the library, with its kind, version, description and the version the open project has installed. Its Install, Update and Remove buttons call InstallPack and RemovePack, which write the pack's files beside game.yaml, record the pack and the autoload entries and plugins it adds in the project, and save the project; a registered plugin a plugin pack names turns on at once. They refuse while playing, without a project and while the project has unsaved edits (ErrProjectDirty), and they empty the undo history, since the files they write cannot be undone. A pack from a library over https is fetched off the event loop, with its button busy until it arrives (FetchingPack). The library format and what an install writes are in Asset and Plugin Library.
Unified Settings pages: Agent, Project, Input map, Audio buses, Export, General, and Shortcuts (#907, #908, #909, #916, #1028, #1060, #1061)
All per-computer agent controls, project-level game.yaml settings, and editor preferences share one unified Settings workspace (SettingsView, opened with OpenSettingsPage(page), inspected with SettingsOpen() / SettingsPage(), and closed with CloseSettings() / Escape) laid out from docs/design/editor/Settings.dc.html and Spec.dc.html using SpecPalette tokens in both Dark and Light appearances. The left sidebar groups AGENT (Models and connections, Tools, Usage and privacy — all per-computer and You only), PROJECT · game.yaml (Project, Input map, Audio buses, Export), and EDITOR · THIS COMPUTER (General, Shortcuts); each row displays its label, help text, value control, and agent-policy badge (Agent may change or You only), and every interactive control across all pages uses real focusable ui.Button / ui.* widgets reachable via Tab with visible focus rings.
Agent pages: Models and connections, Tools, and Usage and privacy (#1028, #1030)
Stored per computer in EditorSettings (editor.yaml under agent, never inside the project) with every mutator refused when invoked by an agent (ErrAgentSettingsYouOnly):
- Models and connections (
SettingsPageModels): shows connected local MCP agents (such as Claude Code), the built-in API connection (Anthropic API, whose key is stored exclusively in NSGo'score.SecretsunderAgentAPIKeySecretAccount/ the host OS keychain underAgentKeychainServiceNameviaStoreAgentAPIKey,HasAgentAPIKey,DeleteAgentAPIKey, andAgentAPIKey— never written toeditor.yaml, project files, or logs), + Connect another agent or model (openingConnectAgentDialogView), and WHO DOES WHAT task routing (AgentTaskRoute/SetAgentTaskRoute/ResolveAgentModelRoute). The sidebar meta reports the active connection count (AgentActiveConnectionCount, e.g.2 on). - Built-in agent runner (
SubmitAgentTaskPrompt,Editor.AgentTools,Editor.BuiltInAgentEndpoint): routes each task kind (AgentTaskSceneEdit,AgentTaskPlaytest,AgentTaskProblems,AgentTaskAskInPlace,AgentTaskArtSound) to either a connected local MCP agent or the built-in Anthropic Messages API runner (DefaultBuiltInModel/DefaultBuiltInFastModel), validating that custom endpoints usehttps://(or loopbackhttp://for local tests) and never forwardx-api-keyacross redirect hosts.editormcp.NewwiresEditor.AgentToolsautomatically so built-in tool calls execute through the sameeditormcp.Servertool toggles, permission rules,WithAgentActorYou-only guard, and symlink-aware outbound privacy enforcement as external MCP clients. - Weekly limit queueing & model error failover (
AgentStatusLimitReached,AgentQueuedRequests,AgentModelErrorState): reaching the person-only weekly request limit (WeeklyRequestLimit/SetWeeklyRequestLimit) transitions the Agent header chip toLimit reached · resets 00:00with a Usage link and queues subsequent requests (SendQueuedAgentRequest,RemoveQueuedAgentRequest) untilCheckAgentUsageResetcrosses the weekly reset or the person raises the limit. Transient model errors (429,5xx,529overloaded) retry onAgentModelRetryDelays(4 s, 8 s, 16 s, 32 s), rendering the model error card with Retry now (RetryAgentTurn) and Use<connected agent>(SwitchAgentTurnToAlternative) to update WHO DOES WHAT and run the request on another connected agent without double-counting usage. - Tools (
SettingsPageTools): lists every tool registered on the editor's MCP server (RegisteredMCPTools) with its monospace name, description, and an accessiblerole="switch"toggle (IsMCPToolEnabled/SetMCPToolEnabled), showing"enabled / total"in the sidebar (EnabledMCPToolCount).game_delete_fileis off by default; turning any tool off removes it from the MCP server's client tool list (tools/list_changed) and returns a readable refusal if called. Below the editor's tools, OTHER MCP SERVERS THE AGENT MAY USE starts with Running game · nsgo dev (nsgo-game/go tool nsgo mcp) and provides + Add a server (AddAgentMCPServer,SetAgentMCPServerEnabled,RemoveAgentMCPServer), syncing enabled servers into the open project's.mcp.jsonand.codex/config.toml(editormcp.InstallWithServers). - Usage and privacy (
SettingsPageUsage): displays This week requests against a user-configured weekly limit (WeeklyRequestLimit/SetWeeklyRequestLimit/RecordAgentRequest), Kept share of reviewed agent changes (RecordAgentReviewOutcome), and local Playtests run count (RecordPlaytestRun), followed by the four WHAT MAY LEAVE THIS COMPUTER switches (AgentPrivacy/SetAgentPrivacy): Scene and data files (on), Viewport images (on), Go source code (off), and Art and audio files (off). The editor's MCP server refuses, with the reason, any tool call or resource read whose result would carry switched-off content for every connected agent.
Project page (#907, #1060)
While a project is open, the toolbar's Settings button (ProjectSettingsOpen / SetProjectSettingsOpen, or OpenSettingsPage(SettingsPageProject)) opens the Project page in SettingsView (ProjectSettingsPanelView) to edit game.yaml exclusively through EditProject, so every change is validated by project.Validate, participates in Undo/Redo, and writes both game.yaml and the synced nsgo.yaml beside it on Save (SaveProject):
- General: edits
name,id,windowwidth/height,autoload.mainScene, andappVersiondirectly on the overview page (SetProjectName,SetProjectID,SetProjectWindowSize,SetProjectMainScene,SetProjectAppVersion). - Window: edits
window.title,width/height,minWidth/minHeight/maxWidth/maxHeightlimits,resizable, andappearance(SetProjectWindowTitle,SetProjectWindowSize,SetProjectWindowLimits,SetProjectWindowResizable,SetProjectWindowAppearance). - Display: toggles the optional
displaysection (SetProjectDisplayEnabled) and edits its virtualwidth/height,mode(fit,fill,stretch,expand),integerScale,pixelSnap, andbarColor(SetProjectDisplaySize,SetProjectDisplayMode,SetProjectDisplayIntegerScale,SetProjectDisplayPixelSnap,SetProjectDisplayBarColor). - Autoload: selects
autoload.mainScene(SetProjectMainScene) and adds, updates, or removesautoload.scenesandautoload.resourcesentries (AddProjectAutoloadScene,UpdateProjectAutoloadScene,RemoveProjectAutoloadScene,AddProjectAutoloadResource,UpdateProjectAutoloadResource,RemoveProjectAutoloadResource) with searchable file pickers populated from the open project's files (ProjectSceneFiles,ProjectResourceFiles). - Physics: edits
physics.gravity2D,physics.gravity3D,physics.solverIterations2D/solverIterations3D, and named collisionphysics.layers(SetProjectPhysicsGravity2D,SetProjectPhysicsGravity3D,SetProjectPhysicsSolverIterations,AddProjectPhysicsLayer,RemoveProjectPhysicsLayer). - Editor plugins: shows every registered plugin (
RegisteredPlugins) with a toggle switch backed bySetPluginEnabled, plus any plugins listed ingame.yamlthat this editor binary lacks (MissingPlugins) with an option to remove them.
Any value project.Validate refuses displays its validation error inline on the offending row without mutating the project or history. Before the first save of the open project (ProjectCanonicalSavePending), the page displays a notice explaining that saving writes game.yaml in canonical YAML form, which does not preserve comments.
Audio buses page (#909, #1060)
While a project is open, the toolbar's Audio button (AudioMixerOpen / SetAudioMixerOpen, or OpenSettingsPage(SettingsPageAudio)) opens the Audio buses Settings page (AudioMixerPanelView) to edit game.yaml's audio section directly through EditProject, so every edit validates against project.Validate, participates in the editor's Undo/Redo history, and writes cleanly on Save (SaveProject):
- Master and buses: adjust the master volume slider with dB readout (
SetAudioMasterVolume), add new buses (AddAudioBus), rename (RenameAudioBus), delete (DeleteAudioBus), reorder (MoveAudioBus), and adjust each bus's routing (Into Master) and volume slider (SetAudioBusVolume). Deleting the last bus when no master volume is set removes the emptyaudiosection, and Undo restores it. - Per-bus DSP effect chains: add (
AddAudioBusEffect/AddAudioBusEffectKind), remove (RemoveAudioBusEffect), reorder (MoveAudioBusEffect), and edit (SetAudioBusEffect) all sixproject.Effecttypes (lowPass,highPass,delay,reverb,gain,bitcrush). Numeric inputs bound parameters toproject.Validate's ranges (withClampAudioEffect), and Go API calls refuse out-of-range values without altering the project or history. - Live audition: choose any audio file from the open project (
ProjectAudioFiles,SelectAudioFile) and press Audition (AuditionAudioBus,StopAudition,SetAuditionLoop) to play it through the selected bus on an editor-ownedsound.Mixerconfigured withproject.File.ConfigureMixer. Volume changes apply live to the playing stream without restarting it, and effect chain edits or Undo/Redo immediately re-process throughsound.Mixer.ProcessSourceso changes are heard identically to runtime game playback.
Input map page (#908, #1060)
While a project is open, the toolbar's Input button (InputMapOpen / SetInputMapOpen, or OpenSettingsPage(SettingsPageInput)) opens the Input map Settings page (InputMapPanelView) to edit game.yaml's input section directly through EditProject with full Undo/Redo and validation against project.Validate:
- Action overview & editor: lists each configured action with its keyboard, gamepad, and touch triggers alongside a button that jumps directly into editing that action. Add (
AddInputAction), rename (RenameInputAction), and delete (DeleteInputAction) actions, and add (AddInputBinding), edit (SetInputBinding), or remove (RemoveInputBinding) bindings of everygame/inputkind:key,keyCode,gamepadButton,mouseButton,touchRegion, andmouseRegion. Renaming an action atomically updates every axis ininput.axesthat reads it so references stay consistent across Rename, Undo, and Redo. - Key capture: pressing Press a key (
BeginKeyCapturewithproject.KindKey) or Press code (project.KindKeyCode) enters capture mode and binds the next hardware key press (CaptureKeyEvent) directly to the selected action, with Cancel (CancelKeyCapture) to back out without changing the project. - Regions over virtual display size: the region canvas scales to the project's
displayresolution (falling back towindowwhendisplayis unset;InputMapDisplaySize), draws alltouchRegionandmouseRegionbounds, and lets you drag existing regions to move them, drag a selected region's bottom-right handle to resize it, or drag on empty space to draw a new region (BeginRegionDrag/UpdateRegionDrag/EndRegionDrag/SetInputRegion). Each drag commits as one undoableEditProjectstep. - Axes, motion axes and gamepad sticks: the Axes tab edits action axes (
AddInputAxis,SetInputAxis,DeleteInputAxis), device motion sensor axes (AddInputMotionAxis,SetInputMotionAxis,DeleteInputMotionAxis), and controller analog stick axes (AddInputGamepadAxis,SetInputGamepadAxis,DeleteInputGamepadAxis).BuildInputActionsbinds the open project's map into a live*input.Actionsviaproject.File.BindInput.
Localization panel (#917)
The Localization panel (LocalizationPanelView) edits per-locale YAML string tables side by side below the viewport, with message keys as rows and project locales as columns.
- Opening: press the toolbar's Strings button (which opens
<project>/localeswhen a project is open, or starts an in-memory"en"table otherwise), or callOpenLocalizations(dir)/NewLocalizations(dir, locales...)in Go.CloseLocalizationscloses the panel. - Keys and locales: add or remove locale columns (
AddLocalizationLocale,RemoveLocalizationLocale) and message key rows (AddLocalizationKey,RemoveLocalizationKey), normalizing locale tags to canonical BCP-47 form (for examplezh_hans->zh-Hans). - Simple strings and CLDR plurals: toggle a key as plural (
SetLocalizationKeyPlural) to edit all six CLDR categories (zero,one,two,few,many,other) viaSetLocalizationPluralorSetLocalizationPluralForm, or edit simple strings viaSetLocalizationString. - Missing translations: cells whose translation is empty (or whose plural
otherfallback is empty) are highlighted with a warning border andMissingindicator;LocalizationMissing,LocalizationMissingCount, andLocalizationIsMissingreport them programmatically. Untranslated keys are omitted when saved so runtimel10n.Cataloglookups fall back along the BCP-47 chain. - Undo, saving, and panel states: every localization edit goes through
Editor.History(Undo/Redo). Save Strings (SaveLocalizations/SaveLocalizationsTo) writes each locale's canonical YAML file to<dir>/<locale>.yamlusingl10n.EncodeYAMLand removes files for locales that were deleted from the workspace. Panel errors are surfaced in a dismissible banner (LocalizationError/ClearLocalizationError), and asynchronous loaders can toggle the loading state viaLocalizationLoading/SetLocalizationLoading.
Problems panel and live agent-proposed fixes (#913, #1036)
While a project is open, the Problems panel (ProblemsView) below the viewport runs assetcheck.CheckWith (using the editor's component registry) and project.Check over the project directory overlaid with every open, unsaved editor document off the UI goroutine, and reports the live problem count in the status bar (Problems: N). It re-checks automatically (debounced via ProblemCheckDebounce, defaulting to 80 ms) after every edit in the editor—made by the person or the agent—without waiting for a save, as well as when a project opens (OpenProject), after saving (SaveFile, SaveProject, SaveClipFile), after moving files (MoveFile, including undo and redo), and when the component registry changes (SetComponentRegistry). The panel's Check button (CheckProblems) re-runs the check on demand after edits made outside the editor.
Each row displays a problem's file:line:column location (assetcheck.Problem.Location, carrying the 1-based column wherever the scene or YAML format knows it), a Spec alert icon, and the message, matching nsgo game check on the same project plus any project-level issues reported by project.Check (such as an nsgo.yaml out of sync with game.yaml, a missing installed pack file, or an invalid non-.scene.yaml autoloaded scene). Pressing a row (OpenProblem) opens the scene in a tab without discarding unsaved edits in other tabs, or selects a non-scene file in the file browser (SelectedFile, SelectFile). Problems attributed to objects in the open scene also draw directly on live objects in the 2D viewport using the Spec Problem overlay (2 px solid problem outline plus a filled alert pill with icon and message, toggled via SetProblemOverlayVisible) and show a problem count badge on the object's row in the scene tree (ObjectProblems, ObjectProblemCount).
- Agent-proposed fixes (
ProposeProblemFix,ApplyProposedFix,ProblemAgentPanelView): an agent inspecting live problems through MCP (game_check) can propose a fix viaproblem_propose_fix(providing the problem, an explanation, and a validated structured edit). Proposing a fix simulates the edit on a cloned scene document to verify validity and compute the exact-/+YAML diff, opens the right-hand Agent panel showing the problem card (file:line:col), explanation, diff, Apply fix, Show me, Ignore, and "Ask about this problem…", and never applies the edit or mutates any file. Only the person pressing Apply fix (ApplyProposedFix) applies the change as a single undoableHistorystep with a Spec toast and Undo action, so one Undo restores the previous YAML and brings the problem back. - Show me, Ignore, and Ask about this problem (
ShowProblem,IgnoreProblem,AskAboutProblem): Show me opens the problem's scene, selects and frames the offending object, and highlights the exact YAML line. Ignore hides that problem from the Problems panel, status bar, scene tree badge, and viewport overlay until its file changes again (tracked by live content hash); any subsequent edit to that file evicts the ignore entry so the problem reappears automatically if it still holds. Submitting "Ask about this problem…" delivers the question with the problem, attributed object, and proposed fix attached (OnAskAboutProblem).
In Go, Problems, ProblemCount, ProblemErr, CheckingProblems, WaitForProblems, IgnoreProblem, IsProblemIgnored, ProposeProblemFix, ProposedFixes, ApplyProposedFix, ShowProblem, and AskAboutProblem manage live problems and proposed fixes safely.
Export and release builds (#916, #1060)
While a project is open, the toolbar's Export button (ExportPanelOpen / SetExportPanelOpen, or OpenSettingsPage(SettingsPageExport)) opens the Export Settings page (ExportPanelView) in SettingsView to edit game.yaml's export section and run release builds directly from the editor:
- Presets, readiness, and output directory: edit
export.output(SetExportOutput) with inline validation and add, remove, or reorder per-platform presets (AddExportPreset,RemoveExportPreset,MoveExportPreset) with targets chosen strictly from each platform's validproject.TargetsOf(platform)(SetExportPresetTargets,ToggleExportPresetTarget). Each preset row displays its readiness (ExportPresetReadiness: Ready or Set up when signing/team configuration or credits are missing) and policy badge, and the Export sidebar item surfaces a warning badge (ExportNavWarningMeta) whenever a preset needs setup. Every change goes throughEditProject(project.Validate+ Undo/Redo), clears an emptyexportsection automatically, and writes canonical YAML plus the syncednsgo.yamlon Save (SaveProject), matchinggameproject targets. - Credits pre-flight: whenever the panel opens, refreshes (
CheckExportCredits), or starts a build, it runs the sametooling/creditsscan thatgame releaseuses. Any asset without a credit is listed with its expected*.import.yamlsidecar path and blocks building until credited; once credited, refreshing clears the warning and successful builds writeCREDITS.mdbeside the packages. - Builds, dry runs, and Output stream: build all configured presets or toggle specific targets (
ExportSelectedTargets), optionally selecting a distribution channel (SetExportChannel), release notes file (SetExportReleaseNotes), or Dry Run (SetExportDryRun).StartExportBuild/RunExportBuildshare the release command planner withnsgo game release, so dry-run builds stream the exact samensgo buildcommand line into the panel's Output view off the UI goroutine, and successful non-dry-run builds open the resolved output folder (OpenOutputFolder/OpenExportOutputFolder).
Build and release screen (#1048, #1050)
For full release preparation, Project > Build & Release... (CmdBuildRelease, shortcut mod+shift+r, or OpenBuildReleaseScreen / CloseBuildReleaseScreen / BuildReleaseScreenOpen) opens the full-window BuildReleaseScreenView styled with Spec tokens:
- Header and pre-build checks: shows
"Release · Version <ver> from <commit> on <branch> · last release <version>"with an editable version field (SetReleaseVersion), Dry Run toggle (SetReleaseDryRun), and Build / Stop / Resume controls (StartReleaseBuild,StopReleaseBuild,ResumeReleaseBuild). BEFORE EVERY BUILD summarizesnsgo check(problem count and elapsed time viaRefreshBuildPreflight), the smoke playtest, and release budgets declared underexport.budgetsingame.yaml(qualityProfile,downloadSizeMB,frameTimeP95Ms, defaulting to Low profile / 80 MB / 16.7 ms). - Export presets, ordered steps, and logs: lists each preset with an include checkbox (
SetBuildPresetIncluded), platform summary, live status (Queued,Building,Notarizing,Done,Failed,Set up), artifact size, and delta against the last release (SetLastReleaseBaseline). Selecting a running preset shows the 6 ordered steps (Check project,Compile Go,Pack assets,Sign,Smoke playtest,Measure) with elapsed times, exactreleaseplancommands matchinggame release -dry-run, and its streaming log (build/<platform>.log). Presets build one at a time; Stop keeps completed steps and Resume continues from the interrupted step. - Failure isolation and agent preset fixes: if a preset fails (for example, a missing signing keystore at
Sign), the screen shows the error, step and elapsed time, failing commands, and"Other platforms keep building. Nothing was uploaded."while continuing remaining checked presets. An agent-proposed preset fix diff (SetBuildPresetFixProposal) can be applied and rebuilt in one click (ApplyBuildPresetFixAndRebuild). - Finished results and platform readiness: completed presets show the artifact path, size and delta against the last release, a
code/textures/audio/otherbreakdown highlighting what grew, download-size and frame-time p95 budget Met/Missed badges, smoke playtest summary, Show in Finder (ShowBuildArtifactInFinder), Edit preset, and (for Web builds) a local test-link QR card. Platforms that cannot build yet (such as iOS) open the READINESS checklist (EvaluateBuildReadiness: bundle ID, app icon, distribution certificate, provisioning profile, privacy manifest, touch controls) clearly separating what the agent can handle (RunBuildReadinessAction/RunBuildReadinessAgentSetup, such as writingPrivacyInfo.xcprivacy) from steps that require the person (Apple sign-in). - Release notes drafted from commits and kept reviews (#1050): RELEASE NOTES reads git commits since the last release tag (or initial commit when untagged), kept review summaries (
SetReleaseKeptReviews/AddReleaseKeptReview), andchangelog.d/*.mdfragments to draft player-facing Markdown (DraftReleaseNotes,RedraftReleaseNotes,DefaultReleaseNotesDraft, pluggable viaEditor.ReleaseNotesDrafter, andrelease_notes_draftineditormcp), displaying"Drafted from N commits since <tag/ref>". Editing the notes in place (SetReleaseNotesText/SaveReleaseNotes) saves directly and atomically to the exact Markdown file read bygame release -release-notes(ReleaseNotesFile/SetReleaseNotesFile, defaulting torelease-notes.md), modifying only that file. - Store uploads that always ask first and system keychain credentials (#1050): pressing Review uploads… (
ReviewReleaseUploads/OpenReviewUploads, orrelease_review_uploadsineditormcp) opens the Review uploads confirmation dialog listing every artifact (name, path, size), its destination (itch.io,Google Play · internal testing,TestFlight), version, and keychain credential status before anything is sent. A strict trust boundary ensures no upload can ever start without the person confirming in Review uploads (ConfirmReleaseUploadswith a single-use session ID;StartReleaseUploadand agent-actor confirmation calls viaWithAgentActor/editormcpare always refused, even underPermissionProfileAutonomous). Upload credentials are stored via the platformKeychainabstraction (StorePublishCredential,HasPublishCredential,DeletePublishCredential— backed by macOS Keychain, Linux Secret Service, Windows Credential Manager, orNewMemoryKeychainin tests) and are never written into project files or serialized into snapshots; confirmed uploads run throughEditor.ReleaseUploaderwith per-artifact progress and error reporting.
Try a build on a phone (LAN QR) or connected device (#1049)
When a Web or Android build completes on the Build and Release screen, authors can test it directly on their computer, on a phone over local Wi-Fi, or on a USB-connected Android device:
- LAN-only HTTP server and pure-Go QR code: finishing a non-dry-run Web build automatically starts a local-network HTTP server (
StartWebBuildServer/StopWebBuildServer/WebBuildServerState) bound strictly to a private RFC 1918 LAN IPv4 address (or loopback when offline, customizable viaEditor.LANAddressResolverandEditor.WebBuildServePort). Public bind addresses are refused (ErrNonLANAddress), non-LAN peer requests receive403 Forbidden, symlinks escaping the build directory are blocked, and stopping the server (via Stop serving, closing the editorClose(), switching projects, or unmountingEditorView) immediately closes the listener and frees the TCP port. The Web result card renders a deterministic scannable ISO/IEC 18004 QR code (internal/qrcode,EncodeBuildQR) on a high-contrast light quiet-zone card using Spec tokens alongside the LAN URL, Copy URL (CopyWebBuildURL), and Stop serving / Start serving controls. - Play-mode MCP bridge over LAN: served web builds retain exact
index.htmland asset bytes while advertising bridge discovery viaX-NSGo-MCP-Bridge: /__nsgo_mcp/infoandX-NSGo-Play-Mode: debugheaders. A phone browser in Play mode reads/__nsgo_mcp/info(or loads/__nsgo_mcp/bridge.js), authenticates with the per-session token atPOST /__nsgo_mcp/session, and exchanges JSON-RPC / inspection tool calls (/__nsgo_mcp/rpc,/__nsgo_mcp/poll,/__nsgo_mcp/reply,Editor.WebBridgeSessions,Editor.CallWebBridgeTool,Editor.WebBridgeHandler) so the editor and agent can inspect and debug the build running on the phone too. - RUN ON DEVICE: shows live device targets and states (
BuildDeviceState) in the finished build rail:- This Mac's / computer's browser (
LaunchBuildOnDevice("browser"), injectableEditor.OpenBrowserURL): opens the active LAN URL in the local browser (ready->running). - Phone · Wi-Fi (
LaunchBuildOnDevice("phone-wifi")): tracksserving,connected(showing the connected phone's name when attached to the MCP bridge), andstoppedstates. - Connected Android device on USB (
RefreshConnectedDevices,RunBuildOnAndroidDevice,WaitAndroidDeviceRun,StopAndroidDeviceRun, injectableEditor.DeviceDiscovererandEditor.DeviceCommandRunner): once the Android build finishes, installs and launches viago -C <dir> tool nsgo build -target <target> -run -device <serial>, reportingready,installing,running,failed, anddisconnectedstates cleanly.
- This Mac's / computer's browser (
Project search and Find References (#914)
While a project is open, the file browser's Search button (SearchOpen / SetSearchOpen) toggles the Search & References panel (SearchPanelView) below the viewport to jump anywhere in the project or answer "what uses this file?":
- Project-wide search (
Search,SetSearchQuery,SearchResults): indexes every project file (following the same walk rules asProjectFilesandrefs.Scan) and parses every scene file (*.scene.yaml,*.scene.yml, autoloaded scenes, and scenes referenced by other files). Case-insensitive queries (including space-separated multi-term queries) match file names and paths (SearchFile), file UIDs from file headers orgame.index.yaml(SearchUID), scene titles, and inside scenes: object IDs and display names (SearchObject, including nested children), component types (SearchComponent, including overrides), prefab names (SearchPrefab), and instanced or inherited scene paths (SearchSceneRef). - Jump-to-result (
OpenSearchResult): activating a result for a non-scene file selects it in the file browser (SelectedFile). Activating a result for a scene file opens that scene (settingScenePathandSelectedFile) and selects the matching object (SelectedID), nested children included, falling back to its top-level ancestor when the child cannot be selected. If the scene is already open, it selects the object in place without reloading from disk or discarding unsaved edits and undo history. - Find References (
FindReferences,ShowReferences,ShowSelectedFileReferences,References,OpenReference): selecting any file or directory in the file browser and pressing Find Refs queriesrefs.Scanfor every incoming reference, listing each referring file, 1-based line, field, and written value in the exact orderrefs.Scanreports them. Pressing a reference row opens the referring scene (and selects the top-level object owning that line when applicable) or selects a non-scene referring file in the file browser. - Live index updates (
RefreshSearch): edits to the currently open scene (PlaceObject,SetObjectName,DeleteObject, Undo/Redo) immediately update active search results in memory; saving scenes, projects, clips, data tables, or localizations, installing/removing packs, and moving files (MoveFile, including Undo/Redo, which also followsReferencesTarget) automatically invalidate and refresh the index; external edits on disk are detected via a lightweight directory fingerprint or refreshed explicitly via Refresh (RefreshSearch). Asynchronous callers can also toggle the panel's loading card withSearchLoading/SetSearchLoading.
Running the game and Output panel (#910)
Alongside the existing in-editor Play preview (Play, PlayIn, Stop), the editor can launch the open project itself on desktop via go tool game dev and stream its logs into a docked Output panel (OutputPanelView) below the viewport:
- Run and Stop: press the toolbar's Run button (or F5) to launch
go tool game devin the open project directory (RunGame/RunGameWith). Enable the Current Scene toggle (SetRunStartAtOpenScene)—or passRunGameOptions{StartAtOpenScene: true}—to pass-scene <path>andNSGO_GAME_SCENE(hotreload.SceneEnv) for the currently open scene. While the game is running, the button switches to Stop Game (Running) (Shift+F5 /StopGame), which terminates the child process and its entire process tree cleanly (via its own process group on Unix andtaskkill /T /Fon Windows). UnmountingEditorView, switching projects (OpenProject), or callingClose()also stops any running game cleanly. Custom tools and tests can injectEditor.RunGameCommand. - Output / Log panel: docked below the viewport (
OutputPanelView, toggleable via the toolbar's Output button orSetOutputPanelOpen), streaming the running game's standard output (OutputStdout) and standard error (OutputStderr) live off the UI goroutine alongside a timestamped history of the editor's own status and error messages (OutputEditor). Consecutive editor errors stay in the log instead of overwriting one another. - Filter, Clear, and
file:linenavigation: toggle Errors (SetOutputErrorsOnly) to show only error entries, press Clear (ClearOutput) to empty the log, and click any log line carrying afile:linelocation (OpenOutputEntry) to open that file in the editor when it is a scene (*.scene.yaml,*.scene.yml, or listed underautoload.scenes) or select it in the file browser otherwise.
Keyboard shortcuts, menu bar, and command palette (#920)
Every common editor action lives in a single command registry (Editor.Commands, Editor.RegisterCommand, Editor.ExecuteCommand) that drives keyboard shortcuts, the desktop application menu bar, and the Command Palette from one source of truth:
- Platform shortcuts and text-field guard: shortcuts use NSGo's
"mod"modifier (Command on macOS, Ctrl on Windows and Linux; formatted viaFormatShortcut) and are bound withcore.KeyNotEditingandcore.MenuNotEditingso typing or pressing Delete/Backspace/Undo/Save while any text field has focus (such as the inspector's Name field or a search box) never triggers editor shortcuts:- File & Edit:
mod+s(Save),mod+z(Undo),mod+shift+z(Redo),mod+c(Copy objects or active tile region),mod+x(Cut objects or active tile region),mod+v(Paste objects or tile region),mod+shift+v(Paste as Child),mod+d(Duplicate),mod+g(Group),mod+shift+g(Ungroup),delete/backspace(Delete selected objects). - 2D Tools:
v(Select),m(Move),p(Place),b(Paint Tile),e(Erase Tile),g(Fill Tile),t(Terrain),u(Rectangle Tile),l(Line Tile),c(Stamp Tile),n(Random Tile). - 3D Gizmo & View:
w(Translate),e(Rotate),r(Scale),t(Local / Global space),shift+c(Collider),alt+2(2D View),alt+3(3D View), the Lit, Unlit and Wireframe 3D shading commands underView > 3D Shading(no shortcut),f(Frame Selection, framing the independent 2DView2DviaFrameSelection2Dwithout mutatingDoc.CameraandCamera3Din 3D),1,ctrl+1,3,ctrl+3,7andctrl+7(the Front, Back, Right, Left, Top and Bottom 3D views),5(3D perspective or orthographic) and0(Look Through Scene Camera), which work in the 3D view only,View > Scene Environment(toggle the Environment panel),mod+k(Command Palette). - Project:
f5(Play / Stop),mod+r(Run Game viaEditor.OnRunGame, falling back to play-in-editor when a scope is attached),mod+,(Settings),mod+shift+,(Project Settings),mod+shift+u(HUD & Menu Layout),mod+shift+e(Export & Release panel),mod+shift+r(Build & Release screen),mod+shift+m(Profiler),mod+shift+b(Check Problems).
- File & Edit:
- Desktop menu bar:
EditorViewregisters the native application menu bar (File,Edit,View,Project) throughdesktop.SetApplicationMenu(Editor.ApplicationMenu), exposing the same registered commands with live enabled/checked states, formatted shortcut hints, active plugin tools underView > Tools, and active plugin commands underProject > Plugins. - Command Palette (
ui.CommandDialog): pressmod+k(or the toolbar's Commands button /View > Command Palette...) to openCommandPaletteView, which lists every built-in and custom command, active plugin commands, active plugin tools (activating them viaSetPluginTool), active plugin panels (focusing them viaFocusPluginPanel), and the open project's scenes and files (opening scenes or selecting files viaOpenProjectFile) with ranked substring and fuzzy matching. - Plugin commands: plugins can declare
Commands []PluginCommandwith an optionalShortcut.RegisterPluginnormalizes each shortcut (NormalizeShortcut) and refuses any shortcut that clashes with a built-in, custom, or other registered plugin command across macOS and Windows/Linux before mutating the editor.
Asset import settings and rebuilding (#915)
Selecting an image (.png, .jpg, .jpeg, .webp), sound (.wav, .ogg, .mp3, .flac), font (.ttf, .otf), or 3D model (.gltf, .glb) in the file browser (SelectedFile, excluding generated target outputs and *.import.yaml sidecars) displays its import settings and credit metadata in the Inspector (InspectorView):
- Sidecar and target defaults:
InspectAssetImportreads the asset's*.import.yamlsidecar when present and overlays it on the matching target's defaults ingame.yaml'sassetssection (imagefilter,format,mipmaps,srgb, sprite-sheetslice, and framepivot; audioformat,rate,channels,bitrate,peakDB/rmsDBnormalization, andloop; fontsize,padding, andchars; modelscale,animations,lodHysteresis, andlods), plus the sharedcreditsection (author,licenseas an SPDX expression,source, andnotice). - Interactive sprite-sheet slice grid and frame pivots (#880): when an image is selected, the import panel shows an interactive preview canvas (
DrawImageImportPreview) over a transparency checkerboard with the live slice grid (width,height,margin,spacing,count) and draggable pivot markers per cell (or a single marker when unsliced). Authors can drag any marker directly on the preview (BeginImagePivotDrag/UpdateImagePivotDrag/EndImagePivotDrag/CancelImagePivotDrag), pick default presets (TL,Center,Bottom), or edit/resetpivot.defaultand per-cellpivot.cellsnumerically (SelectImportSliceCell,SetImageImportPivot,SetImageImportDefaultPivot,SetImageImportCellPivot). Every drag commits once to the sidecar as a single undoable step, and running Reimport or Build Assets writes those pivots into the packed TexturePacker JSON sosprite.LoadAtlasloads exactFrame.PivotXandFrame.PivotYvalues immediately. - Interactive glTF/GLB model preview and animation playback (#897): when a
.gltfor.glbmodel is selected in the file browser, the import panel renders the model through an orbit camera (DrawModelPreview,RenderModelPreview,OrbitModelPreview,PanModelPreview,ZoomModelPreview,ResetModelPreviewCamera) reflecting the effective importscale, and inspects its contents (InspectModelImport): unscaled and scaled bounds, total triangle and vertex counts, and lists of its nodes, meshes, materials, and animations. Each animation can be selected, played, paused, stopped, looped, or scrubbed (SelectModelPreviewAnimation,PlayModelPreviewAnimation,PauseModelPreviewAnimation,StopModelPreviewAnimation,SeekModelPreviewAnimation,StepModelPreviewAnimation), supporting node TRS transforms, skeletal skinning, and morph targets. Editingscale,animations,lodHysteresis, orcreditwrites the deterministic sidecar throughimportsettings.Encodeand shows whichgame.yamlmodel target reads the file, so the nextgame assetsrun rebuilds only that model. - Validated undoable edits and field reset: every change writes the sidecar atomically through
importsettings.Encodeas one undoableEditor.Historystep (EditAssetImportSettings, typedSetImageImport*/SetAudioImport*/SetFontImport*/SetModelImport*setters, andSetAssetImportCredit). Undo restores the exact previous sidecar bytes verbatim (or removes a newly created sidecar file), and Reset (ResetAssetImportField) clears an override back to the target's default, removing the sidecar once no overrides or credit remain. - Reimport, Build Assets, and live reload: the inspector's Reimport button (
ReimportAsset) and the toolbar's Build Assets button (BuildAssets/BuildAssetsWith) runnsgo game assetsoff the UI goroutine, streaming stdout and stderr into the docked Output panel (OutputPanelView). On completion,ReloadAssetsreloads changed atlases and textures from disk intoEditor.Resolver(updatingsceneformat.AtlasMapor existing*sprite.Atlasvalues in place and invokingAssetReloader/OnReloadAssetswhen set), refreshes the Asset Browser and Viewport immediately without restarting the editor, and re-runs the Problems check. Custom tools and tests can injectEditor.AssetsCommandRunner.
Profiler panel and frame time strip (#912)
While playing in the editor or connected to a running game over MCP (game_perf_readout, game_perf_zones, game_perf_reset), the editor displays a live frame-time strip beneath the viewport and opens a full Profiler panel styled with the editor's design spec tokens (docs/design/editor/PlayMode.dc.html and Spec.dc.html):
- Play-mode
FRAME TIME · LAST 60 Sstrip (ProfilerStripView): always visible below the game view while Play mode is active or a remote game is connected (ConnectProfiler). It showsavg,p99, andallocs/framefromgame_perf_readout, threshold lines and legend markers at8.3 ms(over 8.3 ms) and16.7 ms(missed 16.7 ms), the−60 s,−30 s, andnowaxis, and a callout pill labelling spikes with their cause when the game supplies one viadebug.Overlay.NoteFrameCause(or"GC pause"on GC hitches). Pressing the strip's Profiler button opens the full Profiler panel. - Connecting to a running game: connect via
ConnectProfilerMCP(official MCP Go SDK over anymcp.Transport),ConnectProfilerCommand(spawninggo tool nsgo mcp),ConnectProfilerScope(an in-process*core.Scopewithmcp.Bridgeattached), orNewBridgeProfilerClient, and pass the client toEditor.ConnectProfiler. While attached to a scope, the editor pollsgame_perf_readoutandgame_perf_zoneseveryEditor.ProfilerPollInterval(default250 ms), or on demand viaEditor.PollProfiler. Built-in Play mode (Play/PlayIn) also instruments its loop withdebug.Overlay,debug.Profiler, anddebug.GCMonitorautomatically when no external profiler client is connected. - Full Profiler panel (
ProfilerPanelView): toggleable from the strip, toolbar Profiler button,Project > Profiler, Command Palette, ormod+shift+m(CmdProfiler/SetProfilerOpen). It displays live KPI cards and switchable time-series charts (SetProfilerMetric) for Frame (stacked update, draw, total, and GC hitch markers with 8.3 ms / 16.7 ms lines), FPS, Allocs & GC (allocations per frame, live heap bytes, and GC hitches), and Memory (tracked asset memory against budget and per-group totals), alongside a scrollable table of named timing zones fromgame_perf_zonessorted by cost. - Reset and Chrome/Perfetto trace export: pressing Reset (
Editor.ResetProfiler) invokesgame_perf_reseton the connected game and clears the editor's recorded history and zone table. Pressing Export Trace (or callingEditor.ExportProfilerTrace/Editor.ExportProfilerTraceFile, or intercepting viaEditor.OnExportProfilerTrace) writes the recorded frames and zones as Chrome/Perfetto Trace Event Format JSON throughdebug.Profiler.WriteChromeTrace.
Start screen (#922)
Running go tool game editor with no arguments opens the Start Screen (StartScreenView, toggled with SetStartScreenOpen), designed from docs/design/editor/Start.dc.html, step 1 of FirstRun.dc.html, and the Spec.dc.html tokens:
- Recent projects (
RecentProjects,ParseRecentProjects,EncodeRecentProjects): opening a project records its name, directory path, and UTC RFC3339lastOpenedtimestamp in a strict versioned per-user YAML file outside any project (<UserConfigDir>/nsgo-game/recent-projects.yamlviaDefaultRecentProjectsPath, orEditor.RecentProjectsPath). The sidebar's RECENT list appears once at least one project has been opened, displays relative times, marks entries whose folder orgame.yamlis missing on disk (Missing) with a badge and remove action (RemoveRecentProject), and persists across restarts. - Open folder (
BrowseAndOpenProject): opens a project directory through NSGo's native folder picker (core.Scope.PickDirectories) or the injectableEditor.PickProjectFolderhook. - New project from template (
ProjectTemplates,StartCreateProject): template cards andAll/2D/3Dfilter chips are populated dynamically fromgame new's template registry, so newly added templates appear without editor changes. The project name, parent folder (defaulting to~/games), and optional module path are validated live as typed (ValidateNewProjectInputs): checkinga–z,0–9, and-characters, write access to the parent folder, and existing folders (offering Open it or the next free sibling name such asdungeon-run-2). Pressing Create runsgame new(including itsgo getandgo mod tidysteps) off the UI goroutine while streaming stdout and stderr into the Start Screen, then opens the createdgame.yaml. - Open Demo (
OpenDemo,NewDemo): opens the built-in Demo Room scene without creating or opening a project on disk. - Start with AI — from one sentence to the first review (#1051): pressing Start with AI (
StartWithAI) implements the full five-stage flow indocs/design/editor/FirstRun.dc.htmlusing Spec tokens:- WHAT HAPPENS NEXT & Connect in place: the Start Screen lists the three steps (Connect an agent, Approve its plan, Review the first scene). When no agent is connected yet, Start with AI opens Connect an agent (
FirstRunStageConnect) in place on the Start Screen while preserving the idea and project name (with Edit and Later returning cleanly to Step 1). It detectsclaudeandcodexonPATH(or viaEditor.FirstRunDetectAgents), verifies the connection (Editor.FirstRunConnectAgent, with a 30 s no-answer checklist and in-place Copy diagnostics), or validates a pasted API key immediately in memory (Editor.FirstRunValidateAPIKey, never written to YAML). - The first plan (
FirstRunStagePlan,OpenFirstRunPlan): opens a read-only template preview viewport with planned dashed-violet ghosts (FirstRunGhost) beside the Agent panel's PLAN card (Editor.FirstRunPlanner/DefaultFirstRunPlan), optional clarifying question with a suggested answer, Just do it (JustDoItFirstRunPlan), and Approve ⌘↵ (ApproveFirstRunPlan). No project folder is created on disk until Approve. - Building (
FirstRunStageBuilding): after Approve creates the brand-new folder, the editor switches to the working layout with the 5-stage progress bar (Template,Project,First scene,Check,Playtest) and concrete object counts (19 of 31 objects, never a bare spinner). Pressing Cancel orEscpauses and asks first (Keep building, Stop, keep the files, or Stop and delete the folder — offered and permitted only for the brand-new folder created by this flow, never touching sibling or pre-existing folders). A failedCheckstops before the review with the agent's proposed fix (Fix it / Review as is). - The first review & one-time tips (
FirstRunStageReview): displays the plan summary on top (steps completed, with any differences from the plan highlighted in amber with their reason), Before / After toggle plus hold-Bpeek (Before: an empty folder), per-change revert/restore toggles, Revert all, and Keep N of M (KeepFirstRunReview). Three onboarding tips (keep or revert each change, hold B, select then ⌘L) show one at a time and once per person, stored underseenTipsinEditorSettings(editor.yaml); Skip tips ends all three andHelp › Replay tips(CmdReplayTips/ReplayTips) clears them and brings them back.
- WHAT HAPPENS NEXT & Connect in place: the Start Screen lists the three steps (Connect an agent, Approve its plan, Review the first scene). When no agent is connected yet, Start with AI opens Connect an agent (
- Clean project switching and unsaved-edits prompt: opening a project from the Start Screen or later through
File > Open Project...(mod+o),File > New Project...(mod+n), orFile > Start Screenreplaces the current project, scene, clip, cutscene, data table, localization workspace, skeletal rig, and undo history cleanly. Whenever the open session has unsaved edits (HasUnsavedChanges), the editor's unified unsaved-changes dialog asks to Save (ConfirmSaveAndSwitch), Discard (ConfirmDiscardAndSwitch), or Cancel (CancelPendingSwitch) before replacing anything.
3D LOD and occluder visualization (#904)
In 3D view (View3D), the viewport runs the same scenemodel.Build + render3d.OcclusionBuffer + render3d.Queue evaluation used at runtime (automatically backed by scenemodel.NewAssets when a project is open, or an injected Editor.ModelResolver):
- LOD overlay (
ShowLODOverlay/SetShowLODOverlay): color-codes each multi-LOD object by its active level and draws aLOD<n>badge beside it in the viewport; the 3D inspector also reports the selected object's active LOD (ObjectLOD3D,ObjectLODCount3D). Editing a model'slodsorlodHysteresisin the asset import inspector invalidates the 3D build so switches take effect immediately. - Occluder visualization and editing (
ShowOccluders/SetShowOccluders,SetObjectOccluder): draws magenta wireframes withOCC/OCC BOXbadges for every visible occluder (including explicitboxoccluders andmodeloccluders), dims objects culled behind an occluder (ObjectOccluded3D), and exposes undoable Occluder mode (none/model/box), box size, and double-sided controls in the 3D inspector (raising version 1 scenes to version 2 automatically). - RenderStats overlay (
ShowRenderStats/SetShowRenderStats,RenderStats3D): displays the liverender3d.RenderStatsreadout (Draws,Visible,Occluded,Tris,Verts, plus active per-objectLODlevels) in the top-right corner of the 3D viewport, toggleable alongside the LOD and Occluders overlays from the 3D toolbar.
Remote scene tree and live inspector (#911)
While a game built with game/mcp runs with -automation, the editor connects as an MCP client (using github.com/modelcontextprotocol/go-sdk/mcp over go tool nsgo mcp on desktop, or any mcp.Transport passed to ConnectRemote / Editor.RemoteTransport) to inspect and tune the running game live:
- Connecting: enable Auto-connect on Run in the Remote tab (
SetRunWithAutomation) or callRunGameWith(RunGameOptions{Automation: true})to pass-automationtonsgo game devand connect automatically once the game starts, or callConnectRemote/ConnectRemoteCommandto attach to an already-running game.NewRemoteBridgeServer(bridge, run)wraps a*mcp.Bridgedirectly as an MCP server for deterministic in-process or pipe testing. - Remote tab beside the Scene Tree: switch between Scene (
SceneTreeLocal) and Remote (SceneTreeRemote) inSceneTreeView. The Remote tab lists active scenes (game_scenes_list), layers in draw order (game_layers_list), and live entities with their parent-child hierarchy (game_entities_list), refreshed automatically while unpaused (intervalEditor.RemoteRefreshInterval, default 250 ms) or on demand viaRefreshRemote. Entities without a sceneObjectRefgroup under SPAWNED AT RUNTIME, and scene objects that are destroyed while running appear dimmed with the step they were taken at. - Live Inspector and Live Changes: selecting a live entity (
SelectRemoteEntity) inspects its components (game_entity_inspect) inInspectorView. Read-only derived components (world_transform2d,object_ref) show live readouts, while editable components render typed controls that patch the running game immediately throughgame_component_set(SetRemoteComponentField/SetRemoteComponentValue) and display"was X"beside changed fields. Every live edit is recorded in LIVE CHANGES (RemoteLiveChanges), which stays after disconnecting or stopping the game: revert individual rows (RevertRemoteLiveChange), discard all (DiscardRemoteLiveChanges), or press Keep in scene (KeepRemoteLiveChangesInScene) to write all changes on scene-backed entities into the open scene as a single undoableHistory.Groupstep that one Undo restores. - Live Play Bar, Tunables, and Console: while connected, the Play Bar exposes Pause / Resume (
mod+shift+p,RemotePause/RemoteResume), Step (.while paused) and Step N fixed updates (RemoteStep), Time Scale (0.25×,0.5×,1×,2×,RemoteSetTimeScale), and live frame/time/entity readouts in the status bar. When the game configures adebug.Console, the Remote Inspector also lists live Tunables (game_tunables_list/RemoteSetTunable) and a Console command line (RemoteExecConsole/game_console_exec).
3D terrain sculpting and painting (#900)
In 3D view (ViewMode3D), press the toolbar's Terrain button (or open a *.terrain.yaml file from the file browser via double-click / Terrain, or call NewTerrain, OpenTerrainFile, OpenTerrainProjectFile, or OpenTerrain in Go) to edit a world3d terrain directly in the 3D viewport with the docked TerrainPanelView below it:
- Sculpt and paint brushes: choose
TerrainBrushRaise,TerrainBrushLower,TerrainBrushSmooth,TerrainBrushFlatten(targeting the height sampled where the stroke starts, orTargetHeightwhenUseTargetHeightis set),TerrainBrushSetHeight(TargetHeight),TerrainBrushPaintLayer(increasing the active texture layer's weight while keeping all layers normalized to 1), orTerrainBrushPaintFoliage(blending the active foliage layer's density towardTargetDensityin[0, 1], where0erases). ConfigureRadius,Strength, andFalloff(TerrainFalloffSmooth,TerrainFalloffLinear,TerrainFalloffFlat) viaSetTerrainBrushor the panel controls. - 3D raycast strokes and single-step Undo/Redo: clicking or dragging across the terrain in the 3D viewport raycasts against the live
world3d.Heightmap(RaycastTerrain3D,BeginTerrainStrokeAt/ContinueTerrainStrokeAt/EndTerrainStroke, or world-coordinateBeginTerrainStroke/ContinueTerrainStroke), interpolates continuous dabs along fast drags, draws a terrain-conforming brush radius ring overlay, and records each complete stroke as one undo step inEditor.History(withEscape/CancelTerrainStrokeaborting an active stroke cleanly). Undo and Redo restore exact heightmap, layer-weight, and foliage-density samples and trackTerrainDirty()/HasUnsavedChanges(). - Lossless 16-bit saving: Save Terrain (
SaveTerrain,SaveTerrainTo, orSavewhen dirty) writes the 16-bit grayscale PNG heightmap (*image.Gray16, eliminating 8-bit slope banding), per-layer grayscale weight-map PNGs (or packed RGBAsplatMaps), foliage density-map PNGs, and deterministic*.terrain.yamlatomically soworld3d.LoadTerrainFS,TerrainDoc.ScatterFoliage, andrender3d.TerrainMaterialFromDocload and draw the exact same terrain in the game.
Particle emitter editor (#883)
The Particle Emitter Editor (ParticleEditorPanelView), opened from the toolbar's Particles button (CmdParticleEditor), by double-clicking a *.particles.yaml / *.emitter.yaml file or pressing Open Emitter in the file browser, or from the Inspector's Edit Emitter button on an object with particles, edits every field of a 2D particles.Config with live preview and full Undo/Redo:
- Live preview without restart: the panel runs a live
*particles.Emitter(ParticlePreview) on a preview canvas with Play/Pause (PlayParticlePreview/PauseParticlePreview), Restart (RestartParticlePreview), Step (StepParticlePreview), Burst (BurstParticlePreview), Preview Atlas (SetParticlePreviewAtlas), and an optional Floor collider (SetParticlePreviewFloor) to test bounce/stop/kill collisions. Editing rate, curves, motion, or other fields callsEmitter.ReloadConfigso the running preview reflects changes live without restarting or clearing live particles. When no atlas or frames are bound, the preview draws colored fallback discs so particles remain visible while tuning. - Every emitter field & interactive curve widget: edits
space, position, rotation,z,seed,shape(point,circle,ring,rect),rate,maxParticles, scheduledbursts(add/edit/removetime,count,cycles,interval),lifetimeMin/Max,speedMin/Max,angleMin/Max,gravityX/Y,initialRotationMin/Max,rotationSpeedMin/Max,collision,trail, and recursivesubEmitters(navigate into any child config viaSetParticleTargetPath/ Edit Child). The curve widget plotssizeCurve,alphaCurve,rotationCurve,colorCurve,trail.widthCurve, andtrail.colorGradienton an interactive canvas where stops can be dragged, clicked to add, or edited numerically, and the atlas frame picker togglesframeNamesdirectly from the resolver's atlases. - Undo/Redo and deterministic save: every edit goes through
Editor.History, and Save Emitter (SaveParticleEmitterFile/SaveParticleEmitterYAML/OnSaveParticleEmitter) writes canonical versioned YAML (particles.MarshalConfigYAML) that round-trips unchanged and hot-reloads matching emitters already placed in the open scene. - Scene placement: bind any object's
particlesfield viaSetObjectParticles,PlaceParticles, or the Inspector's PARTICLES section (fileandatlaspickers). Placed emitters animate live in the 2D edit viewport (StepSceneEmitters, hidden when the object is hidden), run in Play mode (PlayIn) and in the game (sceneformat.Build), are scanned byrefs(MoveFilerewritesparticles.file), and are validated byassetcheck.
Language and appearance settings (#921)
The editor UI is localized in English (en) and Simplified Chinese (zh) through embedded versioned l10n YAML string tables (editor/locales/en.yaml, editor/locales/zh.yaml), and per-user preferences are stored outside any project as deterministic versioned YAML:
-
Per-user settings file (
EditorSettings,SettingsVersion = 1, #921, #1005, #1006, #1028): stored atDefaultSettingsPath()(underos.UserConfigDir()asnsgo-game/editor.yaml, outside every game project) and loaded/saved withParseEditorSettings,EncodeEditorSettings,LoadEditorSettings,SaveEditorSettings,Editor.LoadSettings,Editor.LoadUserSettings, andEditor.SaveSettings. It storesversion,language,appearance, optionalautoSave(defaults totruewhen omitted), optionalinterfaceSize(compact,default, orlarge), optionalsnap(per-person defaults forgrid,gridSize,pixel,rotation,rotationStepDeg,scale,scaleStep, andshowGrid, used when a project does not override snap in.game/editor.yaml), optionalshowAgentChanges(defaults totruewhen omitted), optionalnavigation3D(default,blender, ormaya), optionalviewportOverlays(canonical sorted list of enabled 2D viewport overlay IDs; omitted for defaults,[]for all off), optionaloverlayLegend(canonical sorted list of enabled Spec viewport overlay legend kinds:selection,agent,added,changed,removed,problem; omitted enables all six,[]hides all six), optionalshortcuts, optionalseenTips, and optionalagentpreferences (task routing, MCP tool toggles, external MCP servers, weekly request limit, outbound privacy switches, and local usage counters; secrets such as API keys are never stored ineditor.yaml). Unknown keys, YAML anchors/aliases/merge keys, trailing documents, negative/non-finite snap steps, and invalid enum values are refused with*loaderr.Error. Output is deterministic 2-space YAML prefixed withSettingsSchemaCommentso a load-save round trip changes nothing byte-for-byte. Its published JSON Schema ishttps://game.nsgo.dev/schemas/editor-settings.v1.json(SettingsSchemaURL).# yaml-language-server: $schema=https://game.nsgo.dev/schemas/editor-settings.v1.json version: 1 language: system appearance: system autoSave: true interfaceSize: default snap: grid: true gridSize: 16 rotation: true rotationStepDeg: 15 showGrid: true showAgentChanges: true navigation3D: default shortcuts: view.frame: g -
Unified Settings window (
SettingsView,⌘,/Esc, #1005):- Opening, closing, and focus restoration: pressing
⌘,(mod+,,CmdEditorSettings) opens the full-window Settings view (with or without an open project) and pressingEsccloses it, returning keyboard focus to the exact control that had focus before opening. - Grouped navigation and page anatomy: the left navigation list is grouped into
AGENT(Models and connections, Permissions, Game brief, Project rules, Tools, Usage and privacy),PROJECT · game.yaml(Project, Input map, Audio buses, Export — hidden when no project is open), andEDITOR · THIS COMPUTER(General, Viewport, Shortcuts), with a live meta line on each entry and no empty group headings. Each page shows its title, one-line subtitle, and scope chip ("This computer","Project · shared", or"Project · game.yaml"), and each row renders a label, help text, value control, and"Agent may change"or"You only"policy column. - Search and agent handoff: typing into the top search field (
"Search settings, or tell the agent what you want") matches setting labels and help text across all pages, narrowing both the sidebar navigation (hiding non-matching pages and empty groups) and the rows on the active page. When no setting matches and the agent panel is enabled, Settings offers sending the query directly to the agent (AskAgentFromSettings). - General page (
SettingsPageGeneral): edits Language (Editor.SetLanguage), Appearance (Editor.SetAppearance), Save automatically (Editor.SetAutoSave, kept changes only after 2 s), and Interface size (Editor.InterfaceSize,Editor.SetInterfaceSize:Compact,Default,Large, scaling text and controls together). - Viewport page (
SettingsPageViewport,OpenViewportSettings): edits Snap (toggle + grid step inpx+ rotation angle in°, hold⌘to ignore), Grid (dots/grid every snap step,SetShowGrid), Show agent changes (Editor.ShowAgentChanges,Editor.SetShowAgentChanges: outlines in the viewport while a review is open), 3D navigation (Editor.Navigation3D,Editor.SetNavigation3D:Default,Blender, orMayamouse mapping), and every toggleable Overlay legend choice (ViewportOverlays, persisted per computer). - Keyboard and accessibility:
ArrowDown/ArrowUp/Home/Endmove through the left navigation list; every on/off toggle usesSpecSwitch(RoleSwitchwitharia-checkedand a 2 px Spec accent focus ring); every row is reachable withTab.
- Opening, closing, and focus restoration: pressing
-
Automatic saving and status bar save status (#1016):
- General › Save automatically (
Editor.AutoSave,Editor.SetAutoSave): enabled by default and persisted asautoSaveinEditorSettings. Kept changes to file-backed scenes andgame.yamlsave automatically after a 2-second debounce (DefaultAutoSaveDelay, configurable viaEditor.AutoSaveDelay). Edits inside an open review (Editor.HasOpenReview(), includingBeginReview/KeepReview, cutscene reviews, playtest metric reviews, safe rename reviews, merge conflicts, and unresolved disk conflicts) are not kept yet and pause autosave until kept. - Status bar save item (
Editor.SaveStatus,SaveStatusSaved/SaveStatusSaving/SaveStatusFailed): displays mutedSaved(hover tooltip shows the last save time), transitions toSaving…only after a write has stayed in flight for at least 300 ms (DefaultSavingIndicatorDelay, configurable viaEditor.SavingIndicatorDelay) so quick saves never flicker, and keeps failed autosaves in the status bar (never as a toast) with a human-readable cause (such as"Couldn't save: folder is read-only"or"Couldn't save: disk is full · 12 MB free"), plus Retry (Editor.RetrySave) and Save as… actions until fixed. - While saving fails: the unsaved dot beside the scene name and on the failing scene tab turns Spec problem red (
#FF6B6B), quitting asks first (Editor.HasUnsavedChanges()remainstrue), andeditormcpappends a warning to every tool result until a save succeeds.
- General › Save automatically (
-
Live language switching:
LanguageacceptsLanguageSystem("system"),LanguageEnglish("en"), orLanguageChinese("zh"). CallingEditor.SetLanguageor picking a language on the General page underEDITOR · THIS COMPUTERin the unified Settings view (SettingsView/EditorSettingsDialogView, opened from the toolbar's Preferences button,File > Editor Settings..., ormod+,) updates the toolbar, desktop menu bar, file browser, asset browser, scene tree, layers, inspector, bottom panels, dialogs, command palette, and status bar immediately without restarting.Editor.ResolvedLanguage()reports the active locale ("en"or"zh") and is exposed to connected MCP agents throughselection_get. -
Appearance (
core.Scope.SetAppearance) and Spec Dark/Light theme (#1062):AppearanceacceptsAppearanceSystem("system"),AppearanceLight("light"), orAppearanceDark("dark").EditorViewinstalls the embedded YAML Spec theme (spec_theme.yaml, loaded viacore.ParseThemeand exposed throughSpecTheme,DarkSpecPalette,LightSpecPalette,SpecPaletteFor, andEditor.SpecPalette) onto the root scope so every NSGouiwidget, panel, viewport overlay, overlay legend (SpecOverlayLegendView/SetOverlayLegendOpen), and toast (ShowToast/DismissToast/ToastView) follows the Spec tokens in both Dark and Light appearances instead of falling back to NSGo's default theme. Every foreground/background, button-on-fill, warning-card, and viewport-overlay pair in both palettes is measured against the same WCAG 2.2 contrast table (ContrastRatio,SpecContrastTable: >= 4.5:1 AA for text, pill labels, and text on accent/agent/problem fills; >= 3:1 UI contrast for focus rings and viewport overlay edges). WithAppearanceSystem, changing the OS appearance repaints the editor live without a restart; explicitAppearanceLightorAppearanceDarkchoices persist toEditor.SettingsPathacross restarts. -
Shortcuts: searchable and rebindable within a scope (#1061):
- Command scopes: every
EditorCommandandPluginCommandcarries aScope(ScopeGlobal,ScopeViewport,ScopeViewport2D,ScopeViewport3D,ScopeSceneTree,ScopeTile,ScopeAnimation,ScopePlay, defaulting toScopeGlobalwhen omitted). - Settings › Shortcuts (
EditorSettingsTabShortcuts,OpenShortcutsSettings,CmdShortcutsSettings): lists every registered built-in, custom, and active plugin command with its scope and live formatted key, searchable by command name, key/shortcut, or scope (FilterShortcutCommands). Pressing a command's key binding enters key-capture mode (ShortcutFromKeyEvent, cancelled cleanly withEscapewithout closing the dialog). Rebinding to a key already used in the same scope (ShortcutConflict/*ShortcutConflictError) flags the conflict in place with a Swap button (SwapShortcut, leaving both commands bound to each other's keys); binding a key used only in a different scope (RebindShortcut) succeeds immediately without a prompt. Per-row Reset (ResetShortcut) and Reset all (ResetAllShortcuts) restore defaults. - Persistence and live surfaces: custom bindings persist under
shortcutsinEditorSettings(editor.yaml, outside any project) and immediately updateEffectiveShortcut, toolbar tooltips/labels, the desktop menu bar (ApplicationMenu), Command Palette (CommandPaletteView), runtime key bindings, and the⌘/Keyboard Shortcuts sheet (ShortcutsSheetView,CmdShortcutsSheet/mod+/).
- Command scopes: every
-
Live language switching:
LanguageacceptsLanguageSystem("system"),LanguageEnglish("en"), orLanguageChinese("zh"). CallingEditor.SetLanguageor picking a language on the General page underEDITOR · THIS COMPUTERin the unified Settings view (SettingsView/EditorSettingsDialogView, opened from the toolbar's Preferences button,File > Editor Settings..., ormod+,) updates the toolbar, desktop menu bar, file browser, asset browser, scene tree, layers, inspector, bottom panels, dialogs, command palette, and status bar immediately without restarting.Editor.ResolvedLanguage()reports the active locale ("en"or"zh") and is exposed to connected MCP agents throughselection_get. -
Appearance (
core.Scope.SetAppearance):AppearanceacceptsAppearanceSystem("system"),AppearanceLight("light"), orAppearanceDark("dark").Editor.SetAppearanceapplies the choice immediately via NSGo'score.Scope.SetAppearance(keeping the editor dark even on a light system, or light on a dark system) and persists it toEditor.SettingsPathwhen set, so the choice survives restarts. -
Plugin localization: plugins may attach a
Catalog *l10n.Catalogor versionedLocaleYAML [][]bytestring tables (RegisterPluginvalidates them strictly) and set optionalTitleKey/LabelKey/DescriptionKey/CategoryKeyon their panels, tools, and commands. InsidePanel.ViewandInspector.View, plugins callEditor.PluginT(pluginName, key, args...)andEditor.PluginPlural(...)so all plugin UI follows the editor's active language live.
2D skeletal rig editor (#886)
The editor opens, edits, previews, saves, and places version-1 .skel.yaml 2D skeletal rigs (game/skeletal) directly through RigPanelView below the viewport:
- Opening and lossless round-tripping: select any
*.skel.yamlor*.skel.ymlfile inFilesViewand double-click it or press Open Rig (OpenRigProjectFile,OpenRigFile,OpenRigYAML), or start a fresh rig withNewRig. Opening and saving an existing rig without edits (or after undoing every edit back to the opened state) writes back the exact original bytes unchanged (SaveRigYAML,SaveRigFile,Editor.OnSaveRig); edited rigs serialize deterministically viaskeletal.Encode. - Interactive rig canvas and handles:
DrawRigViewportrenders attachments through the runtimeskeletal.Skeleton.Drawbeneath the bone hierarchy and interactive handles:- Bone Move (
RigHandleBoneMove): drag a bone's joint circle to move it in its parent's local space (in Bind Pose) or key itstranslateoffset at the current playhead when an animation is active. - Bone Rotate (
RigHandleBoneRotate): drag the rotation ring around a bone to rotate it (bind pose or active animationrotatekeyframe). - Bone Length (
RigHandleBoneLength): drag the tip diamond to setBoneData.Length. - Attachment Origin (
RigHandleAttachmentOrigin): drag the pivot crosshair on the selected slot's active skin attachment to adjustOriginXandOriginY. - Every handle drag (
BeginRigDrag,BeginRigHandleDrag,UpdateRigDrag,EndRigDrag) commits as one undoableEditor.Historystep, andCancelRigDrag(or pressingEscapeduring a drag) restores the pre-drag snapshot without touching history.
- Bone Move (
- Bones, slots, skins, and attachments: add (
AddRigBone), rename (RenameRigBone), delete (DeleteRigBone), move/rotate/scale (MoveRigBone,RotateRigBone,ScaleRigBone,SetRigBoneLength), and reparent bones (ReparentRigBone, optionally preserving bind-pose world transforms and refusing cycles); add, delete, rebind, fade, and reorder draw slots (AddRigSlot,DeleteRigSlot,SetRigSlotBone,SetRigSlotAlpha,MoveRigSlotOrder); manage skins (AddRigSkin,DeleteRigSkin,SelectRigSkin) and attach atlas frames with origin pivots (AttachRigFrame,SetRigAttachment,SetRigAttachmentOrigin,SetRigAttachmentTransform,RemoveRigAttachment). - Timeline, playback, and crossfade preview: create animations (
AddRigAnimation,DeleteRigAnimation,SelectRigAnimation,SetRigAnimationDuration,SetRigAnimationLoop), key bonetranslate,rotate,scaleand slotattachmentandalphatracks (KeyRigBoneTranslate,KeyRigBoneRotate,KeyRigBoneScale,KeyRigSlotAttachment,KeyRigSlotAlpha,DeleteRigBoneKeyframe,DeleteRigSlotKeyframe), scrub (SeekRig), play (PlayRig,PauseRig,StopRig,StepRig), and preview crossfade blends (CrossfadeRig,RigBlending) directly through the runtimeskeletal.Skeleton(RigSkeleton). - Placing rigs in scenes: press Place in Scene (
PlaceOpenRig,PlaceRig) to add a scene object carrying the built-in"skeletal"component (sceneformat.SkeletalComponent,version: 1,rig,atlas,skin,animation,loop).sceneformat.Buildloads the rig throughSkeletonResolverorFileResolver(FSAssets), builds a liveBuiltObject.Skeletonwith the chosen skin and animation, draws it in exact Z order in bothBuiltScene.Drawand the 2D editor viewport, and advances it inBuiltScene.Update(dt).refs.Scantrackscomponents.skeletal.rig(refs.FieldSkeletalRig) soMoveFilerewrites rig paths across scenes automatically.
HUD and menu layout screen (#1047)
Open the HUD and menu layout screen (HUDLayoutView) via the toolbar's HUD button, Project > HUD & Menu Layout, Command Palette (mod+shift+u / CmdHUDLayout), double-clicking or opening any *.screen.yaml file in the file browser, or clicking a screen diagnostic in the Problems panel (OpenHUDScreen / OpenHUDScreenFile / OpenHUDScreenDoc). Styled strictly with the editor's design spec tokens (docs/design/editor/HUDLayout.dc.html and Spec.dc.html), it previews every screen size and project language side by side while keeping manual layout edits focused and undoable:
- Header and Language switcher: displays the
<project> / screens / <file>breadcrumb (with a back button returning to the scene editor), a Language segmented control listing every locale fromlocales/*.yaml(and any unsavedEditor.l10nworkspace edits) viaSetHUDLocale, Search ⌘K, and Play. Switching languages immediately redraws all four screen sizes, the text-width table, the inspector's localized values and overflow zoom, and GAME CHECK. - Left rail (
SCREENSandNODES): lists all project*.screen.yamlfiles (HUDScreens) with each screen's node count and active-language problem count, plus the active screen's hierarchical node tree (HUDTree) with monospace anchor tags (TL,TC,TR,CL,C,CR,BL,BC,BR,FILL) and red problem dots. - Four simultaneous device frames and overlays: draws the active screen at Phone 19.5:9 with a notch (
780 × 360), Tablet 4:3 (640 × 480), Desktop 16:9 (640 × 360), and Ultrawide 21:9 (840 × 360) at once through realgameui.BuildScreenlayout (HUDLayoutFrames), with switches for Safe areas, Anchors, Touch areas, and Focus order (HUDOverlays/ToggleHUDOverlay), plus a floating TEXT WIDTH, PX table (HUDTextWidths) comparing each text node's box width against its measured width in every locale with overflows highlighted. - Inspector, zoomed overflow detail, and
GAME CHECK: inspects the selected node's ANCHOR (a 3×3 grid of buttons plus Fill, anchor and offset in words, and Keep inside the safe area), SIZE (Fixed / Fit text toggle and touch target size), TEXT (key, every locale's value, and a1.5×zoomed overflow detail card when localized text spills past its box), and live GAME CHECK diagnostics backed bygameui.CheckScreen(HUDProblems) with Show buttons to select offending nodes, Ask the agent to fix N, and an empty"No problems at any size in this language"state when clean. - Manual edits and agent composer: reordering children inside a container (
ReorderHUDNode), adjusting container spacing (SetHUDNodeSpacing), changing anchor/safe-area/sizing (SetHUDNodeAnchor,SetHUDNodeSafeArea,SetHUDNodeSizeMode), and directly dragging touch controls (BeginHUDTouchDrag,UpdateHUDTouchDrag,EndHUDTouchDrag,CancelHUDTouchDrag) each record one undo step inEditor.Historyand write canonical YAML back to the*.screen.yamlfile on disk (restored verbatim on Undo). A bottom composer (SubmitHUDPrompt,AskAgentToFixHUDProblems,Editor.OnHUDPrompt) forwards broader HUD changes to the agent.
Cutscene timeline and agent review (#1056)
Opening any *.cutscene.yaml / *.cutscene.yml file (from the file browser, Command Palette, OpenCutsceneProjectFile, OpenCutsceneFile, OpenCutsceneYAML, or an agent cutscene_write MCP call) opens the full-workspace cutscene timeline editor (CutscenePanelView), styled strictly with Spec.dc.html design tokens and laid out from Screen 2 of docs/design/editor/Animation.dc.html:
- Left rail (
CUTSCENESandLINES): lists every project cutscene (ProjectCutscenes) with its length orvideokind marker, plus every localized dialogue line (CutsceneLines) resolved fromloc/en.yamlandloc/zh.yaml(orEditor.CutsceneCatalog/ the open Localization workspace) showing its line ID, English text, and Chinese text. - Live preview stage and thumbnail scrub strip: runs a live
cutscene.TimelinePlayeragainst an isolated copy of the scene (CutscenePreviewScene,SeekCutscene,PlayCutscene,PauseCutscene,StepCutscene) so scrubbing to any timestamp poses actors, camera, and subtitle identically to runtime playback. Displays the active camera caption (CutsceneCameraLabel), localized subtitle overlay (CutsceneActiveDialogue), Play/Pause transport, time readout, and a 24-frame clickable thumbnail strip (CutsceneThumbs). - Track lanes and clip inspector: displays ordered lanes for Camera, each actor, Dialogue, Sound, and Music tracks with positioned clip blocks. Selecting a clip (
SelectCutsceneClip,SelectCutsceneClipByID) inspects and edits Start and Duration with±0.1 ssteppers (AdjustCutsceneClipStart,AdjustCutsceneClipDuration,SetCutsceneClipTiming) and Easing (Linear,In,Out,In-out,HoldviaSetCutsceneClipEasing) on camera and actor tracks. Selecting a dialogue clip displays its line ID, English and Chinese text, and the reminder that text lives inloc/en.yamlandloc/zh.yamlwhile the cutscene stores only the ID. - Agent review mode (
OpenCutsceneReview): compares the original cutscene (Before) against the agent's proposal (After) without overwriting the file on disk until accepted. Supports toggling Before / After (SetCutsceneReviewViewMode) or holding B to peek at Before (SetCutsceneReviewPeekBefore,CutsceneHandleKeyEvent), marks added and changed clips with dashed line styles (addedgreen dashed,changedamber dashed,selectedblue solid) alongside the legend, listsN CHANGESwith per-change Revert / Restore (ToggleCutsceneReviewChange) and click-to-focus (FocusCutsceneReviewChange), lets manual clip edits join the active review with⌘Zundo ("Your edit joins this review · ⌘Z undoes it"), offers Revert all (RevertAllCutsceneReview), and commits the remaining kept changes and joined edits on Keep N of M (KeepCutsceneReview) in one atomic undo step (both in memory and on disk).
Changes and commit panel (#1057)
Open the full-window Changes and commit screen (ChangesPanelView) from the status bar's Changes entry (showing the live working-tree changed-file count), Project > Changes & Commit, or Command Palette (CmdChanges / OpenChangesPanel / CloseChangesPanel), matching docs/design/editor/VersionControl.dc.html (screen 1) using only Spec.dc.html design tokens:
- Branch switcher, upstream status, and Pull: the header displays
<project> / <scene>, a branch switcher dropdown (GitSwitchBranch) showing the active branch plus ahead/behind counts (ahead N,behind M), Refresh (RefreshChanges), Pull (GitPull, fast-forward only), and Play. - CHANGES grouped by category: working-tree changes against
HEAD(git status --porcelain=v1 -uall) group under SCENES, DATA, CODE, and ASSETS (ChangesCategory), each file carrying an include checkbox (SetChangeIncluded,ToggleChangeIncluded), status badge (M,A,D,R), and a concise detail line (4 added · 3 changed objects,+7 -4 lines, or audio duration and file size). - Per-file comparison with
HEADin the Review layout:- Scenes (
*.scene.yaml/*.scene.yml): comparesHEAD(git show HEAD:<path>) with the working tree via side-by-side HEAD and Now 2D scene previews (plus single-view HEAD / Now toggles viaSetChangesSceneView), outlining added objects in dashed green, changed objects in dashed amber, and removed objects in dashed red, with per-object change badges (added · ...,changed · Door (x 584 → 560),removed · ...). - Data and Go code: displays the latest
nsgo checkandnsgo teststatus and relative timestamp (RunChangesChecks, injectable viaEditor.ChangesCheckRunner) above a color-coded unified line-by-line diff (git diff HEAD -- <path>, or full+lines for untracked files) and an Open in editor button (OpenChangedFileInEditor). - Audio assets: renders a playable audition card (
AuditionChangedAudio,StopChangedAudio) with duration, format/sample-rate metadata, a 60-bar waveform, and incoming references (Used by ...) gathered from the project reference index and scene objects.
- Scenes (
- Selective commit card and History milestones: drafts a commit summary and description from the included files, review/playtest context (
SetChangesContext), and checks viaEditor.CommitMessageDrafteror deterministicDefaultCommitDraftwith Redraft (RedraftCommitMessage), editable summary and description inputs (SetCommitSummary,SetCommitDescription),"Made from N agent requests, reviewed and kept"attribution when present, included+/−line counts, Commit (CommitSelectedChanges), Commit and push (CommitAndPushSelectedChanges), and Push N commits (PushCommits). Committing stages and commits only the checked files (git add -A -- <included>+git commit --only -m ... -- <included>), leaving every unchecked file untouched and uncommitted, and records aCommitMilestoneinEditor.History(History.Milestones/CommitMilestones). Nothing is ever committed or pushed automatically without user action. - SHARE: Copy as PR description (
CopyPRDescription/BuildPRDescription, writing structured Markdown with summary, changed files, checks, and playtest numbers viacore.Scope.SetClipboardorEditor.ChangesClipboard) and Open pull request (OpenPullRequest, enabled whenghis onPATHorEditor.GHRunneris set).
Scene merge conflict resolution (#1059)
When Git leaves an unmerged scene file (typically produced by the object-by-object go tool game merge driver from #1058), opening the project (OpenProject), pressing the status-bar conflict pill, or invoking Project > Resolve Scene Merge Conflicts (CmdMergeConflicts / OpenMergeConflict) opens the full-window Scene merge conflict screen (MergeConflictView, styled strictly with docs/design/editor/Spec.dc.html tokens matching VersionControl.dc.html screen 2):
- Header and progress: displays
Merging <theirs> into <mine> · N of M objects need you(updating toready to finishonce every conflict is resolved), Abort merge (AbortMerge, runninggit merge --abortto restore the branch and working tree cleanly), and Finish merge (FinishMerge, enabled only once every conflict is resolved). - Conflicts and MERGED BY ID: groups
sceneformat.MergeResult.Conflictsobject by object under CONFLICTS, each row showing a status dot, object name,Unresolved/Agent/Mine/Theirs/Customchip, and a plain-language summary (such asBoth moved it: x 560 here, x 600 on mainorYour speed change; main deleted it). Objects joined cleanly without conflicts appear under MERGED BY ID with which side added or changed them. Take the agent's suggestion for all N (TakeAllAgentMergeSuggestions) resolves every conflict in one click. - MINE, THEIRS, and RESULT previews: displays clickable MINE (branch, author, short commit SHA) and THEIRS 2D scene preview canvases over a larger RESULT canvas. Unresolved objects render at both Mine and Theirs positions with dashed amber outlines so overlapping moves are immediately visible; selecting a resolution updates RESULT live.
- Agent's suggestion, Mine, Theirs, and hand-edited YAML: the right inspector shows three selectable cards for the focused object — Agent's suggestion (from
Editor.MergeSuggesteror deterministicDefaultMergeSuggestion, combining non-conflicting fields from both sides or explaining why a deletion or higherzholds), Mine, and Theirs — each with its YAML snippet and reason. Edit the result YAML by hand (SetMergeCustomEditing,ApplyMergeCustomYAML) validates custom object YAML withKnownFields(true)andsceneformat.Validatebefore applying it. - Verification and merge commit (
FinishMerge): writes canonicalsceneformat.EncodeYAML to the scene path, runsgame check(runProjectCheckorEditor.MergeCheckRunner) and a short 10-second deterministic playtest (sceneformat.Build+Update+PhysicsScene.SteporEditor.MergePlaytestRunner), refuses to commit if either fails, and otherwise stages the scene and creates the Git merge commit (git add+git commit --no-edit), reportingMerged as <sha>and reloading the resolved scene into the editor. - MCP tools (
editormcp):merge_status,merge_resolve,merge_finish, andmerge_abortlet coding agents inspect conflicted objects, supply or refine suggestions and reasons, apply choices or custom YAML, and finish or abort merges.
Find usages and safe rename (#1041)
Pressing Shift+F12 (CmdFindUsages), choosing Project > Find Usages from the menu bar or Command Palette, right-clicking a file in the file browser (Find Usages / Rename Safely…), right-clicking an instanced scene or prefab object in the scene tree (Find Usages), or calling OpenUsagesScreen(path) opens the full-window Find usages and safe rename screen (ReferencesScreenView, styled strictly with docs/design/editor/Spec.dc.html tokens matching References.dc.html):
- Grouped usages (
FindUsages): shows Back to the editor (Esc),"Usages of <file>", and"N usages in M files", grouped into SCENES (each instanced object with its position and override count), PREFAB VARIANTS (files withinherits:targeting the file), DATA TABLES (rows referencing the path), and GO CODE (string literals and constants parsed from project*.gofiles viago/parser+go/ast, markednot rewritten).↑/↓moves through usages, clicking a scene card focuses that scene's instances on a plotted thumbnail grid, andEnteropens the scene with the referencing object selected and framed. - Safe rename review (
PreviewSafeRename/StartSafeRename/SetSafeRenameInput): pressing Rename… (F2) shows a NEW NAME field between the fixed folder prefix and compound file suffix, validating live againstgame mv/MoveFilepath rules (non-empty, safe relative path, free destination) and computing the exact dry-run rename plan without touching disk. The review lists the moved file ("content unchanged"), every rewritten YAML file with exact−(old) and+(new) line diffs showing preserved instance overrides, and every non-rewritten Go reference as a problem ("<file> loads the old path and is not rewritten") with Ask the agent to update it (AskAgentToUpdateUsage, invokingEditor.OnAskAgentUpdateRef) and Open<file>(Editor.OnOpenSourceFile). - One-step Keep and Undo (
ApplySafeRename/UndoSafeRename): clicking Keep · Rename N files (Mod+Enter) writes only YAML throughMoveFileas one undoableEditor.Historystep and enters the done summary with Undo · ⌘Z and Back to<scene>. One Undo restores every moved and rewritten file on disk byte-for-byte along with all open tabs. - MCP tools (
editormcp):refs_findreturns the grouped usages across scenes, prefab variants, data tables, and Go code (optionally opening the screen), andrefactor_renameprepares the same safe-rename review in the editor with exact planned diffs and non-rewritten Go warnings without silently mutating disk unlessapply: trueis passed.
Material editor (#896)
Assign and edit shared *.material.yaml resource files (resource) directly inside the editor with live preview and full Undo/Redo:
- Assigning and creating materials: in the Inspector, the searchable Material selector (
SetObjectMaterial) picks from the open project's*.material.yamlfiles; New Material (CreateObjectMaterial/CreateMaterialFile) creates a new canonical.material.yamlfile written withresource.Encode, assigns it to the selected object, and opens it; Edit Material (OpenMaterial/OpenMaterialProjectFile), double-clicking a material file or pressing Open / Edit Material in the file browser, picking a material in the Command Palette (OpenProjectFile), or invokingProject > Material Editor(CmdMaterialEditor) opens the dockedMaterialEditorPanelViewbelow the viewport. - Every material field: edits
name(SetMaterialName),baseColorandemissivevia NSGoColorWell/ColorPickerpopups and CSS color inputs (SetMaterialBaseColor,SetMaterialEmissive),texturevia a searchable project image picker (SetMaterialTexture,ProjectTextures),metallic,roughness, andopacityvia bounded sliders and numeric inputs (SetMaterialMetallic,SetMaterialRoughness,SetMaterialOpacity),blendfromresource.BlendModes()(SetMaterialBlend), anddoubleSided/unlitcheckboxes (SetMaterialDoubleSided,SetMaterialUnlit). Invalid values are refused byresource.Encodewithout mutating state or history. - Live preview and viewport sync: the panel renders a live preview (
MaterialPreviewImage,SetMaterialPreviewShape) as a 3D Sphere or Cube lit withrender3d(respectingunlit, PBR metallic/roughness, emissive, texture, opacity, and double-sidedness) or a 2D Sprite preview (defaulting to Sprite in 2D view and Sphere in 3D view). Every edit—including color-picker drags and Undo/Redo—pushes the updated material live throughresource.Library.Reload(usingproject.Resolver.Library()andscenemodel.Assets.Library()), updating the preview, every 2D sprite (BuiltScene.SyncMaterials), and every 3D viewport object using that material immediately before saving. - Undo/Redo and deterministic save: every edit goes through
Editor.History(EditMaterial), tracks unsaved state (MaterialDirty,HasUnsavedChanges), follows file renames (MoveFile), and Save Material (SaveMaterial,SaveMaterialFile,Save,SaveAll, orEditor.OnSaveMaterial) writes the exact deterministic YAML produced byresource.Encode.
Playtest report screen (#1044)
Open the full-window Playtest Report screen (PlaytestReportView) from Project > Playtest Report, Command Palette (mod+shift+y / CmdPlaytestReport), the status-bar playtest badge, double-clicking any *.report.yaml file in the file browser, programmatically via OpenPlaytestReport / OpenPlaytestReportFile, or from an agent calling playtest_report. Styled strictly with docs/design/editor/Spec.dc.html color and contrast tokens (including #101216 text on #3B7BFF primary accent buttons) matching docs/design/editor/Playtest.dc.html:
- Header and replay hand-off: displays
"Playtest · <scope>", the project name and runs summary (such as"20 headless runs by the agent · 1 m 40 s"), Watch run N (WatchPlaytestRun/WatchPlaytestRunIn, which loads that run's saved.replay.yamlfile throughreplay.LoadFile, starts Play mode with a live*replay.PlayerviaPlayReplayIn, and provides a Back to Playtest banner), and Ask the agent to tune it (AskAgentToTunePlaytest/Editor.OnPlaytestPrompt). - BOT PROFILE strip and
playtest_definereview: shows the bot profile switcher/name (BotProfileDisplayName),"playtest.yaml from template <id>"with Open (OpenPlaytestConfigPreview/Editor.OnOpenPlaytestConfig), and a one-sentence strategy. When the agent proposes a metric throughplaytest_define, a violet banner ("Proposed with playtest_define: …") appears with Review, opening an inline unified-diff drawer to Apply or Dismiss without touchingplaytest.yamlon disk until accepted (ApplyPlaytestProposal,DismissPlaytestProposal). - Metric cards: displays each metric's label, a text-and-icon Met or Missed badge (never color alone), formatted value, foot line, and
"Goal · <goal>"paired with its monospace source file (brief.yaml,game.yaml, orplaytest.yaml). - Automatic chart selection (all 4 chart kinds):
SelectPlaytestChartandDrawPlaytestChartchoose and render one canvas chart per report from the report's metrics:- Heat map over the level (
PlaytestChartHeatMap) for deaths or time per tile, with clustered density blobs and hotspot callout chips. - Bars per wave against a goal line (
PlaytestChartBars) with a dashed target line and flagged standout bars. - Line per level (
PlaytestChartLine) for per-level progression curves with flagged spike/dip markers. - Win-rate matrix (
PlaytestChartMatrix) with cells above the threshold (default 60%) flagged by border, marker, and"above 60%"label.
- Heat map over the level (
- Agent's read, actionable suggestions, and footnote: presents a concise diagnostic read (
DefaultPlaytestAgentReador customSetPlaytestAgentRead) and clickable suggestion cards (RequestPlaytestSuggestion) that dispatch requests coming back as reviews, above the footnote noting that runs use the replay system and that metrics and the bot come fromplaytest.yaml. - MCP integration (
editormcp):game_playtestloads freshly generated reports into the editor,playtest_definepushes pending proposals directly onto the Playtest Report banner with synced Apply/Dismiss handlers, andplaytest_reportlets the agent open, inspect, annotate, or watch runs from the report screen.
Asset drawer (#1052)
Switch the top of the left rail between Scene (LeftRailScene) and Assets (LeftRailAssets, also reachable via Command Palette CmdToggleAssetsMode) to browse, filter, preview, and drag every kind of project asset directly into the scene, styled strictly with docs/design/editor/Spec.dc.html design tokens and laid out from docs/design/editor/Assets.dc.html (screen 1):
- Left rail (
AssetsLeftRailView): switches between Scene and Assets (LeftRailSwitchView), lists project FOLDERS with live asset counts (including empty asset directories such asaudio/music), provides SHOW ONLY filters with counts (Unused, Missing files, Generated, Proposed), and includes a file drop zone ("Drop files anywhere to import"). Unused and Missing files are computed directly fromrefs.Project.UnreferencedAssetsandrefs.Project.MissingAssets. - Drawer under the viewport (
AssetDrawerView): offers kind tabs (All, Sprites, Tiles, Audio, Fonts), a live Name or path filter (SetAssetDrawerQuery), a sort toggle defaulting to recently changed (SetAssetDrawerSort), Import (TriggerAssetImport/ImportAssetFiles), and Generate (TriggerAssetGenerate). Cards display a checkerboard preview, a status badge (new,Missing,Generated,Not used), the asset name, and a meta line (such as"6 frames · used 31×"). The footer reports"N assets · M shown"and any missing-file problem ("1 problem · door_open.png missing"). Empty folders display"audio/music is empty · Drop .ogg or .wav files here, or ask the agent."and empty filter results display"Clear a filter to see more assets.". - Drag to viewport (place snapped or swap sprite): dragging a sprite card onto empty space in the 2D viewport shows a snapped drop ghost and pill (
"coin.png new Sprite on Actors · snapped to 16 px") and places a new sprite object on the active layer in one undo step (DropAssetAt). Dropping a sprite onto an existing object swaps that object's sprite in one undo step, so one Undo restores the previous sprite. Pressing Escape (CancelAssetDrag) cancels the drag cleanly without mutating the scene. - Selected asset panel (
AssetInspectorView): displays a checkerboard preview with dimensions/format metadata, frame-by-frame playable clip controls (SetAssetPreviewPlaying,SetAssetPreviewClip,SetAssetPreviewFrame,StepAssetPreviewFrame) for multi-frame sprites, playable sound controls (ToggleAssetAudioPreview,StopAssetAudioPreview) with waveform preview for audio files, a compact IMPORT summary fromInspectAssetImport, and USED BY listing every referring file and usage fromrefs.Project.UsedBy(clicking a reference opens it). Unused assets display"Nothing references it. The agent can propose deleting it; deleting files always asks you.", and missing assets offer Replace with a file (TriggerReplaceMissingAsset/ReplaceMissingAsset) and Ask the agent (AskAgentAboutAsset).
Viewport Overlays menu and agent viewport images (#1040)
In 2D edit mode (ViewMode2D), a floating bar at the bottom-center of the viewport (docs/design/editor/Inspector.dc.html, styled strictly with Spec.dc.html tokens) pairs zoom (− / % / +), Snap, and Fit with an Overlays N button showing the count of active overlays:
SHOW IN VIEWPORTpopover (ui.Popover): opens above Overlays N (also reachable viaView > OverlaysandCmdViewportOverlays) with a swatch, localized label, live count in the current scene, andui.Switchfor each overlay, plus the footer note "The agent's screenshots use the same set:viewport_overlays":- Collision shapes (
collision_shapes): registered non-trigger component shape fields (#882) and non-trigger 2D physics colliders. - Triggers (
triggers): trigger/sensor/area component shapes and 2D physics trigger volumes (amber dotted outline). - Connections (
connections): arched arrows from emitting object to handler object labelled"event → handler"(such as"pulled → open") from the scene'sconnections. - Patrol paths (
patrol_paths): enemy/actor patrol ranges and waypoint paths, built on the sameViewportOverlayregistry that plugins use. - Navigation (
navigation): built 2D navigation mesh polygons, portals, andnavregion2doutlines (#888), kept in sync withShowNavMesh2D. - Camera bounds (
camera_bounds): scene camera bounds rectangle and"bounds W × H"caption (#884). - Labels (
labels): compact object name/ID pills below visible objects.
- Collision shapes (
- Custom plugin overlays (
ViewportOverlay): plugins add custom overlays viaPlugin.Overlays(or directly on an editor withEditor.RegisterViewportOverlay), supplying anID,Name/NameKey, optionalCountcallback, andDraw func(*Editor, *core.Drawing, *sceneformat.BuiltScene)function. Active plugin overlays appear in the popover,View > Overlays, andeditormcp'sviewport_image. - Per-user persistence: toggling any overlay (
SetViewportOverlay,ToggleViewportOverlay,SetViewportOverlays) writesviewportOverlaystoEditor.SettingsPath(EditorSettingsYAML outside the project), never to any project or scene file, so choices survive restarts (including an explicit empty list[]when all overlays are turned off). - Shared with
editormcp'sviewport_image:Editor.DrawViewportWithOverlays(d, size, overlayIDs)renders the exact same overlay set intoviewport_image. Omittingviewport_overlaysuses the editor's active overlays; passing explicit names (or[]) overrides them for that image without mutating editor settings.
Inspector titled sections, field filter, scrub fields, Open YAML, and Ask to add (#1038)
The object Inspector (InspectorView), styled with docs/design/editor/Spec.dc.html tokens matching Inspector.dc.html, Main.dc.html, and Viewport3D.dc.html, organizes object editing into compact collapsible sections while keeping every control backed by an Editor method and matching editormcp tool:
- Header and Open YAML: displays a kind-colored swatch, object ID, kind-and-layer subtitle (such as
Sprite · layer actors), and Open YAML (FindObjectYAMLLine/OpenSelectedObjectYAML), which locates the object's exact 1-based line in the scene YAML (reading the file on disk when clean so comments and formatting match, orSaveYAMLwhen dirty), invokesEditor.OnOpenFileAtLine(path, line)when set, and reportsOpened <path>:<line>in the status bar. - Field filter (
InspectorFilter/SetInspectorFilter): the Filter fields search bar narrows visible sections and fields by case-insensitive substring match against field labels, component names, and section titles (for example, filteringspeedleaves only fields matchingspeed), auto-expanding matching sections and hiding non-matching ones. - Titled collapsible sections and compact transform rows: sections render in Spec section-header style (uppercase title, chevron toggle via
ToggleInspectorSection, field count badge, e.g.TRANSFORM,SPRITE,PATROL,HEALTH), with Position and Scale laid out as compactX Yrows (plusZin 3D, alongside 3D RotationX Y Z), Alpha, and Z order. - Scrubbable number fields: dragging any number field's label (
BeginInspectorScrub,UpdateInspectorScrub,EndInspectorScrub,CancelInspectorScrub) previews changes live in the viewport and records one undo step per drag; pressingEscapeduring a scrub cancels and restores the original value without touching history. In 3D view, holdingShiftwhile scrubbing steps in0.01increments. Focused numeric fields support↑/↓stepping,Shift×10 stepping,Entercommit, andEscaperestore. - Grouped Add component and Ask to add: registered components the object lacks are grouped under
GAMEPLAY,PHYSICS, andAUDIO AND VISUAL(ComponentCategoryOf,AddableComponentGroups). Beside the input, Ask to add (AskToAddComponent,ComposerDraft,SetComposerDraft,Editor.OnComposerPrompt) stages"Add a component to <object> that "in the agent composer. - Review and problem indicators plus footer: fields with active agent review changes (
SetInspectorReviewChanges) show an amber accent bar and"was <old> · in review"; fields failing a project check or schema bound (SetInspectorFieldProblems/Editor.Problems) show a problem pill beside the control and on the section header. The footer reminds authors:"Everything else about this object is in its YAML. Ask the agent, or open the file." - Matching MCP tools (
editormcp):object_set_fieldedits any single object field, component field, or custom property through the sameEditorcommands as one undo step;object_locate_yamlreturns an object's 1-based YAML line and snippet (optionally triggeringOnOpenFileAtLine); andscene_editsetsupports all 2D/3D inspector fields includingparticles,model,gridMap,occluder,light, andcamera.
Generated assets through MCP generator servers (#1053)
Open the full-window Generated Assets screen (AssetGeneratorView) from Project > Generated Assets or the Command Palette (CmdGeneratedAssets / SetAssetGeneratorOpen). Styled strictly with docs/design/editor/Spec.dc.html tokens matching Screen 2 of docs/design/editor/Assets.dc.html, it connects to external MCP image and sound generator servers, checks returned candidates against the game's brief.yaml, and keeps generated output off disk until a person explicitly picks a candidate:
- MCP generator servers (
GENERATORS · MCP): configure servers (GeneratorServerConfig,SetGeneratorServerConfigs) under Settings › Tools (EditorSettingsDialogView) and connect viaConnectAssetGenerator(anymcp.Transport, mirroringConnectRemote) orConnectAssetGeneratorCommand(stdio process on desktop).AssetGeneratorslists every connected or configured server (imagesorsound) with live connection status. - Untrusted output decoded in memory only:
GenerateAssetstrictly decodes image payloads to raster pixels in memory (re-encoding clean PNG bytes, enforcing bounds, and refusing SVG/HTML/non-image payloads) and validates WAV (audioconv.DecodeWAV) or OGG audio in memory. Nothing is written to disk before Pick. - Preview backdrops,
brief.yamlstyle checks, and sound audition: image candidates preview side-by-side with their reference asset on selectable backdrops (PREVIEW ON: Floor 3, Floor 1, Checker viaSetAssetGenPreviewBackground) with pass/fail checks for Palette, Pixel grid, Size against the reference asset, and Contrast against the selected wall (LoadAssetStyleBrief,SetAssetStyleBrief). Sound candidates display waveform bars, duration, RMS loudness (dBFS), peak loudness check against the reference sound or brief target, and in-memory audition (PlayGeneratedSoundCandidate,StopGeneratedSoundCandidate). - Atomic undoable Pick and provenance sidecar (
<file>.source.yaml): Pick (PickGeneratedCandidate) writes exactly the picked media file and its deterministic version-1<file>.source.yamlsidecar (importsettings.AssetSource,AssetSourceVersion = 1, schemahttps://game.nsgo.dev/schemas/source.v1.json) recordingversion,generator,model,prompt,seed,references,license,commercialUse, andapprovedByin one undoableEditor.Historystep; oneEditor.Undo()removes both files cleanly. Vary this (VaryGeneratedCandidate), Refine (RefineGeneratedAsset), and Regenerate N (RegenerateAsset) re-invoke the generator with the same references without writing to disk. - Export license gate (
LICENSES · CHECKED AT EXPORT):credits.ScanGeneratedLicenses,credits.CheckGeneratedLicenses,credits.Collect,releaseplan.Build,game release, and the editor's Export panel (CheckExportCredits) scan every*.source.yamlsidecar in the project. Any generated file with an empty or unknown license (license: ""orlicense: unknown) blocks release builds with*credits.UnknownLicenseErrornaming the asset's path until resolved (for example viaSetGeneratedAssetLicense/ Set license).
Focus ring and keyboard regions (#1003)
Every interactive control in the editor carries the docs/design/editor/Spec.dc.html focus ring on keyboard focus and is reachable via Tab, F6, or arrows:
- Keyboard-only focus ring (
:focus-visible):EditorViewinstallsSpecTheme()(also returned byFocusTheme()), mappinginfo,focus, andringto Spec accent (#3B7BFFin Dark,#1D5CE6in Light) while preserving Spec Dark and Spec Light surfaces. Buttons, toggle buttons, selects, checkboxes, andSpecIconButton/SpecSwitchdraw a 2 px accent ring with a +2 px offset on keyboard focus only—mouse clicks never draw it. - Inset rings and
:focus-within: tree rows (SceneTreeView,LayersView), list rows (AssetBrowserView,FilesView), text fields (ui.Input,ui.NumberInput), and F6-focused regions draw an inset-2 pxaccent ring viaSpecPalette.FocusRing(-2)so scrolling parents never clip them. Selected and focused rows keep both their selection fill and the inset ring. Composer and card containers (SpecFocusWithinCard,hud-composer-card) draw the +2 px accent ring on the card via:focus-within. - Fixed-order keyboard regions (
F6/Shift-F6):F6moves to the next visible region andShift-F6moves to the previous region in fixed Spec order: Header (RegionHeader) → Scene tree (RegionSceneTree) → Viewport (RegionViewport) → Agent and Inspector (RegionInspector) → Status bar (RegionStatusBar) → Toast (RegionToast, included only while a toast is active inToastViewviaEditor.ShowToast). Entering a region viaF6/Shift-F6draws its inset-2 pxring and restores the last control focused in that region.F6/Shift-F6are suppressed during shortcut capture and full-window screens, and close any open object context menu. - Viewport focus is the selection: the viewport canvas draws no focus ring of its own; while focus is in the viewport (
editor-viewport-frame),Tab(Editor.SelectNextObject) andShift-Tab(Editor.SelectPreviousObject) cycle through visible, unlocked scene objects in order. - Dialog focus trapping and opener restoration: editor dialogs (
EditorSettingsDialogView,ShortcutsSheetView,CommandPaletteView, unsaved-changes prompt, scene path dialog, and save-conflict dialog) trapTab/Shift-Tabinside the topmost modal (respecting shortcut capture inSettings › Shortcuts), block global shortcuts behind the modal except⌘./Ctrl+.(Editor.OnStopAgent) to stop an active agent, and return focus to the exact control that opened the dialog when dismissed withEscor an action button. - Focus stability: nothing moves focus automatically during an active drag or inspector scrub (
Editor.IsDragging) or while typing in a text field (Editor.IsTyping). Showing a toast never steals focus, andEditor.ShouldFocusAgentPromptreturnstrueonly when no drag or text input is active and focus is already inside the agent panel (Editor.SetAgentPanelRef).
Connect an agent and status chip (#1009)
Connect an external coding agent (Claude Code, Codex, or any MCP client on your computer) directly from the editor or with go tool game mcp install, matching docs/design/editor/Connect.dc.html, docs/design/editor/AgentStates.dc.html, and docs/design/editor/Settings.dc.html using exclusively docs/design/editor/Spec.dc.html tokens:
- One-time project install (
go tool game mcp install): writes.mcp.json(Claude Code) and.codex/config.toml(Codex) idempotently in the project root while preserving existing unrelated servers and settings, and prints each file written or left unchanged. - Connect dialog (
ConnectAgentDialogView): reachable fromProject > Connect an Agent..., Command Palette (CmdConnectAgent),Editor Settings > Models and connections(+ Connect another agent or model), or the Agent panel header. Offers three choices (An agent on this computer — Recommended, Built in, with your API key, and No agent), showsgo tool game mcp installwith a Copy button, displays"Waiting for an agent to connect…"which turns to"Connected · <agent> over <transport>"as soon as the first MCP client attaches, provides four starting permission checkboxes (Edit scenes and data (always reviewable), Run game check, Run headless playtests, Edit Go code ->AgentPermissionRules), keeps the Agent panel closed when No agent is chosen, and provides Later and Done. - Agent tab panel (
AgentPanelView): switches the right sidebar between Inspector (RightTabInspector) and Agent (RightTabAgent,CmdAgentPanel), showing the thread of requests (including turns made by terminal-started MCP clients), streamed steps, and a labelled multi-line composer (Entersends,Shift+Enteradds a line, plus Send / Stop). Composer requests run throughEditor.AgentRunner(defaulting on desktop toCLIAgentRunner, invoking Claude Code's--print --output-format=stream-json --verboseor Codex'scodex exec --jsonwith the project's MCP configuration). - Status chip (
AgentStatusChipView): announces transitions throughcore.LiveRegionPoliteand renders all five states while keeping manual tools working in every state:Connected · MCP(hover tooltip names the agent and transport, such asClaude Code over stdio)Working · step n of m(violet dot pulses on a1.2 scycle, staying still whenReduceMotionis enabled)Waiting for you · m:ss(clicking focuses the open request card)Reconnecting · try n of 5(retries after1, 2, 4, 8, 16 susing injectableEditor.AgentScheduleAfter)Disconnectedwith Reconnect and Troubleshoot (reopens Connect directly at the failed step rather than the start)Disconnected · offlinewhen the editor is offline.
Play mode marks, rolling replay, and frozen-frame agent questions (#1042)
While playing a scene in Play mode (Play, PlayIn, StepPlay, PlayTick) or connected to a running game, the editor keeps a rolling 60-second input recording, supports marking moments without stopping, lets you freeze any frame to ask the agent what looks wrong, and adds panic triage with one-click replay up to the panic frame (docs/design/editor/PlayMode.dc.html, styled strictly with Spec.dc.html tokens):
- Rolling 60-second input recording: every fixed Play step samples
Editor.PlayInputSource(watchingEditor.PlayInputActions/Editor.PlayInputAxes, defaulting to the project's input actions ingame.yaml) into a bounded 60-second sliding buffer (60 × PlayRateHz(), 3,600 frames at 60 Hz;PlayRollingFrameCount,PlayRollingSummaryshowing"Last 60 s kept · N frames"). Marking, asking, or hitting a panic atomically writes a version 2replayYAML file underreplays/<scene>-<frame>.replay.yaml(SavePlayRollingReplay,PlayLastReplayPath) that rebases older windows cleanly while preserving held actions and axis values entering the window. - Play mode bar and marks (
alt+f/CmdPlayMark): local Play mode renders a Spec-styled Play control bar (playModeBarView, keeping the 2D edit toolbar compact) with live/paused status pill, Pause/Resume (mod+shift+p,SetPlayPaused), single-frame Step (.while paused,StepPlay), time scale (0.25×–2×,SetPlayTimeScale), Mark⌥F(AddPlayMark), Something looks wrong⌘L, and Stop. Pressingalt+fmarks the current frame without stopping Play, saves its.replay.yamlunderreplays/, pins a flag on the 60-second frame-time strip, and lists it under MARKS · N in the Inspector's Agent tab (PlayInspectorTab,PlayMarks) with time, frame, and"replay attached". Stopping Play (Stop)—or clicking Send marks now (SendPlayMarks) earlier—bundles all unsent marks into one thread dispatched toEditor.OnPlayMarksThreadand stored inLastPlayMarksThread. - Frozen-frame questions (
mod+l/CmdAskFrozenFrame) and MCP replay stepping: pressingmod+lor Something looks wrong (OpenAskFrozenFrame) pauses Play, captures the frozen viewport PNG, and opens "Ask about frame N" with the frame preview, attachment chips, prompt field ("What looks wrong? e.g. the slime walks through the wall"),"A fix comes back as a review", Cancel, and Ask. Submitting (SubmitAskFrozenFrame) saves the rolling replay, attaches the frame image and live entity snapshot, dispatchesEditor.OnAskFrozenFrame, and switches to the Agent tab. Connected agents inspect the frozen frame througheditormcp'splay_frozen_contexttool and step the replay throughplay_replay_step(AgentStepPlayReplay), showing the viewport agent pill ("agent stepping frames A–B") and step log ("Stepped frames A–B with game_loop_step…") while keeping the game paused until the person resumes. - Output panel panic card and Replay up to the panic:
ParsePanicTracedetects Go panic messages and stack traces in run output or recovered Play panics (OutputPanic,SetOutputPanic).OutputPanelViewdisplays a Spec-styled panic card with the message, clickablefile:linelinks for game stack frames, folded runtime frames ("N frames in the game runtime · Show"/"Hide",SetOutputPanicRuntimeExpanded), Ask the agent to fix (AskAgentToFixPanic,Editor.OnAskPanicFix), and Replay up to the panic (ReplayUpToPanic,ReplayUpToFrame), which resets the scene (callingEditor.OnPlayResetwhen set), replays the saved recording throughPlayActiveInput(), and stops and pauses atpanicFrame - 1without triggering the panic.
Permissions and MCP enforcement (#1010)
The editor governs every mutating and running MCP tool call with a tracked, versioned YAML rules file, permissions.yaml, stored beside game.yaml (keeping .nsgo/ git-ignored for editor-local state while teams share and review permission rules in Git):
- Three profile presets:
- Cautious (
cautious): asks before every content edit, config edit, code edit, file creation,game check, and playtest, and denies deleting files or running shell commands. - Balanced (
balanced, default whenpermissions.yamlis absent): edits content (scenes/**,prefabs/**,data/**) and runsgame checkand playtests on its own; asks beforegame.yaml,brief.yaml,**/*.go, and creating files anywhere; denies deleting any file or running shell commands. - Autonomous (
autonomous): lets the agent complete whole tasks end to end while keeping reviewable undo steps; deletes and shell commands remain denied unless explicitly relaxed.
- Cautious (
- First-match-wins rule table: each rule matches an action (
edit,create,delete,run,code) and slash-separated file globs (scenes/**,**/*.go,**) or run targets (game check,playtests,shell) to a decision (allow,ask,deny). Every evaluation (Editor.EvaluatePermission) records the exact rule index or profile that decided it. - Settings › Permissions (
PermissionsSettingsView): reachable viaFile > Permissions..., the Command Palette (CmdPermissionsSettings), or a blocked step link. Displays the three profile cards (retaining the active profile's name with a Changed badge when rules are edited from the preset), the reorderable rule table with an arrow-key-navigable Allow / Ask / Deny radio group per row, add/remove controls, and an Agent on this page rail with blocked-step links and pending approval cards. - Blocked step links and Always toast: a
denyrule never invokes the MCP tool and records a blocked step whose link (such as"Settings › Permissions · rule 7 of 7") opens Settings › Permissions with the matching rule focused. Answering Always on anaskcard inserts anallowrule ahead of the asking rule, savespermissions.yaml, and shows the"Always permission rule saved"toast with Show and Undo. - MCP-only scope: rules govern the editor's MCP server tools only. External agent edits directly on disk continue to surface via the editor's disk watcher.
Ask the agent in place (⌘L) and Agent panel (#1037)
Pressing ⌘L (Ctrl+L on Windows and Linux, registered as CmdAskAgent in ScopeGlobal with core.KeyNotEditing) outside any text field opens an anchored in-place composer (AskInPlaceComposerView, styled strictly with docs/design/editor/Spec.dc.html tokens matching AskInPlace.dc.html) directly beside the selected object(s) in the viewport:
- Anchored placement and clamping (
OpenAskInPlace,AskInPlacePlacement,ComputeAskInPlacePlacement): anchors below the selection's viewport bounds (flipping above when near the bottom edge) and clamps strictly inside the viewport container so it stays on screen and never overlaps the right panel (Inspector / Agent panel). Without a selection, it anchors inside the viewport asking about the open scene. PressingEsc(CloseAskInPlace) closes without sending and restores focus to the control that held it before⌘L. Pressing⌘Lwhile typing in the Inspector or any text input is ignored. - Announced selection chip, multi-line field, and contextual suggestions: displays an accessible
RoleStatus/LiveRegionPolitechip announcing the selection count and object names (for example"2 selected · slime_01, slime_02"), a real labelled multi-line input (⇧↵inserts a newline,↵or⌘↵sends), up to two contextual suggestions (such as"Make them a prefab variant"and"Space them evenly"for multi-selection) navigable with↑/↓and↵without blocking free typing, and the localized hint"⌘L asks about the selection · ⌘K searches · right-click 'Ask the agent'". - Context menu wiring: choosing Ask the agent about this (
AskAgentAboutObject) from either the viewport context menu or the Scene Tree context menu opens the same anchored composer for the target object (or the full multi-selection when the object is part of one). - Agent panel and MCP context delivery: sending starts an
AgentTurn(SubmitAskInPlace) flaggedSkipPlan: true(matchingPlan.dc.html: "Small edits with ⌘L skip the plan."), attaches the selection's object IDs and names, the open scene path and YAML, and a rendered viewport PNG (RenderViewportPNG), switches the right rail (RightRailView/RightRailTab, toggleable with⌘1/⌘2) to the Agent tab (AgentPanelView) showing the turn with context chips, and notifies connected MCP clients througheditormcp'seditor://agent/turnresource andagent_turn_get/agent_turn_replytools.
Background task list with queued and parallel agent requests (#1022)
Requests, plan steps, and automations share one background task list in the Agent panel (TasksPanelView, styled strictly with docs/design/editor/Spec.dc.html tokens matching Tasks.dc.html), toggled from the status bar indicator (status-tasks), View > Background Tasks, or CmdToggleTasks (mod+shift+t):
- Task model and plain-text thread persistence (
AgentTask,AgentThreadDoc): tasks move across five visible groups—Needs you (TaskNeedsYou), Running (TaskRunning), Ready to review (TaskReadyToReview), Queued (TaskQueued), and Failed (TaskFailed)—plus completed (TaskDone) and stopped/reverted (TaskStopped) states. Each project persists its task list in plain-text YAML under.nsgo/threads/<id>.thread.yaml(AgentThreadVersion = 1, deterministic output, unknown fields and duplicate keys refused viaParseAgentThread/EncodeAgentThread, round-trip lossless). - Queue vs Run in parallel (
SubmitTask):- Queue (
TaskStartQueue): waits behind the running or unreviewed turn and starts only after that turn is kept (KeepTask) or reverted (RevertTask), so queued requests always build on the reviewed scene. - Run in parallel (
TaskStartParallel): starts immediately as a separate agent session with its own numbered overlay (1,2, …).
- Queue (
- Object holds in
editormcp(Server.ConnectTask,CompleteTaskTurn,ReleaseTaskHolds): each parallel task runs on its own MCP session bound to its task ID. Editing an object (viascene_edit,object_set_field, object menu tools, or tile edit tools) holds that object for the task's active turn; another parallel session trying to edit the same object holds cleanly in FIFO order, updates its step and overlay to"waiting on <object>"naming the holding task, and automatically resumes once the first task finishes its turn or releases holds—producing separateTaskReviewentries per turn. - Numbered overlays in the viewport and scene tree: active tasks draw solid violet (
SpecPalette.Agent) outlines with numbered pills (1 placing the jump arc) on objects they are editing and 45%-opacity dashed outlines with a clock glyph and"2 waiting on slime_02"pill on objects they are holding, paired with a compact bottom-left viewport legend and"1 · editing"/"2 · holding"badges on scene tree rows (ObjectTaskBadge,SceneTaskOverlays). - Bulk dismiss and summary badge counts: multiple Ready to review tasks can be checked (
ToggleTaskDismissSelection) and dismissed together (DismissSelectedTasks/DismissTasks) without reverting anything that was kept.TaskSummaryandTaskDockBadgeCountexpose counts forNeedsYou,Running,Blocked,ReadyToReview,Queued,Failed,MostUrgent, andDockBadge = NeedsYou + ReadyToReview + Failed(excluding running and queued) for both the status bar (No tasks,1 running · 0:38, urgent-first mixed counts, persistentFailed) and downstream notifications/Dock badges (#1023). - Matching MCP tools (
editormcp):tasks_listlists tasks, active holds, and summary counts;tasks_submitqueues or starts parallel requests; andtasks_controlrunskeep,revert,dismiss,stop,retry,open,focus,allow, ordeny.
Game brief and project rules (#1026)
Settings (EditorSettingsDialogView, matching docs/design/editor/Settings.dc.html and styled exclusively with Spec.dc.html tokens) adds two shared project pages under AGENT that the agent reads before every request:
- Game brief (
brief.yaml,OpenBriefSettings): edits the versionedbrief.yamlfile at the project root (project.Brief,project.ParseBrief,project.EncodeBrief, JSON Schemahttps://game.nsgo.dev/schemas/brief.v1.json) with labelled fields for Pitch, Genre, Tags, Platforms, Art direction, Feel and difficulty (including structured playtest targets readable viaplaytest.TargetsFromBrief/playtest.ApplyBriefTargets/Editor.BriefPlaytestTargets), and Tone and audio. Projects withoutbrief.yamlshow an empty state; filling and saving writes a canonicalbrief.yamlthat round-trips byte-for-byte unchanged, unknown fields are refused with their 1-based line number (loaderr), missing sections appear as"1 gap"/"N gaps"in the sidebar, and every edit records an undoable step inEditor.History(EditBrief). - Project rules (
AGENTS.md,OpenRulesSettings): edits the plain MarkdownAGENTS.mdfile at the project root (shared by Claude Code, Codex, and the built-in agent) in a monospace code field as undoable steps (SetProjectRules), showing the bulleted rule count (ProjectRulesCount) in navigation. Patterns of consistently reverted reviews (RecordReviewOutcome/SuggestedProjectRules) surface suggested rules (such as"Suggested from your last 30 reviews: you reverted every change that moved the camera bounds."); pressing Add as a rule (ProposeSuggestedRule) opens a reviewable diff card (Keep / Revert) without modifyingAGENTS.mdon disk until kept. - Reviewable agent edits: agent proposals through
editormcp'sbrief_editandrules_editqueue pendingDocReviewcards (ProposeBriefReview/ProposeProjectRulesReview,KeepDocReview/RevertDocReview) without touching disk until kept; kept reviews apply as one undoable step inEditor.History. - Agent on this page and Settings search: both Agent pages render the right-hand Agent on this page card with a contextual note, clickable suggested asks, and an inline composer; clicking a suggested ask or submitting a prompt in the top Settings search bar calls
AskAgentFromSettings, staging the page-contextualized prompt inComposerDraftand invokingEditor.OnSettingsAgentRequest(andEditor.OnComposerPrompt).
History panel: your edits and the agent's turns on one timeline (#1017)
The History panel (HistoryPanelView), styled with docs/design/editor/Spec.dc.html tokens matching AskInPlace.dc.html and Checkpoints.dc.html, brings manual edits, kept agent turns, external Git reloads, and saved points onto one chronological timeline:
- Rich timeline entries (
History.Entries,Editor.HistoryEntries): eachHistoryEntryrecords who made the change (HistoryAuthorYou,HistoryAuthorAgent, orHistoryAuthorGit), a concise headline and detail (such asYou · moved Knight/x 416 → 452orAgent · slimes and coins/6 changes · kept 5), the list of touched files, change/kept counts, and a timestamp driven by an injectable clock (Editor.SetHistoryClock/History.SetClock) for deterministic testing. Saving records aHistoryEntrySavedmarker (Saved · level_01.scene.yaml) capturing the saved snapshot. - Unified multi-file agent turns (
Editor.RecordAgentTurn): groups scene, project, and extra touched project files under one undoableHistorystep tagged asHistoryAuthorAgent, alongside automatic agent attribution foreditormcpedits (EnterAgentContext/LeaveAgentContext),KeepTileReview, andKeepCutsceneReview. - Opening and filtering: press
⌘Y(Ctrl+Yon Windows/Linux,CmdHistoryPanel), choose View > History, or click the toolbar history icon button (tooltip"History · ⌘Y"). Entries appear newest-first grouped by day (TODAY,YESTERDAY, or date) below a Now row markedunsavedwhen dirty, with All / You / Agent filter tabs (Editor.SetHistoryFilter). - Read-only point-in-time preview (
PreviewHistoryEntry,ExitHistoryPreview): clicking any timeline entry renders that step's snapshot read-only in the 2D and 3D viewports with a"Previewing <relative time> · editing is off"banner, without mutatingEditor.Docor movingHistory's undo cursor. PressingEsc, Back, or Now exits preview cleanly. - Non-destructive Restore (
RestoreHistoryEntry): clicking Restore rolls the active scene, project, and every extra touched file back to that point as one new undoable step inHistory. Later steps remain in the timeline and can still be previewed or restored, and a singleUndoreturns immediately to the latest state. - Agent read access (
editormcp): the read-onlyhistory_listtool (ActionRead) exposes the same newest-first timeline to connected agents with optionalauthor(all,you,agent) andlimitfilters plus unsaved and active preview metadata.
Persistent per-turn checkpoints (#1018)
Agent turns, autonomous tasks, and automations persist across editor restarts inside the project's .nsgo/checkpoints/ directory and appear alongside session edits in the unified History panel (⌘Y, CmdHistoryPanel):
- Lazy first-write capture (
.nsgo/checkpoints/): before an agent turn (BeginCheckpointTurn/RunCheckpointTurn, or any file-mutatingeditormcpActionEdittool call) first modifies a project file—scenes, prefabs, data tables,game.yaml, Go code, or verbatim binary media—the editor snapshots its pre-turn bytes under.nsgo/checkpoints/<id>/files/<path>and writes a strict versioned YAML manifest (manifest.yaml,editor.CheckpointVersion = 1, JSON Schemahttps://game.nsgo.dev/schemas/checkpoint.v1.json). Files created by the turn recordexisted: falseso restoring deletes them..nsgo/checkpoints/.gitignoreand.nsgo/.gitignoreare written automatically so checkpoints stay ignored by Git, andEditor.CheckpointMaxBytes(default128 MiB) prunes the oldest completed checkpoints when total size exceeds the cap. - Tasks and automations: autonomous background tasks (
TakeCheckpointBeforeTask,RunTaskWithCheckpoint, andSubmitTaskrunners) and automations (TakeCheckpointBeforeAutomation,RunAutomationWithCheckpoint,game_playtest, and automation-mode MCP edits) always persist a checkpoint before they start. - Security and integrity: checkpoint capture, writes, and restores strictly exclude
.git/,.nsgo/, and all You-only configuration files (MatchYouOnlyPath/CheckYouOnlyTarget), refuse symlinks along every path component, cap manifest and file sizes (2 MiB/32 MiB), and verify both byte length and SHA-256 digests before writing. - Unified History preview and one-step undoable restore:
OpenProjectreloads persisted checkpoints intoHistoryPanelView(UnifiedHistoryEntries). Clicking a checkpoint previews its scene snapshot read-only (PreviewCheckpoint), and Restore (RestoreCheckpoint) atomically restores every touched file on disk, synchronizes open tabs andgame.yaml, and records one undoable step (checkpointRestoreCmd) soUndo(⌘Z) puts the entire turn back byte-for-byte. - Matching MCP tools (
editormcp):checkpoint_list(ActionRead) lists unified history and persisted checkpoints;checkpoint_restore(ActionEdit) evaluates permission rules (edit,code,delete) and You-only boundaries against every file recorded in the checkpoint manifest before restoring as one undoable step.
You-only trust boundary and proposed deletions (#1015)
Settings that govern what an AI agent is allowed to touch — Permissions (permissions.yaml), Tools (tools.yaml / mcp.yaml), Models (models.yaml), and Usage (usage.yaml) — follow the You-only rule (docs/design/editor/Permissions.dc.html, Settings.dc.html):
- Hard MCP refusal (
editormcp): Every non-read tool on the editor's MCP server refuses any write, rename (including bare-stemrefactor_rename), or deletion targeting a You-only file (permissions.yaml,.nsgo/permissions.yaml,tools.yaml,models.yaml,usage.yaml, or per-usereditor.yaml, including through symlinks and case-insensitive host aliases), returning a structured*editormcp.YouOnlyErroreven when the active profile isAutonomous. - Permissions draft card (
permissions_draft/PermissionsDraftCardView): The agent can only submit a draft viapermissions_draft(Editor.SubmitPermissionsDraft). The draft opens as its own modalui.Dialogwith focus trapping and opener focus restoration, showing each rule'sNOW → DRAFTdecision, a livepermissions.yaml · if appliedYAML diff preview, per-rule checkboxes with nothing ticked by default, Discard draft, and Apply n rules.⌘↵, Keep all, automations, and every profile (Autonomousincluded) cannot apply the draft. Applied rules are recorded inHistoryas the person's (HistoryActorPerson) and can be undone byte-for-byte with⌘Z. - External disk changes to
permissions.yaml(ReconcileExternalPermissions): Whenpermissions.yamlchanges on disk outside the editor (a clone,git pull, or another tool), tightened profiles and rules apply at once, while loosened profiles or rules (such as changingBalancedtoAutonomous, turningDenyintoAllow, or removing aDenyrule) are held and not enforced until the person explicitly confirms each entry in Settings › Permissions (ConfirmHeldPermissionLoosening/RejectHeldPermissionLoosening). - Proposed deletions that Keep all never applies (
game_delete_file/AgentReviewPanelView):game_delete_fileis off by default (Editor.ToolEnabled("game_delete_file") == false) and always proposes a deletion in the Review changes panel (Editor.ProposeFileDeletion) showing the file's exact line count (or binary summary), a red-tinted preview, and whether any scene uses it (viaEditor.FindUsages), while refusing symlinks,.git/**,game.yaml, open scene tabs, and files above 1 MiB. Keep all (Editor.KeepAllReviewChanges/⌘↵) keeps the other changes and leaves pending deletion files untouched on disk; confirming in place (Delete this file /Editor.ConfirmProposedDeletion) deletes the file through a reversible checkpoint command (deleteFileCmd), and⌘Z(Editor.Undo) restores the file byte-for-byte.
Toasts and feedback channels (#1004)
Passing feedback in the editor uses one Spec-styled toast component (ToastView, WindowToastView, and SpecToastCard, matching docs/design/editor/Toasts.dc.html and Spec.dc.html using exclusively SpecPalette tokens). Decisions never go in a toast: permission asks and questions stay in Agent panel cards, check failures go to Problems, and finished agent turns open Review.
- Five kinds on one 40 px, radius 12, single-line pill:
ToastSuccess(check-in-circle icon,Added.Fg),ToastInfo(i-in-circle icon,TextMuted),ToastWarning(triangle icon,Warning.Fg, onWarning.FillandWarning.Edge),ToastError(circle-with-bar icon,Removed.Fg), andToastProgress(progress ring + bottom 2 px bar + live percent).- At most one verb action button (with its shortcut hint, such as
Undo ⌘Z) and a dismiss button on every kind exceptToastProgress.
- Canonical Spec event API (
Editor.EmitToastEvent,ToastHandle,SpecFeedbackChannels): screens emit typedToastEventvalues (ToastEventReviewKept,ToastEventReviewReverted,ToastEventFixApplied,ToastEventAgentStopped,ToastEventPermissionSaved,ToastEventCopied,ToastEventDiskChanged,ToastEventSaveFailed,ToastEventExportRunning,ToastEventExportFailed) instead of inventing ad-hoc tones, durations, or queue keys.EmitToastEventreturns a*ToastHandleso long-running work such asexport_panel.goexports can update completion (SetProgress), transition in place into a success toast (Complete, e.g."Exported <path>"with Show in Finder) or persistent error toast (Failwith Retry), or cancel the running work (Cancel). - Placement: bottom center of the viewport, 8 px above the viewport bar (never over the scene tree, inspector, or agent panel). When no viewport is on screen (Start screen, Settings, Export, or other full-window views),
WindowToastViewanchors at the bottom center of the window, 24 px up. - Queue, waiting badge, merging, and ordering: one toast is shown at a time; others wait in FIFO order and the visible toast displays a
+Nwaiting count badge. Repeating the same event merges into the existing queued entry in place without changing order, and nothing jumps ahead of an active error or running progress toast. - Timing, pause, motion, and accessibility:
ToastDurationenforces Spec lifetimes: success and info stay for 4 s (6 s with an action), warning stays for 8 s, and error and progress stay until retried, dismissed, canceled, or completed. Hover, touch, keyboard focus insideRegionToast, or the window leavingcore.LifecycleActive(going to the background) pauses the countdown (Editor.ToastTimerPaused,Editor.ToastRemaining).- Enter motion fades in and rises 8 px over 180 ms; exit fades out over 120 ms. With
ReduceMotionenabled, toasts appear and leave immediately with no fade or movement. - Both toast hosts are polite live regions (
core.RoleStatus,core.LiveRegionPolite). Showing a toast never steals focus;F6/Shift-F6reachesRegionToast,Tabmoves between its action and dismiss buttons, andEscwhile focused dismisses the toast and restores focus to the control focused before entering the toast.
- Spec Feedback channels table (
SpecFeedbackChannels):
| Event | Channel | Action / Notes |
|---|---|---|
| Review kept or reverted | Toast | Undo ⌘Z |
| Fix applied from Problems | Toast | Undo ⌘Z |
Agent stopped with ⌘. |
Toast | Review |
| “Always” permission rule saved | Toast | Show |
| Copied a config, path or snippet | Toast | Info (routed from Connect, copy YAML, copy objects, web URL, PR description, diagnostics) |
| A file changed on disk outside the editor | Toast | Warning · Show (routed from disk watcher reload) |
| Save or export failed | Toast | Error · Retry, stays (explicit ⌘S / Save and export failures only; failed autosaves stay in the status bar per Checkpoints.dc.html and never toast) |
| Export running | Progress toast | Cancel, stays until done then turns into "Exported <path>" with Show in Finder |
| Agent asks permission or a question | Agent panel card | Never a toast |
| Agent finished a request | Review opens | Never a toast |
| Check failed, broken reference | Problems | Never a toast |
| Agent asks, finishes or stops while the editor is in the background | + System notification | Paired with its in-editor channel |
Agent automations (#1029)
Project automations (automations.yaml beside game.yaml, schema https://game.nsgo.dev/schemas/automations.v1.json) let the agent run follow-up checks and tasks after a change while keeping every result reviewable (docs/design/editor/Settings.dc.html, Tasks.dc.html, Checkpoints.dc.html):
- Versioned YAML format (
AutomationsFile,ParseAutomations,EncodeAutomations):version: 1with an orderedautomationslist of{id, name, enabled, trigger, instruction}. Unknown fields, trailing documents, duplicate keys, YAML anchors/aliases, duplicate IDs, and invalid trigger options are refused with*loaderr.Errorline/column diagnostics; encoding is deterministic and round-trips byte for byte. - Five triggers:
file_changed(glob): fires when a matching project file is saved (manual save, autosave, or tab save), supporting*,**, and?.review_kept(optionalglob): fires when an edit review is kept (KeepReview,EndReview(true),KeepTileReview,KeepCutsceneReview,KeepAllReviewChanges,KeepAgentTurnReview), skipping the originating automation ID to avoid recursion.file_added(kind, optionalglob): fires when a new file of kindprefab,scene,tileset,cutscene,material,particles,rig,screen,datatable,script,asset, oranyis created (NewScene) or detected by disk watching (PollDiskChanges).before_export(optionalplatform): fires beforeStartExportBuildorStartReleaseBuild.daily(timein 24-hourHH:MM): fires once per calendar day at or aftertimewhile the editor is open (driven periodically by the UI scope scheduler and deterministically viaEditor.StepAutomations).
- Pre-run checkpoints, permissions, background tasks, and Ready to review: before starting any automation task, the editor snapshots tracked project text/YAML/Go files (excluding You-only and internal state files, bounded by file count and total size, skipping symlinks) into
.nsgo/checkpoints/<id>/(git-ignored, inspectable viaAutomationCheckpoints, restorable viaRestoreAutomationCheckpointwith symlink containment checks). Each run executes under bounded concurrency with a timeout, underWithAgentActorand the project's permission rules (Editor.Permissions/CheckAutomationActionPermission), appears in the shared background task list (TaskSourceAutomation) and as anAgentTurnin Ready to review (AgentReviewReady) inside the Agent panel with Keep, Dismiss, and Restore checkpoint controls.automations.yamland.nsgo/automations-state.yamlare protected by the You-only trust boundary (YouOnlyAutomations), and automations can never apply You-only drafts (PermissionsDraft,AutomationDraft), confirm held loosenings or proposed deletions, or keep/modify their own reviews (ErrAutomationYouOnly). - Settings › Automations (
SettingsPageAutomations): listsWHEN → THE AGENTcards with weekly run counts (AutomationWeeklyRuns, stored locally in git-ignored.nsgo/automations-state.yaml) andSpecSwitch(core.RoleSwitch) toggles, + New automation, in words (DraftAutomationFromWords-> reviewable YAML card -> human Keep viaKeepAutomationDraft), Pause all automations for today (PauseAutomationsForToday/ResumeAutomations— stops every trigger until the next calendar day), and the Agent on this page card, styled exclusively withSpecPalettetokens in Dark and Light appearances.
Change-by-change agent turn review (#1014)
When an agent completes a turn (Editor.StartTurnReview), the full-window Review screen (ReviewScreenView, docs/design/editor/Review.dc.html, styled strictly with Spec.dc.html tokens in both Dark and Light appearances) lets the author inspect every change across scenes, prefabs, data tables, and Go files one by one before keeping them in a single undo step:
- Header and blockers: displays ← Editor (
Esc), the quoted agent request, an optional blocker warning pill (when a conflict, YAML error, or other blocker prevents keeping), Revert all (⌘⌫/Ctrl+Backspace), and Keep N of M (⌘↵/Ctrl+Enter). When any blocker is active, Keep refuses to commit and jumps focus straight to the blocking change (JumpToReviewBlocker). - Grouped left list and filters: pairs a live search input (
SetReviewSearch, matching name, field, detail, or file path), a"N of M seen"counter with progress bar and Previous/Next buttons, and six counted filter chips (All, Added, Changed, Removed, Unseen, Notes viaSetReviewFilter). Changes are grouped by file (path,+n ~n −ncounts, fold toggle, Revert file / Restore file), then by kind (ADDED, CHANGED, REMOVED with fold and Revert n / Restore n), then one card per change with a seen mark, semantic kind mark, title, detail, and Revert / Restore (X). Focusing any change marks it seen. - Keyboard scope (
ScopeReview) and navigation: registersJ(CmdReviewNext),K(CmdReviewPrev),X(CmdReviewToggleRevert, toggling the focused change, kind group, or file group),B(CmdReviewPeekBefore, holdBto peek at the scene as it was before the request),⌘↵(CmdReviewKeep), and⌘⌫(CmdReviewRevertAll) inScopeReview. Every control shows the Spec 2 px focus ring and is reachable viaTab,F6/Shift-F6(cycling Header → List → Preview → Why & YAML), or arrows; typing in the filter field never triggers single-letter shortcuts. - Adaptive center preview:
- Scene files: renders the focused change's scene (
BuiltScene) with clickable top-left overlay legend toggles (ToggleReviewOverlayLegend), draws unfocused changes at1.5 pxand the focused change in its own semantic color and dash at2.5 pxwith an outlined pill (never Spec accent, which remains reserved for selection), draws reverted changes as they were before the request, frames each focused object onJ/K, and shows"Before this request"while holdingB. - Prefab files: shows before → after field values with numeric
Δ%and computes where the change applies across both scenes in the current review and existing project scenes viaEditor.FindUsages. - Small data tables: renders the table (
ReviewDataTablePreviewFor) with changed rows highlighted and modified cells showingold → new Δ%.
- Scene files: renders the focused change's scene (
- Right pane (Why + YAML): shows the agent's reason (WHY) above the line-numbered YAML lines touched by the focused change with
+/−signs. - Esc / Resume pending state: pressing
Esc(PauseReview) returns to the editor while leaving the review pending—the main viewport renders pending change overlays (drawPendingReviewOverlay) and the right-rail Agent tab (AgentPanelView) shows"Review waiting · N changes, F files"with seen count, blockers, and Resume review (ResumeReview), which returns to the exact same focused change and seen state. - Keep, Revert all, and one-step Undo: Revert all asks in a focus-trapped confirmation dialog naming every file that goes back and reminding that
⌘Z/Ctrl+Zbrings everything back. Both Keep (KeepTurnReview) and Revert all (ConfirmReviewRevertAll) execute as oneEditor.Historystep, update saved YAML files and the open scene, show a Spec toast with Undo, and record"Kept K · reverted R · one undo step"in the Agent panel; a singleEditor.Undo()restores every touched file byte for byte. - MCP read access (
editormcp): the read-onlyreview_statustool (ToolReviewStatus,ActionRead) lets connected agents inspect which changes have been seen or reverted, overlapping conflict choices (mine,agent,both), hand-edited YAML fields and lines tagged"you", active blockers, and keep/revert outcomes (including after Keep for round 2) without granting the agent permission to keep or revert the turn (unsent draft notes are never exposed, andSceneAndData/GoSourceprivacy rules are enforced).
Review notes and second-round redo (#1031)
Instead of reverting everything or hand-editing YAML when one or two changes need adjustment, authors can leave change-scoped notes on the active turn and have the agent redo only those changes as Round 2 within the same review (docs/design/editor/Review.dc.html):
- Inline note composer (
C/CmdReviewNote) and viewport pins: pressingCon a focused change (or clicking its speech-bubble button) opens an inline note composer under the card ("Note for the agent · not sent") with Add note (CommitReviewNote), Revert and redo with this note (RevertAndRedoReviewChange), and Cancel (CancelReviewNoteComposer, orEsc). Saved notes appear on the card with Edit and Remove (RemoveReviewNote) and as Spec-token speech-bubble pins beside noted objects in both the Review viewport and the paused 2D viewport (ReviewViewportPins). Notes live strictly in memory on the turn, are bounded in length and count, and are never written to any scene, prefab, or data file; a note added and removed before sending never reaches the agent. - Send notes and noted-only redo (
SendReviewNotes,ApplyReviewRedo,editormcp): clicking Send N notes in the header (which becomes the primary accent button while unsent notes exist) dispatches all remaining notes to the agent over MCP (review_notes_get), naming each change'schange_id,file,object,field,kind, andnote. The agent revises only noted changes within the same turn viareview_redo(un-noted changes and tampered un-noted objects in the same file are refused, You-only/permission/privacy rules are enforced). Redone changes appear unseen again in Round 2+ with"Redone from your note: …"in WHY and"Revised in round N. Your note: …"on the card. - Round tabs, banner, filters, paused card, and single-step Undo: once Round 2 exists, the header shows Round 1 | Round 2 tabs (
SetReviewViewRound) and a banner below the filter chips ("Round 2 · the agent redid only the N changes you left notes on. Both rounds keep and undo as one step."). Round 1 is read-only (ErrReviewReadOnlyRoundon edit/revert/note attempts) and shows the agent's first version for comparison; Keep (⌘↵) always applies the latest round as oneEditor.Historystep, so a single Undo (⌘Z) restores every touched file to its exact pre-request bytes. The Notes chip filters to changes with notes, the paused Agent panel card shows unsent note counts ("N notes not sent"), and the Revert all dialog warns that pending notes will be dropped.
Review conflicts and in-place YAML hand editing (#1032)
Inside the change-by-change Review screen, two cases block Keep cleanly without losing either the author's or the agent's work:
- Three-way conflict resolution (
syncReviewAfterMutate,SyncReviewPersonEdits,ResolveReviewConflict): manual edits made through editor commands (MoveObject,SetProperty,SetComponentField, and so on) while a review turn is pending automatically three-way merge against the turn baseline and agent snapshot viasceneformat.Merge. Edits to different fields of the same object merge cleanly without asking; overlapping edits to the same field or list (such as appending todoor_1'son_openlist) display both sides inside the change card with line authors (you,agent) and a Mine / Agent's / Both segmented control (ReviewConflictMine,ReviewConflictAgent,ReviewConflictBoth), where Both keeps both entries with yours first. Until every unresolved conflict is chosen, Keep is disabled (*ReviewBlockedErrorwrappingErrReviewBlocked) with"Choose how <object> merges", and pressing Keep or the header blocker jumps straight to that change. - In-place YAML editing and live viewport preview (
BeginReviewYAMLEdit,SetReviewYAMLDraft,FinishReviewYAMLEdit): clicking Edit on any non-reverted added or changed scene object makes the right-hand YAML pane editable in place without losing text-input focus or firing single-letter Review shortcuts while typing. Drafts are bounded (256 KiB), strictly decoded withKnownFields(true), checked for duplicate keys andsceneformat.Validate(and component registry rules), and checked against You-only boundaries. Valid edits update the Review viewport live (ReviewEffectiveSceneDoc) and tag hand-edited linesyou. - Parse errors, mechanical one-step fixes, and Undo my typing (
ApplyReviewYAMLFix,UndoReviewYAMLTyping): invalid YAML (such as typingx 444without a colon) marks the failing scene line, surfaces"Fix YAML on line N"in the header blocker and"Line N isn't valid YAML"in the alert card, disables Done (ErrReviewYAMLInvalid) and Keep, offers verified one-step fixes when the parser names what is missing (Add the colon, Close the quote, Add the closing brace, Add the closing bracket, Replace tabs with spaces), and always provides Undo my typing. - Single undo step and round-2 MCP visibility: conflict merge choices and valid hand edits land with the turn in one
Editor.Historystep (KeepTurnReview)—oneUndoreverts the agent turn, merge choice, and hand edit together while preserving any concurrent manual edits made outside the review—and remain readable througheditormcp'sreview_statustool (Editor.ReviewStatus) tagged"you"for round 2.
System notifications, Dock badge, and Play-mode dot for agent tasks (#1023)
Agent tasks (both background tasks managed via tasks.go / #1022 and foreground Agent panel runs) reach the person outside the editor through NSGo's native notification and badge APIs (core.Scope.ShowNotification, core.Scope.RequestNotificationPermission, core.Scope.OnNotificationPress, and core.Scope.SetBadge), matching docs/design/editor/Tasks.dc.html, docs/design/editor/AgentStates.dc.html, and docs/design/editor/Spec.dc.html using exclusively Spec design tokens:
- Only three events notify: waiting for permission (
TaskNeedsYou), ready to review (TaskReadyToReview), and failed (TaskFailed), formatted with"NSGo Editor · <project>", the task title, detail, and primary action (Allow once,Review, orOpen) with control-character sanitization and length bounds. Finished steps, queued starts, restored thread entries on load, and agent replies never send system notifications. - Permission on first need and 30 s rule:
cx.RequestNotificationPermissionis called only the first time a notification is actually needed (preserving macOS Dock badges before any notification permission check). When the editor window is in the background (cx.Env().Lifecycle() != core.LifecycleActive), all three events notify immediately; in the foreground, an unanswered waiting request notifies afterAgentWaitingNotifyDelay(30 s) unless answered first. - Click opens the task in its scene:
cx.OnNotificationPress(delegating toEditor.HandleNotificationPress/Editor.OpenAgentTask) brings the editor window to the front (also callingEditor.OnFocusWindowwhen set), stops Play if running, dismisses obstructing panels (Settings, History, Problem agent panel, Ask-in-place, Assets mode), switches to or safely opens the task's scene tab strictly confined inside the project root (refusing traversal and symlink escapes), opens the Tasks or Agent panel, and focuses the task and any open request card. - Dock badge (
cx.SetBadge):Editor.AgentDockBadgeCountcounts waiting (TaskNeedsYou), ready to review (TaskReadyToReview), and failed (TaskFailed) tasks (AgentTaskCounts.BadgeCount()); running and queued tasks never add to the badge, and0clears it (including on scope cleanup). - Play-mode corner dot and deferred notifications (
PlayTaskDotView): while Play mode is active (Editor.Playing()), agent task notifications do not pop over the running game and are held (Editor.HeldAgentNotifications) untilEditor.Stop()flushes any tasks still needing attention. A single 8 pt dot with a 3 pt halo stays stably mounted in the top-right corner of the viewport in the Spec color of the most urgent state (FailedRemoved.Fg> WaitingWarning.Fg> Ready to reviewAccent.Fg), revealing its label pill (such as"1 task needs you · stop Play to open") only on hover or keyboard focus.
Live agent edits in the viewport and scene tree (#1013)
While an agent edits a scene through editormcp or an active agent turn (Editor.BeginAgentTurn / Editor.RunAsAgent), the editor shows its pending changes live in both the viewport and scene tree (docs/design/editor/Working.dc.html, Main.dc.html, and Spec.dc.html) without ever moving the 2D or 3D viewport camera on the agent's behalf:
- Live viewport overlays (
ViewportLiveOverlays/VisibleViewportLiveOverlays):- Added: 1.5 px dashed green outline (
SpecPalette.Added) and"+ <name>"mono pill. - Changed: 1.5 px dashed amber outline (
SpecPalette.Changed) and"<field> <old> → <new>"mono pill (also synced into the Inspector's amber review markers). - Removed: 25% grey ghost at the object's pre-turn bounds, 1.5 px solid red outline (
SpecPalette.Removed), and a"<name> removed"pill with the object's name struck through. - Agent working: 1.5 px solid pulsing violet outline (
SpecPalette.Agent, 1.6 s pulse between 45% and 100% opacity, held solid at 100% under reduced motion) with no resize handles and a pill carrying the violet sparkle glyph and activity text (for exampleplaying level_01 headless). - Problem: 2 px solid red outline and filled alert pill for object-scoped diagnostics.
- Non-overlapping pill placement automatically stacks colliding pills vertically so adjacent objects stay readable.
- Added: 1.5 px dashed green outline (
- Selection coexistence and read-only step guard: when the user selects an object the agent is actively touching (
Editor.BeginAgentStep/editormcp.Server.BeginStep), the selection keeps its resize/transform handles and the agent outline sits 3 px further out (OutsetPx: 6). Until the agent's step moves on (EndAgentStep), manual edits to that object are refused withErrAgentTouchingObjectacross the viewport, 2D/3D gizmos, inspector (which shows a violet read-only banner), scene tree (rename and reparent), context menu, and directEditormutation methods, while untouched objects remain freely editable. - Scene tree markers: added nodes show a
NEWbadge, changed nodes show aMODbadge, removed nodes remain visible as struck-through ghost rows with aDELbadge, and currently touched nodes display a violet agent-working dot until Keep or Revert. - Header pill: follows the agent's state (
Editor.SetAgentState/Editor.AgentState): violet working pill ("Agent is <activity> · manual edits stay available"), warning waiting pill ("Waiting for you · <detail>"), pending-review pill with Keep (KeepAgentTurn, collapsing the turn into one undo step) and Revert (RevertAgentTurn, undoing the turn and restoring removed objects), and hidden while idle. - Interactive top-left Overlay Legend: appears automatically whenever live overlays are active (or when
OverlayLegendOpenis true). Each row (Selection, Agent working, Added, Changed, Removed, Problem) is aRoleSwitchtoggle (ToggleOverlayLegendKind/SetOverlayLegendKind) persisted per-user inEditorSettings.HiddenOverlayKinds(hiddenOverlayKindsineditor.yaml, schemaeditor-settings.v1.json) without modifying project files.
Agent threads per line of work, grouped by scene (#1019)
The right rail (RightRailView) switches between Agent (AgentPanelView / AgentThreadsView), Inspector (InspectorView, the default tab), and History (AgentHistoryView), using docs/design/editor/Spec.dc.html tokens matching Threads.dc.html across Dark and Light appearances:
- One YAML file per thread under
.nsgo/threads/(AgentThread,AgentThreadFileVersion = 1): each thread is persisted as a strict versioned YAML document at.nsgo/threads/<id>.yaml(with.nsgo/.gitignoreautomatically ignoring the directory from git), storingid,title(named from its first request),scenePath, external agentsessionId(SetAgentThreadSessionID), timestamps, and chronologicalrequestswithsteps,outcome(pending,kept,reverted), change counts, changedobjects, andhistorySteplinks. Parsed withParseAgentThreadYAMLand written canonically withEncodeAgentThreadYAML(JSON Schemahttps://game.nsgo.dev/schemas/agent-thread.v1.json). - Grouped thread switcher, search, and
⌘N(AgentThreadGroups,CmdNewAgentThread): the switcher groups threads under<OPEN_SCENE> · OPEN SCENE, other scenes (<SCENE>), andPROJECT · NO SCENE, each showing relative age and state (now · 3 changes to review,1 h ago · kept 5 of 6,yesterday · reverted, or changed files). Opening or switching scenes enters that scene's most recent thread (or a fresh draft) and never carries another scene's thread along;⌘N(ScopeAgent) starts a new empty thread. - Folded earlier requests, History link, and Jump to latest: earlier reviewed requests fold to one line each (
N EARLIER REQUESTS) and expand on click to show the full prompt, changed fields, steps, and Open this step in History (OpenHistoryStep), which opens the unified History timeline highlighted on that step. Expanding an earlier request surfaces a floating Jump to latest pill (JumpToLatestAgentRequest). - Empty-thread view (
AgentAlwaysReadItems,AgentBriefSuggestions): an empty thread lists what the agent reads with every request (<scene> · whole scene,brief.yaml,AGENTS.md,Viewport image) and up to three starter prompts read safely from the project'sbrief.yaml(FROM YOUR BRIEF). - Inspector footer attribution (
LastAgentChangeForObject,OpenAgentRequest): when a selected object was changed by a non-reverted agent request (viaSendAgentRequestWith,RecordAgentStep, oreditormcp'sscene_edit), the Inspector footer displaysChanged in “<request>” · <age>and clicking it opens that thread and expands that request.
Viewport sketch layer for the agent (#1025)
Draw session-only numbered annotations directly over the 2D viewport to point at empty places in a level before asking the agent to build them (docs/design/editor/Sketch.dc.html, styled exclusively with docs/design/editor/Spec.dc.html tokens):
- Four sketch tools in scene coordinates: press
D(CmdSketchToggle, orView > Sketch) to toggle Sketch mode without adding extra buttons to the compact 2Deditor-toolbar. Switch between Pen (P, freehand polyline), Arrow (A, start → end), Box (B, rect), and Text (T, point + label) inScopeSketch, or place a mark at the cursor withI(CmdSketchAddMarkAtCursor). Every mark gets a sequential numbered badge (1,2,3, …) and an optional label (such as"3 spikes","platform, back and forth","locked until the lever"). All geometry is converted throughCanvasToWorldand stored strictly in scene coordinates so marks scale and pan accurately across zoom levels and are never written intoSceneDoc,*.scene.yaml, or scene undoHistory. - Sketch bar, Scene Tree row, and status bar: the floating sketch bar displays the four tools, Undo last mark (
⌘ZinScopeSketch), Hide / Show marks (H),"N marks not saved", Clear, and Done. PressingEscfinishes sketch mode while keeping drawn marks until sent, cleared, or kept. The Scene Tree displays a compactSKETCH LAYERrow (N marks · not saved), and the status bar shows live scene coordinates and the active sketch tool. - Sending a sketch to the agent (
SendSketch/Editor.OnSendSketch): the composer attaches a"Sketch · N marks"context chip (clicking toggles a"Sent with this request"scene-coordinate preview). Sending deliversSketchAgentRequestwith structured marks (number,kind, geometry in scene coordinates,label) and a rendered PNG of the viewport with numbered marks overlaid (RenderSketchViewportPNG). - Agent reading card &
scene_editconfirmation hold: sending a sketch arms a hold gate (SketchHoldActive() == true) that causesscene_editand other mutating scene MCP tools to refuse edits until the person confirms. The agent reads marks viasketch_readand posts its restatement ("I read your sketch as: …"with numbered items and assumptions) viasketch_reading(PostSketchReading). Clicking Go ahead (ApproveSketchReading,⌘↵) releases the hold; clicking Correct a mark (CorrectSketchMark,⇧M, or clicking any numbered item) reopens sketch mode with that exact mark selected while keeping the hold active; replying in words (ReplyToSketchReading) works too. - Review overlay & Keep / Revert: after approval, agent edits open a review card (
SketchReviewOpen) with a Sketch overlay toggle (O,ToggleSketchReviewOverlay, also available inTileReview) that lays the faint dotted sketch over the result. Keep (KeepSketchReview/KeepTileReview) keeps the edits and clears the sketch layer; Revert (RevertSketchReview/RevertAllTileReview) undoes the edits while keeping the sketch marks intact to send again.
Reference images in the agent composer and pinning to the brief (#1027)
Attach PNG, JPEG, or WebP reference images to a single agent request or pin them to the project's game brief, matching docs/design/editor/Sketch.dc.html (Paste or drop an image, Pin to brief) using exclusively docs/design/editor/Spec.dc.html tokens:
- Drop, paste, or pick PNG, JPEG, and WebP: dragging files over the Agent composer shows the Spec-styled "Drop to attach" overlay (
SetAgentComposerDragOver,DropAgentReferenceFiles); pasting an image or image files into the composer (HandleAgentComposerPasteviacore.Input.OnPaste, orPasteAgentReferenceImage) or clicking the Attach an image button (PickAndAttachAgentReferenceImages/CmdAttachReferenceImage) validates actual PNG, JPEG, or WebP headers and pixels in memory (DecodeAgentReferenceImage). Unsupported file types (such as GIF, SVG, BMP, text, or corrupted images) are refused with the exact reason in an accessible error banner (AgentAttachError). - One-shot chips with hover preview: each attached image appears as a chip with a thumbnail, filename, Pin to brief button, and × remove button (
RemoveAgentReferenceImage). Hovering or focusing a chip displays a floating preview card above the composer with the decoded image, format, dimensions, and scope (Sent with this request only). Submitting a request (SubmitAgentPrompt) delivers attached images inAgentRequest.AttachedImagesandAgentRequest.Images(and records thumbnails onAgentTurn.Images), then clears the one-shot chips so the next request does not carry them. - Pin to brief (
PinAgentReferenceImage): clicking Pin to brief copies the image toart/reference/<name>(disambiguating collisions without overwriting different files) and adds an entry underart.referencesinbrief.yamlvia YAML AST editing (preserving existing keys and comments) as one atomic, undoableEditor.Historystep. Both files immediately appear in Review / Changes (RefreshChanges), a confirmation card displays the+YAML diff with an Undo button (UndoLastBriefPin), and a single Undo removes both the copied file and the YAML line (or deletes a freshly createdbrief.yamland emptyart/reference/folder). - Always chip (
brief.yaml): wheneverbrief.yamlexists, the composer shows the Always row with a lockedbrief.yamlchip (showing the pinned reference count when non-zero). Hovering or pressing the chip previews every pinned reference image, and every subsequent agent request automatically includes those images viaAgentRequest.BriefImagesandAgentRequest.Images.
Agent turns: multi-file pending changes as one undo step (#1011)
Every edit an agent makes through the editor's MCP server between the start and end of one request (started from the Agent panel or opened via turn_start and closed via turn_end) accumulates into one pending agent turn across every file it touches—scenes, prefabs, data tables, game.yaml, and animation clips:
- Live in memory, zero disk writes until Keep + Save: edits apply in memory immediately so the viewport, scene tree, inspector, and
scene_readshow them live (Editor.StagedFileYAML), while nothing is written to disk until the person keeps the turn and saves. Saving (Save/SaveAll) refuses while a turn is still pending, and autosave pauses while a turn is open. - Derived structural diff with
why: rather than logging raw commands, the editor structurally diffs each touched file between its pre-turn state and its current state (per object ID and field/component/property/layer/parent for scenes and prefabs, per record for data tables, per dotted key forgame.yaml, per header/track/event for clips). Each derivedAgentTurnChangecarriesKind(added,changed,removed),Title, conciseDetail(such asz 10 → 12),File, 1-based YAMLLine, optionalWhyreason (from MCP edit tools'whyargument), andRevertedflag, alongside exact per-file+added −removedline counts. - Per-change and per-file Revert / Restore while pending: while a turn is pending or stopped (
⌘./CmdStopAgentTurn), the person can revert or restore any individual change (RevertAgentTurnChange/RestoreAgentTurnChange/ToggleAgentTurnChange) or every change in a file (RevertAgentTurnFile/RestoreAgentTurnFile). Reverted changes leave in-memory state immediately and return cleanly on restore, leaving untouched edits (including concurrent person edits on other objects) intact. - Keep and Revert as one Undo step + Spec toast:
- Keep (
KeepAgentTurn/⌘↵/CmdKeepAgentTurn) commits all remaining changes across every touched file as oneEditor.Historycommand taggedAuthorAgent/HistoryAuthorAgent(History.Entries(),History.UndoAuthor(),History.RedoAuthor()). One⌘Zrestores every touched file byte-for-byte, and⇧⌘Zredoes the entire kept turn. A SpecToastSuccessappears with an Undo (⌘Z) action. - Revert (
RevertAgentTurn/⌘⌫/CmdRevertAgentTurn) restores every touched file to its exact pre-request state and shows a SpecToastInfowhose Undo action (UndoRevertAgentTurn) brings the turn back as pending. - Checkpoints
⌘Zrules: while the agent is actively working (AgentTurnWorking),⌘Zundoes only the person's own edits; inside an open review (AgentTurnReviewOpen),⌘Zundoes the person's edits made inside the review first and then reverts the review; once kept or idle,⌘Zundoes the ordinary history stack.
- Keep (
- Right-panel Agent tab & Summary Card (
RightRailView/AgentPanelView): switch between Agent (mod+1/CmdAgentTab) and Inspector (mod+2/CmdInspectorTab) in the right panel header (showing a live pending indicator dot and MCP connection status). Styled exclusively withSpec.dc.htmltokens matchingMain.dc.html(localized in English and Chinese), the Agent panel displays the request bubble, progress steps, working Stop (⌘.) control, completion summary, the small summary card ("6 changes · 1 file · +38 −0", grouped changes with per-change and per-file Revert/Restore, Keep, Review, Revert), Kept/Reverted notes ("one undo step (⌘Z)"), and the composer with"Edits stay unsaved until you keep them". - Navigation, close, and boundary protection: opening another scene (
RequestOpenScene), switching scene tabs (RequestSelectTab), switching projects (RequestOpenProject), closing the window, or quitting with a pending turn prompts Keep, Revert, or Cancel (pendingTurnDialog), matching unsaved-changes behavior. Every staged file enforces project-root symlink containment, refuses.git/**and You-only files, enforces a 2 MiB per-file limit, and resets cleanly onOpenProjectandOpenDemo. - MCP surface (
editormcp):turn_start,turn_end,turn_status(read-only, reporting reverted changes), andfile_edit(validatinggame.yaml, data tables, clips, prefabs, and scenes in memory) work alongsidescene_editandobject_set_field'swhysupport. By design there is no MCP tool that keeps or reverts a turn.
Agent panel failure, recovery, and offline states (#1024)
When an agent request does not simply succeed, AgentPanelView renders dedicated docs/design/editor/AgentStates.dc.html cards using exclusively SpecPalette tokens (both Dark and Light themes) while keeping every manual editing tool (Select, Move, Inspector, CheckProblems, and Play) working in every state:
- Partial (
AgentPartialState): displays"Done N of M · couldn't place <target>"with the explanation, Keep these (keeps partial edits as undoable changes), Let me point (ToggleAgentPointing, clicking in the 2D viewport picks world coordinates viaPickAgentPointWorldandEsccancels cleanly), Try another way (TryAnotherWayAgentTurn), and a change-count review strip (N changes · 1 file | +X −Y | Review). - Stuck (
AgentStuckState): when the same MCP tool (such asscene_edit) fails three times in a row (AgentStuckFailureThreshold = 3), the editor pauses/cancels the active request instead of guessing again, transitions the header chip toWaiting for you, lists all three refused calls with their errors in a recessed monospace log, and offers a Hint for the agent input with Continue with hint (ContinueAgentWithHint) or Stop here (StopStuckAgentTurn, leaving the scene and disk untouched since refused edits never mutate files). - Lost (
AgentLostState): when an MCP client disconnects or a model API fails mid-request, completed steps stay intact in an unkeptAgentTurnReview, the interrupted step is marked"cut off, nothing written"with no partly written file on disk, and the card states when and at which step it failed alongside Reconnect, Review N changes, and Troubleshoot (or Retry now and fallback switching such as Use Claude Code for model errors like 529 overloaded). After reconnecting, the agent asks before picking up at the next step (ConfirmResumeLostAgentTurn/DismissResumeLostAgentTurn) instead of auto-resuming. - Stopped (
AgentStoppedState): stopping a running turn recordsDONEandNOT DONEstep sections, Resume (ResumeAgentTurn, which starts strictly at the first not-done step and skips steps already done), and Review N changes; completed changes stay unkept until explicitly reviewed and kept. - Mismatch (
AgentMismatchReport): the editor automatically checks every turn summary against the actual diff (CheckAgentSummaryAgainstDiff) and displays aWHAT · SUMMARY · REVIEWtable when they disagree, including the auto-derived reason when known (for example, an object added at step 3 and removed at step 5), Ask why (AskAgentWhyMismatch), and Open review (OpenAgentTurnReview). Keep always applies the actual review diff, never the prose summary. - Offline (
AgentStatusOffline,SetAgentOffline): displays"You're offline"and queues submitted requests with timestamps (AgentQueuedRequests,QueueAgentRequest,RemoveQueuedAgentRequest) while Select, Move, the Inspector, game check, and Play keep working. Returning online never runs queued requests on its own; each queued request waits for an explicit Send (SendQueuedAgentRequest).
Spec viewport overlays and toggle legend (#1006)
Every semantic overlay drawn over the 2D and 3D viewports passes through one shared helper (DrawObjectOverlay) using exclusively SpecPalette tokens (docs/design/editor/Spec.dc.html, "Overlay legend"), with a non-color second cue (corner handles, pill glyph/prefix, ghost fill, strikethrough, or filled alert badge) so every kind remains distinguishable in greyscale:
Kind (OverlayKind) |
Token & line style | Second cue |
|---|---|---|
Selection (selection) |
Accent, 1.5 px solid |
Four 8×8 corner handles and an accent name tag (person's selection only) |
Agent working (agent) |
Agent, 1.5 px solid, no handles |
Pulsing 1.6 s between 100% and 45%, dark pill with 4-point agent glyph (or numbered task badge) saying what the agent is doing |
Added (added) |
Added, 1.5 px dashed |
Dark pill labelled "+ <name>" |
Changed (changed) |
Changed, 1.5 px dashed |
Dark pill showing field, old, and new value (for example "z 10 → 12") |
Removed (removed) |
Removed, 1.5 px solid |
25% grey ghost fill and dark pill with struck-through object name + "removed" |
Problem (problem) |
Problem, 2 px solid on the live object |
Filled pill (Problem.Fg / Problem.OnFill) with alert triangle icon and message; never resembles a removed ghost |
Focused change in Review (focused) |
Base change kind's own color and dash at 2.5 px (never Accent) |
Bright outlined pill matching the change kind |
- Pairing, motion, and reduced motion: When Selection and Agent working sit on the same object (
PairedWithSelection), Selection keeps its four corner handles and the Agent outline sits 3 px further out (OverlaySelectionAgentGap) with its pill stacked above. Added, Changed, and Removed overlays fade in over 240 ms (OverlayChangeFadeDuration/OverlayFadeAlpha), and active Agent working outlines pulse on a 1.6 s cycle (OverlayAgentPulsePeriod/OverlayAgentPulseAlpha). With reduced motion enabled (core.Environment.ReduceMotionorEditor.SetReduceMotion(true)), change overlays appear immediately at 100% and Agent outlines stay solid at 100% with no animation timer running. - Top-left toggle legend (
viewport-overlay-legend): Every edit-mode viewport (both 2D and 3D) mounts the same top-left legend card (viewportOverlayLegendView) with six accessiblerole="switch"rows (Selection, Agent working, Added, Changed, Removed, Problem), each showing its drawn line style and second cue. Toggling any row (Editor.ToggleOverlayKind,Editor.SetOverlayKindVisible,Editor.SetOverlayLegendKinds) hides or shows that kind across all viewports immediately and persistsoverlayLegendin the per-userEditorSettingsYAML file (Editor.SettingsPath, outside the project, never modifying project or scene files). - Live scene overlay API and Problems object attribution: Live agent edits, reviews, and plans attach overlays to objects (or removed ghost bounds) via
Editor.SetSceneOverlays,AddSceneOverlay,RemoveSceneOverlay, andClearSceneOverlays(SceneOverlayEntry).assetcheck.Problemnow carriesObject(also returned byeditormcp'sgame_check) for scene object, component, override, and connection diagnostics so Problems naming a live object in the open scene automatically draw the Spec Problem overlay on that object in both 2D and 3D viewports. - Neutral viewport guides: The camera frame, camera bounds, camera tether, tile grid, and snap grid use neutral
SpecPalettetokens (TextMuted/TextFaint1 px hairline and2, 4dotted lines) that no semantic legend kind uses.
Agent composer: @-mentions, context chips, and context meter (#1020)
Inside the unified right-rail Agent tab (RightRailView / AgentPanelView, switchable with ⌘1 / ⌘2 via CmdAgentTab / CmdInspectorTab), AgentComposerView (docs/design/editor/Threads.dc.html, styled strictly with Spec.dc.html tokens) adds @-mentions, explicit context chips, exact hover previews, and a live context meter:
@-mention picker over the project search index: typing@in the composer opens a live picker backed bysearch.go(ensureProjectIndex),Editor.Problems,PlaytestSession/AddComposerPlaytestRun, andEditor.History, showing a match count and 8 groups (Objects, Files, Prefabs, Assets, Problems, Playtest runs, History steps, Rules) with 9 tabs (All plus each group). Navigate with↑/↓(MoveMentionSelection), add with↵(AcceptActiveMention), cycle groups withTab/Shift+Tab(CycleMentionPickerGroup), and close withEsc(CloseMentionPicker). Already-attached items are filtered out.- Context chips and exact hover preview: above the composer, attached chips show what joins the request (removable by clicking
×viaRemoveComposerChipor pressing⌫in an empty composer viaRemoveLastComposerChip), Always chips showbrief.yamlandAGENTS.mdwhen present in the project root, and Viewport image is a toggleable chip (SetViewportImageIncluded/ToggleViewportImage). Selecting an object in the viewport or scene tree only surfaces a dashed+ <Name> · selectedsuggestion chip (SuggestedChip)—nothing joins the request unless explicitly added (AcceptSuggestedChip).TriggerAskAgentShortcutattaches the selected object or, when nothing is selected, the whole open scene (AttachWholeSceneChip) and focuses the composer. Hovering any chip (SetHoveredChip/HoveredChipPayload) displays the exact header (# level_01.scene.yaml · lines 72–78) and YAML text or image bytes resolved byResolveChipPayload. - Single-source request assembly:
AssembleAgentRequestbuildsAgentRequestfrom the active chips and nothing else—calling the exact sameResolveChipPayloadfunction used on hover—and feeds bothSendComposerPrompt(Editor.OnSendAgentComposerRequest) andSubmitAgentPrompt(Editor.AgentRunner). - Context meter ring, breakdown, Compact, and Start fresh: a 20×20 circular progress ring reflects reported token usage (
SetAgentTokenUsageorAgentResponse.Usage) across three Spec states (normal≤ 70%, amber warning71–89%, and critical≥ 90%"compact now"). Clicking the ring opens a 6-row breakdown (Conversation, Open scene, Attached, Always, Tools and instructions, Viewport image) with Compact thread (CompactAgentThread, folding earlier requests into a summary while keeping the last request whole and dropping the ring) and Start fresh with summary (StartFreshAgentThread, opening a new thread seeded with that summary).
AI-first main layout (#1007)
The editor's main window (main_layout_ui.go, ui.go, agent_ui.go, overlays_ui.go, scenetree.go) implements the AI-first workspace from docs/design/editor/Main.dc.html using exclusively docs/design/editor/Spec.dc.html tokens, sizing, and accessible controls:
- 44 px header (
mainHeaderView): displays the<project> / <scene>breadcrumb (ProjectDisplayName,SceneBreadcrumbName) with a Scene file menu and unsaved dot (aria-label: "unsaved changes"/"save failed"), a centered toolbase.RadioGroup(Select V,Move W,Rotate E,Scale R,Pan Spaceas icon-only Lucide 1.8 px@15 pxcurrentColoricons with"Label · key"tooltips), a2D / 3Dsegmented radio group,History (⌘Y)icon button,Search ⌘Kpalette button, andPlay (⌘P)as the single primary button. - 232 px left rail (
leftRailSceneView): combines theScene / Assetsswitcher withSCENE · N nodes(SceneNodeCount), a quick filter toggle (SceneTreeFilter/SetSceneTreeFilter/SetSceneTreeFilterOpen) that narrows the scene tree by name, ID, or kind with auto-expanded ancestors, a quick-add+menu (AddSceneRailObjectfor empty object, trigger, or light andAddSceneRailLayer, all undoable throughHistory), scene tree rows carrying kind color dots (ObjectKindColor), kind tags (SceneRailObjectKind,LayerKindLabel), andNEWbadges on pending-review proposed objects (IsObjectProposedNew,SetProposedNewObjectIDs) with ellipsis-safe layout so visibility/lock buttons never clip, and a bottomFILESsection listing the open scene, prefabs/instanced scenes it uses (SceneUsedPrefabs), andgame.yaml. Picking a scene tree row switches the right rail to Inspector. - Viewport dot grid, non-sprite markers, caption, bottom bar, and overlay legend: in 2D edit mode,
DrawViewportdraws the neutral Spec 16×16 dot-grid surround (SpecPalette.ViewportDot) when no scene background color is set and neutral Spec-token markers for visible non-sprite objects so empty nodes, prefabs without sprites, and triggers stay legible and clickable without colliding with semantic overlay legend hues.viewportCameraCaptionViewsubscribes toEditor.SubscribeCanvasSize(CanvasSizeRevision) soCamera · W × Htracks the camera frame on first layout and every resize and avoids the top-left overlay legend, paired with the bottom bar (Zoom out, zoom%,Zoom in,Snapas abase.SwitchwithRoleSwitch/aria-checked,Fit, andOverlays N). - Command Palette (
⌘K,PaletteItems,ExecutePaletteItem): searches built-in/custom/plugin commands, plugin tools and panels, project scenes and files, open-scene nodes (node:<id>, selecting, switching to Inspector, and framing the object), and Settings pages (setting:<page>), with prefix scopes (>commands,@nodes,#files), empty-query Recent history (PaletteRecent), and an Ask the agent entry (ask:<query>) that stages natural-language queries directly in the Agent composer. - 380 px right panel (
RightRailView): hosts theAgent(⌘1) andInspector(⌘2) radio tabs alongside the thread History toggle and live agent connection chip (Connected · MCP,Working,Waiting for you,Reconnecting,Disconnected); choosing a tree row switches directly to Inspector. - 32 px status bar (
mainStatusBarView): renders muted text onbgwith the active layer button (toggling Layers), live 2D pointer coordinates, current tool readout, problem count pill (opening Problems), Output, and Debugger. Secondary views previously hosted on the old toolbar (Settings, Audio Mixer, Input Map, Localization/Strings, Export, Library, Data Table, Project Search, Files, Assets, Animation, Particles, Material, HUD Layout, Terrain, NavMesh) remain reachable through the Command Palette (⌘K), Menu bar, Settings, and Status bar. - Designed empty, loading, and error states (
WorkspaceState,SceneOpenError): every region renders a dedicated state forWorkspaceNoProject,WorkspaceNoScene,WorkspaceLoading(SetProjectLoading), andWorkspaceSceneError(SceneOpenError,RetryOpenScene,ClearSceneOpenError). Opening a missing or malformed scene YAML renders an alert card with file path, line/column, message, fix guidance, Retry, and Dismiss instead of a blank viewport. - Spec controls and keyboard navigation: preserves Spec heights (
28 pxrows/tool buttons,30–32 pxbuttons,44 pxheader,32 pxstatus bar, no interactive hit area under28 × 28), spacing (4 / 8 / 12 / 16 / 24), radii (6 / 8),base.RadioGroup/base.Radioandbase.Switchsemantics, 2 px Spec focus rings, accessible names, andF6cycling across all five regions (Header,Scene tree,Viewport,Agent / Inspector,Status bar).
Agent panel live steps, permission cards, and Stop (#1012)
The Agent panel (AgentPanelView inside RightRailView, ⌘1 / ⌘2) streams live progress, interactive permission cards, follow-up instructions, and global Stop cancellation using docs/design/editor/Spec.dc.html tokens (Working.dc.html, Permissions.dc.html, Main.dc.html, AgentStates.dc.html) on top of the project's permissions.yaml rules and You-only boundaries:
- Live steps and
agent_report_step: starting a request (Editor.StartAgentRequestorEditor.SubmitAgentPrompt) immediately renders a gray placeholder step (within 300 ms). Aseditormcp.Serverexecutes tool calls, each step streams in plain words with a violet spinner on the single active step and a green check once done. Agents can also callagent_report_step(text, optionalobjects, optionalstatus) to report steps in their own words, name touched scene object IDs, and receive queued"Add to this request"follow-ups. - Interactive permission cards over
permissions.yaml: when a tool call evaluates toaskagainstpermissions.yaml(after You-only boundary enforcement),editormcp.Serverpauses that call on its goroutine without blocking the editor UI and renders analertdialogpermission card (LiveRegionPolite) in the Agent panel showing the title, why the agent wants it, its effect (such as "Nothing is saved."), the rule preview and source, and Allow once, Always, and Deny. - Focus and keyboard rules (Spec rules 02, 04, 05): a permission card never steals focus unless focus is already inside the Agent panel (
Editor.ShouldFocusAgentPrompt); clicking the header Waiting for you chip focuses it on demand. While focused,⌘↵allows once,⌥↵persists an Always rule topermissions.yamlviaEditor.ApproveAlwaysPermission(with the Always permission rule saved toast offering Show and Undo) so future identical calls run without asking,⌘⌫denies,↑/↓cycle buttons, andEscleaves the card unanswered while the agent keeps waiting. - No automatic retry after denial: denying a permission card records its
(action, target)key on the active request, renders "You denied … · continued without it" with an explicit Allow now action, notes the unchecked item in the turn's review summary (such as "Not playtested"), and immediately returns a structured non-fataldeniedresponse for any repeated identical call in the same request without re-opening a card. Starting a new request clears per-request denials. - Add to this request, Stop (
⌘.), and concurrent manual editing: while the agent works or waits, manual edits stay available and the bottom status bar reports what the agent is doing ("manual edits stay available"). The working footer keeps the Add to this request input focus-stable while steps stream (Editor.AddToAgentRequest). Pressing Stop or⌘.from anywhere—modal dialogs included—cancels the running request and any waiting Ask (Editor.StopAgent), keeps completed steps and scene edits pending for review (pausing autosave until kept or reverted), and shows the Agent stopped toast with Review;Escnever stops the agent.
Dockable panels and layout (#919)
EditorView builds the workspace on NSGo's ui.DockArea, turning the Scene tree, Layers, Asset Browser, Files, Library, Inspector (including the right-rail Agent, Sketch, Tasks, History, Problem Fix, and Tile Review views), Problems, Output, Profiler, Animation, States, Tileset, Terrain, 2D Rig, Particle Emitter, Material Editor, Scene Environment, Data Table, Search, 3D NavMesh, Localization, and every active plugin panel into dockable, resizable panels around the viewport (with SceneTabsView above the viewport canvas):
- Drag to resize, move, and tab: drag any split or dock handle to resize panels, drag any panel tab into another group to tab them together or onto a group's edge to split beside it, and close panels from their tab close button (the
viewportpanel stays open). - Show, hide, and reset from the menu: open View > Panels to check or uncheck any built-in or active plugin panel (
PanelVisible,SetPanelVisible,TogglePanel,Panels), or choose View > Reset Layout / View > Panels > Reset Layout (CmdResetLayout,ResetLayout) to restore the default arrangement. - Per-user saved layout (
LayoutFile,ParseLayout,EncodeLayout): layout changes persist automatically as strict versioned YAML outside any project under<UserConfigDir>/nsgo-game/layout.yaml(DefaultLayoutPath, configured viaEditor.LayoutPath/Editor.SetLayoutPathand wired automatically bygame editorandeditorcmd). Starting the editor again restores saved splits, tab groups, active tabs, sizes, and hidden panels, dropping any panel that no longer exists (for example from a removed plugin). - Plugin panel placement: plugin panels (
Plugin.Panels) appear at their declared defaultDock(DockLeft,DockRight, orDockBottom) on first use; once moved or tabbed elsewhere by the user, subsequent launches restore them at their moved position.
Reviewing the agent's Go changes file by file (#1034)
When an agent turn proposes Go edits alongside scene, prefab, or data YAML changes, the editor opens a dedicated file-by-file code review (CodeReviewView, matching docs/design/editor/ReviewCode.dc.html and Review.dc.html with exclusively SpecPalette tokens in both Dark and Light appearances):
- Pending Go isolation and Go build overlay checks: Go files proposed during a turn (
ProposeCodeReviewFilesoreditormcp'scode_review_propose) are held strictly in memory until confirmed and kept—until then, the project on disk and Play keep running the old code.RunCodeReviewChecks/RunCodeReviewChecksAsyncbuilds a temporary Go build overlay JSON (BuildGoOverlay, mapping both cleaned and symlink-resolved project paths so macOS/var→/private/varworks cleanly) and executesgo tool nsgo check <pkg>andgo tool nsgo test -json <pkg> -count=1withGOFLAGS=-overlay=<overlay.json>against the pending code without touching any project file on disk (injectable viaEditor.CodeReviewCheckRunner). - Split file list and Unified / Split diff: the left sidebar splits into PREFABS · IN KEEP (YAML/prefab files included in Keep) and GO · CONFIRM EACH FILE (each Go file with
+n −nline counts and a Needs OK / OK badge), above an explanation card ("Why Go confirms on its own"). Go diffs toggle between Unified (u) and Split (s) layouts with old and new line numbers, right-aligned line tags (fails test,failed here,agent edited,round 2), and Open in<IDE>(Editor.ExternalEditorName,OpenCodeReviewInExternalEditorviaEditor.OnOpenSourceFile,Editor.OnOpenFileAtLine, or the OS opener). - Checks strip, failing test card, and Round 2 fixes in the same turn: the live status strip (
RoleStatus+LiveRegionPolite) showsnsgo check,nsgo testpass/fail counts, elapsed duration and package path, Run again (r), and live streaming progress ("nsgo test running · M of N"/"Agent is fixing · nsgo test running · M of N"with an"Agent edited <file>:<line>"badge). A failing test displays its name,file:linefailure message, and the agent's explanation, with Ask the agent to fix (AskAgentToFixCodeReview,Editor.OnAskCodeReviewFix, keeping the fix inside the same turn as Round 2 and rerunning checks) and Open the test (OpenCodeReviewTestFile). - Per-file confirmation, Keep, Waiting card, and single-step Undo: Confirm
<file>(ConfirmCodeReviewFile) is disabled and refused withErrCodeReviewChecksNotPasseduntil bothnsgo checkandnsgo testpass for the latest pending code, then toggles to Confirmed · undo. Keep (KeepCodeReview/⌘↵) writes kept YAML files and confirmed Go files atomically as one undo step inEditor.Historyso a singleEditor.Undo()restores old YAML and Go files and removes newly created Go files. Keeping while Go files remain unconfirmed writes only the YAML changes and leaves a waiting card in the Agent panel ("patrol.go is waiting for your OK", explaining what that means in Play, with Review to resume directly on the unconfirmed Go file). PressingEsc(CloseCodeReview) pauses the review without discarding it, and Revert all (RevertCodeReview/⌘⌫) discards pending changes without touching disk. - Command and MCP tools:
CmdReviewCode(agent.reviewCode) opens or resumes an active Go review.editormcpexposescode_review_propose,code_review_status, andcode_review_run_checksso agents can propose pending Go files, inspect failures, submit Round 2 fixes in the same turn, and rerun overlay checks off the UI goroutine.
Rewind an agent thread (#1021)
Rewind an agent conversation to before any earlier sent message (docs/design/editor/Checkpoints.dc.html, styled exclusively with docs/design/editor/Spec.dc.html tokens):
- Per-turn file and scene checkpoints: each composer request (
SubmitAgentPrompt) snapshots the project's files on disk (skipping.git,.nsgo,node_modules, symlinks, and You-only settings files) alongside the open scene andgame.yamlbefore the agent runs, and compacts the diff when the turn finishes (AgentTurn.ChangedFiles,AgentTurn.SessionIDBefore,AgentTurn.SessionIDAfter). - Hover or focus "Rewind to here" and three choices: hovering or focusing any sent user message in
AgentPanelViewreveals Rewind to here (OpenAgentRewindPopover/ToggleAgentRewindPopover), opening the"Rewind to before this message"popover (AgentRewindPreview) with three choices (AgentRewindMode), Cancel (orEsc), and Rewind (ConfirmAgentRewind/RewindAgentTurn):- Files and conversation (
AgentRewindBoth): restores all files touched by the target and later turns from their checkpoints (synchronizing the open scene, inactive scene tabs,game.yaml, and file tree), drops the target and later turns from the thread, and restoresAgentSessionIDtoSessionIDBeforeso the next request continues the session from before the rewound message. - Files only (
AgentRewindFilesOnly): restores the files from the turns' checkpoints while keeping the conversation thread and session unchanged. - Conversation only (
AgentRewindConversationOnly): drops the target and later turns and restores the session ID while leaving all files on disk untouched.
- Files and conversation (
- Post-rewind banner, Redo, and composer return: after rewinding, the rewound message returns to the composer highlighted with the Spec accent ring (
AgentComposerRewound) so you can edit and ask it differently, and a status banner above the composer (AgentRewindBanner) summarizes what was rewound with a Redo button (RedoAgentRewind/CanRedoAgentRewind) that restores the files, conversation turns, session ID, and prior composer draft.
Agent plans with clarifying questions and planned ghosts (#1035)
For larger changes—such as edits touching Go code, creating files, or spanning multiple files under the project's permissions.yaml rules (EvaluatePlanPermissions, PlanNeededForEdit)—an agent proposes a structured plan before modifying any scene or file (docs/design/editor/Plan.dc.html, styled strictly with Spec.dc.html Dark and Light tokens):
- MCP plan proposal (
plan_propose&plan_step_update): callingeditormcp'splan_proposetool (ActionRead, never mutating files before approval) stages anAgentPlaninPlanPhaseDraftwith a title, dynamic summary ("5 steps · 3 files · 10 objects · about 2 min · ~35k tokens"), clarifying questions with visual option previews (roomsketches orstriptimelines), numbered steps (files, additions, editable numericPlanStepFieldsteppers with min/max limits, permission badges likeEdit GoorRun the game, planned Scene Tree nodes, and viewport ghosts), and waits until the person approves or stops, returning the structuredAgentPlanDecision(answers, updated step counts, custom step notes, and removed steps).plan_step_updatereports per-step execution status and attaches the finishedAgentPlanReviewchecklist to the turn's review. - Interactive Plan card in the Agent panel (
agentPlanCardView):- Clarifying questions render as radio option cards with optional previews; picking an option collapses the question to a single summary row with Change (
ReopenPlanQuestion). Approve (⌘↵) stays disabled and refused (ApproveAgentPlan) until every question is answered; Just do it (JustDoItAgentPlan) selects each question's suggested option and records"Picked for you: …". - Numbered steps support inline editing (
EditPlanStep,AdjustPlanStepField,SetPlanStepNote) and removal/restoration (RemovePlanStep,RestorePlanStep), striking out exclusive files in FILES IN THIS PLAN. - The footer states
"Nothing changes until you approve."along with the permission-derived reason and a clickable Permissions link opening Settings › Permissions (SettingsPagePermissions).
- Clarifying questions render as radio option cards with optional previews; picking an option collapses the question to a single summary row with Change (
- Planned viewport ghosts and Scene Tree markers:
drawPlanGhostsOverlaydraws agent-violet dashed outlines with step-numbered pills (ResolvedPlanGhosts), updating live as question answers move ghosts (viaPlanGhostOverride) or numeric steppers change repeat counts (RepeatField), with a top-left legend ("planned · not in the file yet") and a Plan ghosts toggle in the bottom floating viewport bar (TogglePlanGhosts).SceneTreeViewdisplays a"{N} planned"count, step badges on touched existing layers, dashed planned node rows, and the FILES IN THIS PLAN footer (ResolvedPlanFiles).
- Running, manual-edit pause, Stop, and turn review:
- While
PlanPhaseRunning, the top header pill shows"Agent is working · step k of N · manual edits to planned objects are paused", the active step's ghost switches from dashed to solid, and manual edits to planned objects (IsObjectPausedByPlan) are paused until completion or stop. - Pressing Stop,
Esc, or⌘.before step 1 writes anything (StopAgentPlan) leaves every file unchanged (NothingWritten: true) and shows"Stopped before step 1. Nothing was written."with Edit plan (EditStoppedPlan) and Run again (RunStoppedPlanAgain). - Once completed (
CompleteAgentPlan/plan_step_updatewithcomplete: true), the turn's review (AgentTurn.Plan,agentTurnPlanReviewView) lists every plan step and marks which were done or skipped. Small edits started with⌘Lcontinue to setSkipPlan: true.
- While
Design tokens (#1002)
Every color, type size, spacing step, corner radius, height, and motion duration in the editor comes from the embedded YAML theme and constants defined in pkg/editor/spec_theme.yaml and pkg/editor/spec_theme.go, matching docs/design/editor/Spec.dc.html and docs/design/editor/Viewport3D.dc.html:
- Embedded YAML theme (
spec_theme.yaml,SpecTheme,SpecPalette): loaded withcore.ParseThemeand attached onEditorView's root scope viacx.SetTheme(SpecTheme()). Every NSGocore.Paletteandui.ColorsOfrole (Background,Surface,Raised,Line,Border,Text,TextMuted,Accent,AccentText,Success,Warning,Danger,Focus) maps directly onto the Spec palette in both dark and light appearances, whileEditor.SpecPalette(cx)(DarkSpecPalette(),LightSpecPalette(),SpecPaletteFor(dark)) exposes the additional Spec roles (TextPrimary/ text strong,TextSecondary/ text,TextMuted/ text secondary,TextFaint/ text muted,OnTextPrimary,Viewport,ViewportDot,PillBg,HoverOverlay,ActiveOverlay,PrimaryHover,AccentHover,AccentPressed,Viewport3DGround,Viewport3DGrid,Accent,Agent,Added,Changed,Removed/Problem,Warningwith dedicatedFillandEdge, and 3D axis tokensAxisX,AxisY,AxisZ). - Dark palette tokens (
Spec.dc.html&Viewport3D.dc.html):- Surfaces & borders:
bg #101216,panel #12141A,raised #171A21,line #1F232A,line raised #262B35,viewport #15181D,viewportDot #2A2F38. - Text ladder:
text strong #FFFFFF,text #D9DDE5,text secondary #B4BAC6,text muted #8B92A0. The retired#6F7684,#5D6472, and#4A505Care never used for text. - Semantic roles:
accent #3B7BFF(on-fill ink#101216at weight 600;#FFFFFFon dark accent or agent is never used),agent #9B7BFF,added #4FD38A,changed #E9A84A,removed · problem #FF6B6B,warning #F2C14E(on fill#2A2414, edge#4A3F1F). - 3D axes (
Viewport3D.dc.html):axisX #FF6B6B,axisY #4FD38A,axisZ #3B7BFF(with WCAG-passing light equivalents#C92A2A,#0D7A43,#1D5CE6).
- Surfaces & borders:
- Measured WCAG 2.2 contrast table (
SpecContrastTable,ContrastRatio):TestSpecContrastTableDarkAndLightcomputes the WCAG 2.2 luminance contrast ratio of every foreground/background, on-fill, warning-card, pill, overlay, and 3D axis pair directly fromspec_theme.yamlfor both dark and light palettes, failing below4.5:1for text/on-fill or3.0:1for UI/overlay edges. A dedicated regression test verifies that reverting darktext_mutedto#6F7684fails the check. - Type, spacing, shape, heights, and motion constants:
- Type scale: Inter title
14 / 600(SpecFontTitleSize,SpecFontTitleWeight), body12.5 / 400(SpecFontBodySize,SpecFontBodyWeight), section11 / 600at+6%tracking (SpecFontSectionSize,SpecFontSectionWeight,SpecFontSectionTrack), JetBrains Mono11.5(SpecFontCodeSize,SpecFontFamilyMono). - Spacing:
4,8,12,16,24px only (SpecSpace4–SpecSpace24). - Radii & geometry:
6controls (SpecRadiusControl),8buttons (SpecRadiusButton),12cards and toasts (SpecRadiusCard),18dialogs (SpecRadiusDialog); heights28rows/tool buttons (SpecRowHeight, minimum hit areaSpecMinHitSize = 28),30–32buttons (SpecButtonHeight,SpecButtonTallHeight),44header (SpecHeaderHeight);1px inner borders (SpecBorderWidth). - Motion:
120 mshover/press (SpecMotionHover),180 mspanels/popovers/toasts (SpecMotionPanel),240 msagent overlays (SpecMotionOverlay),1.6 sagent pulse (SpecMotionAgentPulse,100%↔45%opacity).SpecMotionDurationandSpecAgentPulseOpacitydisable all motion (0duration, solid1.0opacity) wheneverEnv.ReduceMotionis enabled.
- Type scale: Inter title
- No hardcoded UI color literals or dark-only package aliases: every non-test
.gofile inpkg/editoroutsidespec_theme.godraws UI chrome, gizmos, overlays, and debug views exclusively from reactiveSpecPalettetokens (ed.SpecPalette(cx)/e.activeSpecPalette(), keeping scene content data such asscene.BackgroundColoras scene data).TestSpecNoHardcodedColorLiteralsInEditorrejects anycore.RGB/core.RGBAcall or hardcoded UI hex color literal outsidespec_theme.go, andTestSpecNoDarkOnlyPackageColorVarsInEditorrejects package-level color variables initialized fromdarkSpecPaletteorlightSpecPaletteso every editor screen repaints live across Dark and Light appearances.