@origingame/engine 0.3.0 → 0.5.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/dist/web/origin-engine.d.ts +44 -5
- package/dist/web/origin-engine.js +279 -19
- package/dist/web/origin-engine_bg.wasm +0 -0
- package/dist/web/origin-engine_bg.wasm.d.ts +18 -5
- package/dist/web-publish/origin-engine-lanes.js +289 -48
- package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish/origin-engine.d.ts +44 -5
- package/dist/web-publish/origin-engine.js +279 -38
- package/dist/web-publish/origin-engine_bg.wasm +0 -0
- package/dist/web-publish/origin-engine_bg.wasm.d.ts +18 -5
- package/dist/web-publish-2d/origin-engine-lanes.js +289 -48
- package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine.d.ts +44 -5
- package/dist/web-publish-2d/origin-engine.js +279 -38
- package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +18 -5
- package/knowledge/README.md +2 -1
- package/knowledge/guides/three-to-og.md +393 -0
- package/knowledge/knowledge.json +2 -1
- package/knowledge/looks/catalogue.json +123 -2
- package/knowledge/package.json +3 -2
- package/knowledge/scaffold/origin-engine.json +2 -2
- package/knowledge/scaffold/template/package.json +1 -1
- package/knowledge/scaffold/template/project.ogt +1 -1
- package/knowledge/scripts/validate.ts +209 -27
- package/knowledge/skills/og-audio/SKILL.md +33 -7
- package/knowledge/skills/og-build/SKILL.md +66 -7
- package/knowledge/skills/og-core/SKILL.md +24 -8
- package/knowledge/skills/og-feel/SKILL.md +11 -3
- package/knowledge/skills/og-game/SKILL.md +680 -51
- package/knowledge/skills/og-i18n/SKILL.md +7 -7
- package/knowledge/skills/og-model/SKILL.md +374 -0
- package/knowledge/skills/og-platform-sdk/SKILL.md +7 -1
- package/knowledge/skills/og-taste/SKILL.md +7 -0
- package/knowledge/skills/og-ui/SKILL.md +39 -8
- package/knowledge/wiki/ai.md +20 -20
- package/knowledge/wiki/anim.md +537 -63
- package/knowledge/wiki/atmosphere.md +13 -13
- package/knowledge/wiki/audio.md +160 -20
- package/knowledge/wiki/camera.md +13 -13
- package/knowledge/wiki/commands.md +11 -11
- package/knowledge/wiki/debug.md +13 -13
- package/knowledge/wiki/game.md +8 -8
- package/knowledge/wiki/i18n.md +7 -7
- package/knowledge/wiki/index.md +81 -3
- package/knowledge/wiki/input.md +47 -47
- package/knowledge/wiki/load.md +83 -57
- package/knowledge/wiki/math.md +102 -102
- package/knowledge/wiki/nav.md +34 -34
- package/knowledge/wiki/net.md +10 -10
- package/knowledge/wiki/path.md +14 -14
- package/knowledge/wiki/physics.md +111 -100
- package/knowledge/wiki/platform.md +44 -44
- package/knowledge/wiki/probe.md +86 -86
- package/knowledge/wiki/reflect.md +30 -18
- package/knowledge/wiki/render.md +1243 -176
- package/knowledge/wiki/rng.md +14 -14
- package/knowledge/wiki/shapes.md +727 -0
- package/knowledge/wiki/stream.md +15 -15
- package/knowledge/wiki/system.md +8 -8
- package/knowledge/wiki/systems.md +2 -2
- package/knowledge/wiki/terrain.md +24 -20
- package/knowledge/wiki/tilemap.md +13 -13
- package/knowledge/wiki/time.md +4 -4
- package/knowledge/wiki/timeline.md +14 -14
- package/knowledge/wiki/transform.md +8 -8
- package/knowledge/wiki/tween.md +17 -17
- package/knowledge/wiki/ui.md +245 -269
- package/knowledge/wiki/video.md +5 -5
- package/knowledge/wiki/world.md +36 -36
- package/package.json +4 -4
- package/schema/api.schema.json +2238 -81
- package/shell/page.ts +4 -0
- package/shell/platform.ts +5 -0
- package/shell/player.ts +8 -2
- package/shell/transport.ts +6 -0
- package/src/generated/abi.ts +40 -1
- package/src/geom.ts +260 -0
- package/src/index.ts +19 -1
- package/src/node/device.ts +5 -2
- package/src/node/playtest-run.ts +1 -0
- package/src/node/polish.ts +34 -15
- package/src/node/run.ts +23 -6
- package/src/platform-local.ts +2 -0
- package/src/playtest.ts +8 -0
- package/src/runtime.ts +88 -6
- package/src/ui-kit/settings.ts +9 -0
- package/src/web/gl-state.ts +907 -0
- package/src/web/shell.ts +1 -1
- package/src/web/worker.ts +8 -2
- package/types/bindings.json +1222 -453
- package/types/index.d.ts +1868 -315
|
@@ -6,9 +6,9 @@ Reflection: components and resources are declared once with their field layout a
|
|
|
6
6
|
|
|
7
7
|
The inspector, Tune, the probe, scene text and the wiki read this one schema. Each column factory below makes one field.
|
|
8
8
|
|
|
9
|
-
A field holds one value
|
|
9
|
+
A field holds one value, or a list of at most a fixed number of one number type or handle: `list(u32(), 8)`, `list(Asset(), 4)` (the list factory below). A list is read as a frozen copy (`push` throws) and written whole (`chain.passes = [...chain.passes, h]`); one over its capacity is refused, never truncated. A few vectors are numbered fields (`p0` to `p7`, as og.CameraRail does); a list of things with fields of their own is an entity each, with its own component, looped over by a query (a ring of skid marks, the laps of a race); a long record (a lap's taped inputs) is text in `str` fields of at most 4,096 bytes each, chunked over entities. Keep none of it in module variables: they are not world state, so a snapshot, a replay and a hot reload lose them.
|
|
10
10
|
|
|
11
|
-
A handle (an og.load answer, a texture, a sound, a geometry, a material, an entity) is a 64-bit number: keep it in a field of its own kind (`Asset()`, `Texture()`, `Sound()`, `Geometry()`, `Material()`, `Entity()
|
|
11
|
+
A handle (an og.load answer, a texture, a sound, a geometry, a material, an entity) is a 64-bit number: keep it in a field of its own kind (`Asset()`, `Texture()`, `Sound()`, `Font()`, `Style()`, `Geometry()`, `Material()`, `Entity()`: every handle type of the API has its factory, named as the type), never cast to another kind, in a component or a resource. A `u32` field refuses one (handles pass 2^32: `4294967298 is not a u32`); an `f64` holds the number but loses its type.
|
|
12
12
|
|
|
13
13
|
- **TypeScript**: functions are named exports of the package: `import { … } from "@origingame/engine"`; components, resources and events are tokens on `og`.
|
|
14
14
|
- **Publish builds**: kept (members may override).
|
|
@@ -20,7 +20,7 @@ module reflect {
|
|
|
20
20
|
# declarations follow, each quoted below
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
<sub>`api.ogt` line
|
|
23
|
+
<sub>`api.ogt` line 661</sub>
|
|
24
24
|
|
|
25
25
|
## Contents
|
|
26
26
|
|
|
@@ -38,6 +38,7 @@ module reflect {
|
|
|
38
38
|
| [`Matrix4()`](#column-Matrix4) | column kind | A Matrix4 field: sixteen column-major elements per entity. |
|
|
39
39
|
| [`Color()`](#column-Color) | column kind | A Color field: r, g, b interleaved. |
|
|
40
40
|
| [`str()`](#column-str) | column kind | Text of at most `capacity` bytes of UTF-8, stored inline and zero-padded, so it is world state like a number: a player's name, a label. `str(48)` holds any 12 characters (four bytes covers every script). The capacity is 1 to 4,096 bytes: a larger one is refused when the game starts (`a string field holds 1 to 4096 bytes`), so longer text goes in chunks, an entity each. |
|
|
41
|
+
| [`list()`](#column-list) | column kind | A list of at most `capacity` values of one number column (`f32`, `f64`, `u32`, `i32`) or handle column (`Asset`, `Entity`, `Post`, ...), stored inline: a count, then the elements, zeros past the count, so `[]` and `[0]` differ and the list is world state like a number. The capacity is 1 to 1,024 elements; it starts empty and is never tunable. |
|
|
41
42
|
| [`defineComponent`](#fn-defineComponent) | function | Declare a component: plain data stored per entity in engine memory, one column per field. |
|
|
42
43
|
| [`defineResource`](#fn-defineResource) | function | Declare a resource: a reflected singleton, such as a tuning table. Its fields start at their defaults. |
|
|
43
44
|
|
|
@@ -75,7 +76,7 @@ fn defineComponent {
|
|
|
75
76
|
}
|
|
76
77
|
```
|
|
77
78
|
|
|
78
|
-
<sub>`api.ogt` line
|
|
79
|
+
<sub>`api.ogt` line 765</sub>
|
|
79
80
|
|
|
80
81
|
<a id="fn-defineResource"></a>
|
|
81
82
|
|
|
@@ -106,7 +107,7 @@ fn defineResource {
|
|
|
106
107
|
}
|
|
107
108
|
```
|
|
108
109
|
|
|
109
|
-
<sub>`api.ogt` line
|
|
110
|
+
<sub>`api.ogt` line 774</sub>
|
|
110
111
|
|
|
111
112
|
## Types
|
|
112
113
|
|
|
@@ -142,11 +143,11 @@ struct FieldOptions {
|
|
|
142
143
|
}
|
|
143
144
|
```
|
|
144
145
|
|
|
145
|
-
<sub>`api.ogt` line
|
|
146
|
+
<sub>`api.ogt` line 669</sub>
|
|
146
147
|
|
|
147
148
|
## Column kinds
|
|
148
149
|
|
|
149
|
-
Each is a factory, `f32(value?, options?)`, that makes one field of a component or resource layout; `str(capacity, value?, options?)` takes its capacity in bytes first.
|
|
150
|
+
Each is a factory, `f32(value?, options?)`, that makes one field of a component or resource layout; `str(capacity, value?, options?)` takes its capacity in bytes first; `list(of, capacity, options?)` takes another factory's field (`u32()`, `Asset()`) and a capacity in elements.
|
|
150
151
|
|
|
151
152
|
| Column | Value | Typed array | Stride | Doc |
|
|
152
153
|
|---|---|---|---|---|
|
|
@@ -161,6 +162,7 @@ Each is a factory, `f32(value?, options?)`, that makes one field of a component
|
|
|
161
162
|
| <a id="column-Matrix4"></a>`Matrix4` | `Matrix4` | `Float32Array` | 16 | A Matrix4 field: sixteen column-major elements per entity. |
|
|
162
163
|
| <a id="column-Color"></a>`Color` | `Color` | `Float32Array` | 3 | A Color field: r, g, b interleaved. |
|
|
163
164
|
| <a id="column-str"></a>`str` | `string` | `Uint8Array` | the capacity | Text of at most `capacity` bytes of UTF-8, stored inline and zero-padded, so it is world state like a number: a player's name, a label. `str(48)` holds any 12 characters (four bytes covers every script). The capacity is 1 to 4,096 bytes: a larger one is refused when the game starts (`a string field holds 1 to 4096 bytes`), so longer text goes in chunks, an entity each. Get and set it as a JavaScript string; text over the capacity is refused with the fix named (an error value from world.insert/world.set, a throw from a resource's setter), never truncated. Its view is the raw bytes. |
|
|
165
|
+
| <a id="column-list"></a>`list` | an array of the element's | the element's | the element's × (capacity + 1) | A list of at most `capacity` values of one number column (`f32`, `f64`, `u32`, `i32`) or handle column (`Asset`, `Entity`, `Post`, ...), stored inline: a count, then the elements, zeros past the count, so `[]` and `[0]` differ and the list is world state like a number. The capacity is 1 to 1,024 elements; it starts empty and is never tunable. Reading it answers a frozen array, a copy: `push`, `splice` and index writes throw, so change it by writing a whole array (`v.passes = [...v.passes, h]`, `v.passes = []`). A list over the capacity is refused with the fix named (an error value from world.insert/world.set, a throw from a resource's setter), never truncated. Scene text and looks give it on one line, its elements in order (`passes 3 5`), the key alone for the empty list. Its view is the element's typed array with a stride of (capacity + 1) elements, the count first. |
|
|
164
166
|
|
|
165
167
|
```ogt
|
|
166
168
|
column f32 {
|
|
@@ -171,7 +173,7 @@ column f32 {
|
|
|
171
173
|
}
|
|
172
174
|
```
|
|
173
175
|
|
|
174
|
-
<sub>`api.ogt` line
|
|
176
|
+
<sub>`api.ogt` line 681</sub>
|
|
175
177
|
|
|
176
178
|
```ogt
|
|
177
179
|
column f64 {
|
|
@@ -182,7 +184,7 @@ column f64 {
|
|
|
182
184
|
}
|
|
183
185
|
```
|
|
184
186
|
|
|
185
|
-
<sub>`api.ogt` line
|
|
187
|
+
<sub>`api.ogt` line 688</sub>
|
|
186
188
|
|
|
187
189
|
```ogt
|
|
188
190
|
column u32 {
|
|
@@ -193,7 +195,7 @@ column u32 {
|
|
|
193
195
|
}
|
|
194
196
|
```
|
|
195
197
|
|
|
196
|
-
<sub>`api.ogt` line
|
|
198
|
+
<sub>`api.ogt` line 695</sub>
|
|
197
199
|
|
|
198
200
|
```ogt
|
|
199
201
|
column i32 {
|
|
@@ -204,7 +206,7 @@ column i32 {
|
|
|
204
206
|
}
|
|
205
207
|
```
|
|
206
208
|
|
|
207
|
-
<sub>`api.ogt` line
|
|
209
|
+
<sub>`api.ogt` line 702</sub>
|
|
208
210
|
|
|
209
211
|
```ogt
|
|
210
212
|
column bool {
|
|
@@ -215,7 +217,7 @@ column bool {
|
|
|
215
217
|
}
|
|
216
218
|
```
|
|
217
219
|
|
|
218
|
-
<sub>`api.ogt` line
|
|
220
|
+
<sub>`api.ogt` line 709</sub>
|
|
219
221
|
|
|
220
222
|
```ogt
|
|
221
223
|
column Vector2 {
|
|
@@ -226,7 +228,7 @@ column Vector2 {
|
|
|
226
228
|
}
|
|
227
229
|
```
|
|
228
230
|
|
|
229
|
-
<sub>`api.ogt` line
|
|
231
|
+
<sub>`api.ogt` line 716</sub>
|
|
230
232
|
|
|
231
233
|
```ogt
|
|
232
234
|
column Vector3 {
|
|
@@ -237,7 +239,7 @@ column Vector3 {
|
|
|
237
239
|
}
|
|
238
240
|
```
|
|
239
241
|
|
|
240
|
-
<sub>`api.ogt` line
|
|
242
|
+
<sub>`api.ogt` line 723</sub>
|
|
241
243
|
|
|
242
244
|
```ogt
|
|
243
245
|
column Quaternion {
|
|
@@ -248,7 +250,7 @@ column Quaternion {
|
|
|
248
250
|
}
|
|
249
251
|
```
|
|
250
252
|
|
|
251
|
-
<sub>`api.ogt` line
|
|
253
|
+
<sub>`api.ogt` line 730</sub>
|
|
252
254
|
|
|
253
255
|
```ogt
|
|
254
256
|
column Matrix4 {
|
|
@@ -259,7 +261,7 @@ column Matrix4 {
|
|
|
259
261
|
}
|
|
260
262
|
```
|
|
261
263
|
|
|
262
|
-
<sub>`api.ogt` line
|
|
264
|
+
<sub>`api.ogt` line 737</sub>
|
|
263
265
|
|
|
264
266
|
```ogt
|
|
265
267
|
column Color {
|
|
@@ -270,7 +272,7 @@ column Color {
|
|
|
270
272
|
}
|
|
271
273
|
```
|
|
272
274
|
|
|
273
|
-
<sub>`api.ogt` line
|
|
275
|
+
<sub>`api.ogt` line 744</sub>
|
|
274
276
|
|
|
275
277
|
```ogt
|
|
276
278
|
column str {
|
|
@@ -282,4 +284,14 @@ column str {
|
|
|
282
284
|
}
|
|
283
285
|
```
|
|
284
286
|
|
|
285
|
-
<sub>`api.ogt` line
|
|
287
|
+
<sub>`api.ogt` line 751</sub>
|
|
288
|
+
|
|
289
|
+
```ogt
|
|
290
|
+
column list {
|
|
291
|
+
doc "A list of at most `capacity` values of one number column (`f32`, `f64`, `u32`, `i32`) or handle column (`Asset`, `Entity`, `Post`, ...), stored inline: a count, then the elements, zeros past the count, so `[]` and `[0]` differ and the list is world state like a number. The capacity is 1 to 1,024 elements; it starts empty and is never tunable."
|
|
292
|
+
doc "Reading it answers a frozen array, a copy: `push`, `splice` and index writes throw, so change it by writing a whole array (`v.passes = [...v.passes, h]`, `v.passes = []`). A list over the capacity is refused with the fix named (an error value from world.insert/world.set, a throw from a resource's setter), never truncated. Scene text and looks give it on one line, its elements in order (`passes 3 5`), the key alone for the empty list. Its view is the element's typed array with a stride of (capacity + 1) elements, the count first."
|
|
293
|
+
list true
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
<sub>`api.ogt` line 759</sub>
|