@origingame/engine 0.2.0 → 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.
Files changed (107) hide show
  1. package/bin/og.mjs +1 -1
  2. package/dist/web/origin-engine.d.ts +219 -5
  3. package/dist/web/origin-engine.js +1344 -125
  4. package/dist/web/origin-engine_bg.wasm +0 -0
  5. package/dist/web/origin-engine_bg.wasm.d.ts +68 -3
  6. package/dist/web-publish/origin-engine-lanes.js +1007 -22
  7. package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
  8. package/dist/web-publish/origin-engine.d.ts +162 -5
  9. package/dist/web-publish/origin-engine.js +1004 -19
  10. package/dist/web-publish/origin-engine_bg.wasm +0 -0
  11. package/dist/web-publish/origin-engine_bg.wasm.d.ts +52 -3
  12. package/dist/web-publish-2d/origin-engine-lanes.js +1007 -22
  13. package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
  14. package/dist/web-publish-2d/origin-engine.d.ts +162 -5
  15. package/dist/web-publish-2d/origin-engine.js +1004 -19
  16. package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
  17. package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +52 -3
  18. package/knowledge/looks/catalogue.json +40 -40
  19. package/knowledge/package.json +1 -1
  20. package/knowledge/scaffold/distribution.json +14 -0
  21. package/knowledge/scaffold/origin-engine.json +2 -2
  22. package/knowledge/scaffold/template/README.md +2 -1
  23. package/knowledge/scaffold/template/assets/audio/sting.ogt +10 -0
  24. package/knowledge/scaffold/template/assets/timelines/intro.ogt +101 -0
  25. package/knowledge/scaffold/template/assets/timelines/narration.srt +11 -0
  26. package/knowledge/scaffold/template/host.d.ts +46 -0
  27. package/knowledge/scaffold/template/package.json +1 -1
  28. package/knowledge/scaffold/template/project.ogt +1 -1
  29. package/knowledge/scaffold/template/src/main.ts +1 -1
  30. package/knowledge/scaffold/template/tests/frames.ts +134 -0
  31. package/knowledge/scaffold/template/tests/intro.og.ts +65 -0
  32. package/knowledge/scaffold/template/tests/smoke.og.ts +30 -36
  33. package/knowledge/scaffold/template/tsconfig.json +1 -1
  34. package/knowledge/scripts/mount.ts +2 -1
  35. package/knowledge/scripts/validate.ts +19 -10
  36. package/knowledge/skills/og-build/SKILL.md +8 -5
  37. package/knowledge/skills/og-core/SKILL.md +11 -0
  38. package/knowledge/skills/og-game/SKILL.md +877 -8
  39. package/knowledge/skills/og-platform-sdk/SKILL.md +1 -0
  40. package/knowledge/skills/og-taste/SKILL.md +82 -73
  41. package/knowledge/skills/og-ui/SKILL.md +65 -50
  42. package/knowledge/wiki/ai.md +20 -20
  43. package/knowledge/wiki/anim.md +384 -41
  44. package/knowledge/wiki/atmosphere.md +36 -13
  45. package/knowledge/wiki/audio.md +18 -18
  46. package/knowledge/wiki/camera.md +19 -13
  47. package/knowledge/wiki/commands.md +19 -13
  48. package/knowledge/wiki/debug.md +414 -0
  49. package/knowledge/wiki/game.md +8 -8
  50. package/knowledge/wiki/i18n.md +7 -7
  51. package/knowledge/wiki/index.md +262 -7
  52. package/knowledge/wiki/input.md +47 -47
  53. package/knowledge/wiki/load.md +236 -68
  54. package/knowledge/wiki/math.md +2607 -0
  55. package/knowledge/wiki/nav.md +34 -34
  56. package/knowledge/wiki/net.md +340 -0
  57. package/knowledge/wiki/path.md +402 -0
  58. package/knowledge/wiki/physics.md +95 -95
  59. package/knowledge/wiki/platform.md +463 -29
  60. package/knowledge/wiki/probe.md +681 -67
  61. package/knowledge/wiki/reflect.md +15 -15
  62. package/knowledge/wiki/render.md +3893 -1896
  63. package/knowledge/wiki/rng.md +14 -14
  64. package/knowledge/wiki/stream.md +15 -15
  65. package/knowledge/wiki/system.md +8 -8
  66. package/knowledge/wiki/systems.md +2 -2
  67. package/knowledge/wiki/terrain.md +19 -19
  68. package/knowledge/wiki/tilemap.md +13 -13
  69. package/knowledge/wiki/time.md +4 -4
  70. package/knowledge/wiki/timeline.md +396 -0
  71. package/knowledge/wiki/transform.md +8 -8
  72. package/knowledge/wiki/tween.md +17 -17
  73. package/knowledge/wiki/ui.md +559 -629
  74. package/knowledge/wiki/video.md +157 -0
  75. package/knowledge/wiki/world.md +36 -36
  76. package/package.json +4 -3
  77. package/schema/api.schema.json +21707 -14725
  78. package/shell/page.ts +26 -2
  79. package/shell/platform.ts +46 -0
  80. package/shell/player.ts +7 -0
  81. package/src/depth.ts +71 -0
  82. package/src/e6.ts +32 -1
  83. package/src/env.d.ts +5 -1
  84. package/src/generated/abi.ts +189 -3
  85. package/src/index.ts +25 -4
  86. package/src/light.ts +18 -0
  87. package/src/math.ts +622 -0
  88. package/src/node/index.ts +17 -0
  89. package/src/node/playtest-run.ts +114 -18
  90. package/src/node/polish.ts +13 -3
  91. package/src/node/render.ts +291 -0
  92. package/src/node/run.ts +86 -5
  93. package/src/p2.ts +19 -1
  94. package/src/playtest.ts +57 -4
  95. package/src/runtime.ts +13 -3
  96. package/src/targets.ts +28 -0
  97. package/src/trace.ts +169 -0
  98. package/src/ui-kit/huds.ts +34 -34
  99. package/src/ui-kit/menus.ts +12 -12
  100. package/src/ui-kit/settings.ts +2 -2
  101. package/src/ui-kit/store.ts +18 -18
  102. package/src/ui-kit/story.ts +6 -4
  103. package/src/ui-kit/util.ts +8 -8
  104. package/src/web/shell.ts +58 -0
  105. package/src/web/worker.ts +103 -2
  106. package/types/bindings.json +9101 -6647
  107. package/types/index.d.ts +15503 -11564
package/src/index.ts CHANGED
@@ -25,10 +25,16 @@ import {
25
25
  type FieldSpec,
26
26
  } from "./runtime.ts";
27
27
  import { cameras } from "./systems/cameras.ts";
28
- import { ai, i18n, nav, platform } from "./e6.ts";
29
- import { stream, terrain } from "./p2.ts";
28
+ import { ai, i18n, nav, net, platform } from "./e6.ts";
29
+ import { path, stream, terrain, timeline } from "./p2.ts";
30
+ import { debug, depthRender } from "./depth.ts";
31
+ import { targetsLoad, targetsRender } from "./targets.ts";
32
+ import { lightRender } from "./light.ts";
30
33
  import { uiKit } from "./ui-kit/index.ts";
31
34
 
35
+ // The math layer (IDL `math`): three.js's methods as pure functions over the plain structs.
36
+ export { vec3, vec2, quat, mat4, box3, sphere, plane, frustum, ray, color } from "./math.ts";
37
+
32
38
  const spec = (kind: string, value: unknown, options: unknown): FieldSpec =>
33
39
  Object.freeze({ kind, default: value, options: Object.freeze({ ...((options as object | undefined) ?? {}) }) });
34
40
 
@@ -57,7 +63,9 @@ export const Lut = ((value = 0 as Api.Lut, options) => spec("Lut", value, option
57
63
  export const EnvironmentMap = ((value = 0 as Api.EnvironmentMap, options) => spec("EnvironmentMap", value, options)) as typeof Api.EnvironmentMap;
58
64
  export const ParticleEmitter = ((value = 0 as Api.ParticleEmitter, options) => spec("ParticleEmitter", value, options)) as typeof Api.ParticleEmitter;
59
65
  export const AoMethod = ((value = "auto" as Api.AoMethod, options) => spec("AoMethod", value, options)) as typeof Api.AoMethod;
66
+ export const LineMode = ((value = "strip" as Api.LineMode, options) => spec("LineMode", value, options)) as typeof Api.LineMode;
60
67
  export const DofQuality = ((value = "low" as Api.DofQuality, options) => spec("DofQuality", value, options)) as typeof Api.DofQuality;
68
+ export const ReflectionProbeMode = ((value = "baked" as Api.ReflectionProbeMode, options) => spec("ReflectionProbeMode", value, options)) as typeof Api.ReflectionProbeMode;
61
69
  export const SpriteBlend = ((value = "alpha" as Api.SpriteBlend, options) => spec("SpriteBlend", value, options)) as typeof Api.SpriteBlend;
62
70
  export const StripBlend = ((value = "additive" as Api.StripBlend, options) => spec("StripBlend", value, options)) as typeof Api.StripBlend;
63
71
  export const Palette = ((value = 0 as Api.Palette, options) => spec("Palette", value, options)) as typeof Api.Palette;
@@ -71,6 +79,14 @@ export const ClipAsset = ((value = 0 as Api.ClipAsset, options) => spec("ClipAss
71
79
  export const GraphAsset = ((value = 0 as Api.GraphAsset, options) => spec("GraphAsset", value, options)) as typeof Api.GraphAsset;
72
80
  export const FlipbookSheet = ((value = 0 as Api.FlipbookSheet, options) => spec("FlipbookSheet", value, options)) as typeof Api.FlipbookSheet;
73
81
  export const Tween = ((value = 0 as Api.Tween, options) => spec("Tween", value, options)) as typeof Api.Tween;
82
+ export const Video = ((value = 0 as Api.Video, options) => spec("Video", value, options)) as typeof Api.Video;
83
+ export const Path = ((value = 0 as Api.Path, options) => spec("Path", value, options)) as typeof Api.Path;
84
+ export const PathKind = ((value = "catmullRom" as Api.PathKind, options) => spec("PathKind", value, options)) as typeof Api.PathKind;
85
+ export const TimelineAsset = ((value = 0 as Api.TimelineAsset, options) => spec("TimelineAsset", value, options)) as typeof Api.TimelineAsset;
86
+ export const Rig2D = ((value = 0 as Api.Rig2D, options) => spec("Rig2D", value, options)) as typeof Api.Rig2D;
87
+ export const RenderTargetFormat = ((value = "ldr" as Api.RenderTargetFormat, options) => spec("RenderTargetFormat", value, options)) as typeof Api.RenderTargetFormat;
88
+ export const RenderTarget = ((value = 0 as Api.RenderTarget, options) => spec("RenderTarget", value, options)) as typeof Api.RenderTarget;
89
+ export const Post = ((value = 0 as Api.Post, options) => spec("Post", value, options)) as typeof Api.Post;
74
90
  export const TilemapAsset = ((value = 0 as Api.TilemapAsset, options) => spec("TilemapAsset", value, options)) as typeof Api.TilemapAsset;
75
91
  export const TerrainData = ((value = 0 as Api.TerrainData, options) => spec("TerrainData", value, options)) as typeof Api.TerrainData;
76
92
  export const RootMotion = ((value = "off" as Api.RootMotion, options) => spec("RootMotion", value, options)) as typeof Api.RootMotion;
@@ -100,6 +116,7 @@ export const MAX_POINTERS: typeof Api.MAX_POINTERS = 5;
100
116
  export const MAX_GAMEPADS: typeof Api.MAX_GAMEPADS = 4;
101
117
  export const MAX_LIGHTS: typeof Api.MAX_LIGHTS = 256;
102
118
  export const MAX_CLUSTER_LIGHTS: typeof Api.MAX_CLUSTER_LIGHTS = 64;
119
+ export const MAX_REFLECTION_PROBES: typeof Api.MAX_REFLECTION_PROBES = 8;
103
120
  export const PARTICLES_ARMED: typeof Api.PARTICLES_ARMED = 4294967295;
104
121
  export const UI_LAYER: typeof Api.UI_LAYER = 1000;
105
122
  export const BODY_DYNAMIC: typeof Api.BODY_DYNAMIC = 0;
@@ -172,8 +189,8 @@ export const og: typeof Api.og = Object.freeze({
172
189
  ...BUILTINS,
173
190
  game: (desc?: Api.GameDesc) => defineGame(desc as never),
174
191
  transform,
175
- render,
176
- load,
192
+ render: Object.freeze({ ...render, ...depthRender, ...targetsRender, ...lightRender }),
193
+ load: Object.freeze({ ...load, ...targetsLoad }),
177
194
  commands,
178
195
  physics,
179
196
  atmosphere,
@@ -187,8 +204,12 @@ export const og: typeof Api.og = Object.freeze({
187
204
  ai,
188
205
  platform,
189
206
  i18n,
207
+ net,
190
208
  terrain,
191
209
  stream,
210
+ debug,
211
+ path,
212
+ timeline,
192
213
  ui: Object.freeze({ ...ui, ...uiKit }),
193
214
  systems: Object.freeze({ cameras }),
194
215
  }) as unknown as typeof Api.og;
package/src/light.ts ADDED
@@ -0,0 +1,18 @@
1
+ // The depth wave's baked lighting (IDL `render`: bakedLighting): a thin
2
+ // call into the host's binding symbol, typed by the generated declarations
3
+ // through index.ts.
4
+
5
+ import type { HostAbi } from "./generated/abi.ts";
6
+ import { boundHost } from "./runtime.ts";
7
+
8
+ type W = { readonly id: number };
9
+
10
+ function abi(): HostAbi<Uint32Array, unknown> {
11
+ const h = boundHost();
12
+ if (!h) throw new Error("no engine host is loaded: start the game through @origingame/engine's web or node loader");
13
+ return h.abi;
14
+ }
15
+
16
+ export const lightRender = Object.freeze({
17
+ bakedLighting: (world: W) => JSON.parse(abi().og_render_baked_lighting(world.id)) as unknown,
18
+ });