@origingame/engine 0.1.1 → 0.3.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/bin/og.mjs +1 -1
- package/dist/web/origin-engine.d.ts +219 -5
- package/dist/web/origin-engine.js +1344 -125
- package/dist/web/origin-engine_bg.wasm +0 -0
- package/dist/web/origin-engine_bg.wasm.d.ts +68 -3
- package/dist/web-publish/origin-engine-lanes.js +1007 -22
- package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish/origin-engine.d.ts +162 -5
- package/dist/web-publish/origin-engine.js +1004 -19
- package/dist/web-publish/origin-engine_bg.wasm +0 -0
- package/dist/web-publish/origin-engine_bg.wasm.d.ts +52 -3
- package/dist/web-publish-2d/origin-engine-lanes.js +1007 -22
- package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine.d.ts +162 -5
- package/dist/web-publish-2d/origin-engine.js +1004 -19
- package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +52 -3
- package/knowledge/looks/catalogue.json +40 -40
- package/knowledge/package.json +4 -4
- package/knowledge/scaffold/distribution.json +14 -0
- package/knowledge/scaffold/origin-engine.json +2 -2
- package/knowledge/scaffold/template/README.md +2 -1
- package/knowledge/scaffold/template/assets/audio/sting.ogt +10 -0
- package/knowledge/scaffold/template/assets/timelines/intro.ogt +101 -0
- package/knowledge/scaffold/template/assets/timelines/narration.srt +11 -0
- package/knowledge/scaffold/template/host.d.ts +46 -0
- package/knowledge/scaffold/template/package.json +1 -1
- package/knowledge/scaffold/template/project.ogt +1 -1
- package/knowledge/scaffold/template/src/main.ts +1 -1
- package/knowledge/scaffold/template/tests/frames.ts +134 -0
- package/knowledge/scaffold/template/tests/intro.og.ts +65 -0
- package/knowledge/scaffold/template/tests/smoke.og.ts +30 -36
- package/knowledge/scaffold/template/tsconfig.json +1 -1
- package/knowledge/scripts/mount.ts +2 -1
- package/knowledge/scripts/validate.ts +21 -11
- package/knowledge/skills/og-build/SKILL.md +25 -6
- package/knowledge/skills/og-core/SKILL.md +11 -0
- package/knowledge/skills/og-feel/SKILL.md +8 -1
- package/knowledge/skills/og-game/SKILL.md +994 -21
- package/knowledge/skills/og-i18n/SKILL.md +12 -3
- package/knowledge/skills/og-platform-sdk/SKILL.md +4 -1
- package/knowledge/skills/og-taste/SKILL.md +82 -73
- package/knowledge/skills/og-ui/SKILL.md +82 -54
- package/knowledge/wiki/ai.md +20 -20
- package/knowledge/wiki/anim.md +384 -41
- package/knowledge/wiki/atmosphere.md +36 -13
- package/knowledge/wiki/audio.md +18 -18
- package/knowledge/wiki/camera.md +19 -13
- package/knowledge/wiki/commands.md +19 -13
- package/knowledge/wiki/debug.md +414 -0
- package/knowledge/wiki/game.md +8 -8
- package/knowledge/wiki/i18n.md +7 -7
- package/knowledge/wiki/index.md +265 -7
- package/knowledge/wiki/input.md +47 -47
- package/knowledge/wiki/load.md +236 -68
- package/knowledge/wiki/math.md +2614 -7
- package/knowledge/wiki/nav.md +34 -34
- package/knowledge/wiki/net.md +340 -0
- package/knowledge/wiki/path.md +402 -0
- package/knowledge/wiki/physics.md +124 -106
- package/knowledge/wiki/platform.md +465 -31
- package/knowledge/wiki/probe.md +681 -67
- package/knowledge/wiki/reflect.md +15 -15
- package/knowledge/wiki/render.md +3904 -1897
- package/knowledge/wiki/rng.md +14 -14
- 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 +19 -19
- package/knowledge/wiki/tilemap.md +19 -15
- package/knowledge/wiki/time.md +4 -4
- package/knowledge/wiki/timeline.md +396 -0
- package/knowledge/wiki/transform.md +8 -8
- package/knowledge/wiki/tween.md +17 -17
- package/knowledge/wiki/ui.md +603 -629
- package/knowledge/wiki/video.md +157 -0
- package/knowledge/wiki/world.md +67 -37
- package/package.json +7 -6
- package/schema/api.schema.json +21071 -13964
- package/shell/page.ts +26 -2
- package/shell/platform.ts +46 -0
- package/shell/player.ts +7 -0
- package/src/depth.ts +71 -0
- package/src/e6.ts +32 -1
- package/src/env.d.ts +5 -1
- package/src/generated/abi.ts +189 -3
- package/src/index.ts +26 -4
- package/src/light.ts +18 -0
- package/src/math.ts +622 -0
- package/src/node/index.ts +17 -0
- package/src/node/playtest-run.ts +114 -18
- package/src/node/polish.ts +15 -4
- package/src/node/render.ts +291 -0
- package/src/node/run.ts +91 -6
- package/src/p2.ts +19 -1
- package/src/playtest.ts +57 -4
- package/src/runtime.ts +15 -3
- package/src/targets.ts +28 -0
- package/src/trace.ts +169 -0
- package/src/ui-kit/huds.ts +49 -45
- package/src/ui-kit/menus.ts +12 -12
- package/src/ui-kit/settings.ts +2 -2
- package/src/ui-kit/store.ts +18 -18
- package/src/ui-kit/story.ts +6 -4
- package/src/ui-kit/util.ts +8 -8
- package/src/web/shell.ts +58 -0
- package/src/web/worker.ts +103 -2
- package/types/bindings.json +8945 -6456
- package/types/index.d.ts +15507 -11437
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<!-- Generated from crates/og-api/api.ogt by `og api gen`. Do not edit: `og api check` fails on any difference; change api.ogt and regenerate. -->
|
|
2
|
+
|
|
3
|
+
# The `video` module
|
|
4
|
+
|
|
5
|
+
Footage in a game (docs/design.md §2.9): a `type video` asset cooked by ffmpeg into a texture array of its frames and its sound, loaded with og.load.video and played by og.VideoPlayer. The frame shown is a Texture (VideoInfo.texture, also VideoPlayer.texture) any material map, og.Sprite or UI image draws, and the sound plays on the entity's og.AudioSource in step with it.
|
|
6
|
+
|
|
7
|
+
Playback is simulation: the og.video system (after the game's systems, before og.audio) advances VideoPlayer.time by the tick's dt times `speed` (not the time scale, so the picture stays with its sound), so the frame at a tick is the same on both hosts, in every run and after a snapshot is restored. With a 30 Hz tick a player started at 0 shows the source's frame 3 s in at tick 90.
|
|
8
|
+
|
|
9
|
+
- **TypeScript**: functions are none at module level (its members live on the types below); components, resources and events are tokens on `og`.
|
|
10
|
+
- **Publish builds**: kept (members may override).
|
|
11
|
+
- **Skill**: `og-game`, which teaches the module (how much of it to use, and how to prove it).
|
|
12
|
+
- **Index**: [every module and name](index.md).
|
|
13
|
+
|
|
14
|
+
```ogt
|
|
15
|
+
module video {
|
|
16
|
+
# declarations follow, each quoted below
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
<sub>`api.ogt` line 13361</sub>
|
|
20
|
+
|
|
21
|
+
## Contents
|
|
22
|
+
|
|
23
|
+
| Name | Kind | Summary |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| [`Video`](#type-Video) | handle | Cooked footage: its frames as a texture array, its sound (og.load.video). |
|
|
26
|
+
| [`Video()`](#column-Video) | column kind | A Video handle field (0 is none). |
|
|
27
|
+
| [`VideoInfo`](#type-VideoInfo) | struct | What og.load.video loaded. |
|
|
28
|
+
| [`og.VideoPlayer`](#record-VideoPlayer) | component | Plays a loaded video: VideoInfo.texture shows its current frame (frame n is the source at n / fps seconds), and when the entity has an og.AudioSource the og.video system sets its sound, playing, pitch and loop each tick so the sound plays in step: a seek or a restart starts the sound again at the new time on the next tick (AudioSource.startOffset). Each player has a texture of its own (written to `texture`): the first player of a video takes VideoInfo.texture, each further one a texture the og.video system makes for it over the same decoded frames (one frame of GPU memory each), so two players at different times show different frames. Show a player's `texture`, not VideoInfo.texture, once a video has more than one player. |
|
|
29
|
+
|
|
30
|
+
## Components, resources and events
|
|
31
|
+
|
|
32
|
+
<a id="record-VideoPlayer"></a>
|
|
33
|
+
|
|
34
|
+
### `og.VideoPlayer` (component)
|
|
35
|
+
|
|
36
|
+
Plays a loaded video: VideoInfo.texture shows its current frame (frame n is the source at n / fps seconds), and when the entity has an og.AudioSource the og.video system sets its sound, playing, pitch and loop each tick so the sound plays in step: a seek or a restart starts the sound again at the new time on the next tick (AudioSource.startOffset). Each player has a texture of its own (written to `texture`): the first player of a video takes VideoInfo.texture, each further one a texture the og.video system makes for it over the same decoded frames (one frame of GPU memory each), so two players at different times show different frames. Show a player's `texture`, not VideoInfo.texture, once a video has more than one player.
|
|
37
|
+
|
|
38
|
+
Token `og.VideoPlayer`, registered under the schema name `og.VideoPlayer`; its value type is `VideoPlayer`.
|
|
39
|
+
|
|
40
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
41
|
+
|---|---|---|---|---|---|---|
|
|
42
|
+
| `video` | `Video` | `0` | — | — | — | The video (og.load.video's `video`); 0 plays nothing. |
|
|
43
|
+
| `playing` | `boolean` | `true` | — | — | — | Whether time advances. |
|
|
44
|
+
| `time` | `number` | `0` | ≥ 0 | `s` | — | Seconds into the video; written every tick, set it to seek. |
|
|
45
|
+
| `speed` | `number` | `1` | 0 … 4 | — | tunable | The playback rate: 1 as cooked, 0.5 half speed (the sound's pitch follows). |
|
|
46
|
+
| `loop` | `boolean` | `false` | — | — | — | Start again at 0 past the end; otherwise hold the last frame and set finished. |
|
|
47
|
+
| `frame` | `number` | `0` | — | — | read only | Written: the frame shown, floor(time * fps). |
|
|
48
|
+
| `finished` | `boolean` | `false` | — | — | read only | Written: a player without loop reached the end. |
|
|
49
|
+
| `texture` | `Texture` | `0` | — | — | read only | Written: this player's texture (VideoInfo.texture for the video's first player, a texture of its own for each further one), for a material, sprite or UI image set up from the player. It keeps it while it lives. |
|
|
50
|
+
|
|
51
|
+
```ogt
|
|
52
|
+
component VideoPlayer {
|
|
53
|
+
doc "Plays a loaded video: VideoInfo.texture shows its current frame (frame n is the source at n / fps seconds), and when the entity has an og.AudioSource the og.video system sets its sound, playing, pitch and loop each tick so the sound plays in step: a seek or a restart starts the sound again at the new time on the next tick (AudioSource.startOffset). Each player has a texture of its own (written to `texture`): the first player of a video takes VideoInfo.texture, each further one a texture the og.video system makes for it over the same decoded frames (one frame of GPU memory each), so two players at different times show different frames. Show a player's `texture`, not VideoInfo.texture, once a video has more than one player."
|
|
54
|
+
field video Video "The video (og.load.video's `video`); 0 plays nothing."
|
|
55
|
+
field playing bool "Whether time advances." {
|
|
56
|
+
default true
|
|
57
|
+
}
|
|
58
|
+
field time f32 "Seconds into the video; written every tick, set it to seek." {
|
|
59
|
+
min 0
|
|
60
|
+
unit s
|
|
61
|
+
}
|
|
62
|
+
field speed f32 "The playback rate: 1 as cooked, 0.5 half speed (the sound's pitch follows)." {
|
|
63
|
+
default 1
|
|
64
|
+
min 0
|
|
65
|
+
max 4
|
|
66
|
+
tunable true
|
|
67
|
+
}
|
|
68
|
+
field loop bool "Start again at 0 past the end; otherwise hold the last frame and set finished."
|
|
69
|
+
field frame u32 "Written: the frame shown, floor(time * fps)." {
|
|
70
|
+
readonly true
|
|
71
|
+
}
|
|
72
|
+
field finished bool "Written: a player without loop reached the end." {
|
|
73
|
+
readonly true
|
|
74
|
+
}
|
|
75
|
+
field texture Texture "Written: this player's texture (VideoInfo.texture for the video's first player, a texture of its own for each further one), for a material, sprite or UI image set up from the player. It keeps it while it lives." {
|
|
76
|
+
readonly true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
<sub>`api.ogt` line 13393</sub>
|
|
82
|
+
|
|
83
|
+
## Types
|
|
84
|
+
|
|
85
|
+
<a id="type-Video"></a>
|
|
86
|
+
|
|
87
|
+
### `Video` (handle)
|
|
88
|
+
|
|
89
|
+
Cooked footage: its frames as a texture array, its sound (og.load.video).
|
|
90
|
+
|
|
91
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
92
|
+
|
|
93
|
+
```ogt
|
|
94
|
+
handle Video "Cooked footage: its frames as a texture array, its sound (og.load.video)."
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
<sub>`api.ogt` line 13366</sub>
|
|
98
|
+
|
|
99
|
+
<a id="type-VideoInfo"></a>
|
|
100
|
+
|
|
101
|
+
### `VideoInfo` (struct)
|
|
102
|
+
|
|
103
|
+
What og.load.video loaded.
|
|
104
|
+
|
|
105
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
106
|
+
|---|---|---|---|---|---|---|
|
|
107
|
+
| `video` | `Video` | `0` | — | — | — | The video. |
|
|
108
|
+
| `texture` | `Texture` | `0` | — | — | — | The texture that shows the frame its og.VideoPlayer is at (frame 0 until one plays it). |
|
|
109
|
+
| `sound` | `Sound` | `0` | — | — | — | Its sound track (og.load.sound's kind of handle, for an og.AudioSource); 0 when it has none or was cooked with `audio false`. |
|
|
110
|
+
| `width` | `number` | `0` | — | — | — | Each frame's width in texels. |
|
|
111
|
+
| `height` | `number` | `0` | — | — | — | Each frame's height in texels. |
|
|
112
|
+
| `frames` | `number` | `0` | — | — | — | Frames kept (at most 256). |
|
|
113
|
+
| `fps` | `number` | `0` | — | — | — | Frames per second kept. |
|
|
114
|
+
| `seconds` | `number` | `0` | — | `s` | — | frames / fps. |
|
|
115
|
+
| `format` | `string` | `""` | — | — | — | The frames' encoding on the GPU (`rgba8`, `bc7`, `astc4x4`, `etc2`). |
|
|
116
|
+
| `bytes` | `number` | `0` | — | `bytes` | — | Bytes its frames take on the GPU. |
|
|
117
|
+
|
|
118
|
+
```ogt
|
|
119
|
+
struct VideoInfo {
|
|
120
|
+
doc "What og.load.video loaded."
|
|
121
|
+
field video Video "The video."
|
|
122
|
+
field texture Texture "The texture that shows the frame its og.VideoPlayer is at (frame 0 until one plays it)."
|
|
123
|
+
field sound Sound "Its sound track (og.load.sound's kind of handle, for an og.AudioSource); 0 when it has none or was cooked with `audio false`."
|
|
124
|
+
field width u32 "Each frame's width in texels."
|
|
125
|
+
field height u32 "Each frame's height in texels."
|
|
126
|
+
field frames u32 "Frames kept (at most 256)."
|
|
127
|
+
field fps u32 "Frames per second kept."
|
|
128
|
+
field seconds f32 "frames / fps." {
|
|
129
|
+
unit s
|
|
130
|
+
}
|
|
131
|
+
field format String "The frames' encoding on the GPU (`rgba8`, `bc7`, `astc4x4`, `etc2`)."
|
|
132
|
+
field bytes f64 "Bytes its frames take on the GPU." {
|
|
133
|
+
unit bytes
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
<sub>`api.ogt` line 13375</sub>
|
|
139
|
+
|
|
140
|
+
## Column kinds
|
|
141
|
+
|
|
142
|
+
Each is a factory, `Video(value?, options?)`, that makes one field of a component or resource layout.
|
|
143
|
+
|
|
144
|
+
| Column | Value | Typed array | Stride | Doc |
|
|
145
|
+
|---|---|---|---|---|
|
|
146
|
+
| <a id="column-Video"></a>`Video` | `Video` | `Uint32Array` | 2 | A Video handle field (0 is none). |
|
|
147
|
+
|
|
148
|
+
```ogt
|
|
149
|
+
column Video {
|
|
150
|
+
doc "A Video handle field (0 is none)."
|
|
151
|
+
array Uint32Array
|
|
152
|
+
stride 2
|
|
153
|
+
value Video
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
<sub>`api.ogt` line 13368</sub>
|
package/knowledge/wiki/world.md
CHANGED
|
@@ -16,7 +16,7 @@ module world {
|
|
|
16
16
|
# declarations follow, each quoted below
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
<sub>`api.ogt` line
|
|
19
|
+
<sub>`api.ogt` line 778</sub>
|
|
20
20
|
|
|
21
21
|
## Contents
|
|
22
22
|
|
|
@@ -26,11 +26,41 @@ module world {
|
|
|
26
26
|
| [`Entity()`](#column-Entity) | column kind | An Entity field: (index, generation) pairs. |
|
|
27
27
|
| [`SpawnDesc`](#type-SpawnDesc) | desc struct | How to spawn an entity. `{}` spawns an unnamed entity at the origin with a Transform. |
|
|
28
28
|
| [`RestoreDesc`](#type-RestoreDesc) | desc struct | How world.restore takes a save. |
|
|
29
|
+
| [`og.WorldRestored`](#record-WorldRestored) | event | A world.restore applied: the tick after it (the first whole tick after a save taken mid-tick, whose next step completes the saved tick) delivers this, read through world.events like any event. Everything in the world came back as saved, request numbers and resources the session filled included; the session did not (og-game §17), so a system that reads this resets what belongs to the session: it forgets requests answered long ago, asks the store again for the settings and progress, and closes a menu the player had open. Sent as that tick starts, not when the restore applies, so the world between the two hashes as the save did. |
|
|
29
30
|
| [`QueryDesc`](#type-QueryDesc) | desc struct | Which entities a query matches. |
|
|
30
31
|
| [`World`](#type-World) | interface | The world a system, a command or a game callback is handed. Game code never holds a world beyond the call it was passed to. |
|
|
31
32
|
| [`Query`](#type-Query) | interface | A set of matched archetypes. Iterate archetypes, never entities one by one. |
|
|
32
33
|
| [`ArchetypeView`](#type-ArchetypeView) | interface | One archetype's columns for this tick. Views are invalidated by structural changes; using a stale view throws with the tick and the system it belonged to. |
|
|
33
34
|
|
|
35
|
+
## Components, resources and events
|
|
36
|
+
|
|
37
|
+
<a id="record-WorldRestored"></a>
|
|
38
|
+
|
|
39
|
+
### `og.WorldRestored` (event)
|
|
40
|
+
|
|
41
|
+
A world.restore applied: the tick after it (the first whole tick after a save taken mid-tick, whose next step completes the saved tick) delivers this, read through world.events like any event. Everything in the world came back as saved, request numbers and resources the session filled included; the session did not (og-game §17), so a system that reads this resets what belongs to the session: it forgets requests answered long ago, asks the store again for the settings and progress, and closes a menu the player had open. Sent as that tick starts, not when the restore applies, so the world between the two hashes as the save did.
|
|
42
|
+
|
|
43
|
+
Token `og.WorldRestored`, registered under the schema name `og.WorldRestored`; its value type is `WorldRestored`.
|
|
44
|
+
|
|
45
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
46
|
+
|---|---|---|---|---|---|---|
|
|
47
|
+
| `from` | `number` | `0` | — | `ticks` | — | The tick the world was at when the restore applied. |
|
|
48
|
+
| `tick` | `number` | `0` | — | `ticks` | — | The saved tick: og.Time's tick right after the restore. |
|
|
49
|
+
|
|
50
|
+
```ogt
|
|
51
|
+
event WorldRestored {
|
|
52
|
+
doc "A world.restore applied: the tick after it (the first whole tick after a save taken mid-tick, whose next step completes the saved tick) delivers this, read through world.events like any event. Everything in the world came back as saved, request numbers and resources the session filled included; the session did not (og-game §17), so a system that reads this resets what belongs to the session: it forgets requests answered long ago, asks the store again for the settings and progress, and closes a menu the player had open. Sent as that tick starts, not when the restore applies, so the world between the two hashes as the save did."
|
|
53
|
+
field from u32 "The tick the world was at when the restore applied." {
|
|
54
|
+
unit ticks
|
|
55
|
+
}
|
|
56
|
+
field tick u32 "The saved tick: og.Time's tick right after the restore." {
|
|
57
|
+
unit ticks
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
<sub>`api.ogt` line 816</sub>
|
|
63
|
+
|
|
34
64
|
## Interfaces
|
|
35
65
|
|
|
36
66
|
<a id="type-World"></a>
|
|
@@ -45,7 +75,7 @@ interface World {
|
|
|
45
75
|
# members follow, each quoted below
|
|
46
76
|
```
|
|
47
77
|
|
|
48
|
-
<sub>`api.ogt` line
|
|
78
|
+
<sub>`api.ogt` line 833</sub>
|
|
49
79
|
|
|
50
80
|
<a id="member-World-tick"></a>
|
|
51
81
|
|
|
@@ -63,7 +93,7 @@ Binding symbol `og_world_get_tick` · publish builds: kept
|
|
|
63
93
|
prop tick u32 "Fixed steps taken since the world was created."
|
|
64
94
|
```
|
|
65
95
|
|
|
66
|
-
<sub>`api.ogt` line
|
|
96
|
+
<sub>`api.ogt` line 836</sub>
|
|
67
97
|
|
|
68
98
|
<a id="member-World-spawn"></a>
|
|
69
99
|
|
|
@@ -91,7 +121,7 @@ fn spawn {
|
|
|
91
121
|
}
|
|
92
122
|
```
|
|
93
123
|
|
|
94
|
-
<sub>`api.ogt` line
|
|
124
|
+
<sub>`api.ogt` line 838</sub>
|
|
95
125
|
|
|
96
126
|
<a id="member-World-despawn"></a>
|
|
97
127
|
|
|
@@ -119,7 +149,7 @@ fn despawn {
|
|
|
119
149
|
}
|
|
120
150
|
```
|
|
121
151
|
|
|
122
|
-
<sub>`api.ogt` line
|
|
152
|
+
<sub>`api.ogt` line 844</sub>
|
|
123
153
|
|
|
124
154
|
<a id="member-World-alive"></a>
|
|
125
155
|
|
|
@@ -147,7 +177,7 @@ fn alive {
|
|
|
147
177
|
}
|
|
148
178
|
```
|
|
149
179
|
|
|
150
|
-
<sub>`api.ogt` line
|
|
180
|
+
<sub>`api.ogt` line 850</sub>
|
|
151
181
|
|
|
152
182
|
<a id="member-World-has"></a>
|
|
153
183
|
|
|
@@ -178,7 +208,7 @@ fn has {
|
|
|
178
208
|
}
|
|
179
209
|
```
|
|
180
210
|
|
|
181
|
-
<sub>`api.ogt` line
|
|
211
|
+
<sub>`api.ogt` line 856</sub>
|
|
182
212
|
|
|
183
213
|
<a id="member-World-insert"></a>
|
|
184
214
|
|
|
@@ -213,7 +243,7 @@ fn insert {
|
|
|
213
243
|
}
|
|
214
244
|
```
|
|
215
245
|
|
|
216
|
-
<sub>`api.ogt` line
|
|
246
|
+
<sub>`api.ogt` line 864</sub>
|
|
217
247
|
|
|
218
248
|
<a id="member-World-remove"></a>
|
|
219
249
|
|
|
@@ -244,7 +274,7 @@ fn remove {
|
|
|
244
274
|
}
|
|
245
275
|
```
|
|
246
276
|
|
|
247
|
-
<sub>`api.ogt` line
|
|
277
|
+
<sub>`api.ogt` line 875</sub>
|
|
248
278
|
|
|
249
279
|
<a id="member-World-get"></a>
|
|
250
280
|
|
|
@@ -275,7 +305,7 @@ fn get {
|
|
|
275
305
|
}
|
|
276
306
|
```
|
|
277
307
|
|
|
278
|
-
<sub>`api.ogt` line
|
|
308
|
+
<sub>`api.ogt` line 883</sub>
|
|
279
309
|
|
|
280
310
|
<a id="member-World-set"></a>
|
|
281
311
|
|
|
@@ -308,7 +338,7 @@ fn set {
|
|
|
308
338
|
}
|
|
309
339
|
```
|
|
310
340
|
|
|
311
|
-
<sub>`api.ogt` line
|
|
341
|
+
<sub>`api.ogt` line 891</sub>
|
|
312
342
|
|
|
313
343
|
<a id="member-World-resource"></a>
|
|
314
344
|
|
|
@@ -337,7 +367,7 @@ fn resource {
|
|
|
337
367
|
}
|
|
338
368
|
```
|
|
339
369
|
|
|
340
|
-
<sub>`api.ogt` line
|
|
370
|
+
<sub>`api.ogt` line 900</sub>
|
|
341
371
|
|
|
342
372
|
<a id="member-World-find"></a>
|
|
343
373
|
|
|
@@ -365,7 +395,7 @@ fn find {
|
|
|
365
395
|
}
|
|
366
396
|
```
|
|
367
397
|
|
|
368
|
-
<sub>`api.ogt` line
|
|
398
|
+
<sub>`api.ogt` line 907</sub>
|
|
369
399
|
|
|
370
400
|
<a id="member-World-nameOf"></a>
|
|
371
401
|
|
|
@@ -393,7 +423,7 @@ fn nameOf {
|
|
|
393
423
|
}
|
|
394
424
|
```
|
|
395
425
|
|
|
396
|
-
<sub>`api.ogt` line
|
|
426
|
+
<sub>`api.ogt` line 913</sub>
|
|
397
427
|
|
|
398
428
|
<a id="member-World-query"></a>
|
|
399
429
|
|
|
@@ -421,7 +451,7 @@ fn query {
|
|
|
421
451
|
}
|
|
422
452
|
```
|
|
423
453
|
|
|
424
|
-
<sub>`api.ogt` line
|
|
454
|
+
<sub>`api.ogt` line 919</sub>
|
|
425
455
|
|
|
426
456
|
<a id="member-World-events"></a>
|
|
427
457
|
|
|
@@ -450,7 +480,7 @@ fn events {
|
|
|
450
480
|
}
|
|
451
481
|
```
|
|
452
482
|
|
|
453
|
-
<sub>`api.ogt` line
|
|
483
|
+
<sub>`api.ogt` line 925</sub>
|
|
454
484
|
|
|
455
485
|
<a id="member-World-emit"></a>
|
|
456
486
|
|
|
@@ -481,7 +511,7 @@ fn emit {
|
|
|
481
511
|
}
|
|
482
512
|
```
|
|
483
513
|
|
|
484
|
-
<sub>`api.ogt` line
|
|
514
|
+
<sub>`api.ogt` line 932</sub>
|
|
485
515
|
|
|
486
516
|
<a id="member-World-instantiate"></a>
|
|
487
517
|
|
|
@@ -514,7 +544,7 @@ fn instantiate {
|
|
|
514
544
|
}
|
|
515
545
|
```
|
|
516
546
|
|
|
517
|
-
<sub>`api.ogt` line
|
|
547
|
+
<sub>`api.ogt` line 940</sub>
|
|
518
548
|
|
|
519
549
|
<a id="member-World-snapshot"></a>
|
|
520
550
|
|
|
@@ -537,13 +567,13 @@ fn snapshot {
|
|
|
537
567
|
}
|
|
538
568
|
```
|
|
539
569
|
|
|
540
|
-
<sub>`api.ogt` line
|
|
570
|
+
<sub>`api.ogt` line 948</sub>
|
|
541
571
|
|
|
542
572
|
<a id="member-World-restore"></a>
|
|
543
573
|
|
|
544
574
|
#### `World.restore`
|
|
545
575
|
|
|
546
|
-
Replace the world with a save that world.snapshot wrote: entities, components, names, resources, events and the modules' state, so the restored world hashes as the saved one did, on either host. The session stays: input (og.Input, og.Pointers, og.Gamepad), the player's bus volumes (og.Audio), the UI's focus and hover, and what lives outside the world (the platform's calls and clock, the language, the loaded assets, the command channel's scheduled steps, which keep their remaining delays though og.Time takes the saved tick). Called in a system or a command it applies when the tick ends, after the last system; elsewhere (GameDesc.start, between ticks) at once. A save a system took mid-tick restores to that moment of its tick (og.Time reads its tick): the next step completes it (the systems after the saver, then the engine's), so the ticks after it are the saved run's. The meshes and height fields its colliders name must be loaded or registered first (a save naming one that is not is refused). A save holds only the world: progress kept in module variables is not in it, so keep it in components and resources.
|
|
576
|
+
Replace the world with a save that world.snapshot wrote: entities, components, names, resources, events and the modules' state, so the restored world hashes as the saved one did, on either host. The session stays: input (og.Input, og.Pointers, og.Gamepad), the player's bus volumes (og.Audio), the UI's focus and hover, and what lives outside the world (the platform's calls and clock, the language, the loaded assets, the command channel's scheduled steps, which keep their remaining delays though og.Time takes the saved tick, so an `og run --commands` script goes on to its last step or `quit` whether the save is of a later tick or an earlier one). Called in a system or a command it applies when the tick ends, after the last system; elsewhere (GameDesc.start, between ticks) at once. Either way the tick after it delivers og.WorldRestored, for the systems that reset what lives in the session. A save a system took mid-tick restores to that moment of its tick (og.Time reads its tick): the next step completes it (the systems after the saver, then the engine's), so the ticks after it are the saved run's. The meshes and height fields its colliders name must be loaded or registered first (a save naming one that is not is refused). A save holds only the world: progress kept in module variables is not in it, so keep it in components and resources.
|
|
547
577
|
|
|
548
578
|
```ts
|
|
549
579
|
World.restore(save: string, desc?: RestoreDesc): Result<void>
|
|
@@ -560,14 +590,14 @@ Binding symbol `og_world_restore` · publish builds: kept
|
|
|
560
590
|
|
|
561
591
|
```ogt
|
|
562
592
|
fn restore {
|
|
563
|
-
doc "Replace the world with a save that world.snapshot wrote: entities, components, names, resources, events and the modules' state, so the restored world hashes as the saved one did, on either host. The session stays: input (og.Input, og.Pointers, og.Gamepad), the player's bus volumes (og.Audio), the UI's focus and hover, and what lives outside the world (the platform's calls and clock, the language, the loaded assets, the command channel's scheduled steps, which keep their remaining delays though og.Time takes the saved tick). Called in a system or a command it applies when the tick ends, after the last system; elsewhere (GameDesc.start, between ticks) at once. A save a system took mid-tick restores to that moment of its tick (og.Time reads its tick): the next step completes it (the systems after the saver, then the engine's), so the ticks after it are the saved run's. The meshes and height fields its colliders name must be loaded or registered first (a save naming one that is not is refused). A save holds only the world: progress kept in module variables is not in it, so keep it in components and resources."
|
|
593
|
+
doc "Replace the world with a save that world.snapshot wrote: entities, components, names, resources, events and the modules' state, so the restored world hashes as the saved one did, on either host. The session stays: input (og.Input, og.Pointers, og.Gamepad), the player's bus volumes (og.Audio), the UI's focus and hover, and what lives outside the world (the platform's calls and clock, the language, the loaded assets, the command channel's scheduled steps, which keep their remaining delays though og.Time takes the saved tick, so an `og run --commands` script goes on to its last step or `quit` whether the save is of a later tick or an earlier one). Called in a system or a command it applies when the tick ends, after the last system; elsewhere (GameDesc.start, between ticks) at once. Either way the tick after it delivers og.WorldRestored, for the systems that reset what lives in the session. A save a system took mid-tick restores to that moment of its tick (og.Time reads its tick): the next step completes it (the systems after the saver, then the engine's), so the ticks after it are the saved run's. The meshes and height fields its colliders name must be loaded or registered first (a save naming one that is not is refused). A save holds only the world: progress kept in module variables is not in it, so keep it in components and resources."
|
|
564
594
|
param save String "The text world.snapshot returned."
|
|
565
595
|
param desc RestoreDesc "Whether a type whose layout changed since the save is mapped field by field."
|
|
566
596
|
returns Result.Void "Refused, with nothing changed, for text world.snapshot did not write, a save from a newer engine, or a type whose layout changed since the save (a field added, removed or retyped, an enum's variants): the reason names the type and the fields, and the fix (`{ migrate: true }`, or keeping a saved type's fields stable between releases)."
|
|
567
597
|
}
|
|
568
598
|
```
|
|
569
599
|
|
|
570
|
-
<sub>`api.ogt` line
|
|
600
|
+
<sub>`api.ogt` line 953</sub>
|
|
571
601
|
|
|
572
602
|
<a id="type-Query"></a>
|
|
573
603
|
|
|
@@ -581,7 +611,7 @@ interface Query {
|
|
|
581
611
|
# members follow, each quoted below
|
|
582
612
|
```
|
|
583
613
|
|
|
584
|
-
<sub>`api.ogt` line
|
|
614
|
+
<sub>`api.ogt` line 961</sub>
|
|
585
615
|
|
|
586
616
|
<a id="member-Query-archetypes"></a>
|
|
587
617
|
|
|
@@ -604,7 +634,7 @@ fn archetypes {
|
|
|
604
634
|
}
|
|
605
635
|
```
|
|
606
636
|
|
|
607
|
-
<sub>`api.ogt` line
|
|
637
|
+
<sub>`api.ogt` line 963</sub>
|
|
608
638
|
|
|
609
639
|
<a id="member-Query-count"></a>
|
|
610
640
|
|
|
@@ -627,7 +657,7 @@ fn count {
|
|
|
627
657
|
}
|
|
628
658
|
```
|
|
629
659
|
|
|
630
|
-
<sub>`api.ogt` line
|
|
660
|
+
<sub>`api.ogt` line 967</sub>
|
|
631
661
|
|
|
632
662
|
<a id="type-ArchetypeView"></a>
|
|
633
663
|
|
|
@@ -641,7 +671,7 @@ interface ArchetypeView {
|
|
|
641
671
|
# members follow, each quoted below
|
|
642
672
|
```
|
|
643
673
|
|
|
644
|
-
<sub>`api.ogt` line
|
|
674
|
+
<sub>`api.ogt` line 973</sub>
|
|
645
675
|
|
|
646
676
|
<a id="member-ArchetypeView-count"></a>
|
|
647
677
|
|
|
@@ -659,7 +689,7 @@ Binding symbol `og_archetype_view_get_count` · publish builds: kept
|
|
|
659
689
|
prop count u32 "The number of entities in the archetype."
|
|
660
690
|
```
|
|
661
691
|
|
|
662
|
-
<sub>`api.ogt` line
|
|
692
|
+
<sub>`api.ogt` line 975</sub>
|
|
663
693
|
|
|
664
694
|
<a id="member-ArchetypeView-tick"></a>
|
|
665
695
|
|
|
@@ -677,7 +707,7 @@ Binding symbol `og_archetype_view_get_tick` · publish builds: kept
|
|
|
677
707
|
prop tick u32 "The tick this view belongs to."
|
|
678
708
|
```
|
|
679
709
|
|
|
680
|
-
<sub>`api.ogt` line
|
|
710
|
+
<sub>`api.ogt` line 976</sub>
|
|
681
711
|
|
|
682
712
|
<a id="member-ArchetypeView-entities"></a>
|
|
683
713
|
|
|
@@ -695,7 +725,7 @@ Binding symbol `og_archetype_view_get_entities` · publish builds: kept
|
|
|
695
725
|
prop entities Uint32Array "The entities as (index, generation) pairs: entity i is at 2i and 2i + 1."
|
|
696
726
|
```
|
|
697
727
|
|
|
698
|
-
<sub>`api.ogt` line
|
|
728
|
+
<sub>`api.ogt` line 977</sub>
|
|
699
729
|
|
|
700
730
|
<a id="member-ArchetypeView-entity"></a>
|
|
701
731
|
|
|
@@ -723,7 +753,7 @@ fn entity {
|
|
|
723
753
|
}
|
|
724
754
|
```
|
|
725
755
|
|
|
726
|
-
<sub>`api.ogt` line
|
|
756
|
+
<sub>`api.ogt` line 978</sub>
|
|
727
757
|
|
|
728
758
|
<a id="member-ArchetypeView-has"></a>
|
|
729
759
|
|
|
@@ -752,7 +782,7 @@ fn has {
|
|
|
752
782
|
}
|
|
753
783
|
```
|
|
754
784
|
|
|
755
|
-
<sub>`api.ogt` line
|
|
785
|
+
<sub>`api.ogt` line 983</sub>
|
|
756
786
|
|
|
757
787
|
<a id="member-ArchetypeView-column"></a>
|
|
758
788
|
|
|
@@ -784,7 +814,7 @@ fn column {
|
|
|
784
814
|
}
|
|
785
815
|
```
|
|
786
816
|
|
|
787
|
-
<sub>`api.ogt` line
|
|
817
|
+
<sub>`api.ogt` line 989</sub>
|
|
788
818
|
|
|
789
819
|
## Types
|
|
790
820
|
|
|
@@ -805,7 +835,7 @@ handle Entity {
|
|
|
805
835
|
}
|
|
806
836
|
```
|
|
807
837
|
|
|
808
|
-
<sub>`api.ogt` line
|
|
838
|
+
<sub>`api.ogt` line 783</sub>
|
|
809
839
|
|
|
810
840
|
<a id="type-SpawnDesc"></a>
|
|
811
841
|
|
|
@@ -841,7 +871,7 @@ struct SpawnDesc {
|
|
|
841
871
|
}
|
|
842
872
|
```
|
|
843
873
|
|
|
844
|
-
<sub>`api.ogt` line
|
|
874
|
+
<sub>`api.ogt` line 795</sub>
|
|
845
875
|
|
|
846
876
|
<a id="type-RestoreDesc"></a>
|
|
847
877
|
|
|
@@ -863,7 +893,7 @@ struct RestoreDesc {
|
|
|
863
893
|
}
|
|
864
894
|
```
|
|
865
895
|
|
|
866
|
-
<sub>`api.ogt` line
|
|
896
|
+
<sub>`api.ogt` line 810</sub>
|
|
867
897
|
|
|
868
898
|
<a id="type-QueryDesc"></a>
|
|
869
899
|
|
|
@@ -887,7 +917,7 @@ struct QueryDesc {
|
|
|
887
917
|
}
|
|
888
918
|
```
|
|
889
919
|
|
|
890
|
-
<sub>`api.ogt` line
|
|
920
|
+
<sub>`api.ogt` line 826</sub>
|
|
891
921
|
|
|
892
922
|
## Column kinds
|
|
893
923
|
|
|
@@ -906,4 +936,4 @@ column Entity {
|
|
|
906
936
|
}
|
|
907
937
|
```
|
|
908
938
|
|
|
909
|
-
<sub>`api.ogt` line
|
|
939
|
+
<sub>`api.ogt` line 788</sub>
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@origingame/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Origin Engine: the TypeScript API, generated from crates/og-api/api.ogt, its runtime on the web (wasm in a Worker) and native (napi addon) hosts, the player shell, and the agents' knowledge (skills, wiki, style catalogue) in knowledge/.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/
|
|
8
|
+
"url": "git+https://github.com/originai-game/origin-engine.git",
|
|
9
9
|
"directory": "packages/engine"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.com/
|
|
11
|
+
"homepage": "https://github.com/originai-game/origin-engine#readme",
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/
|
|
13
|
+
"url": "https://github.com/originai-game/origin-engine/issues"
|
|
14
14
|
},
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
@@ -51,8 +51,9 @@
|
|
|
51
51
|
"bun": ">=1.3"
|
|
52
52
|
},
|
|
53
53
|
"optionalDependencies": {
|
|
54
|
-
"@origingame/engine-darwin-arm64": "0.
|
|
55
|
-
"@origingame/engine-linux-x64": "0.
|
|
54
|
+
"@origingame/engine-darwin-arm64": "0.3.0",
|
|
55
|
+
"@origingame/engine-linux-x64": "0.3.0",
|
|
56
|
+
"@origingame/engine-win32-x64": "0.3.0",
|
|
56
57
|
"@tsrs/darwin-arm64": "0.18.0-ts7.1.0-dev.20260929",
|
|
57
58
|
"@tsrs/linux-arm64-gnu": "0.18.0-ts7.1.0-dev.20260929",
|
|
58
59
|
"@tsrs/linux-arm64-musl": "0.18.0-ts7.1.0-dev.20260929",
|