@nodetool-ai/agents 0.8.4-a24.2 → 0.8.4
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/dist/.nodetool-build-stamp +1 -1
- package/dist/_skills/LICENSE-iart-motion-design-skills +21 -0
- package/dist/_skills/README.md +211 -0
- package/dist/_skills/api-agents/SKILL.md +58 -0
- package/dist/_skills/api-apps/SKILL.md +54 -0
- package/dist/_skills/api-assets/SKILL.md +66 -0
- package/dist/_skills/api-collections/SKILL.md +33 -0
- package/dist/_skills/api-games/SKILL.md +81 -0
- package/dist/_skills/api-media/SKILL.md +131 -0
- package/dist/_skills/api-memory/SKILL.md +72 -0
- package/dist/_skills/api-models/SKILL.md +78 -0
- package/dist/_skills/api-scripts/SKILL.md +79 -0
- package/dist/_skills/api-settings/SKILL.md +49 -0
- package/dist/_skills/api-sketches/SKILL.md +61 -0
- package/dist/_skills/api-storyboards/SKILL.md +94 -0
- package/dist/_skills/api-timelines/SKILL.md +151 -0
- package/dist/_skills/api-web/SKILL.md +57 -0
- package/dist/_skills/api-workflows/SKILL.md +123 -0
- package/dist/_skills/beat-sync-editing/SKILL.md +208 -0
- package/dist/_skills/caption-titles/SKILL.md +94 -0
- package/dist/_skills/color-motion/SKILL.md +185 -0
- package/dist/_skills/commercial-beat-sheet/SKILL.md +338 -0
- package/dist/_skills/elevenlabs-audio-prompting/SKILL.md +163 -0
- package/dist/_skills/explainer-storyboard/SKILL.md +63 -0
- package/dist/_skills/flux-2-klein-prompting/SKILL.md +107 -0
- package/dist/_skills/frame-composition/SKILL.md +291 -0
- package/dist/_skills/game-direction/SKILL.md +99 -0
- package/dist/_skills/gpt-image-2-prompting/SKILL.md +161 -0
- package/dist/_skills/hailuo-prompting/SKILL.md +107 -0
- package/dist/_skills/kling-video-prompting/SKILL.md +188 -0
- package/dist/_skills/launch-commercial/SKILL.md +267 -0
- package/dist/_skills/launch-kit/SKILL.md +120 -0
- package/dist/_skills/logo-reveal/SKILL.md +225 -0
- package/dist/_skills/manimgx/SKILL.md +123 -0
- package/dist/_skills/minimax-h3-prompting/SKILL.md +134 -0
- package/dist/_skills/motion-ad/SKILL.md +281 -0
- package/dist/_skills/motion-background/SKILL.md +145 -0
- package/dist/_skills/motion-curves/SKILL.md +302 -0
- package/dist/_skills/motion-direction/SKILL.md +259 -0
- package/dist/_skills/motion-graphics/SKILL.md +217 -0
- package/dist/_skills/motion-principles/SKILL.md +255 -0
- package/dist/_skills/music-video-treatment/SKILL.md +40 -0
- package/dist/_skills/nano-banana-pro-prompting/SKILL.md +133 -0
- package/dist/_skills/native-game/SKILL.md +310 -0
- package/dist/_skills/native-game-reference/SKILL.md +879 -0
- package/dist/_skills/nodetool-3d-scene/SKILL.md +110 -0
- package/dist/_skills/nodetool-api-reference/SKILL.md +338 -0
- package/dist/_skills/nodetool-app-builder/SKILL.md +291 -0
- package/dist/_skills/nodetool-browser-agent/SKILL.md +119 -0
- package/dist/_skills/nodetool-chat-cli/SKILL.md +184 -0
- package/dist/_skills/nodetool-custom-node-developer/SKILL.md +294 -0
- package/dist/_skills/nodetool-deployment/SKILL.md +195 -0
- package/dist/_skills/nodetool-js-scripting/SKILL.md +223 -0
- package/dist/_skills/nodetool-model-provider-config/SKILL.md +348 -0
- package/dist/_skills/nodetool-rag-indexing/SKILL.md +153 -0
- package/dist/_skills/nodetool-sketch/SKILL.md +138 -0
- package/dist/_skills/nodetool-skill-author/SKILL.md +125 -0
- package/dist/_skills/nodetool-troubleshooter/SKILL.md +370 -0
- package/dist/_skills/nodetool-video-post/SKILL.md +149 -0
- package/dist/_skills/nodetool-workflow-builder/SKILL.md +295 -0
- package/dist/_skills/product-commercial/SKILL.md +132 -0
- package/dist/_skills/qwen-image-prompting/SKILL.md +122 -0
- package/dist/_skills/script-video/SKILL.md +106 -0
- package/dist/_skills/seedance-2-prompting/SKILL.md +194 -0
- package/dist/_skills/seedream-prompting/SKILL.md +117 -0
- package/dist/_skills/short-film/SKILL.md +123 -0
- package/dist/_skills/stable-audio-prompting/SKILL.md +130 -0
- package/dist/_skills/storyboard-core/SKILL.md +716 -0
- package/dist/_skills/timeline-edit-ops/SKILL.md +736 -0
- package/dist/_skills/trailer-template/SKILL.md +291 -0
- package/dist/_skills/ugc-video/SKILL.md +186 -0
- package/dist/_skills/veo-3-prompting/SKILL.md +140 -0
- package/dist/_skills/video-audio-continuity/SKILL.md +90 -0
- package/dist/_skills/video-clone/SKILL.md +96 -0
- package/dist/_skills/video-workflow/SKILL.md +119 -0
- package/dist/_skills/wan-2-6-prompting/SKILL.md +107 -0
- package/dist/app-build/bridge.d.ts.map +1 -1
- package/dist/app-build/bridge.js +44 -17
- package/dist/app-build/bridge.js.map +1 -1
- package/dist/capabilities/apps.d.ts.map +1 -1
- package/dist/capabilities/apps.js +55 -13
- package/dist/capabilities/apps.js.map +1 -1
- package/dist/capabilities/apps.specs.d.ts.map +1 -1
- package/dist/capabilities/apps.specs.js +5 -3
- package/dist/capabilities/apps.specs.js.map +1 -1
- package/dist/capabilities/game-asset-browser.d.ts.map +1 -1
- package/dist/capabilities/game-asset-browser.js +6 -1
- package/dist/capabilities/game-asset-browser.js.map +1 -1
- package/dist/capabilities/game.d.ts +1 -1
- package/dist/capabilities/game.d.ts.map +1 -1
- package/dist/capabilities/game.js +71 -56
- package/dist/capabilities/game.js.map +1 -1
- package/dist/capabilities/game.specs.js +1 -1
- package/dist/capabilities/game.specs.js.map +1 -1
- package/dist/capabilities/game3d.d.ts.map +1 -1
- package/dist/capabilities/game3d.js +14 -19
- package/dist/capabilities/game3d.js.map +1 -1
- package/dist/capabilities/gameAssertions.d.ts +52 -0
- package/dist/capabilities/gameAssertions.d.ts.map +1 -0
- package/dist/capabilities/gameAssertions.js +32 -0
- package/dist/capabilities/gameAssertions.js.map +1 -0
- package/dist/capabilities/models.d.ts.map +1 -1
- package/dist/capabilities/models.js +9 -0
- package/dist/capabilities/models.js.map +1 -1
- package/dist/capabilities/storyboards.d.ts.map +1 -1
- package/dist/capabilities/storyboards.js +36 -11
- package/dist/capabilities/storyboards.js.map +1 -1
- package/dist/capabilities/storyboards.specs.d.ts.map +1 -1
- package/dist/capabilities/storyboards.specs.js +11 -1
- package/dist/capabilities/storyboards.specs.js.map +1 -1
- package/dist/capabilities/workflows.d.ts.map +1 -1
- package/dist/capabilities/workflows.js +1 -0
- package/dist/capabilities/workflows.js.map +1 -1
- package/dist/capabilities/workflows.specs.d.ts.map +1 -1
- package/dist/capabilities/workflows.specs.js +4 -3
- package/dist/capabilities/workflows.specs.js.map +1 -1
- package/dist/evals/surfaces/game.d.ts.map +1 -1
- package/dist/evals/surfaces/game.js +29 -1
- package/dist/evals/surfaces/game.js.map +1 -1
- package/dist/game-authoring.d.ts +120 -0
- package/dist/game-authoring.d.ts.map +1 -1
- package/dist/game-build-integrity.d.ts +12 -0
- package/dist/game-build-integrity.d.ts.map +1 -0
- package/dist/game-build-integrity.js +78 -0
- package/dist/game-build-integrity.js.map +1 -0
- package/dist/game-examples.d.ts +44 -3
- package/dist/game-examples.d.ts.map +1 -1
- package/dist/game-examples.js +60 -10
- package/dist/game-examples.js.map +1 -1
- package/dist/system-skills.d.ts +1 -1
- package/dist/system-skills.js +1 -1
- package/dist/tools/builtin-tools.d.ts.map +1 -1
- package/dist/tools/builtin-tools.js +2 -0
- package/dist/tools/builtin-tools.js.map +1 -1
- package/package.json +19 -19
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: native-game
|
|
3
|
+
description: "Build or revise a playable 2D or 3D game in NodeTool's built-in engine: create and edit the document, generate and install art and audio, playtest and autoplay a route, capture frames, publish, and prepare a standalone web build. Also the entry point for making a game look or feel better. For a glTF model use nodetool-3d-scene. For nodetool.games calls inside a code action use api-games."
|
|
4
|
+
featured: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Build a native game
|
|
8
|
+
|
|
9
|
+
Create and edit a versioned built-in game document. The engine owns simulation,
|
|
10
|
+
rendering, and web export. The default is a playable 2D top-down room.
|
|
11
|
+
Use `dimension: "3d"` for an exploration blockout with a capsule controller,
|
|
12
|
+
follow camera, ramps, a moving platform, a crate and scripted interactions.
|
|
13
|
+
|
|
14
|
+
Load `game-direction` before the first edit of a new game, an art overhaul, or
|
|
15
|
+
a game that plays but feels flat. Lock its style string, layer plan, feel
|
|
16
|
+
parameters, and pacing sheet, then keep later edits and asset prompts
|
|
17
|
+
consistent with that spec. Load `native-game-reference` when an edit needs
|
|
18
|
+
script hooks, events, lighting, effects, particles, 3D rendering, the audio mix,
|
|
19
|
+
animation graphs, input bindings, the HUD tree or performance fields. Load
|
|
20
|
+
`api-games` before calling `nodetool.games` from a code action.
|
|
21
|
+
|
|
22
|
+
## Build and revise
|
|
23
|
+
|
|
24
|
+
1. `create_native_game {project_id, name, dimension?}` creates a playable draft
|
|
25
|
+
and returns its full id and current immutable revision. Resource ids may be
|
|
26
|
+
full ids or exact 12-character prefixes.
|
|
27
|
+
2. `get_native_game {game_id, view: "outline"}` reads the compact draft outline.
|
|
28
|
+
Use `view: "entity"` with `entity_id` for one entity or `view: "full"` for
|
|
29
|
+
the whole document. `source: "revision"` reads an immutable revision.
|
|
30
|
+
3. `edit_native_game {game_id, base_updated_at?, ops}` applies ordered ops to
|
|
31
|
+
the draft and validates the result atomically. Use the `draft_updated_at`
|
|
32
|
+
from a read for compare-and-swap when an edit depends on that exact state.
|
|
33
|
+
Invalid edits return an op index and field path. A generated level can
|
|
34
|
+
replace the whole draft with `ops: [{op: "set_document", document}]`. The
|
|
35
|
+
replacement preserves the stored game id and revision and supports undo.
|
|
36
|
+
4. Prove it plays.
|
|
37
|
+
`playtest_native_game {game_id, inputs?, assertions?, capture_ticks?}` runs
|
|
38
|
+
the draft for up to 18,000 ticks, subject to the wall time budget. An input
|
|
39
|
+
can repeat with `ticks`. `justPressed` fires on the first repeated tick.
|
|
40
|
+
`autoplay_native_game {game_id, target_prefix? | win?, player_id?, seed?,
|
|
41
|
+
max_ticks?}` steers a supported 2D player and returns an executed `route`,
|
|
42
|
+
observed win tick, target contacts, and authored level stats. It needs a
|
|
43
|
+
player with a `movement` behavior, or a script player with `left` and
|
|
44
|
+
`right` actions, and takes jump from a `jump`, `space` or `up` action. A
|
|
45
|
+
prefix selects every matching authored collider, whose IDs must be unique
|
|
46
|
+
across scenes. Win steering targets
|
|
47
|
+
collectibles or an authored `win` or `victory` trigger. Other scripted goals
|
|
48
|
+
need `target_prefix`. A failed steering search or exhausted budget does not
|
|
49
|
+
prove the game impossible. Replay `route` as playtest `inputs` with the same
|
|
50
|
+
seed, and check `route_complete` before accepting the replay. A target
|
|
51
|
+
contact alone does not prove completion.
|
|
52
|
+
5. Assert what the replay proves. 2D playtests accept three forms, and any
|
|
53
|
+
other returns `Unsupported assertion`:
|
|
54
|
+
- `{event: "win", before_tick?}` requires an engine win or a scripted `win`
|
|
55
|
+
or `victory` trigger. `{event: "<name>"}` requires that emitted event.
|
|
56
|
+
- `{entity_id, near: {x, y, tolerance}, at_tick?}` checks a position.
|
|
57
|
+
- `{no_script_errors: true}` fails on the first script error.
|
|
58
|
+
3D playtests add `region`, `grounded` and `replay_matches` (see 3D authoring).
|
|
59
|
+
6. Look at it. `capture_native_game_frame {game_id, ticks?, sheet?}` renders up
|
|
60
|
+
to eight frames and returns image refs (`asset_id`, `uri`), not pixels. Call
|
|
61
|
+
`view_image` on each ref you judge, as a direct tool call, before reporting
|
|
62
|
+
visual changes or polish. Inside a code action the pixels cannot arrive.
|
|
63
|
+
`sheet: true` returns one contact sheet. Captures report `cancelled`,
|
|
64
|
+
`wall_time_limited`, and `route_complete`. An interrupted capture returns
|
|
65
|
+
only frames rendered before interruption.
|
|
66
|
+
7. Generate assets (see Assets). Confirm scope before spending.
|
|
67
|
+
8. `publish_native_game {game_id, base_revision}` publishes the current draft
|
|
68
|
+
only when the user asks. For an explicit `document`, pass the paired
|
|
69
|
+
`draft_updated_at` returned by `get_native_game` as `base_updated_at`. On a
|
|
70
|
+
conflict, read the draft and reconcile edits.
|
|
71
|
+
9. `build_native_game {game_id, revision?, target?}` writes a standalone web
|
|
72
|
+
player for an owned revision under the project workspace and returns its
|
|
73
|
+
path, only when the user asks. `target: "tauri"` writes a Tauri desktop app
|
|
74
|
+
project instead, named after the game. It compiles to installers with
|
|
75
|
+
`npm run build` where Rust is installed. On a touch screen the 2D player adds a floating stick for
|
|
76
|
+
`left`/`right`/`up`/`down` and one button per other input action, labeled
|
|
77
|
+
with the action name. Installed media must still exist, match its recorded
|
|
78
|
+
digest, and use a supported format.
|
|
79
|
+
|
|
80
|
+
## Build a complete document
|
|
81
|
+
|
|
82
|
+
Author a whole level in a code action with the `@nodetool-ai/sandbox-game` pack.
|
|
83
|
+
Read its signatures and an example with
|
|
84
|
+
`nodetool.packs.docs("@nodetool-ai/sandbox-game")` (the direct tool is
|
|
85
|
+
`get_sandbox_package_docs`). It exports `game`, `entity`, `script`,
|
|
86
|
+
`registerAssets`, `fill`, `plank`, `arc`, `constructGame` and `saveGame`. Asset
|
|
87
|
+
registration records bindings, and installation supplies the bytes.
|
|
88
|
+
`saveGame({name, document}, {games: nodetool.games, project_id})` creates a
|
|
89
|
+
game and saves the generated draft in one edit. To replace an existing draft,
|
|
90
|
+
pass `game_id` and its last-read `base_updated_at` instead of `project_id`.
|
|
91
|
+
`api-games` covers `constructGame` and retained rebuilds. Publish separately
|
|
92
|
+
when requested.
|
|
93
|
+
|
|
94
|
+
`list_example_games {query?}` discovers shipped references.
|
|
95
|
+
`get_example_game {slug: "kindle"}` reads its outline. Use `view: "entity"`
|
|
96
|
+
with `entity_id` to study the controller or `view: "full"` for the document.
|
|
97
|
+
Kindle is the platformer benchmark for layered art, aligned poses, terrain
|
|
98
|
+
edges, feel, and pacing. `install_example_game {project_id, slug}` copies a
|
|
99
|
+
bundle and its verified media into the project. A raw example document has
|
|
100
|
+
`package://` bindings. Install the bundle before editing it as a user game.
|
|
101
|
+
|
|
102
|
+
For a workflow-based brief, `design_game` writes its design and `build_game
|
|
103
|
+
{workflow_id, save?}` creates or selects the native game and stages its asset
|
|
104
|
+
graph. The graph's generated media are candidates until installed.
|
|
105
|
+
|
|
106
|
+
## Scripts during play
|
|
107
|
+
|
|
108
|
+
Edit an existing script through `edit_native_game` with an `update_behavior`
|
|
109
|
+
document op. Supply `entity_id`, `index` and `behavior: {source}` to preserve the
|
|
110
|
+
script limits. The editor compiles changed sources
|
|
111
|
+
during play and continues at the current tick with
|
|
112
|
+
existing script state. A compile failure keeps the previous source running and
|
|
113
|
+
reports the error in the Console. Only source edits apply during play. Use
|
|
114
|
+
**Restart from tick 0** to apply other draft changes or reset script state.
|
|
115
|
+
Changing between a function and lifecycle-object script requires a restart.
|
|
116
|
+
|
|
117
|
+
A successful reload starts a new replay checkpoint at the current tick. Saved
|
|
118
|
+
play states use the accepted script document. Earlier checkpoints belong to
|
|
119
|
+
older source code and cannot be loaded into the changed session.
|
|
120
|
+
|
|
121
|
+
## Assets
|
|
122
|
+
|
|
123
|
+
Generation spends provider credits, and no tool prices it in advance. Before
|
|
124
|
+
the first generation, state which slots, kinds, prompts and models you plan,
|
|
125
|
+
and get the user's go-ahead unless the request already authorized that scope.
|
|
126
|
+
Do not invent a dollar estimate. Reuse a prior authorization instead of asking
|
|
127
|
+
again. Importing an `input_file` and building a `lut` cost nothing. Report
|
|
128
|
+
actual spend with `get_cost_summary`.
|
|
129
|
+
|
|
130
|
+
Call `browse_native_game_assets {game_id}` before replacing or regenerating
|
|
131
|
+
art. It returns every bound asset with `usedBy`, prefabs with their instances,
|
|
132
|
+
scenes with the assets they use, the staged candidates under the game's
|
|
133
|
+
`assets/` folder, and `slot_requests`. A slot request is the template slot's
|
|
134
|
+
prompt and image preparation, or the prompt recorded with the asset now bound.
|
|
135
|
+
Use it to regenerate in the same style. Narrow the lists with `query` and
|
|
136
|
+
`kind`. `staleSiblings` lists `<slot>.frame.N` and `<slot>.tile.M` bindings that
|
|
137
|
+
still point at the slot's previous bytes. Rebind them with `bind_asset` ops
|
|
138
|
+
before publishing, or the sheet's animations keep drawing the old art.
|
|
139
|
+
|
|
140
|
+
`generate_game_asset {game_id, slot, kind, prompt?, input_file?, provider?,
|
|
141
|
+
model?}` generates or imports, prepares, installs, and binds an asset. `kind` is
|
|
142
|
+
`image`, `audio` (speech), `music`, `sfx`, `font`, `model` or `collider`.
|
|
143
|
+
`sfx` uses an explicit registered `node_type` and its `params`, or imports an
|
|
144
|
+
existing audio file. `font` imports a TrueType or OpenType `input_file` and has
|
|
145
|
+
no generation model. An `input_file` is an owned asset URI or current workspace
|
|
146
|
+
path. `reference_slot` generates an image from an installed slot's image, which
|
|
147
|
+
keeps a new asset in the locked style. `install: false` stages a 2D candidate
|
|
148
|
+
without binding it. For a slow model, pass `background: true`, await the
|
|
149
|
+
returned generation, then call `generate_game_asset` again with
|
|
150
|
+
`generation_id` and the same game, slot, kind, prompt, and preparation.
|
|
151
|
+
|
|
152
|
+
`install_native_game_asset {game_id, slot, binding, candidate_workspace_id?}`
|
|
153
|
+
installs a staged candidate and binds it to the draft. The staged bytes must
|
|
154
|
+
match `binding.digest`. To bind an earlier candidate, call
|
|
155
|
+
`browse_native_game_assets {game_id, digest, slot}` and pass the returned
|
|
156
|
+
`binding` and `draft_updated_at`. An unrecorded image or audio file gets a
|
|
157
|
+
binding derived from its bytes. An unrecorded collider must be restaged.
|
|
158
|
+
|
|
159
|
+
Image preparation supports alpha trim, target size and crop policy, pivot,
|
|
160
|
+
sampling, and mirror tiling. Choose at most one of these atlas or grade modes:
|
|
161
|
+
|
|
162
|
+
| Preparation | Result |
|
|
163
|
+
|---|---|
|
|
164
|
+
| `sheet: {cols, rows, baseline?}` | Slices a row-major sheet, trims each pose, and aligns the feet on one output row. Returns equal-sized atlas `frames` and bindings named `<slot>.frame.<index>`. `baseline` is a zero-based output foot row. |
|
|
165
|
+
| `tileset: {tileWidth?, tileHeight?, edges?, highlight?, shadow?}` | Builds 16 terrain variants with baked exposed-edge treatments. Returns `tiles` and `<slot>.tile.<mask>` bindings. Mask bits are top `1`, right `2`, bottom `4`, left `8`. |
|
|
166
|
+
| `lut: {size?, brightness?, contrast?, saturation?, lift?, gain?, gamma?}` | Creates an opaque packed `size² × size` color cube from numeric grade settings, without a generation model. Bind it to a `lut` render effect. |
|
|
167
|
+
|
|
168
|
+
Use returned atlas rectangles as animator frames or tile frames. Keep the
|
|
169
|
+
locked style string in every generated visual prompt. Review foot alignment,
|
|
170
|
+
terrain joins, lighting, and grade in viewed captures before accepting the art
|
|
171
|
+
pass.
|
|
172
|
+
|
|
173
|
+
## Audio
|
|
174
|
+
|
|
175
|
+
Install music in an audio slot, then use `update_scene {scene_id, set: {music:
|
|
176
|
+
{assetId, volume, fadeInTicks, fadeOutTicks, streaming}}}` in 2D or 3D.
|
|
177
|
+
`assetId` names the installed slot. `volume` ranges from 0 to 1 and each fade
|
|
178
|
+
ranges from 0 to 600 ticks. A scene transition overlaps the outgoing fade out
|
|
179
|
+
and incoming fade in.
|
|
180
|
+
|
|
181
|
+
For long tracks set `streaming: {loopStartSeconds, loopEndSeconds?}`. The
|
|
182
|
+
browser streams the asset through the music bus without decoding the whole
|
|
183
|
+
track. Loop start defaults to 0 seconds. Loop end must exceed loop start,
|
|
184
|
+
and both are bounded by 86400 seconds. Omit loop end to loop to the track's
|
|
185
|
+
end. Omit `streaming` for decoded music. Loading a snapshot positions music at
|
|
186
|
+
the saved logical tick within the loop. Browser audio needs a user gesture.
|
|
187
|
+
|
|
188
|
+
Use `set_audio {mixer}` for mixer buses and `audioSource` for triggered effects.
|
|
189
|
+
See `native-game-reference` § Audio mix and spatial audio for their fields.
|
|
190
|
+
|
|
191
|
+
## 3D authoring
|
|
192
|
+
|
|
193
|
+
Create with `dimension: "3d"` and optional `template: "exploration"`.
|
|
194
|
+
The document uses `schemaVersion: 3`, `engineVersion: "2"`, meters, Y up,
|
|
195
|
+
forward `-Z`, and quaternion rotations `[x, y, z, w]`. A game keeps its
|
|
196
|
+
dimension. Read the returned outline before editing. The 2D sandbox helpers and
|
|
197
|
+
sprite preparation retain their 2D contracts.
|
|
198
|
+
|
|
199
|
+
Keep controller, body, collider and interactions on a gameplay root. Put the
|
|
200
|
+
replaceable model on a visual child using `parentId`. Physics roots have unit
|
|
201
|
+
scale and one pose owner. `character3d` requires a kinematic body and a capsule.
|
|
202
|
+
Dynamic props use primitives or prepared convex hulls. Triangle meshes require
|
|
203
|
+
static bodies. Collision category and mask use 16 bits in 3D. Shared friction
|
|
204
|
+
and restitution belong in named `physicsMaterials` that colliders reference by
|
|
205
|
+
`physicsMaterial`. Each scene names one `activeCameraId`. The camera supports perspective or orthographic projection
|
|
206
|
+
and fixed or follow behavior.
|
|
207
|
+
|
|
208
|
+
`generate_game_asset {game_id, slot, kind: "model", input_file, preparation?}`
|
|
209
|
+
imports an owned GLB or glTF. Provider generation requires an explicit
|
|
210
|
+
registered `node_type` with its `params`. Preparation normalizes dependencies to
|
|
211
|
+
a closed GLB, records bounds and stable `node:<index>`/`clip:<index>`
|
|
212
|
+
selectors, and checks resource budgets. Import settings specify `scale`,
|
|
213
|
+
`forward` (`-z`, `+z`, `+x`, `-x`) and `origin` (`preserve`, `ground`,
|
|
214
|
+
`centerGround`). For glTF with separate files, pass `dependency_files` as a map
|
|
215
|
+
from declared buffer or image URI to an owned workspace path. Unresolved
|
|
216
|
+
dependencies fail preparation. `kind: "collider"` builds collision geometry
|
|
217
|
+
from a GLB or glTF, or accepts an already prepared collider JSON, and requires
|
|
218
|
+
`preparation.shape`: `convexHull` for a dynamic prop or `triangleMesh` for
|
|
219
|
+
static level geometry. Model and collider results are candidates. Review them,
|
|
220
|
+
then call `install_native_game_asset` with the returned binding and draft
|
|
221
|
+
timestamp. Reinstall after editing source model bytes. The model editor
|
|
222
|
+
(`nodetool-3d-scene`) edits model assets. Gameplay stays in the game document.
|
|
223
|
+
|
|
224
|
+
A `set_prefab` definition includes `rootId`, `entities`, `externalAssets` and
|
|
225
|
+
`externalScenes`. `instantiate_prefab` clones that subtree with a new
|
|
226
|
+
`instance_id` and remaps internal entity references. Each runtime instance owns
|
|
227
|
+
its script state, physics bodies and animation state. Bind prepared clips
|
|
228
|
+
through `animator3d.clips`. An idle/run/jump rig can replace the placeholder
|
|
229
|
+
visual without changing its root controller or collider.
|
|
230
|
+
|
|
231
|
+
3D script input adds analog `axes`, `look`, XYZ `entity.position`/`velocity`,
|
|
232
|
+
`grounded`, world entities and query observations. It preserves isolated JSON
|
|
233
|
+
state, seeded `random`, and previous-tick event delivery. Use `characterIntent`
|
|
234
|
+
for character motion, `setKinematicPose` for kinematic targets, `impulse` or
|
|
235
|
+
`setVelocity` for dynamic bodies, and `teleport` for explicit discontinuities.
|
|
236
|
+
For continuous acceleration, return `{kind: "addForce", force: {x, y, z}}`,
|
|
237
|
+
`{kind: "addTorque", torque: {x, y, z}}` or
|
|
238
|
+
`{kind: "addForceAtPoint", force: {x, y, z}, point: {x, y, z}}`.
|
|
239
|
+
The vectors and application point use world space. These commands act on the
|
|
240
|
+
issuing entity's active dynamic body and accumulate for one simulation tick.
|
|
241
|
+
Return them each tick to keep applying a load. An offset point also produces
|
|
242
|
+
torque. Static, kinematic and absent bodies reject them. 2D scripts do not
|
|
243
|
+
support them.
|
|
244
|
+
`setVisual` changes only a nonphysical visual. `spawn` accepts a prefab and XYZ
|
|
245
|
+
position, rotation and velocity. Shared `emit`, `hud`, `playAnimation`,
|
|
246
|
+
`despawn` and `sceneTransition` commands retain their meanings. Ray and shape
|
|
247
|
+
queries are bounded commands with a caller-supplied `queryId`. Results arrive
|
|
248
|
+
in the next tick. Scripts receive no Three.js or Rapier objects.
|
|
249
|
+
|
|
250
|
+
3D playtests accept run-length frames with `pressed`, `justPressed`, `axes`,
|
|
251
|
+
`look` and `ticks`. Assertions take `{entity_id, near: {x, y, z, tolerance}}`,
|
|
252
|
+
`{entity_id, region: {min, max}}` and `{entity_id, grounded}`, each with an
|
|
253
|
+
optional `at_tick`, plus the `event` and `no_script_errors` forms. Set
|
|
254
|
+
`restore_at_tick` with a `{replay_matches: true}` assertion to compare restored
|
|
255
|
+
continuation against the recorded route. `autoplay_native_game` reports 3D as
|
|
256
|
+
unsupported, so write the route yourself and assert the win. Capture the same
|
|
257
|
+
source, revision, seed and inputs to review actual WebGL2 frames and state
|
|
258
|
+
hashes. A failed tick invalidates the session. Reset or restore a snapshot from
|
|
259
|
+
before the failure.
|
|
260
|
+
|
|
261
|
+
`build_native_game` exports a self-contained directory for an immutable
|
|
262
|
+
revision. Serve it over static HTTP. Models, colliders, fonts, audio and pinned
|
|
263
|
+
runtime files are included. The first 3D release targets desktop web and
|
|
264
|
+
Electron.
|
|
265
|
+
|
|
266
|
+
## Platformers
|
|
267
|
+
|
|
268
|
+
New 2D games (schema 4) support side-view physics. Older documents need schema
|
|
269
|
+
2 or later.
|
|
270
|
+
|
|
271
|
+
1. Set scene `gravity {x, y}` in world units per second squared. Kinematic
|
|
272
|
+
bodies fall at `body2d.gravityScale` times the gravity, which defaults to
|
|
273
|
+
`1`. Give floating effects `gravityScale: 0`.
|
|
274
|
+
2. A body that strikes a solid loses the velocity that pushed into it. A resting
|
|
275
|
+
body therefore keeps zero fall speed, and a script can add a jump to
|
|
276
|
+
`entity.velocityY`.
|
|
277
|
+
3. Mark a tilemap `solid: true`, or a single tile `solid`, to make its tiles
|
|
278
|
+
static colliders. Tilemap `category` and `mask` filter them. Faces shared by
|
|
279
|
+
neighboring solid tiles never stop a body, so a body slides along a row of
|
|
280
|
+
tiles without catching on the seams.
|
|
281
|
+
4. A `oneWay` collider or tile stops only a body that falls onto its top.
|
|
282
|
+
A body passes through it from below and from the sides.
|
|
283
|
+
5. A static body with a velocity, from `patrol` or a script, is a moving solid.
|
|
284
|
+
It carries the bodies that stand on it and pushes out bodies in its way.
|
|
285
|
+
6. A patrolling kinematic body turns when a wall blocks it. Set
|
|
286
|
+
`turnAtLedges: true` on an x-axis patrol to also turn at the edge of its
|
|
287
|
+
ground.
|
|
288
|
+
7. Frames omit tiles far outside the camera, so a large tilemap costs little to
|
|
289
|
+
draw.
|
|
290
|
+
|
|
291
|
+
## Failures and validation
|
|
292
|
+
|
|
293
|
+
Runtime event and spawned-instance limits stop the session when exceeded.
|
|
294
|
+
A failed tick cannot be saved or resumed. Reset the session or load a snapshot
|
|
295
|
+
from before the failure, then reduce overlapping pairs or spawning.
|
|
296
|
+
|
|
297
|
+
Validation rejects unsupported component fields. Movement requires a kinematic
|
|
298
|
+
body, patrol requires a body, animation requires a sprite, and asset media kinds
|
|
299
|
+
must match their image or audio components. Resolve validation errors before
|
|
300
|
+
publishing. `native-game-reference` § Schema versions lists which fields each
|
|
301
|
+
2D schema accepts.
|
|
302
|
+
|
|
303
|
+
## Scope
|
|
304
|
+
|
|
305
|
+
The runtime supports separate 2D and 3D games. Mixed dimensions, multiplayer,
|
|
306
|
+
terrain streaming, navigation meshes, vehicles, ragdolls, retargeting and root
|
|
307
|
+
motion are outside this release. A glTF model is an asset, so use
|
|
308
|
+
`nodetool-3d-scene` to edit one. Existing external-engine source files can
|
|
309
|
+
remain in a workspace as files, but their scripts and scenes need reconstruction in
|
|
310
|
+
the built-in game document to become playable.
|