@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.
Files changed (92) hide show
  1. package/dist/web/origin-engine.d.ts +44 -5
  2. package/dist/web/origin-engine.js +279 -19
  3. package/dist/web/origin-engine_bg.wasm +0 -0
  4. package/dist/web/origin-engine_bg.wasm.d.ts +18 -5
  5. package/dist/web-publish/origin-engine-lanes.js +289 -48
  6. package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
  7. package/dist/web-publish/origin-engine.d.ts +44 -5
  8. package/dist/web-publish/origin-engine.js +279 -38
  9. package/dist/web-publish/origin-engine_bg.wasm +0 -0
  10. package/dist/web-publish/origin-engine_bg.wasm.d.ts +18 -5
  11. package/dist/web-publish-2d/origin-engine-lanes.js +289 -48
  12. package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
  13. package/dist/web-publish-2d/origin-engine.d.ts +44 -5
  14. package/dist/web-publish-2d/origin-engine.js +279 -38
  15. package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
  16. package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +18 -5
  17. package/knowledge/README.md +2 -1
  18. package/knowledge/guides/three-to-og.md +393 -0
  19. package/knowledge/knowledge.json +2 -1
  20. package/knowledge/looks/catalogue.json +123 -2
  21. package/knowledge/package.json +3 -2
  22. package/knowledge/scaffold/origin-engine.json +2 -2
  23. package/knowledge/scaffold/template/package.json +1 -1
  24. package/knowledge/scaffold/template/project.ogt +1 -1
  25. package/knowledge/scripts/validate.ts +209 -27
  26. package/knowledge/skills/og-audio/SKILL.md +33 -7
  27. package/knowledge/skills/og-build/SKILL.md +66 -7
  28. package/knowledge/skills/og-core/SKILL.md +24 -8
  29. package/knowledge/skills/og-feel/SKILL.md +11 -3
  30. package/knowledge/skills/og-game/SKILL.md +680 -51
  31. package/knowledge/skills/og-i18n/SKILL.md +7 -7
  32. package/knowledge/skills/og-model/SKILL.md +374 -0
  33. package/knowledge/skills/og-platform-sdk/SKILL.md +7 -1
  34. package/knowledge/skills/og-taste/SKILL.md +7 -0
  35. package/knowledge/skills/og-ui/SKILL.md +39 -8
  36. package/knowledge/wiki/ai.md +20 -20
  37. package/knowledge/wiki/anim.md +537 -63
  38. package/knowledge/wiki/atmosphere.md +13 -13
  39. package/knowledge/wiki/audio.md +160 -20
  40. package/knowledge/wiki/camera.md +13 -13
  41. package/knowledge/wiki/commands.md +11 -11
  42. package/knowledge/wiki/debug.md +13 -13
  43. package/knowledge/wiki/game.md +8 -8
  44. package/knowledge/wiki/i18n.md +7 -7
  45. package/knowledge/wiki/index.md +81 -3
  46. package/knowledge/wiki/input.md +47 -47
  47. package/knowledge/wiki/load.md +83 -57
  48. package/knowledge/wiki/math.md +102 -102
  49. package/knowledge/wiki/nav.md +34 -34
  50. package/knowledge/wiki/net.md +10 -10
  51. package/knowledge/wiki/path.md +14 -14
  52. package/knowledge/wiki/physics.md +111 -100
  53. package/knowledge/wiki/platform.md +44 -44
  54. package/knowledge/wiki/probe.md +86 -86
  55. package/knowledge/wiki/reflect.md +30 -18
  56. package/knowledge/wiki/render.md +1243 -176
  57. package/knowledge/wiki/rng.md +14 -14
  58. package/knowledge/wiki/shapes.md +727 -0
  59. package/knowledge/wiki/stream.md +15 -15
  60. package/knowledge/wiki/system.md +8 -8
  61. package/knowledge/wiki/systems.md +2 -2
  62. package/knowledge/wiki/terrain.md +24 -20
  63. package/knowledge/wiki/tilemap.md +13 -13
  64. package/knowledge/wiki/time.md +4 -4
  65. package/knowledge/wiki/timeline.md +14 -14
  66. package/knowledge/wiki/transform.md +8 -8
  67. package/knowledge/wiki/tween.md +17 -17
  68. package/knowledge/wiki/ui.md +245 -269
  69. package/knowledge/wiki/video.md +5 -5
  70. package/knowledge/wiki/world.md +36 -36
  71. package/package.json +4 -4
  72. package/schema/api.schema.json +2238 -81
  73. package/shell/page.ts +4 -0
  74. package/shell/platform.ts +5 -0
  75. package/shell/player.ts +8 -2
  76. package/shell/transport.ts +6 -0
  77. package/src/generated/abi.ts +40 -1
  78. package/src/geom.ts +260 -0
  79. package/src/index.ts +19 -1
  80. package/src/node/device.ts +5 -2
  81. package/src/node/playtest-run.ts +1 -0
  82. package/src/node/polish.ts +34 -15
  83. package/src/node/run.ts +23 -6
  84. package/src/platform-local.ts +2 -0
  85. package/src/playtest.ts +8 -0
  86. package/src/runtime.ts +88 -6
  87. package/src/ui-kit/settings.ts +9 -0
  88. package/src/web/gl-state.ts +907 -0
  89. package/src/web/shell.ts +1 -1
  90. package/src/web/worker.ts +8 -2
  91. package/types/bindings.json +1222 -453
  92. package/types/index.d.ts +1868 -315
package/src/web/shell.ts CHANGED
@@ -486,7 +486,7 @@ export class Shell {
486
486
  /** What answers og.platform's calls from now on (og.platform.info reports its host and capabilities). */
487
487
  setPlatform(host: PlatformHost): void {
488
488
  this.#platform = host;
489
- this.worker.postMessage({ type: "platform-host", host: host.host, capabilities: host.capabilities });
489
+ this.worker.postMessage({ type: "platform-host", host: host.host, capabilities: host.capabilities, time: host.time });
490
490
  }
491
491
 
492
492
  /** What stopped the engine (a panic, an error, a hang), or null while it runs. */
package/src/web/worker.ts CHANGED
@@ -54,6 +54,7 @@ import { loadBasisTranscoder, transcodeKtx2, TEXTURE_FORMATS, type BasisTranscod
54
54
  import type { HostError } from "./shell.ts";
55
55
  import { PlatformCounter, settle, SETTLE_FIRST_MS, SETTLE_MS } from "./settle.ts";
56
56
  import { Trace, unixMs } from "../trace.ts";
57
+ import { filterGlStateOf } from "./gl-state.ts";
57
58
 
58
59
  interface Start {
59
60
  type: "start";
@@ -115,7 +116,7 @@ type Message =
115
116
  | { type: "viewport"; viewport: Viewport }
116
117
  | { type: "resize"; width: number; height: number; viewport: Viewport }
117
118
  | { type: "platform-answer"; request: number; answer: PlatformAnswer }
118
- | { type: "platform-host"; host: string; capabilities: string[] }
119
+ | { type: "platform-host"; host: string; capabilities: string[]; time?: number }
119
120
  | { type: "room-events"; events: unknown[] }
120
121
  | { type: "room-host"; host: string; join?: string }
121
122
  | AudioMessage
@@ -448,6 +449,9 @@ export function installInflater(glue: Pick<WebExtras, "og_web_set_inflater" | "o
448
449
  * too: it is asked again until its budget runs out.)
449
450
  */
450
451
  function isPendingCapture(frame: string, answer: string): boolean {
452
+ // Every null result is written `"result":null` (the probe's compact JSON);
453
+ // a frame's answer is megabytes of base64 not worth parsing to learn it is not null.
454
+ if (!answer.includes('"result":null')) return false;
451
455
  try {
452
456
  const request = JSON.parse(frame) as { method?: string };
453
457
  if (request.method !== "capture" && request.method !== "sweep") return false;
@@ -981,6 +985,8 @@ export function startWorker(game: GameToken): void {
981
985
  let tier = "none";
982
986
  if (data.canvas) {
983
987
  canvas = data.canvas;
988
+ // The WebGL2 tier draws through the state filter (gl-state.ts).
989
+ if (data.webgl) filterGlStateOf(data.canvas);
984
990
  tier = await glue.og_web_attach_canvas(engine.id, data.canvas, !!data.webgl);
985
991
  rendering = true;
986
992
  }
@@ -1073,7 +1079,7 @@ export function startWorker(game: GameToken): void {
1073
1079
  engine.answerPlatform(data.request, data.answer);
1074
1080
  platformCounter.answered();
1075
1081
  }
1076
- if (data.type === "platform-host") engine.attachPlatform(toPage(data.host, data.capabilities, platformCounter));
1082
+ if (data.type === "platform-host") engine.attachPlatform({ ...toPage(data.host, data.capabilities, platformCounter), time: data.time });
1077
1083
  if (data.type === "room-host") {
1078
1084
  boundHost()?.abi.og_room_set_host(engine.id, JSON.stringify({ host: data.host, ...(data.join ? { join: data.join } : {}) }));
1079
1085
  // A Play link's join leaves now, not with the next frame (the page may be behind its gate).