@bendyline/molen-tooling 0.0.1 → 0.0.2

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 (137) hide show
  1. package/README.md +22 -4
  2. package/dist/cli.mjs +26 -4
  3. package/dist/docs-src/guide/3d-art-guidelines.md +2 -2
  4. package/dist/docs-src/guide/3d-model-assets.md +15 -11
  5. package/dist/docs-src/guide/aircraft.md +9 -10
  6. package/dist/docs-src/guide/browser-mount.md +14 -0
  7. package/dist/docs-src/guide/building-interiors.md +2 -1
  8. package/dist/docs-src/guide/determinism.md +16 -11
  9. package/dist/docs-src/guide/entities.md +16 -5
  10. package/dist/docs-src/guide/examples.md +38 -23
  11. package/dist/docs-src/guide/experience-playback.md +2 -3
  12. package/dist/docs-src/guide/game-samples.md +30 -18
  13. package/dist/docs-src/guide/project.md +22 -2
  14. package/dist/docs-src/guide/quickstart.md +37 -28
  15. package/dist/docs-src/guide/recognizable-places.md +21 -15
  16. package/dist/docs-src/guide/rendering-backends.md +5 -4
  17. package/dist/docs-src/guide/scripting.md +4 -2
  18. package/dist/docs-src/guide/sky.md +10 -9
  19. package/dist/docs-src/guide/structure-library.md +18 -8
  20. package/dist/docs-src/guide/terrain.md +6 -4
  21. package/dist/docs-src/guide/vehicles.md +9 -5
  22. package/dist/docs-src/guide/worldgen.md +31 -21
  23. package/dist/docs-src/llms.txt +26 -15
  24. package/dist/docs-src/schemas/README.md +1 -1
  25. package/dist/index.d.mts +26 -2
  26. package/dist/index.mjs +2 -2
  27. package/dist/{mcp-BFnCWrg0.mjs → mcp-AOfIp89b.mjs} +12 -2
  28. package/dist/{ops-BGxhSP6w.mjs → ops-C4BvDgP-.mjs} +267 -33
  29. package/dist/templates/city-courier/README.md +53 -0
  30. package/dist/templates/city-courier/checks.json +20 -0
  31. package/dist/templates/city-courier/commands.json +32 -0
  32. package/dist/templates/city-courier/delivery-run.replay.json +214 -0
  33. package/dist/templates/city-courier/gen/molen-types.ts +878 -0
  34. package/dist/templates/city-courier/index.html +2 -0
  35. package/dist/templates/city-courier/package.json +25 -0
  36. package/dist/templates/city-courier/project.json +8 -0
  37. package/dist/templates/city-courier/scene.json +3395 -0
  38. package/dist/templates/city-courier/scripts/game.ts +127 -0
  39. package/dist/templates/city-courier/scripts/molen-scripts.d.ts +1125 -0
  40. package/dist/templates/city-courier/scripts/tsconfig.json +16 -0
  41. package/dist/templates/city-courier/src/game-shell.css +309 -0
  42. package/dist/templates/city-courier/src/main.ts +81 -0
  43. package/dist/templates/city-courier/src/scene.ts +17 -0
  44. package/dist/templates/city-courier/src/vite-env.d.ts +1 -0
  45. package/dist/templates/city-courier/src/worker.ts +5 -0
  46. package/dist/templates/city-courier/test/headless.test.ts +95 -0
  47. package/dist/templates/city-courier/test/playthrough.test.js +52 -0
  48. package/dist/templates/city-courier/test/replay.test.ts +22 -0
  49. package/dist/templates/city-courier/tsconfig.json +17 -0
  50. package/dist/templates/city-courier/vite.config.ts +19 -0
  51. package/dist/templates/cubes/README.md +51 -0
  52. package/dist/templates/cubes/index.html +16 -0
  53. package/dist/templates/cubes/package.json +24 -0
  54. package/dist/templates/cubes/scene.json +15 -0
  55. package/dist/templates/cubes/src/cubes.ts +100 -0
  56. package/dist/templates/cubes/src/main.ts +21 -0
  57. package/dist/templates/cubes/src/worker.ts +15 -0
  58. package/dist/templates/cubes/test/headless.test.ts +98 -0
  59. package/dist/templates/cubes/tsconfig.json +17 -0
  60. package/dist/templates/cubes/vite.config.ts +17 -0
  61. package/dist/templates/data-viz/README.md +47 -0
  62. package/dist/templates/data-viz/camera-track.json +12 -0
  63. package/dist/templates/data-viz/data.json +9 -0
  64. package/dist/templates/data-viz/index.html +16 -0
  65. package/dist/templates/data-viz/package.json +25 -0
  66. package/dist/templates/data-viz/scene.json +7 -0
  67. package/dist/templates/data-viz/src/main.ts +39 -0
  68. package/dist/templates/data-viz/src/viz.ts +91 -0
  69. package/dist/templates/data-viz/src/worker.ts +12 -0
  70. package/dist/templates/data-viz/test/headless.test.ts +75 -0
  71. package/dist/templates/data-viz/tsconfig.json +17 -0
  72. package/dist/templates/data-viz/vite.config.ts +16 -0
  73. package/dist/templates/figures-gallery/README.md +46 -0
  74. package/dist/templates/figures-gallery/index.html +16 -0
  75. package/dist/templates/figures-gallery/package.json +25 -0
  76. package/dist/templates/figures-gallery/scene.json +276 -0
  77. package/dist/templates/figures-gallery/src/main.ts +44 -0
  78. package/dist/templates/figures-gallery/src/worker.ts +17 -0
  79. package/dist/templates/figures-gallery/test/headless.test.ts +90 -0
  80. package/dist/templates/figures-gallery/tsconfig.json +17 -0
  81. package/dist/templates/figures-gallery/vite.config.ts +17 -0
  82. package/dist/templates/index.json +188 -0
  83. package/dist/templates/skybound/README.md +53 -0
  84. package/dist/templates/skybound/checks.json +24 -0
  85. package/dist/templates/skybound/commands.json +32 -0
  86. package/dist/templates/skybound/first-leap.replay.json +224 -0
  87. package/dist/templates/skybound/gen/molen-types.ts +878 -0
  88. package/dist/templates/skybound/index.html +2 -0
  89. package/dist/templates/skybound/package.json +25 -0
  90. package/dist/templates/skybound/project.json +8 -0
  91. package/dist/templates/skybound/scene.json +1737 -0
  92. package/dist/templates/skybound/scripts/game.ts +119 -0
  93. package/dist/templates/skybound/scripts/molen-scripts.d.ts +1125 -0
  94. package/dist/templates/skybound/scripts/tsconfig.json +16 -0
  95. package/dist/templates/skybound/src/game-shell.css +309 -0
  96. package/dist/templates/skybound/src/main.ts +60 -0
  97. package/dist/templates/skybound/src/scene.ts +17 -0
  98. package/dist/templates/skybound/src/vite-env.d.ts +1 -0
  99. package/dist/templates/skybound/src/worker.ts +5 -0
  100. package/dist/templates/skybound/test/headless.test.ts +124 -0
  101. package/dist/templates/skybound/test/playthrough.test.js +38 -0
  102. package/dist/templates/skybound/test/replay.test.ts +22 -0
  103. package/dist/templates/skybound/tsconfig.json +17 -0
  104. package/dist/templates/skybound/vite.config.ts +19 -0
  105. package/dist/templates/terrain-flyover/README.md +46 -0
  106. package/dist/templates/terrain-flyover/index.html +16 -0
  107. package/dist/templates/terrain-flyover/package.json +26 -0
  108. package/dist/templates/terrain-flyover/src/flyover.ts +23 -0
  109. package/dist/templates/terrain-flyover/src/main.ts +93 -0
  110. package/dist/templates/terrain-flyover/terrain.json +15 -0
  111. package/dist/templates/terrain-flyover/test/headless.test.ts +72 -0
  112. package/dist/templates/terrain-flyover/tsconfig.json +17 -0
  113. package/dist/templates/terrain-flyover/vite.config.ts +15 -0
  114. package/dist/templates/top-down-arena/README.md +52 -0
  115. package/dist/templates/top-down-arena/arena-skirmish.replay.json +204 -0
  116. package/dist/templates/top-down-arena/index.html +16 -0
  117. package/dist/templates/top-down-arena/package.json +25 -0
  118. package/dist/templates/top-down-arena/project.json +10 -0
  119. package/dist/templates/top-down-arena/scene.json +162 -0
  120. package/dist/templates/top-down-arena/scripts/chase.ts +17 -0
  121. package/dist/templates/top-down-arena/scripts/combat.ts +12 -0
  122. package/dist/templates/top-down-arena/scripts/control.ts +8 -0
  123. package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +1095 -0
  124. package/dist/templates/top-down-arena/scripts/spawner.ts +11 -0
  125. package/dist/templates/top-down-arena/scripts/tsconfig.json +16 -0
  126. package/dist/templates/top-down-arena/src/arena.ts +8 -0
  127. package/dist/templates/top-down-arena/src/gen/molen-types.ts +882 -0
  128. package/dist/templates/top-down-arena/src/main.ts +31 -0
  129. package/dist/templates/top-down-arena/src/scene.ts +24 -0
  130. package/dist/templates/top-down-arena/src/vite-env.d.ts +1 -0
  131. package/dist/templates/top-down-arena/src/worker.ts +7 -0
  132. package/dist/templates/top-down-arena/test/headless.test.ts +87 -0
  133. package/dist/templates/top-down-arena/test/replay.test.ts +22 -0
  134. package/dist/templates/top-down-arena/tsconfig.json +17 -0
  135. package/dist/templates/top-down-arena/types/arena.types.json +54 -0
  136. package/dist/templates/top-down-arena/vite.config.ts +21 -0
  137. package/package.json +14 -14
@@ -0,0 +1,162 @@
1
+ {
2
+ "format": "molen/scene@3",
3
+ "name": "top-down-arena",
4
+ "seed": "arena-1",
5
+ "tickRate": 30,
6
+ "keyframeInterval": 60,
7
+ "physics": {
8
+ "engine": "kinematics"
9
+ },
10
+ "camera": {
11
+ "mode": "top-down-ortho",
12
+ "center": [0, 0],
13
+ "viewHeight": 26
14
+ },
15
+ "input": {
16
+ "bindings": {
17
+ "KeyW": "up",
18
+ "KeyS": "down",
19
+ "KeyA": "left",
20
+ "KeyD": "right"
21
+ },
22
+ "emit": [
23
+ {
24
+ "kind": "axis2d",
25
+ "xNeg": "left",
26
+ "xPos": "right",
27
+ "yNeg": "up",
28
+ "yPos": "down",
29
+ "command": "move",
30
+ "field": "dir"
31
+ }
32
+ ]
33
+ },
34
+ "commands": {
35
+ "move": {
36
+ "doc": "Set the player's planar move direction: dir = [x, z], each in -1..1.",
37
+ "payload": {
38
+ "type": "object",
39
+ "properties": {
40
+ "dir": {
41
+ "type": "array",
42
+ "items": {
43
+ "type": "number",
44
+ "minimum": -1,
45
+ "maximum": 1
46
+ },
47
+ "minItems": 2,
48
+ "maxItems": 2
49
+ }
50
+ },
51
+ "required": ["dir"],
52
+ "additionalProperties": false
53
+ }
54
+ }
55
+ },
56
+ "scripts": [
57
+ {
58
+ "id": "control",
59
+ "path": "scripts/control.ts",
60
+ "config": {
61
+ "playerSpeed": 9
62
+ },
63
+ "checkpoint": "state"
64
+ },
65
+ {
66
+ "id": "spawner",
67
+ "path": "scripts/spawner.ts",
68
+ "config": {
69
+ "interval": 12,
70
+ "size": 20
71
+ },
72
+ "checkpoint": "state"
73
+ },
74
+ {
75
+ "id": "chase",
76
+ "path": "scripts/chase.ts",
77
+ "config": {
78
+ "speed": 5
79
+ },
80
+ "checkpoint": "state"
81
+ },
82
+ {
83
+ "id": "combat",
84
+ "path": "scripts/combat.ts",
85
+ "checkpoint": "state"
86
+ }
87
+ ],
88
+ "entities": [
89
+ {
90
+ "id": "player",
91
+ "type": "arena.player"
92
+ },
93
+ {
94
+ "id": "wall-n",
95
+ "type": "arena.wall",
96
+ "components": {
97
+ "transform": {
98
+ "pos": [0, 0, -10]
99
+ },
100
+ "collider": {
101
+ "halfExtents": [10, 0.5]
102
+ },
103
+ "renderable": {
104
+ "primitive": {
105
+ "size": [20, 1, 1]
106
+ }
107
+ }
108
+ }
109
+ },
110
+ {
111
+ "id": "wall-s",
112
+ "type": "arena.wall",
113
+ "components": {
114
+ "transform": {
115
+ "pos": [0, 0, 10]
116
+ },
117
+ "collider": {
118
+ "halfExtents": [10, 0.5]
119
+ },
120
+ "renderable": {
121
+ "primitive": {
122
+ "size": [20, 1, 1]
123
+ }
124
+ }
125
+ }
126
+ },
127
+ {
128
+ "id": "wall-w",
129
+ "type": "arena.wall",
130
+ "components": {
131
+ "transform": {
132
+ "pos": [-10, 0, 0]
133
+ },
134
+ "collider": {
135
+ "halfExtents": [0.5, 10]
136
+ },
137
+ "renderable": {
138
+ "primitive": {
139
+ "size": [1, 1, 20]
140
+ }
141
+ }
142
+ }
143
+ },
144
+ {
145
+ "id": "wall-e",
146
+ "type": "arena.wall",
147
+ "components": {
148
+ "transform": {
149
+ "pos": [10, 0, 0]
150
+ },
151
+ "collider": {
152
+ "halfExtents": [0.5, 10]
153
+ },
154
+ "renderable": {
155
+ "primitive": {
156
+ "size": [1, 1, 20]
157
+ }
158
+ }
159
+ }
160
+ }
161
+ ]
162
+ }
@@ -0,0 +1,17 @@
1
+ // Every enemy steers straight at the player at `config.speed`.
2
+ molen.on('tick', () => {
3
+ const player = molen.get('player', 'transform');
4
+ if (!player) return;
5
+ for (const row of molen.query('tag', 'transform')) {
6
+ const id = row[0];
7
+ const tag = row[1];
8
+ const t = row[2];
9
+ if (tag.name !== 'enemy') continue;
10
+ const dx = player.pos[0] - t.pos[0];
11
+ const dz = player.pos[2] - t.pos[2];
12
+ const len = molen.math.hypot(dx, 0, dz) || 1;
13
+ molen.patch(id, 'kinematicBody', {
14
+ vel: [(dx / len) * config.speed, 0, (dz / len) * config.speed],
15
+ });
16
+ }
17
+ });
@@ -0,0 +1,12 @@
1
+ // Contact damage: an enemy touching the player costs 1 hp and destroys the enemy. The
2
+ // `collision` event comes from the kinematics layer (physics.engine = "kinematics").
3
+ molen.on('collision', (e) => {
4
+ const involvesPlayer = e.a === 'player' || e.b === 'player';
5
+ if (!involvesPlayer) return;
6
+ const enemy = e.a === 'player' ? e.b : e.a;
7
+ const tag = molen.get(enemy, 'tag');
8
+ if (tag?.name !== 'enemy') return;
9
+ const hp = molen.get('player', 'health');
10
+ if (hp) molen.set('player', 'health', { hp: hp.hp - 1 });
11
+ molen.destroy(enemy);
12
+ });
@@ -0,0 +1,8 @@
1
+ // Player control: the `move` command (declared in scene.json with its payload schema, emitted
2
+ // by the scene's axis2d input rule) sets the player's planar velocity. Pure scene data — no
3
+ // setup module, no build step.
4
+ molen.onCommand('move', (p) => {
5
+ molen.patch('player', 'kinematicBody', {
6
+ vel: [p.dir[0] * config.playerSpeed, 0, p.dir[1] * config.playerSpeed],
7
+ });
8
+ });