@datamoc/mw_games 0.40.0 → 0.41.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 (90) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/REFERENCE.md +2115 -0
  3. package/api-surface.json +48 -0
  4. package/data/microgm-opt.PROVENANCE.md +3 -0
  5. package/data/soundfont-catalog.json +183 -0
  6. package/dist/ai/index.d.ts +10 -0
  7. package/dist/ai/index.d.ts.map +1 -1
  8. package/dist/ai/index.js.map +1 -1
  9. package/dist/ai/lua.d.ts +6 -0
  10. package/dist/ai/lua.d.ts.map +1 -1
  11. package/dist/ai/lua.js.map +1 -1
  12. package/dist/audio/SampleDecoder.d.ts +41 -0
  13. package/dist/audio/SampleDecoder.d.ts.map +1 -0
  14. package/dist/audio/SampleDecoder.js +70 -0
  15. package/dist/audio/SampleDecoder.js.map +1 -0
  16. package/dist/audio/SoundFont.d.ts +59 -0
  17. package/dist/audio/SoundFont.d.ts.map +1 -1
  18. package/dist/audio/SoundFont.js +248 -2
  19. package/dist/audio/SoundFont.js.map +1 -1
  20. package/dist/audio/index.d.ts +3 -1
  21. package/dist/audio/index.d.ts.map +1 -1
  22. package/dist/audio/index.js +2 -1
  23. package/dist/audio/index.js.map +1 -1
  24. package/dist/mw_games.global.js +11 -11
  25. package/dist/mwl/presentation.d.ts +16 -0
  26. package/dist/mwl/presentation.d.ts.map +1 -1
  27. package/dist/mwl/presentation.js.map +1 -1
  28. package/dist/mwl/pyroeis-runtime.d.ts +7 -0
  29. package/dist/mwl/pyroeis-runtime.d.ts.map +1 -1
  30. package/dist/mwl/pyroeis-runtime.js.map +1 -1
  31. package/dist/mwl/pyroeis.d.ts +3 -0
  32. package/dist/mwl/pyroeis.d.ts.map +1 -1
  33. package/dist/mwl/pyroeis.js.map +1 -1
  34. package/dist/physics/PhysicsWorld.d.ts +3 -0
  35. package/dist/physics/PhysicsWorld.d.ts.map +1 -1
  36. package/dist/physics/PhysicsWorld.js.map +1 -1
  37. package/dist/physics/XpbdWorld.d.ts +11 -0
  38. package/dist/physics/XpbdWorld.d.ts.map +1 -1
  39. package/dist/physics/XpbdWorld.js.map +1 -1
  40. package/dist/physics/cloth/index.d.ts +20 -19
  41. package/dist/physics/cloth/index.d.ts.map +1 -1
  42. package/dist/physics/cloth/index.js +19 -0
  43. package/dist/physics/cloth/index.js.map +1 -1
  44. package/dist/physics/spring/index.d.ts +19 -18
  45. package/dist/physics/spring/index.d.ts.map +1 -1
  46. package/dist/physics/spring/index.js +23 -0
  47. package/dist/physics/spring/index.js.map +1 -1
  48. package/dist/three-d/Character3D.d.ts +8 -7
  49. package/dist/three-d/Character3D.d.ts.map +1 -1
  50. package/dist/three-d/Character3D.js +7 -0
  51. package/dist/three-d/Character3D.js.map +1 -1
  52. package/dist/three-d/Collision3D.d.ts +4 -0
  53. package/dist/three-d/Collision3D.d.ts.map +1 -1
  54. package/dist/three-d/Collision3D.js.map +1 -1
  55. package/dist/three-d/Engine3D.d.ts +2 -0
  56. package/dist/three-d/Engine3D.d.ts.map +1 -1
  57. package/dist/three-d/Engine3D.js.map +1 -1
  58. package/dist/three-d/Grid.d.ts +5 -0
  59. package/dist/three-d/Grid.d.ts.map +1 -1
  60. package/dist/three-d/Grid.js.map +1 -1
  61. package/dist/three-d/Heightmap.d.ts +3 -0
  62. package/dist/three-d/Heightmap.d.ts.map +1 -1
  63. package/dist/three-d/Heightmap.js.map +1 -1
  64. package/dist/three-d/TileGrid3D.d.ts +6 -0
  65. package/dist/three-d/TileGrid3D.d.ts.map +1 -1
  66. package/dist/three-d/TileGrid3D.js.map +1 -1
  67. package/dist/three-d/Vox.d.ts +7 -0
  68. package/dist/three-d/Vox.d.ts.map +1 -1
  69. package/dist/three-d/Vox.js.map +1 -1
  70. package/dist/two-d/presentation/MwlPresentation.d.ts +7 -0
  71. package/dist/two-d/presentation/MwlPresentation.d.ts.map +1 -1
  72. package/dist/two-d/presentation/MwlPresentation.js.map +1 -1
  73. package/dist/version.d.ts +1 -1
  74. package/dist/version.js +1 -1
  75. package/package.json +16 -1
  76. package/sbom.cdx.json +139 -139
  77. package/tools/benchmark-browser.mjs +6 -0
  78. package/tools/bundle-size.mjs +4 -0
  79. package/tools/compile-resources.mjs +3 -2
  80. package/tools/init.mjs +3 -1
  81. package/tools/make-example-assets.mjs +4 -0
  82. package/tools/multiplayer-server.mjs +4 -0
  83. package/tools/mwl.mjs +7 -0
  84. package/tools/play-uci.mjs +4 -0
  85. package/tools/sbom.mjs +4 -0
  86. package/tools/soundfonts.d.mts +79 -0
  87. package/tools/soundfonts.mjs +301 -0
  88. package/tools/verify-scenarios.mjs +6 -2
  89. package/tools/vite.mjs +1 -1
  90. package/tools.md +216 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,75 @@ the public API may still change between minor versions.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.41.0] - 2026-10-16
11
+
12
+ `microgm-opt` stays the default SoundFont, and a game that wants another one can now pick it:
13
+ a licence-classified catalogue of a per-instrument collection, a tool that fetches only the
14
+ instruments the game plays, and SoundFont 3 support from the build to the browser, so the
15
+ font reaches the page compressed and is decoded at load.
16
+
17
+ ### Added
18
+
19
+ - `mwg-soundfonts` (`list`, `fetch`, `convert`, and `@datamoc/mw_games/tools/soundfonts`):
20
+ `data/soundfont-catalog.json` lists the bundled bank and 18 fonts of the marmooo
21
+ free-soundfonts collection with each licence classified (public domain, permissive and
22
+ attribution fetch freely; share-alike, copyleft and unclear ones need `--accept-licence`;
23
+ TimGM6mb is listed as GPL-2.0 where the collection says public domain). `fetch` takes the
24
+ instruments named by `--midi` files or `--programs` and merges them into one SoundFont 3 with
25
+ a `.credits.txt` beside it: nothing is decoded, so no `ffmpeg`. `--sf2` and `convert` decode
26
+ to a plain SoundFont 2 instead (Ogg Vorbis through `ffmpeg`, a developer-machine tool), about
27
+ eight times larger.
28
+ - `loadSoundFont`, `decodeSoundFont` and `webAudioSampleDecoder` (`audio`): a game reads the
29
+ SoundFont 2 or 3 it ships with `loadSoundFont`, a SoundFont 3 decoded once at load through
30
+ `decodeAudioData` (each sample in a context at its own rate, so no resampling), or through a
31
+ decoder the caller passes. Checked in Chrome against `ffmpeg`: the same frames, rates and
32
+ loop points, and the same render. `decodeSoundFont` returns the SoundFont 2 bytes for
33
+ anything that takes them.
34
+ - `compileResources`, `emitPage` and `mwgPage` embed `.sf3` assets and subset them to the
35
+ programs the game's MIDI files use, the Ogg bytes copied untouched.
36
+ - `mergeSoundFonts` (`audio`): joins SoundFont 2 files, or SoundFont 3 files with their Ogg
37
+ bytes untouched, into one, the first font winning a shared (bank, program).
38
+
39
+ ### Fixed
40
+
41
+ - `parseSoundFont` refuses a SoundFont 3 by name (pointing at `loadSoundFont`) instead of
42
+ reading its Ogg bytes as PCM and playing noise.
43
+ - A SoundFont whose sample offsets point outside its sample data is refused when read, rather
44
+ than read beyond it.
45
+ - Decoding a SoundFont 3 bounds what the file can make it allocate: a sample rate outside 400 to
46
+ 200000 Hz is refused, a decoded sample is capped at sixteen million frames and a whole font at
47
+ 134 million (256 MB of audio), in both `decodeSoundFont` and the WebAudio decoder.
48
+ - `mwg-soundfonts` treats the font as untrusted input: a sample whose offsets point outside the
49
+ sample data is refused instead of copied from beyond it, and `ffmpeg` only ever receives bytes
50
+ that start with the Ogg magic, with the demuxer forced to Ogg and only the `pipe` protocol
51
+ allowed, so a crafted "sample" cannot be probed as a playlist that names local files.
52
+
53
+ ## [0.40.1] - 2026-10-15
54
+
55
+ The published package now carries its documentation the way npm expects to find it: a
56
+ homepage that opens the documentation site, the reference and the tools guide inside the
57
+ tarball, declared Node support, and a `--help` on every command line tool.
58
+
59
+ ### Added
60
+
61
+ - `package.json` declares `homepage` (the documentation site, so `npm docs` opens it
62
+ instead of the GitHub README), `bugs` and `engines` (`node >=20.19.0`), and exports
63
+ `./package.json` so a tool can read an installed module's metadata. `@datamoc/mwg`
64
+ inherits all of them, plus the keywords it lacked.
65
+ - `REFERENCE.md` and `tools.md` ship in the tarball, so the README's relative links
66
+ resolve offline from `node_modules`.
67
+ - `REFERENCE.md` sections for `skeleton`, `physics` and `mwl/pyroeis`.
68
+ - JSDoc on the exported symbols of the least documented entry points
69
+ (`mwl/presentation`, `ai/lua`, `physics/xpbd`, `two-d/presentation`, `3d`, `mwl/pyroeis`,
70
+ `physics`).
71
+
72
+ ### Fixed
73
+
74
+ - `mwg-bench`, `mwg-size`, `mwg-sbom`, `mwg-lockstep-server`, `mwg-mwl`, `mwg-uci` now print
75
+ their usage for `--help` instead of running. `mwg-init --help` no longer creates a folder
76
+ named `--help`, `mwg-scenarios --help` no longer hangs, and `mwg-placeholder-assets --help`
77
+ no longer rewrites the assets.
78
+
10
79
  ## [0.40.0] - 2026-10-15
11
80
 
12
81
  A game that plays sampled MIDI no longer ships a whole SoundFont: the asset