@origingame/engine 0.0.0-stage → 0.1.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 (158) hide show
  1. package/bin/og.mjs +25 -0
  2. package/dist/web/origin-engine.d.ts +1233 -0
  3. package/dist/web/origin-engine.js +8628 -0
  4. package/dist/web/origin-engine_bg.wasm +0 -0
  5. package/dist/web/origin-engine_bg.wasm.d.ts +366 -0
  6. package/dist/web-publish/origin-engine-lanes.js +8509 -0
  7. package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
  8. package/dist/web-publish/origin-engine.d.ts +1176 -0
  9. package/dist/web-publish/origin-engine.js +8313 -0
  10. package/dist/web-publish/origin-engine_bg.wasm +0 -0
  11. package/dist/web-publish/origin-engine_bg.wasm.d.ts +347 -0
  12. package/dist/web-publish/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
  13. package/dist/web-publish-2d/origin-engine-lanes.js +8509 -0
  14. package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
  15. package/dist/web-publish-2d/origin-engine.d.ts +1176 -0
  16. package/dist/web-publish-2d/origin-engine.js +8313 -0
  17. package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
  18. package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +347 -0
  19. package/dist/web-publish-2d/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
  20. package/knowledge/README.md +31 -0
  21. package/knowledge/knowledge.json +13 -0
  22. package/knowledge/looks/catalogue.json +1871 -0
  23. package/knowledge/package.json +33 -0
  24. package/knowledge/rules/platform.json +329 -0
  25. package/knowledge/scaffold/README.md +27 -0
  26. package/knowledge/scaffold/distribution.json +48 -0
  27. package/knowledge/scaffold/origin-engine.json +19 -0
  28. package/knowledge/scaffold/template/.origin/setup +14 -0
  29. package/knowledge/scaffold/template/LICENSES.md +23 -0
  30. package/knowledge/scaffold/template/README.md +37 -0
  31. package/knowledge/scaffold/template/assets/ai/guard.ogt +48 -0
  32. package/knowledge/scaffold/template/assets/audio/click.ogt +9 -0
  33. package/knowledge/scaffold/template/assets/fonts/NotoSansSC-Regular-subset.ttf.ogt +12 -0
  34. package/knowledge/scaffold/template/assets/fonts/OFL.txt +93 -0
  35. package/knowledge/scaffold/template/assets/looks/origin-game.ogt +12 -0
  36. package/knowledge/scaffold/template/assets/nav/yard.ogt +27 -0
  37. package/knowledge/scaffold/template/assets/scenes/main.ogt +34 -0
  38. package/knowledge/scaffold/template/assets/strings/en.ogt +14 -0
  39. package/knowledge/scaffold/template/assets/textures/stone_n.png.ogt +7 -0
  40. package/knowledge/scaffold/template/gitattributes +22 -0
  41. package/knowledge/scaffold/template/package.json +18 -0
  42. package/knowledge/scaffold/template/project.ogt +25 -0
  43. package/knowledge/scaffold/template/src/main.ts +246 -0
  44. package/knowledge/scaffold/template/tests/guard.og.ts +67 -0
  45. package/knowledge/scaffold/template/tests/smoke.og.ts +43 -0
  46. package/knowledge/scaffold/template/tsconfig.json +17 -0
  47. package/knowledge/scripts/lib.ts +203 -0
  48. package/knowledge/scripts/mount.ts +210 -0
  49. package/knowledge/scripts/pack.ts +24 -0
  50. package/knowledge/scripts/scaffold.ts +72 -0
  51. package/knowledge/scripts/validate.ts +749 -0
  52. package/knowledge/skills/og-ai/SKILL.md +386 -0
  53. package/knowledge/skills/og-audio/SKILL.md +191 -0
  54. package/knowledge/skills/og-build/SKILL.md +330 -0
  55. package/knowledge/skills/og-core/SKILL.md +285 -0
  56. package/knowledge/skills/og-feel/SKILL.md +385 -0
  57. package/knowledge/skills/og-game/SKILL.md +1479 -0
  58. package/knowledge/skills/og-i18n/SKILL.md +220 -0
  59. package/knowledge/skills/og-platform-sdk/SKILL.md +199 -0
  60. package/knowledge/skills/og-taste/SKILL.md +537 -0
  61. package/knowledge/skills/og-ui/SKILL.md +444 -0
  62. package/knowledge/wiki/ai.md +627 -0
  63. package/knowledge/wiki/anim.md +1187 -0
  64. package/knowledge/wiki/atmosphere.md +636 -0
  65. package/knowledge/wiki/audio.md +732 -0
  66. package/knowledge/wiki/camera.md +711 -0
  67. package/knowledge/wiki/commands.md +357 -0
  68. package/knowledge/wiki/game.md +220 -0
  69. package/knowledge/wiki/i18n.md +213 -0
  70. package/knowledge/wiki/index.md +1027 -0
  71. package/knowledge/wiki/input.md +1714 -0
  72. package/knowledge/wiki/load.md +1280 -0
  73. package/knowledge/wiki/math.md +166 -0
  74. package/knowledge/wiki/nav.md +1154 -0
  75. package/knowledge/wiki/physics.md +3142 -0
  76. package/knowledge/wiki/platform.md +857 -0
  77. package/knowledge/wiki/probe.md +1692 -0
  78. package/knowledge/wiki/reflect.md +285 -0
  79. package/knowledge/wiki/render.md +3511 -0
  80. package/knowledge/wiki/rng.md +393 -0
  81. package/knowledge/wiki/stream.md +376 -0
  82. package/knowledge/wiki/system.md +197 -0
  83. package/knowledge/wiki/systems.md +43 -0
  84. package/knowledge/wiki/terrain.md +727 -0
  85. package/knowledge/wiki/tilemap.md +422 -0
  86. package/knowledge/wiki/time.md +150 -0
  87. package/knowledge/wiki/transform.md +230 -0
  88. package/knowledge/wiki/tween.md +580 -0
  89. package/knowledge/wiki/ui.md +8000 -0
  90. package/knowledge/wiki/world.md +909 -0
  91. package/package.json +68 -4
  92. package/schema/api.schema.json +29675 -0
  93. package/shell/README.md +22 -0
  94. package/shell/brand/README.md +23 -0
  95. package/shell/brand/icon-192.png +0 -0
  96. package/shell/brand/icon-512.png +0 -0
  97. package/shell/brand/mark-on-paper.svg +6 -0
  98. package/shell/brand/origin-mark.svg +5 -0
  99. package/shell/brand/origin-motion.css +251 -0
  100. package/shell/brand/tokens.css +20 -0
  101. package/shell/brand.ts +132 -0
  102. package/shell/page.ts +715 -0
  103. package/shell/platform.ts +203 -0
  104. package/shell/player.ts +238 -0
  105. package/shell/shell.css +185 -0
  106. package/shell/sw.ts +177 -0
  107. package/shell/transport.ts +515 -0
  108. package/shell/wire.ts +369 -0
  109. package/src/e6.ts +69 -0
  110. package/src/env.d.ts +100 -0
  111. package/src/generated/abi.ts +980 -0
  112. package/src/index.ts +193 -0
  113. package/src/node/audio.ts +86 -0
  114. package/src/node/build.ts +109 -0
  115. package/src/node/device.ts +981 -0
  116. package/src/node/doctor.ts +60 -0
  117. package/src/node/index.ts +102 -0
  118. package/src/node/platform.ts +24 -0
  119. package/src/node/playtest-run.ts +249 -0
  120. package/src/node/png.ts +130 -0
  121. package/src/node/polish.ts +976 -0
  122. package/src/node/run.ts +373 -0
  123. package/src/node/web-build.ts +808 -0
  124. package/src/p2.ts +35 -0
  125. package/src/platform-local.ts +211 -0
  126. package/src/playtest.ts +131 -0
  127. package/src/runtime.ts +1509 -0
  128. package/src/systems/cameras.ts +247 -0
  129. package/src/ui-kit/bind.ts +141 -0
  130. package/src/ui-kit/huds.ts +303 -0
  131. package/src/ui-kit/index.ts +36 -0
  132. package/src/ui-kit/menus.ts +187 -0
  133. package/src/ui-kit/settings.ts +131 -0
  134. package/src/ui-kit/store.ts +222 -0
  135. package/src/ui-kit/story.ts +89 -0
  136. package/src/ui-kit/util.ts +106 -0
  137. package/src/web/a11y.ts +429 -0
  138. package/src/web/audio-worklet.ts +193 -0
  139. package/src/web/audio.ts +307 -0
  140. package/src/web/basis.ts +239 -0
  141. package/src/web/gamepad.ts +123 -0
  142. package/src/web/host.ts +166 -0
  143. package/src/web/input.ts +237 -0
  144. package/src/web/lanes.ts +21 -0
  145. package/src/web/play.ts +20 -0
  146. package/src/web/rpc-ring.ts +110 -0
  147. package/src/web/settle.ts +122 -0
  148. package/src/web/shell.ts +643 -0
  149. package/src/web/text-input.ts +248 -0
  150. package/src/web/worker.ts +1002 -0
  151. package/types/bindings.json +13654 -0
  152. package/types/index.d.ts +20090 -0
  153. package/vendor/basis/LICENSE +201 -0
  154. package/vendor/basis/NOTICE +15 -0
  155. package/vendor/basis/README.md +18 -0
  156. package/vendor/basis/basis_transcoder.js +19 -0
  157. package/vendor/basis/basis_transcoder.wasm +0 -0
  158. package/README.md +0 -3
@@ -0,0 +1,213 @@
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 `i18n` module
4
+
5
+ Localization: one string table per locale (`.ogt` of `type strings`: `locale "ja"`, its font chain `fonts "..."`, `string "key" "message"`), messages in a subset of ICU MessageFormat (`{name}`, `{n, number}`, `{n, plural, =0 {..} one {..} other {..}}` with `#`, `{g, select, a {..} other {..}}`), CLDR plural rules, and the locale the host asks for (the browser's `navigator.language` on the web, `og run --locale` natively).
6
+
7
+ The active locale is the best loaded table for the request (ja-JP takes ja; zh-TW takes zh-Hant or zh-TW), else the base table (`base true`, else en, else the first). A key it lacks is read from its `fallback` table, then the base. It also sets the UI's font chain (its fonts first, then the other tables') and direction: a right-to-left locale (ar, he, fa, ur) mirrors og.ui's layout, and og-ui shapes Arabic words with the font's own tables (a font cooked with the `arabic` charset carries them). `og cook` warns about every key a locale lacks, or takes other arguments for, than the base.
8
+
9
+ - **TypeScript**: functions are the namespace `og.i18n`; components, resources and events are tokens on `og`.
10
+ - **Publish builds**: kept (members may override).
11
+ - **Skill**: `og-i18n`, 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 i18n {
16
+ # declarations follow, each quoted below
17
+ ```
18
+
19
+ <sub>`api.ogt` line 7718</sub>
20
+
21
+ ## Contents
22
+
23
+ | Name | Kind | Summary |
24
+ |---|---|---|
25
+ | [`LocaleInfo`](#type-LocaleInfo) | struct | The localization state. |
26
+ | [`og.i18n.load`](#fn-load) | function | Load a cooked string table; the active locale is negotiated again. |
27
+ | [`og.i18n.setLocale`](#fn-setLocale) | function | Ask for a locale (a player's choice in settings); the active one is the best table for it. |
28
+ | [`og.i18n.locale`](#fn-locale) | function | The requested and active locales, the direction and the font chain. |
29
+ | [`og.i18n.t`](#fn-t) | function | A key's message in the active locale, formatted with its arguments; a key no table has answers the key itself and logs one warning. |
30
+ | [`og.i18n.has`](#fn-has) | function | Whether the active locale's own table has the key (not a fallback). |
31
+
32
+ ## Functions
33
+
34
+ <a id="fn-load"></a>
35
+
36
+ ### `og.i18n.load`
37
+
38
+ Load a cooked string table; the active locale is negotiated again.
39
+
40
+ ```ts
41
+ og.i18n.load(world: World, path: string): Result<LocaleInfo>
42
+ ```
43
+
44
+ | Parameter | Type | Optional | Doc |
45
+ |---|---|---|---|
46
+ | `world` | `World` | no | The world. |
47
+ | `path` | `string` | no | The table, such as `strings/ja.ogt`. |
48
+
49
+ **Returns** `Result<LocaleInfo>`: Refused for a path that is not a cooked string table, or a font of its chain that is not cooked.
50
+
51
+ Binding symbol `og_i18n_load` · publish builds: kept
52
+
53
+ ```ogt
54
+ fn load {
55
+ doc "Load a cooked string table; the active locale is negotiated again."
56
+ param world World "The world."
57
+ param path String "The table, such as `strings/ja.ogt`."
58
+ returns Result.LocaleInfo "Refused for a path that is not a cooked string table, or a font of its chain that is not cooked."
59
+ }
60
+ ```
61
+
62
+ <sub>`api.ogt` line 7732</sub>
63
+
64
+ <a id="fn-setLocale"></a>
65
+
66
+ ### `og.i18n.setLocale`
67
+
68
+ Ask for a locale (a player's choice in settings); the active one is the best table for it.
69
+
70
+ ```ts
71
+ og.i18n.setLocale(world: World, locale: string): LocaleInfo
72
+ ```
73
+
74
+ | Parameter | Type | Optional | Doc |
75
+ |---|---|---|---|
76
+ | `world` | `World` | no | The world. |
77
+ | `locale` | `string` | no | A BCP 47 tag: `ja`, `zh-CN`, `ar-EG`. |
78
+
79
+ **Returns** `LocaleInfo`.
80
+
81
+ Binding symbol `og_i18n_set_locale` · publish builds: kept
82
+
83
+ ```ogt
84
+ fn setLocale {
85
+ doc "Ask for a locale (a player's choice in settings); the active one is the best table for it."
86
+ param world World "The world."
87
+ param locale String "A BCP 47 tag: `ja`, `zh-CN`, `ar-EG`."
88
+ returns LocaleInfo
89
+ }
90
+ ```
91
+
92
+ <sub>`api.ogt` line 7739</sub>
93
+
94
+ <a id="fn-locale"></a>
95
+
96
+ ### `og.i18n.locale`
97
+
98
+ The requested and active locales, the direction and the font chain.
99
+
100
+ ```ts
101
+ og.i18n.locale(world: World): LocaleInfo
102
+ ```
103
+
104
+ | Parameter | Type | Optional | Doc |
105
+ |---|---|---|---|
106
+ | `world` | `World` | no | The world. |
107
+
108
+ **Returns** `LocaleInfo`.
109
+
110
+ Binding symbol `og_i18n_locale` · publish builds: kept
111
+
112
+ ```ogt
113
+ fn locale {
114
+ doc "The requested and active locales, the direction and the font chain."
115
+ param world World "The world."
116
+ returns LocaleInfo
117
+ }
118
+ ```
119
+
120
+ <sub>`api.ogt` line 7746</sub>
121
+
122
+ <a id="fn-t"></a>
123
+
124
+ ### `og.i18n.t`
125
+
126
+ A key's message in the active locale, formatted with its arguments; a key no table has answers the key itself and logs one warning.
127
+
128
+ ```ts
129
+ og.i18n.t(world: World, key: string, args?: unknown): string
130
+ ```
131
+
132
+ | Parameter | Type | Optional | Doc |
133
+ |---|---|---|---|
134
+ | `world` | `World` | no | The world. |
135
+ | `key` | `string` | no | The key, such as `menu.start`. |
136
+ | `args` | `unknown` | yes | The arguments: an object of strings and numbers, `{ count: 3, name: "Kai" }`. |
137
+
138
+ **Returns** `string`.
139
+
140
+ Binding symbol `og_i18n_t` · publish builds: kept
141
+
142
+ ```ogt
143
+ fn t {
144
+ doc "A key's message in the active locale, formatted with its arguments; a key no table has answers the key itself and logs one warning."
145
+ param world World "The world."
146
+ param key String "The key, such as `menu.start`."
147
+ param args Json "The arguments: an object of strings and numbers, `{ count: 3, name: \"Kai\" }`." {
148
+ optional true
149
+ }
150
+ returns String
151
+ }
152
+ ```
153
+
154
+ <sub>`api.ogt` line 7752</sub>
155
+
156
+ <a id="fn-has"></a>
157
+
158
+ ### `og.i18n.has`
159
+
160
+ Whether the active locale's own table has the key (not a fallback).
161
+
162
+ ```ts
163
+ og.i18n.has(world: World, key: string): boolean
164
+ ```
165
+
166
+ | Parameter | Type | Optional | Doc |
167
+ |---|---|---|---|
168
+ | `world` | `World` | no | The world. |
169
+ | `key` | `string` | no | The key. |
170
+
171
+ **Returns** `boolean`.
172
+
173
+ Binding symbol `og_i18n_has` · publish builds: kept
174
+
175
+ ```ogt
176
+ fn has {
177
+ doc "Whether the active locale's own table has the key (not a fallback)."
178
+ param world World "The world."
179
+ param key String "The key."
180
+ returns bool
181
+ }
182
+ ```
183
+
184
+ <sub>`api.ogt` line 7762</sub>
185
+
186
+ ## Types
187
+
188
+ <a id="type-LocaleInfo"></a>
189
+
190
+ ### `LocaleInfo` (struct)
191
+
192
+ The localization state.
193
+
194
+ | Field | Type | Default | Range | Unit | Notes | Doc |
195
+ |---|---|---|---|---|---|---|
196
+ | `requested` | `string` | `""` | — | — | — | The locale the host or the game asked for (empty: none). |
197
+ | `active` | `string` | `""` | — | — | — | The table in use (empty: none loaded). |
198
+ | `direction` | `string` | `""` | — | — | — | `ltr` or `rtl`. |
199
+ | `locales` | `readonly string[]` | `[]` | — | — | — | Every loaded table's locale. |
200
+ | `fonts` | `readonly string[]` | `[]` | — | — | — | The UI's font chain, first first. |
201
+
202
+ ```ogt
203
+ struct LocaleInfo {
204
+ doc "The localization state."
205
+ field requested String "The locale the host or the game asked for (empty: none)."
206
+ field active String "The table in use (empty: none loaded)."
207
+ field direction String "`ltr` or `rtl`."
208
+ field locales List.String "Every loaded table's locale."
209
+ field fonts List.String "The UI's font chain, first first."
210
+ }
211
+ ```
212
+
213
+ <sub>`api.ogt` line 7723</sub>