@jgengine/shell 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/CombatPresentation.d.ts +5 -0
- package/dist/CombatPresentation.js +8 -0
- package/dist/GameHost.d.ts +27 -1
- package/dist/GameHost.js +83 -4
- package/dist/GamePlayer.d.ts +5 -0
- package/dist/GamePlayer.js +5 -0
- package/dist/GamePlayerShell.d.ts +5 -0
- package/dist/GamePlayerShell.js +63 -359
- package/dist/GameUiPreview.js +3 -0
- package/dist/Shell3dPresentation.d.ts +63 -0
- package/dist/Shell3dPresentation.js +302 -0
- package/dist/ShellChrome.d.ts +51 -0
- package/dist/ShellChrome.js +51 -0
- package/dist/ShellHudPresentation.d.ts +41 -0
- package/dist/ShellHudPresentation.js +22 -0
- package/dist/audio/audioEngine.d.ts +4 -0
- package/dist/audio/audioEngine.js +111 -26
- package/dist/audio/audioWire.d.ts +22 -4
- package/dist/audio/audioWire.js +46 -3
- package/dist/audio/loopParams.d.ts +20 -0
- package/dist/audio/loopParams.js +28 -0
- package/dist/camera/GameCameraRig.js +6 -1
- package/dist/camera/GameOrbitCamera.js +7 -1
- package/dist/camera/cameraCollision.d.ts +28 -0
- package/dist/camera/cameraCollision.js +34 -0
- package/dist/camera/cameraRigs.d.ts +3 -1
- package/dist/camera/cameraRigs.js +24 -10
- package/dist/camera/index.d.ts +1 -0
- package/dist/camera/index.js +1 -0
- package/dist/camera/rigMath.d.ts +27 -0
- package/dist/camera/rigMath.js +45 -0
- package/dist/defineGame.d.ts +15 -1
- package/dist/defineGame.js +26 -4
- package/dist/devtools/DevtoolsOverlay.d.ts +4 -4
- package/dist/devtools/DevtoolsOverlay.js +28 -12
- package/dist/devtools/agentBridge.js +4 -0
- package/dist/devtools/perfDiagnose.js +1 -1
- package/dist/diagnostics/RuntimeDiagnostics.d.ts +7 -0
- package/dist/diagnostics/RuntimeDiagnostics.js +23 -12
- package/dist/environment/EnvironmentScene.js +17 -3
- package/dist/environment/RoadJunctions.d.ts +12 -0
- package/dist/environment/RoadJunctions.js +69 -0
- package/dist/environment/RoadRibbons.d.ts +8 -2
- package/dist/environment/RoadRibbons.js +26 -8
- package/dist/environment/terrainGroundColor.d.ts +9 -0
- package/dist/environment/terrainGroundColor.js +22 -0
- package/dist/gameKit.d.ts +27 -0
- package/dist/gameKit.js +29 -0
- package/dist/map/MapMarkerBeacons.d.ts +3 -2
- package/dist/postfx/PostProcessing.d.ts +9 -1
- package/dist/postfx/PostProcessing.js +11 -4
- package/dist/presentationResolve.d.ts +39 -0
- package/dist/presentationResolve.js +53 -0
- package/dist/registry.d.ts +1 -0
- package/dist/render/PartMotion.d.ts +18 -0
- package/dist/render/PartMotion.js +91 -0
- package/dist/render/SceneModels.d.ts +9 -2
- package/dist/render/SceneModels.js +31 -180
- package/dist/render/assetBase.d.ts +17 -0
- package/dist/render/assetBase.js +35 -0
- package/dist/render/measureBounds.d.ts +34 -0
- package/dist/render/measureBounds.js +127 -0
- package/dist/render/modelLoad.js +4 -1
- package/dist/render/resolveModel.d.ts +15 -0
- package/dist/render/resolveModel.js +43 -2
- package/dist/render/useModelAnimation.d.ts +10 -0
- package/dist/render/useModelAnimation.js +198 -0
- package/dist/scatter/InstancedScatter.js +5 -0
- package/dist/scatter/scatterProxies.js +24 -0
- package/dist/scene/AuthoredScene.d.ts +3 -1
- package/dist/scene/AuthoredScene.js +7 -2
- package/dist/scene/CityRenderer.d.ts +2 -0
- package/dist/scene/CityRenderer.js +1031 -0
- package/dist/scene/GrassFieldRenderer.js +53 -5
- package/dist/scene/PoleLineRenderer.d.ts +2 -0
- package/dist/scene/PoleLineRenderer.js +287 -0
- package/dist/scene/SoilPatchRenderer.js +70 -7
- package/dist/scene/WaterRenderer.js +34 -10
- package/dist/scene/builtinSceneKindRenderers.js +4 -0
- package/dist/scene/cityWindowMaterial.d.ts +16 -0
- package/dist/scene/cityWindowMaterial.js +81 -0
- package/dist/scene/sceneKindRenderers.d.ts +2 -0
- package/dist/settings/appliedSettings.d.ts +2 -1
- package/dist/settings/appliedSettings.js +4 -2
- package/dist/structures/GeneratedBuilding.d.ts +4 -0
- package/dist/structures/GeneratedBuilding.js +17 -7
- package/dist/structures/TransformGizmo.d.ts +11 -1
- package/dist/structures/TransformGizmo.js +9 -5
- package/dist/terrain/GrassField.d.ts +11 -3
- package/dist/terrain/GrassField.js +16 -6
- package/dist/terrain/grassGeometry.d.ts +33 -1
- package/dist/terrain/grassGeometry.js +83 -21
- package/dist/terrain/grassMaterial.d.ts +18 -0
- package/dist/terrain/grassMaterial.js +66 -13
- package/dist/terrain/heightfieldGeometry.d.ts +34 -0
- package/dist/terrain/heightfieldGeometry.js +109 -0
- package/dist/terrain/index.d.ts +1 -0
- package/dist/terrain/index.js +1 -0
- package/dist/terrain/soilPatchMaterial.d.ts +15 -2
- package/dist/terrain/soilPatchMaterial.js +46 -8
- package/dist/terrain/terrainDetailMaterial.js +15 -2
- package/dist/water/Ocean.d.ts +7 -1
- package/dist/water/Ocean.js +16 -3
- package/dist/water/OceanConfig.d.ts +9 -0
- package/dist/water/OceanConfig.js +6 -0
- package/dist/water/OceanMaterial.d.ts +12 -0
- package/dist/water/OceanMaterial.js +9 -0
- package/dist/water/OceanShader.d.ts +2 -2
- package/dist/water/OceanShader.js +78 -10
- package/dist/world/PlaceScene.d.ts +11 -0
- package/dist/world/PlaceScene.js +27 -0
- package/dist/world/WorldHud.d.ts +3 -1
- package/dist/world/WorldHud.js +2 -2
- package/dist/world/WorldScene.js +32 -4
- package/dist/worldSky.d.ts +7 -1
- package/dist/worldSky.js +11 -1
- package/package.json +4 -4
- package/skills/game-design/SKILL.md +28 -0
- package/skills/game-design/agents/openai.yaml +4 -0
- package/skills/game-design/references/application-playbook.md +170 -0
- package/skills/game-design/references/field-guide.md +288 -0
- package/skills/jgengine/SKILL.md +8 -4
- package/skills/jgengine/api.md +182 -81
- package/skills/jgengine/capabilities.md +104 -2
- package/skills/jgengine/recipes/minimal-game.md +88 -0
- package/skills/jgengine-ui/SKILL.md +17 -10
- package/skills/jgengine-ui/api.md +316 -51
- package/skills/jgengine-ui/capabilities.md +135 -2
- package/skills/jgengine-ui/recipes/portable-minimap.md +150 -0
- package/skills/jgengine-ui/reference.md +59 -9
- package/skills/jgengine-ui/references/visual-scorecard.md +1 -1
- package/skills/jgengine-world/SKILL.md +13 -0
- package/skills/jgengine-world/api.md +453 -21
- package/skills/jgengine-world/capabilities.md +112 -2
- package/skills/jgengine-world/recipes/commanding-entities.md +128 -0
- package/skills/jgengine-world/reference.md +43 -4
- package/skills/level-design/SKILL.md +54 -0
- package/skills/level-design/agents/openai.yaml +4 -0
- package/skills/level-design/references/application-playbook.md +192 -0
- package/skills/level-design/references/field-guide.md +337 -0
- package/skills/level-design/references/live-editor-loop.md +179 -0
- package/dist/cartridge/runtime.d.ts +0 -15
- package/dist/cartridge/runtime.js +0 -556
- package/dist/cartridge/spec.d.ts +0 -188
- package/dist/cartridge/spec.js +0 -19
- package/dist/cartridge/validate.d.ts +0 -2
- package/dist/cartridge/validate.js +0 -78
- package/dist/cartridge.d.ts +0 -145
- package/dist/cartridge.js +0 -246
- package/skills/jgengine/reference-cartridge.md +0 -72
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Live editor loop
|
|
2
|
+
|
|
3
|
+
Use this protocol to turn live play evidence into safe, executable instructions for an agent controlling the JGengine editor. The level designer owns the hypothesis and acceptance criteria; the editor agent owns document operations. Never send “make this area better” or infer that a successful tool call changed runtime play.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
1. Closed loop
|
|
8
|
+
2. Authority and capability gate
|
|
9
|
+
3. Evidence packet
|
|
10
|
+
4. Editor-agent prompt contract
|
|
11
|
+
5. Mutation policy
|
|
12
|
+
6. Verification and iteration
|
|
13
|
+
7. Example: spawn repair
|
|
14
|
+
|
|
15
|
+
## 1. Closed loop
|
|
16
|
+
|
|
17
|
+
Repeat this sequence until the acceptance scenario passes or a stop condition is reached:
|
|
18
|
+
|
|
19
|
+
`capture -> inspect -> map pixels to scene/runtime ids -> form one spatial hypothesis -> brief editor agent -> author -> inspect document -> replay same scenario -> compare`
|
|
20
|
+
|
|
21
|
+
Preserve the same game state, viewport size, player pose, camera orientation, input sequence, and capture moment when comparing iterations. A changed screenshot from a different pose is not before/after evidence.
|
|
22
|
+
|
|
23
|
+
The parent level-design agent must retain authority over the player journey. Do not delegate “improve the level” without first defining the behavior to change, evidence, scope, and falsifier.
|
|
24
|
+
|
|
25
|
+
## 2. Authority and capability gate
|
|
26
|
+
|
|
27
|
+
Before composing mutations, establish all of the following:
|
|
28
|
+
|
|
29
|
+
- authoritative persisted scene path and current document revision
|
|
30
|
+
- whether the live editor session loaded that same document
|
|
31
|
+
- whether runtime consumes the target marker/path/volume/meta directly
|
|
32
|
+
- visible objects mapped to stable document ids, runtime ids, or catalog ids
|
|
33
|
+
- registered marker, volume, and path kinds plus their schemas
|
|
34
|
+
- available placeable assets, prefabs, collections, terrain materials, and catalog entries
|
|
35
|
+
- whether target changes are scene, asset/catalog, gameplay, UI, or renderer concerns
|
|
36
|
+
|
|
37
|
+
In the editor agent, begin with `editor_status`, `document_revision` with the document included, `scene_summary`, `list_layers`, `list_assets`, `list_catalogs`, and—when connected to play—`runtime_summary`. Use `runtime_get` for specific visible entities.
|
|
38
|
+
|
|
39
|
+
Stop instead of mutating when:
|
|
40
|
+
|
|
41
|
+
- the live document differs from the runtime's persisted scene
|
|
42
|
+
- a target position exists only in code or is duplicated between code and scene
|
|
43
|
+
- an expected stable id is missing or ambiguous
|
|
44
|
+
- a required kind/schema or mutation cannot be expressed
|
|
45
|
+
- another human/agent changed the base revision
|
|
46
|
+
- the requested fix belongs to model scale/pivot, animation, UI, gameplay rules, or rendering rather than scene authoring
|
|
47
|
+
|
|
48
|
+
Report the precise ownership or editor capability gap. File the required `[FEATURE]` issue before a code fallback. A scene prompt cannot repair an authority split.
|
|
49
|
+
|
|
50
|
+
## 3. Evidence packet
|
|
51
|
+
|
|
52
|
+
Build the editor handoff from observed evidence:
|
|
53
|
+
|
|
54
|
+
| Field | Required content |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| scenario | game state, objective, player pose, camera, input sequence, capture time |
|
|
57
|
+
| artifacts | absolute before-capture paths and relevant document/runtime summaries |
|
|
58
|
+
| observation | what dominates, hides, contradicts, confuses, delays, or misleads |
|
|
59
|
+
| player consequence | the wrong belief/action or missing decision caused by the space |
|
|
60
|
+
| hypothesis | one causal spatial change expected to alter that behavior |
|
|
61
|
+
| metrics | controller/camera/interaction/encounter measurements with units |
|
|
62
|
+
| target ids | existing semantic ids and catalog/runtime links; no guessed ids |
|
|
63
|
+
| preserve | working routes, landmarks, content, silhouettes, performance budget, and unrelated user work |
|
|
64
|
+
| scope | one spawn, route, zone, encounter, or teaching sequence |
|
|
65
|
+
| acceptance | document assertions plus replay, timing, comprehension, and visual thresholds |
|
|
66
|
+
| falsifier | observation that means the hypothesis failed |
|
|
67
|
+
|
|
68
|
+
Distinguish direct observation (“the NPC fills the left half of the spawn frame”) from inference (“the player may assume the NPC is the immediate objective”). Require replay or player evidence for the inference.
|
|
69
|
+
|
|
70
|
+
## 4. Editor-agent prompt contract
|
|
71
|
+
|
|
72
|
+
Send this structure to the agent controlling the live editor:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
You are authoring <game>/<scene> through the provided JGengine editor tools.
|
|
76
|
+
Do not hand-edit JSON or source code. Do not invent unavailable ids, kinds, assets, or metadata.
|
|
77
|
+
|
|
78
|
+
PLAYER OUTCOME
|
|
79
|
+
<observable behavior the revised space must cause>
|
|
80
|
+
|
|
81
|
+
FIXED REPLAY SCENARIO
|
|
82
|
+
<state, spawn/pose, camera, inputs, capture moment, viewport>
|
|
83
|
+
|
|
84
|
+
EVIDENCE
|
|
85
|
+
<capture paths, document/runtime summaries, observations separated from inferences>
|
|
86
|
+
|
|
87
|
+
SPATIAL HYPOTHESIS
|
|
88
|
+
<one causal claim; why these scene changes should alter player behavior>
|
|
89
|
+
|
|
90
|
+
METRICS AND CONSTRAINTS
|
|
91
|
+
<measured movement/camera/interaction/AI values, scope, performance, accessibility>
|
|
92
|
+
|
|
93
|
+
PRESERVE
|
|
94
|
+
<ids, routes, content, authored work, silhouettes, and behavior that must not change>
|
|
95
|
+
|
|
96
|
+
TARGET SEMANTICS
|
|
97
|
+
<existing ids to inspect plus required stable ids/kinds/meta; describe additions semantically>
|
|
98
|
+
|
|
99
|
+
AUTHORING SEQUENCE
|
|
100
|
+
1. Call editor_status, document_revision(includeDocument=true), scene_summary, list_layers,
|
|
101
|
+
list_assets, list_catalogs, and runtime_summary when available.
|
|
102
|
+
2. Verify that the live document is authoritative and every target maps to a stable id/runtime consumer.
|
|
103
|
+
If not, stop and return an ownership/capability report without mutation.
|
|
104
|
+
3. Focus the camera on the target and inspect its nearby ids, hierarchy, collections, terrain, and runtime entities.
|
|
105
|
+
4. Return a concise proposed operation list tied to the hypothesis. Then execute one coherent undoable patch group.
|
|
106
|
+
5. Re-read the document revision and target objects. Check reachability, collision space, sightlines,
|
|
107
|
+
spawn safety, reverse travel, encounter reset, and performance implications.
|
|
108
|
+
6. Switch to walk/play mode only when safe, exercise the fixed scenario, and report what still requires
|
|
109
|
+
the parent agent's external capture or gameplay verification.
|
|
110
|
+
|
|
111
|
+
MUTATION RULES
|
|
112
|
+
- Use direct setters for existing objects, place_asset for registered assets, and terrain/prefab tools for their domains.
|
|
113
|
+
- For structural add/remove operations, use push_document_patch with type=commands and the exact current
|
|
114
|
+
baseRevision. Use validated EditorCommand shapes; never force a revision mismatch.
|
|
115
|
+
- Prefer stable semantic ids and one coherent patch over many anonymous props.
|
|
116
|
+
- Do not use import_document for ordinary iteration or replace unrelated scene content.
|
|
117
|
+
- Keep every edit undoable. On a rejected operation or broken invariant, stop or undo rather than improvising in code.
|
|
118
|
+
|
|
119
|
+
REQUIRED OPERATIONS
|
|
120
|
+
<ordered add/move/remove/retag/terrain operations; state purpose and intended downstream consumer,
|
|
121
|
+
but let the editor resolve exact coordinates from inspected scene context and measured constraints>
|
|
122
|
+
|
|
123
|
+
ACCEPTANCE
|
|
124
|
+
<document assertions, play behavior, timing, wayfinding, visual composition, reset/exploit checks>
|
|
125
|
+
|
|
126
|
+
FALSIFIER
|
|
127
|
+
<what observed result means this patch should be undone or revised>
|
|
128
|
+
|
|
129
|
+
RETURN
|
|
130
|
+
- before and after document revisions
|
|
131
|
+
- exact successful operations and affected ids
|
|
132
|
+
- rejected/skipped operations with reasons
|
|
133
|
+
- unresolved non-scene ownership
|
|
134
|
+
- document assertions performed
|
|
135
|
+
- the exact replay/capture request for the parent agent
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Do not put speculative coordinates into the brief. Give topology, relative relationships, measured clearances, timing targets, and target semantics. The editor agent inspects the current scene and chooses positions that satisfy them; the parent verifies the result live.
|
|
139
|
+
|
|
140
|
+
## 5. Mutation policy
|
|
141
|
+
|
|
142
|
+
Use the narrowest safe editor operation:
|
|
143
|
+
|
|
144
|
+
| Intent | Preferred operation |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| inspect authority/state | `document_revision`, `scene_summary`, `list_layers`, `runtime_summary` |
|
|
147
|
+
| inspect target | `get_marker`, `get_volume`, `runtime_get`, `camera_goto`, `hierarchy` |
|
|
148
|
+
| move/rotate existing | `set_transform` |
|
|
149
|
+
| retag or patch semantics | `set_marker`, `set_volume`, `set_path`, `set_meta` |
|
|
150
|
+
| place registered prop | `place_asset` |
|
|
151
|
+
| add/remove semantic object | versioned `push_document_patch` with `addMarker`/`addVolume`/`addPath`/`remove` commands |
|
|
152
|
+
| repeated authored kit | prefab and collection tools |
|
|
153
|
+
| terrain form/material | sculpt/paint/layer tools |
|
|
154
|
+
| test an uncertain live pose | runtime override, then `write_back_override` only after validation |
|
|
155
|
+
| recover failed hypothesis | `undo` and re-run the fixed scenario |
|
|
156
|
+
|
|
157
|
+
Never use runtime overrides as completion evidence: they are ephemeral until written back, and write-back is valid only for document-linked entities.
|
|
158
|
+
|
|
159
|
+
## 6. Verification and iteration
|
|
160
|
+
|
|
161
|
+
After the editor agent returns:
|
|
162
|
+
|
|
163
|
+
1. Confirm the persisted document diff contains only intended ids and semantics.
|
|
164
|
+
2. Assert the required marker/path/volume/prefab/terrain state.
|
|
165
|
+
3. Confirm runtime consumers query those ids rather than copied positions.
|
|
166
|
+
4. Replay the identical scenario and capture the identical views.
|
|
167
|
+
5. Inspect both images for first-look hierarchy, goal/threat/affordance readability, occlusion, safe footing, and world/UI agreement.
|
|
168
|
+
6. Measure the behavioral claim: orientation time, first action/decision, route completion, encounter result, failure/retry, or reverse navigation.
|
|
169
|
+
7. Keep, revise, or undo the patch based on the falsifier. Change one causal hypothesis per iteration.
|
|
170
|
+
|
|
171
|
+
Scene counts prove ownership, tests prove transitions, driven play proves progress, and screenshots prove visible composition. Require all applicable rungs.
|
|
172
|
+
|
|
173
|
+
## 7. Example: spawn repair
|
|
174
|
+
|
|
175
|
+
For a spawn capture where an oversized NPC, placeholder prop, and weapon silhouette obscure the destination, do not send “make the spawn prettier.” Send a brief whose outcome is: “within five seconds, a fresh player looks toward the first route, recognizes the NPC as optional/safe, and has clear movement space.”
|
|
176
|
+
|
|
177
|
+
The editor agent must first resolve the player-spawn marker, NPC runtime/document link, visible prop ids, route id, camera direction, and persisted scene revision. It may then move or regroup authored props, establish a foreground-to-landmark composition, preserve collision clearance, and add semantic onboarding markers only when the runtime consumes them. It must report model-scale or viewmodel defects as asset/rendering work, not fake their repair with arbitrary scene transforms.
|
|
178
|
+
|
|
179
|
+
If the player/NPC coordinates come from code while nearby props come from the scene, stop: migrate authority before spatial polish. Otherwise the before capture and editor session describe different worlds.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type AbilityKit } from "@jgengine/core/combat/abilityKit";
|
|
2
|
-
import type { GameLoop } from "@jgengine/core/game/defineGame";
|
|
3
|
-
import type { GameContext, GameContextContent } from "@jgengine/core/runtime/gameContext";
|
|
4
|
-
import { type CartridgeRun, type CartridgeSpec } from "./spec.js";
|
|
5
|
-
export interface CartridgeRuntime {
|
|
6
|
-
content: GameContextContent;
|
|
7
|
-
loop: GameLoop<GameContext>;
|
|
8
|
-
run(ctx: GameContext): CartridgeRun;
|
|
9
|
-
weaponKit(ctx: GameContext): AbilityKit;
|
|
10
|
-
chooseUpgrade(ctx: GameContext, offerId: string): void;
|
|
11
|
-
begin(ctx: GameContext): void;
|
|
12
|
-
reset(ctx: GameContext): void;
|
|
13
|
-
spec: CartridgeSpec;
|
|
14
|
-
}
|
|
15
|
-
export declare function createCartridge(spec: CartridgeSpec): CartridgeRuntime;
|