@origingame/engine 0.1.1 → 0.2.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.
Files changed (59) hide show
  1. package/dist/web/origin-engine.js +4 -4
  2. package/dist/web/origin-engine_bg.wasm +0 -0
  3. package/dist/web-publish/origin-engine-lanes.js +6 -6
  4. package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
  5. package/dist/web-publish/origin-engine.js +4 -4
  6. package/dist/web-publish/origin-engine_bg.wasm +0 -0
  7. package/dist/web-publish-2d/origin-engine-lanes.js +6 -6
  8. package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
  9. package/dist/web-publish-2d/origin-engine.js +4 -4
  10. package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
  11. package/knowledge/package.json +4 -4
  12. package/knowledge/scaffold/origin-engine.json +2 -2
  13. package/knowledge/scaffold/template/package.json +1 -1
  14. package/knowledge/scaffold/template/project.ogt +1 -1
  15. package/knowledge/scripts/validate.ts +2 -1
  16. package/knowledge/skills/og-build/SKILL.md +17 -1
  17. package/knowledge/skills/og-feel/SKILL.md +8 -1
  18. package/knowledge/skills/og-game/SKILL.md +117 -13
  19. package/knowledge/skills/og-i18n/SKILL.md +12 -3
  20. package/knowledge/skills/og-platform-sdk/SKILL.md +3 -1
  21. package/knowledge/skills/og-ui/SKILL.md +19 -6
  22. package/knowledge/wiki/ai.md +20 -20
  23. package/knowledge/wiki/anim.md +41 -41
  24. package/knowledge/wiki/atmosphere.md +13 -13
  25. package/knowledge/wiki/audio.md +18 -18
  26. package/knowledge/wiki/camera.md +13 -13
  27. package/knowledge/wiki/commands.md +11 -11
  28. package/knowledge/wiki/game.md +8 -8
  29. package/knowledge/wiki/i18n.md +7 -7
  30. package/knowledge/wiki/index.md +4 -1
  31. package/knowledge/wiki/input.md +47 -47
  32. package/knowledge/wiki/load.md +45 -45
  33. package/knowledge/wiki/math.md +7 -7
  34. package/knowledge/wiki/nav.md +34 -34
  35. package/knowledge/wiki/physics.md +124 -106
  36. package/knowledge/wiki/platform.md +31 -31
  37. package/knowledge/wiki/probe.md +66 -66
  38. package/knowledge/wiki/reflect.md +15 -15
  39. package/knowledge/wiki/render.md +99 -89
  40. package/knowledge/wiki/rng.md +14 -14
  41. package/knowledge/wiki/stream.md +15 -15
  42. package/knowledge/wiki/system.md +8 -8
  43. package/knowledge/wiki/systems.md +2 -2
  44. package/knowledge/wiki/terrain.md +19 -19
  45. package/knowledge/wiki/tilemap.md +19 -15
  46. package/knowledge/wiki/time.md +4 -4
  47. package/knowledge/wiki/transform.md +8 -8
  48. package/knowledge/wiki/tween.md +17 -17
  49. package/knowledge/wiki/ui.md +289 -245
  50. package/knowledge/wiki/world.md +67 -37
  51. package/package.json +6 -6
  52. package/schema/api.schema.json +134 -9
  53. package/src/index.ts +1 -0
  54. package/src/node/polish.ts +2 -1
  55. package/src/node/run.ts +5 -1
  56. package/src/runtime.ts +2 -0
  57. package/src/ui-kit/huds.ts +18 -14
  58. package/types/bindings.json +61 -26
  59. package/types/index.d.ts +144 -13
@@ -16,7 +16,7 @@ module world {
16
16
  # declarations follow, each quoted below
17
17
  ```
18
18
 
19
- <sub>`api.ogt` line 204</sub>
19
+ <sub>`api.ogt` line 205</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 243</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 249</sub>
78
+ <sub>`api.ogt` line 260</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 252</sub>
96
+ <sub>`api.ogt` line 263</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 254</sub>
124
+ <sub>`api.ogt` line 265</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 260</sub>
152
+ <sub>`api.ogt` line 271</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 266</sub>
180
+ <sub>`api.ogt` line 277</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 272</sub>
211
+ <sub>`api.ogt` line 283</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 280</sub>
246
+ <sub>`api.ogt` line 291</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 291</sub>
277
+ <sub>`api.ogt` line 302</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 299</sub>
308
+ <sub>`api.ogt` line 310</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 307</sub>
341
+ <sub>`api.ogt` line 318</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 316</sub>
370
+ <sub>`api.ogt` line 327</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 323</sub>
398
+ <sub>`api.ogt` line 334</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 329</sub>
426
+ <sub>`api.ogt` line 340</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 335</sub>
454
+ <sub>`api.ogt` line 346</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 341</sub>
483
+ <sub>`api.ogt` line 352</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 348</sub>
514
+ <sub>`api.ogt` line 359</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 356</sub>
547
+ <sub>`api.ogt` line 367</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 364</sub>
570
+ <sub>`api.ogt` line 375</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 369</sub>
600
+ <sub>`api.ogt` line 380</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 377</sub>
614
+ <sub>`api.ogt` line 388</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 379</sub>
637
+ <sub>`api.ogt` line 390</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 383</sub>
660
+ <sub>`api.ogt` line 394</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 389</sub>
674
+ <sub>`api.ogt` line 400</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 391</sub>
692
+ <sub>`api.ogt` line 402</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 392</sub>
710
+ <sub>`api.ogt` line 403</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 393</sub>
728
+ <sub>`api.ogt` line 404</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 394</sub>
756
+ <sub>`api.ogt` line 405</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 399</sub>
785
+ <sub>`api.ogt` line 410</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 405</sub>
817
+ <sub>`api.ogt` line 416</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 209</sub>
838
+ <sub>`api.ogt` line 210</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 221</sub>
874
+ <sub>`api.ogt` line 222</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 236</sub>
896
+ <sub>`api.ogt` line 237</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 242</sub>
920
+ <sub>`api.ogt` line 253</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 214</sub>
939
+ <sub>`api.ogt` line 215</sub>
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@origingame/engine",
3
- "version": "0.1.1",
3
+ "version": "0.2.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/fran0220/origin-engine.git",
8
+ "url": "git+https://github.com/originai-game/origin-engine.git",
9
9
  "directory": "packages/engine"
10
10
  },
11
- "homepage": "https://github.com/fran0220/origin-engine#readme",
11
+ "homepage": "https://github.com/originai-game/origin-engine#readme",
12
12
  "bugs": {
13
- "url": "https://github.com/fran0220/origin-engine/issues"
13
+ "url": "https://github.com/originai-game/origin-engine/issues"
14
14
  },
15
15
  "publishConfig": {
16
16
  "access": "public"
@@ -51,8 +51,8 @@
51
51
  "bun": ">=1.3"
52
52
  },
53
53
  "optionalDependencies": {
54
- "@origingame/engine-darwin-arm64": "0.1.1",
55
- "@origingame/engine-linux-x64": "0.1.1",
54
+ "@origingame/engine-darwin-arm64": "0.2.0",
55
+ "@origingame/engine-linux-x64": "0.2.0",
56
56
  "@tsrs/darwin-arm64": "0.18.0-ts7.1.0-dev.20260929",
57
57
  "@tsrs/linux-arm64-gnu": "0.18.0-ts7.1.0-dev.20260929",
58
58
  "@tsrs/linux-arm64-musl": "0.18.0-ts7.1.0-dev.20260929",