@waica/cli 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 (231) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/dist/cli.js +184 -0
  4. package/dist/editor/assets/abap-08VXUWAP.js +1 -0
  5. package/dist/editor/assets/apex-BWPQTe0t.js +1 -0
  6. package/dist/editor/assets/azcli-Bc_sGQ0U.js +1 -0
  7. package/dist/editor/assets/bat-i0X4ZdIN.js +1 -0
  8. package/dist/editor/assets/bicep-B5-_aFwp.js +2 -0
  9. package/dist/editor/assets/cameligo-DMUM7wLl.js +1 -0
  10. package/dist/editor/assets/clojure-Cm7r79vr.js +1 -0
  11. package/dist/editor/assets/codicon-DCmgc-ay.ttf +0 -0
  12. package/dist/editor/assets/coffee-Ba7i2nA0.js +1 -0
  13. package/dist/editor/assets/cpp-C7h46wYY.js +1 -0
  14. package/dist/editor/assets/csharp-BKxtCVv1.js +1 -0
  15. package/dist/editor/assets/csp-bTuwJoIa.js +1 -0
  16. package/dist/editor/assets/css-DIMkf-bt.js +3 -0
  17. package/dist/editor/assets/css.worker-Fwwr_HdT.js +88 -0
  18. package/dist/editor/assets/cssMode-CQE-WdwL.js +4 -0
  19. package/dist/editor/assets/cypher-CVaqCwHa.js +1 -0
  20. package/dist/editor/assets/dart-onAF5SnQ.js +1 -0
  21. package/dist/editor/assets/dockerfile-DZFCIeNp.js +1 -0
  22. package/dist/editor/assets/ecl-D05T4iGw.js +1 -0
  23. package/dist/editor/assets/editor.worker-DsBDrWS5.js +12 -0
  24. package/dist/editor/assets/elixir-6RTg0lbw.js +1 -0
  25. package/dist/editor/assets/flow9-C5_-GSwl.js +1 -0
  26. package/dist/editor/assets/freemarker2-CYgdVabn.js +3 -0
  27. package/dist/editor/assets/fsharp-C8Ef5oNN.js +1 -0
  28. package/dist/editor/assets/go-C-y9NEjX.js +1 -0
  29. package/dist/editor/assets/graphql-fmXr3nnJ.js +1 -0
  30. package/dist/editor/assets/handlebars-DdeORCJD.js +1 -0
  31. package/dist/editor/assets/hcl-CpzslTdj.js +1 -0
  32. package/dist/editor/assets/html-DTIAGV84.js +1 -0
  33. package/dist/editor/assets/html.worker-B3Ztmmz2.js +495 -0
  34. package/dist/editor/assets/htmlMode-CRV3iBih.js +4 -0
  35. package/dist/editor/assets/index-Btzc6zxr.css +1 -0
  36. package/dist/editor/assets/index-Dhkqk31v.js +11016 -0
  37. package/dist/editor/assets/ini-sBoK_t0W.js +1 -0
  38. package/dist/editor/assets/java-BEtHBSE6.js +1 -0
  39. package/dist/editor/assets/javascript-dxBW86cl.js +1 -0
  40. package/dist/editor/assets/json.worker-PWQxM7ZO.js +51 -0
  41. package/dist/editor/assets/jsonMode-DFA5-FFK.js +10 -0
  42. package/dist/editor/assets/julia-Bri6UV-V.js +1 -0
  43. package/dist/editor/assets/kotlin-B0qVs-E9.js +1 -0
  44. package/dist/editor/assets/less-B9JPFI3C.js +2 -0
  45. package/dist/editor/assets/lexon-CfSJPG6W.js +1 -0
  46. package/dist/editor/assets/liquid-CScWaXYV.js +1 -0
  47. package/dist/editor/assets/lua-CsQS60Ue.js +1 -0
  48. package/dist/editor/assets/m3-D-oSqn_W.js +1 -0
  49. package/dist/editor/assets/markdown-Cimd5fb3.js +1 -0
  50. package/dist/editor/assets/mdx-Bvp84SqA.js +1 -0
  51. package/dist/editor/assets/mips-CIPQ_RoX.js +1 -0
  52. package/dist/editor/assets/msdax-DauUninz.js +1 -0
  53. package/dist/editor/assets/mysql-SOo6toE5.js +1 -0
  54. package/dist/editor/assets/objective-c-FvmIjYaQ.js +1 -0
  55. package/dist/editor/assets/pascal-DrH0SRf2.js +1 -0
  56. package/dist/editor/assets/pascaligo-D-ptJ9y-.js +1 -0
  57. package/dist/editor/assets/perl-oz_6vUea.js +1 -0
  58. package/dist/editor/assets/pgsql-DTj74zXo.js +1 -0
  59. package/dist/editor/assets/php-nr791fC2.js +1 -0
  60. package/dist/editor/assets/pla-CopQ2nXW.js +1 -0
  61. package/dist/editor/assets/postiats-43DmfD33.js +1 -0
  62. package/dist/editor/assets/powerquery-D3hlyOfw.js +1 -0
  63. package/dist/editor/assets/powershell-DmHpPYUd.js +1 -0
  64. package/dist/editor/assets/protobuf-C531GsRP.js +2 -0
  65. package/dist/editor/assets/pug-Z5eAx3Zn.js +1 -0
  66. package/dist/editor/assets/python-CG-OtvFa.js +1 -0
  67. package/dist/editor/assets/qsharp-DkqhCAOL.js +1 -0
  68. package/dist/editor/assets/r-BwWrilGY.js +1 -0
  69. package/dist/editor/assets/razor-r-iUEZPj.js +1 -0
  70. package/dist/editor/assets/redis-ClamHrr6.js +1 -0
  71. package/dist/editor/assets/redshift-DT7zqm-g.js +1 -0
  72. package/dist/editor/assets/restructuredtext-BYgofb2h.js +1 -0
  73. package/dist/editor/assets/ruby-DezsRK8O.js +1 -0
  74. package/dist/editor/assets/rust-DdL9SqIa.js +1 -0
  75. package/dist/editor/assets/sb-CcwsVR0C.js +1 -0
  76. package/dist/editor/assets/scala-DHpiXF5c.js +1 -0
  77. package/dist/editor/assets/scheme-BeGwcela.js +1 -0
  78. package/dist/editor/assets/scss-gp-XZpBa.js +3 -0
  79. package/dist/editor/assets/shell-CC2rA5mh.js +1 -0
  80. package/dist/editor/assets/solidity-BEEn4gHE.js +1 -0
  81. package/dist/editor/assets/sophia-CRfGWb83.js +1 -0
  82. package/dist/editor/assets/sparql-D_Lu-MrJ.js +1 -0
  83. package/dist/editor/assets/sql-NEE52Syq.js +1 -0
  84. package/dist/editor/assets/st-DbInun42.js +1 -0
  85. package/dist/editor/assets/swift-Bxkupp3x.js +1 -0
  86. package/dist/editor/assets/systemverilog-Bz4Y3fRF.js +1 -0
  87. package/dist/editor/assets/tcl-DISqw1ZD.js +1 -0
  88. package/dist/editor/assets/ts.worker-0mEyHVru.js +51339 -0
  89. package/dist/editor/assets/tsMode-Bth1rJwM.js +11 -0
  90. package/dist/editor/assets/twig-De2hgUGE.js +1 -0
  91. package/dist/editor/assets/typescript-tNRuHsoe.js +1 -0
  92. package/dist/editor/assets/typespec-B8J7ngcE.js +1 -0
  93. package/dist/editor/assets/vb-DV3o63ZY.js +1 -0
  94. package/dist/editor/assets/wgsl-DpFanUEy.js +298 -0
  95. package/dist/editor/assets/xml-BCx9e6CK.js +1 -0
  96. package/dist/editor/assets/yaml-Bb-peGP_.js +1 -0
  97. package/dist/editor/index.html +14 -0
  98. package/dist/mcp/archetypes.js +103 -0
  99. package/dist/mcp/cli.js +6 -0
  100. package/dist/mcp/create-project.js +151 -0
  101. package/dist/mcp/introspection.js +201 -0
  102. package/dist/mcp/node_modules/@waica/archetype-platformer/assets/waica-coin.png +0 -0
  103. package/dist/mcp/node_modules/@waica/archetype-platformer/assets/waica-dog.png +0 -0
  104. package/dist/mcp/node_modules/@waica/archetype-platformer/assets/waica-slime.png +0 -0
  105. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/art.d.ts +10 -0
  106. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/art.js +13 -0
  107. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/bundle.d.ts +3 -0
  108. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/bundle.js +10 -0
  109. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/controls.d.ts +5 -0
  110. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/controls.js +12 -0
  111. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/index.d.ts +38 -0
  112. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/index.js +34 -0
  113. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/manifest.d.ts +15 -0
  114. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/manifest.js +26 -0
  115. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/prefabs.d.ts +7 -0
  116. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/prefabs.js +97 -0
  117. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/registry-data.d.ts +5 -0
  118. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/registry-data.js +45 -0
  119. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/registry.d.ts +6 -0
  120. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/registry.js +15 -0
  121. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/scene-default.d.ts +40 -0
  122. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/scene-default.js +93 -0
  123. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/ui.d.ts +10 -0
  124. package/dist/mcp/node_modules/@waica/archetype-platformer/dist/ui.js +24 -0
  125. package/dist/mcp/node_modules/@waica/archetype-platformer/package.json +30 -0
  126. package/dist/mcp/node_modules/@waica/behaviors/dist/chaser.d.ts +59 -0
  127. package/dist/mcp/node_modules/@waica/behaviors/dist/chaser.js +127 -0
  128. package/dist/mcp/node_modules/@waica/behaviors/dist/collectible.d.ts +25 -0
  129. package/dist/mcp/node_modules/@waica/behaviors/dist/collectible.js +27 -0
  130. package/dist/mcp/node_modules/@waica/behaviors/dist/hazard.d.ts +29 -0
  131. package/dist/mcp/node_modules/@waica/behaviors/dist/hazard.js +42 -0
  132. package/dist/mcp/node_modules/@waica/behaviors/dist/index.d.ts +9 -0
  133. package/dist/mcp/node_modules/@waica/behaviors/dist/index.js +9 -0
  134. package/dist/mcp/node_modules/@waica/behaviors/dist/lifetime.d.ts +16 -0
  135. package/dist/mcp/node_modules/@waica/behaviors/dist/lifetime.js +19 -0
  136. package/dist/mcp/node_modules/@waica/behaviors/dist/npc.d.ts +4 -0
  137. package/dist/mcp/node_modules/@waica/behaviors/dist/npc.js +14 -0
  138. package/dist/mcp/node_modules/@waica/behaviors/dist/patrol.d.ts +43 -0
  139. package/dist/mcp/node_modules/@waica/behaviors/dist/patrol.js +68 -0
  140. package/dist/mcp/node_modules/@waica/behaviors/dist/platformer-motor.d.ts +124 -0
  141. package/dist/mcp/node_modules/@waica/behaviors/dist/platformer-motor.js +146 -0
  142. package/dist/mcp/node_modules/@waica/behaviors/dist/player-identity.d.ts +3 -0
  143. package/dist/mcp/node_modules/@waica/behaviors/dist/player-identity.js +5 -0
  144. package/dist/mcp/node_modules/@waica/behaviors/dist/player-states.d.ts +18 -0
  145. package/dist/mcp/node_modules/@waica/behaviors/dist/player-states.js +95 -0
  146. package/dist/mcp/node_modules/@waica/behaviors/dist/respawnable.d.ts +23 -0
  147. package/dist/mcp/node_modules/@waica/behaviors/dist/respawnable.js +27 -0
  148. package/dist/mcp/node_modules/@waica/behaviors/package.json +24 -0
  149. package/dist/mcp/node_modules/@waica/engine/dist/aabb.d.ts +2 -0
  150. package/dist/mcp/node_modules/@waica/engine/dist/aabb.js +4 -0
  151. package/dist/mcp/node_modules/@waica/engine/dist/animation/clip-player.d.ts +20 -0
  152. package/dist/mcp/node_modules/@waica/engine/dist/animation/clip-player.js +24 -0
  153. package/dist/mcp/node_modules/@waica/engine/dist/animation/contract.d.ts +21 -0
  154. package/dist/mcp/node_modules/@waica/engine/dist/animation/contract.js +23 -0
  155. package/dist/mcp/node_modules/@waica/engine/dist/animation/sheet.d.ts +65 -0
  156. package/dist/mcp/node_modules/@waica/engine/dist/animation/sheet.js +44 -0
  157. package/dist/mcp/node_modules/@waica/engine/dist/archetype.d.ts +37 -0
  158. package/dist/mcp/node_modules/@waica/engine/dist/archetype.js +1 -0
  159. package/dist/mcp/node_modules/@waica/engine/dist/camera.d.ts +71 -0
  160. package/dist/mcp/node_modules/@waica/engine/dist/camera.js +59 -0
  161. package/dist/mcp/node_modules/@waica/engine/dist/collision-shape.d.ts +26 -0
  162. package/dist/mcp/node_modules/@waica/engine/dist/collision-shape.js +136 -0
  163. package/dist/mcp/node_modules/@waica/engine/dist/component-registry.d.ts +16 -0
  164. package/dist/mcp/node_modules/@waica/engine/dist/component-registry.js +44 -0
  165. package/dist/mcp/node_modules/@waica/engine/dist/component.d.ts +58 -0
  166. package/dist/mcp/node_modules/@waica/engine/dist/component.js +11 -0
  167. package/dist/mcp/node_modules/@waica/engine/dist/components/animated-sprite.d.ts +80 -0
  168. package/dist/mcp/node_modules/@waica/engine/dist/components/animated-sprite.js +210 -0
  169. package/dist/mcp/node_modules/@waica/engine/dist/components/dynamic-body.d.ts +68 -0
  170. package/dist/mcp/node_modules/@waica/engine/dist/components/dynamic-body.js +189 -0
  171. package/dist/mcp/node_modules/@waica/engine/dist/components/hitbox.d.ts +25 -0
  172. package/dist/mcp/node_modules/@waica/engine/dist/components/hitbox.js +21 -0
  173. package/dist/mcp/node_modules/@waica/engine/dist/components/solid.d.ts +32 -0
  174. package/dist/mcp/node_modules/@waica/engine/dist/components/solid.js +45 -0
  175. package/dist/mcp/node_modules/@waica/engine/dist/components/sprite.d.ts +51 -0
  176. package/dist/mcp/node_modules/@waica/engine/dist/components/sprite.js +112 -0
  177. package/dist/mcp/node_modules/@waica/engine/dist/entity.d.ts +22 -0
  178. package/dist/mcp/node_modules/@waica/engine/dist/entity.js +52 -0
  179. package/dist/mcp/node_modules/@waica/engine/dist/events.d.ts +8 -0
  180. package/dist/mcp/node_modules/@waica/engine/dist/events.js +20 -0
  181. package/dist/mcp/node_modules/@waica/engine/dist/game.d.ts +95 -0
  182. package/dist/mcp/node_modules/@waica/engine/dist/game.js +263 -0
  183. package/dist/mcp/node_modules/@waica/engine/dist/index.d.ts +39 -0
  184. package/dist/mcp/node_modules/@waica/engine/dist/index.js +26 -0
  185. package/dist/mcp/node_modules/@waica/engine/dist/input.d.ts +40 -0
  186. package/dist/mcp/node_modules/@waica/engine/dist/input.js +84 -0
  187. package/dist/mcp/node_modules/@waica/engine/dist/scene.d.ts +80 -0
  188. package/dist/mcp/node_modules/@waica/engine/dist/scene.js +93 -0
  189. package/dist/mcp/node_modules/@waica/engine/dist/solid-axis.d.ts +21 -0
  190. package/dist/mcp/node_modules/@waica/engine/dist/solid-axis.js +77 -0
  191. package/dist/mcp/node_modules/@waica/engine/dist/state/hooks.d.ts +90 -0
  192. package/dist/mcp/node_modules/@waica/engine/dist/state/hooks.js +81 -0
  193. package/dist/mcp/node_modules/@waica/engine/dist/state/state-machine.d.ts +83 -0
  194. package/dist/mcp/node_modules/@waica/engine/dist/state/state-machine.js +173 -0
  195. package/dist/mcp/node_modules/@waica/engine/dist/stats.d.ts +27 -0
  196. package/dist/mcp/node_modules/@waica/engine/dist/stats.js +54 -0
  197. package/dist/mcp/node_modules/@waica/engine/dist/ui.d.ts +47 -0
  198. package/dist/mcp/node_modules/@waica/engine/dist/ui.js +175 -0
  199. package/dist/mcp/node_modules/@waica/engine/package.json +25 -0
  200. package/dist/mcp/package-resolver.js +240 -0
  201. package/dist/mcp/project-path.js +86 -0
  202. package/dist/mcp/scaffolds.js +153 -0
  203. package/dist/mcp/server.js +217 -0
  204. package/dist/mcp/stdio.js +13 -0
  205. package/dist/mcp/template/README.md +22 -0
  206. package/dist/mcp/template/_gitignore +5 -0
  207. package/dist/mcp/template/index.html +25 -0
  208. package/dist/mcp/template/package.json.tpl +20 -0
  209. package/dist/mcp/template/public/waica.params.json +1 -0
  210. package/dist/mcp/template/src/art/waica-coin.png +0 -0
  211. package/dist/mcp/template/src/art/waica-dog.png +0 -0
  212. package/dist/mcp/template/src/art/waica-slime.png +0 -0
  213. package/dist/mcp/template/src/characters/player.character.json +133 -0
  214. package/dist/mcp/template/src/characters/slime.character.json +61 -0
  215. package/dist/mcp/template/src/controls.json +8 -0
  216. package/dist/mcp/template/src/game.json +10 -0
  217. package/dist/mcp/template/src/main.ts +105 -0
  218. package/dist/mcp/template/src/objects/coin.object.json +41 -0
  219. package/dist/mcp/template/src/scenes/main.scene.json +217 -0
  220. package/dist/mcp/template/src/stats.json +7 -0
  221. package/dist/mcp/template/src/tiles/block.tile.json +21 -0
  222. package/dist/mcp/template/src/tiles/decor.tile.json +14 -0
  223. package/dist/mcp/template/src/tiles/platform.tile.json +21 -0
  224. package/dist/mcp/template/src/ui/coin-counter.html +12 -0
  225. package/dist/mcp/template/tsconfig.json +15 -0
  226. package/dist/mcp/template/vite.config.ts +3 -0
  227. package/dist/mcp/validation.js +323 -0
  228. package/dist/mcp/workspace-loader.js +14 -0
  229. package/dist/mcp/workspace-runtime.js +109 -0
  230. package/dist/server.js +210 -0
  231. package/package.json +38 -0
@@ -0,0 +1,13 @@
1
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
+ import { prepareWorkspaceRuntime } from './workspace-runtime.js';
3
+ /**
4
+ * Connects the MCP server to stdio. Kept separate from the bin wrapper so the
5
+ * waica CLI can start the same server in-process from its bundled copy without
6
+ * importing a module that runs on load.
7
+ */
8
+ export async function startStdioServer() {
9
+ await prepareWorkspaceRuntime();
10
+ const { createWaicaMcpServer } = await import('./server.js');
11
+ const server = createWaicaMcpServer();
12
+ await server.connect(new StdioServerTransport());
13
+ }
@@ -0,0 +1,22 @@
1
+ # My game 🐕
2
+
3
+ Made with [Waica](https://github.com/chichex/waica), the archetype-driven web game engine.
4
+
5
+ ## Run
6
+
7
+ ```bash
8
+ npm install
9
+ npm run dev
10
+ ```
11
+
12
+ - **← →** move · **space** jump
13
+ - Parameter overrides live in `public/waica.params.json` — tweak them there to beat the component defaults.
14
+ - Your character is the placeholder dog: replace it in `src/main.ts` keeping the contract clips (`idle`, `run`, `jump`, `fall`).
15
+
16
+ ## Export for the web
17
+
18
+ ```bash
19
+ npm run build
20
+ ```
21
+
22
+ The `dist/` folder is ready to upload to itch.io or any static hosting.
@@ -0,0 +1,5 @@
1
+ node_modules/
2
+ dist/
3
+ .vite/
4
+ *.local
5
+ .DS_Store
@@ -0,0 +1,25 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🐕</text></svg>" />
7
+ <title>My game — made with Waica</title>
8
+ <style>
9
+ html,
10
+ body {
11
+ margin: 0;
12
+ height: 100%;
13
+ }
14
+ #game {
15
+ width: 100%;
16
+ height: 100%;
17
+ display: block;
18
+ }
19
+ </style>
20
+ </head>
21
+ <body>
22
+ <canvas id="game"></canvas>
23
+ <script type="module" src="/src/main.ts"></script>
24
+ </body>
25
+ </html>
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "__PROJECT_NAME__",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@waica/archetype-platformer": "^__WAICA_VERSION__",
13
+ "@waica/behaviors": "^__WAICA_VERSION__",
14
+ "@waica/engine": "^__WAICA_VERSION__"
15
+ },
16
+ "devDependencies": {
17
+ "typescript": "^7.0.0",
18
+ "vite": "^8.0.0"
19
+ }
20
+ }
@@ -0,0 +1,133 @@
1
+ {
2
+ "waicaPrefab": 1,
3
+ "type": "character",
4
+ "components": [
5
+ {
6
+ "type": "AnimatedSprite",
7
+ "props": {
8
+ "texture": "src/art/waica-dog.png",
9
+ "cols": 4,
10
+ "rows": 4,
11
+ "width": 1.4,
12
+ "height": 1.4,
13
+ "clips": {
14
+ "idle": {
15
+ "frames": [
16
+ 0,
17
+ 1,
18
+ 2,
19
+ 3
20
+ ],
21
+ "fps": 5
22
+ },
23
+ "run": {
24
+ "frames": [
25
+ 4,
26
+ 5,
27
+ 6,
28
+ 7
29
+ ],
30
+ "fps": 10
31
+ },
32
+ "jump": {
33
+ "frames": [
34
+ 8,
35
+ 9
36
+ ],
37
+ "fps": 8,
38
+ "loop": false
39
+ },
40
+ "fall": {
41
+ "frames": [
42
+ 12,
43
+ 13
44
+ ],
45
+ "fps": 8
46
+ }
47
+ },
48
+ "initialClip": "idle"
49
+ }
50
+ },
51
+ {
52
+ "type": "PlatformerMotor"
53
+ },
54
+ {
55
+ "type": "StateMachine",
56
+ "props": {
57
+ "role": "player",
58
+ "initial": "idle",
59
+ "states": {
60
+ "idle": {
61
+ "transitions": [
62
+ {
63
+ "on": "signal:move",
64
+ "to": "run"
65
+ },
66
+ {
67
+ "on": "signal:rise",
68
+ "to": "jump"
69
+ },
70
+ {
71
+ "on": "signal:fall",
72
+ "to": "fall"
73
+ }
74
+ ]
75
+ },
76
+ "run": {
77
+ "transitions": [
78
+ {
79
+ "on": "signal:stop",
80
+ "to": "idle"
81
+ },
82
+ {
83
+ "on": "signal:rise",
84
+ "to": "jump"
85
+ },
86
+ {
87
+ "on": "signal:fall",
88
+ "to": "fall"
89
+ }
90
+ ]
91
+ },
92
+ "jump": {
93
+ "transitions": [
94
+ {
95
+ "on": "signal:fall",
96
+ "to": "fall"
97
+ },
98
+ {
99
+ "on": "signal:land",
100
+ "to": "idle"
101
+ }
102
+ ]
103
+ },
104
+ "fall": {
105
+ "transitions": [
106
+ {
107
+ "on": "signal:rise",
108
+ "to": "jump"
109
+ },
110
+ {
111
+ "on": "signal:land",
112
+ "to": "idle"
113
+ }
114
+ ]
115
+ }
116
+ }
117
+ }
118
+ },
119
+ {
120
+ "type": "Hitbox",
121
+ "props": {
122
+ "width": 0.9,
123
+ "height": 0.95
124
+ }
125
+ },
126
+ {
127
+ "type": "Respawnable",
128
+ "props": {
129
+ "killY": -12
130
+ }
131
+ }
132
+ ]
133
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "waicaPrefab": 1,
3
+ "type": "character",
4
+ "components": [
5
+ {
6
+ "type": "AnimatedSprite",
7
+ "props": {
8
+ "texture": "src/art/waica-slime.png",
9
+ "cols": 4,
10
+ "rows": 1,
11
+ "width": 1.1,
12
+ "height": 1.1,
13
+ "clips": {
14
+ "idle": {
15
+ "frames": [
16
+ 0,
17
+ 1,
18
+ 2,
19
+ 3
20
+ ],
21
+ "fps": 6
22
+ }
23
+ },
24
+ "initialClip": "idle"
25
+ }
26
+ },
27
+ {
28
+ "type": "Patrol",
29
+ "props": {
30
+ "distance": 2,
31
+ "speed": 2
32
+ }
33
+ },
34
+ {
35
+ "type": "StateMachine",
36
+ "props": {
37
+ "role": "patroller",
38
+ "initial": "walk",
39
+ "states": {
40
+ "walk": {
41
+ "clip": "idle"
42
+ }
43
+ }
44
+ }
45
+ },
46
+ {
47
+ "type": "Hitbox",
48
+ "props": {
49
+ "width": 0.9,
50
+ "height": 0.6
51
+ }
52
+ },
53
+ {
54
+ "type": "Hazard",
55
+ "props": {
56
+ "stompable": true,
57
+ "bounce": 10
58
+ }
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "waicaControls": 1,
3
+ "bindings": {
4
+ "left": ["ArrowLeft", "KeyA"],
5
+ "right": ["ArrowRight", "KeyD"],
6
+ "jump": ["Space", "ArrowUp", "KeyW"]
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "waicaGame": 1,
3
+ "archetype": "platformer",
4
+ "resolution": {
5
+ "mode": "fill",
6
+ "width": 640,
7
+ "height": 360
8
+ },
9
+ "pixelsPerUnit": 16
10
+ }
@@ -0,0 +1,105 @@
1
+ import {
2
+ collectModuleComponents,
3
+ Game,
4
+ installArchetype,
5
+ loadScene,
6
+ mergeRegistryComponents,
7
+ type PrefabJson,
8
+ } from '@waica/engine'
9
+ import { PLATFORMER_BUNDLE, PLATFORMER_REGISTRY } from '@waica/archetype-platformer'
10
+ import scene from './scenes/main.scene.json'
11
+ import controls from './controls.json'
12
+ import stats from './stats.json'
13
+ import settings from './game.json'
14
+
15
+ // Your components, roles and state code extend the installed archetype
16
+ // baseline when main() imports them.
17
+ const projectCode = import.meta.glob(['./components/*.ts', './roles/*.ts', './states/*.ts'])
18
+
19
+ // Your prefabs ARE these files (saved by the editor, or hand-edited — they're
20
+ // just JSON). Nothing else: delete one and the game stops knowing about it.
21
+ const prefabFiles = import.meta.glob<PrefabJson>(
22
+ ['./characters/*.character.json', './objects/*.object.json', './tiles/*.tile.json'],
23
+ { eager: true, import: 'default' },
24
+ )
25
+ const prefabs: Record<string, PrefabJson> = {}
26
+ for (const [path, prefab] of Object.entries(prefabFiles)) {
27
+ // './characters/slime.character.json' -> 'characters/slime'
28
+ prefabs[path.slice(2, path.indexOf('.', 2))] = prefab
29
+ }
30
+
31
+ // UI pieces are plain HTML (src/ui/*.html): presentation only — markup,
32
+ // styles and {{stat}} bindings. Code toggles them via game.ui.
33
+ const uiFiles = import.meta.glob<string>('./ui/*.html', {
34
+ eager: true,
35
+ query: '?raw',
36
+ import: 'default',
37
+ })
38
+ const ui: Record<string, string> = {}
39
+ for (const [path, html] of Object.entries(uiFiles)) {
40
+ // './ui/coin-counter.html' -> 'coin-counter'
41
+ ui[path.slice('./ui/'.length, -'.html'.length)] = html
42
+ }
43
+
44
+ // Your art (src/art/*): texture props store the project path
45
+ // ('src/art/hero.png'); this map turns each into a served, build-safe URL.
46
+ const artFiles = import.meta.glob<string>('./art/*', {
47
+ eager: true,
48
+ query: '?url',
49
+ import: 'default',
50
+ })
51
+ const artUrls: Record<string, string> = {}
52
+ for (const [path, url] of Object.entries(artFiles)) {
53
+ // './art/hero.png' -> 'src/art/hero.png'
54
+ artUrls[`src/${path.slice(2)}`] = url
55
+ }
56
+
57
+ const registryBase = {
58
+ ...PLATFORMER_REGISTRY,
59
+ // Keep these two: the spread above carries the archetype's own catalogs,
60
+ // and these replace them with yours. Drop one and the game starts
61
+ // resolving pieces that are nowhere in src/.
62
+ prefabs,
63
+ ui,
64
+ resolveAsset: (uri: string) =>
65
+ artUrls[uri] ?? PLATFORMER_REGISTRY.resolveAsset?.(uri) ?? uri,
66
+ }
67
+
68
+ const canvas = document.querySelector<HTMLCanvasElement>('#game')
69
+ if (!canvas) throw new Error('missing <canvas id="game">')
70
+
71
+ // One game per page (guards against module re-runs).
72
+ if (canvas.dataset.waica) {
73
+ location.reload()
74
+ } else {
75
+ canvas.dataset.waica = 'mounted'
76
+ void main(canvas)
77
+ }
78
+
79
+ async function main(canvas: HTMLCanvasElement): Promise<void> {
80
+ installArchetype(PLATFORMER_BUNDLE)
81
+ const projectModules = await Promise.all(Object.values(projectCode).map((load) => load()))
82
+ const registry = mergeRegistryComponents(
83
+ registryBase,
84
+ collectModuleComponents(projectModules as Array<Record<string, unknown>>),
85
+ )
86
+
87
+ // Controls, stats and game settings come from src/*.json (the editor's
88
+ // Project views). The camera (start framing, zoom, follow) lives in the scene.
89
+ const game = new Game({
90
+ canvas,
91
+ background: 0x1a1a2e,
92
+ resolution: settings.resolution.mode === 'fixed' ? settings.resolution : undefined,
93
+ bindings: controls.bindings,
94
+ stats: stats.stats,
95
+ })
96
+
97
+ // Persisted parameter overrides (public/waica.params.json) beat the defaults.
98
+ await game.loadParams('/waica.params.json')
99
+
100
+ // Your scene: edit it with the Waica editor or by hand — it's just JSON.
101
+ // Its "ui" list mounts the UI pieces it starts with (the coin counter).
102
+ loadScene(game, scene as never, registry)
103
+
104
+ game.start()
105
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "waicaPrefab": 1,
3
+ "type": "object",
4
+ "components": [
5
+ {
6
+ "type": "AnimatedSprite",
7
+ "props": {
8
+ "texture": "src/art/waica-coin.png",
9
+ "cols": 4,
10
+ "rows": 1,
11
+ "width": 0.6,
12
+ "height": 0.6,
13
+ "clips": {
14
+ "spin": {
15
+ "frames": [
16
+ 0,
17
+ 1,
18
+ 2,
19
+ 3
20
+ ],
21
+ "fps": 8
22
+ }
23
+ },
24
+ "initialClip": "spin"
25
+ }
26
+ },
27
+ {
28
+ "type": "Hitbox",
29
+ "props": {
30
+ "width": 0.5,
31
+ "height": 0.5
32
+ }
33
+ },
34
+ {
35
+ "type": "Collectible",
36
+ "props": {
37
+ "value": 1
38
+ }
39
+ }
40
+ ]
41
+ }
@@ -0,0 +1,217 @@
1
+ {
2
+ "waicaScene": 3,
3
+ "camera": {
4
+ "position": [
5
+ 0,
6
+ -1
7
+ ],
8
+ "zoom": 12,
9
+ "follow": "Player"
10
+ },
11
+ "entities": [
12
+ {
13
+ "name": "Player",
14
+ "prefab": "characters/player",
15
+ "position": [
16
+ 0,
17
+ -1
18
+ ]
19
+ },
20
+ {
21
+ "name": "Ground-A",
22
+ "prefab": "tiles/platform",
23
+ "position": [
24
+ -6,
25
+ -5
26
+ ],
27
+ "overrides": {
28
+ "Sprite": {
29
+ "width": 16,
30
+ "height": 2
31
+ },
32
+ "Solid": {
33
+ "width": 16,
34
+ "height": 2
35
+ }
36
+ }
37
+ },
38
+ {
39
+ "name": "Ground-B",
40
+ "prefab": "tiles/platform",
41
+ "position": [
42
+ 16,
43
+ -5
44
+ ],
45
+ "overrides": {
46
+ "Sprite": {
47
+ "width": 16,
48
+ "height": 2
49
+ },
50
+ "Solid": {
51
+ "width": 16,
52
+ "height": 2
53
+ }
54
+ }
55
+ },
56
+ {
57
+ "name": "Platform-1",
58
+ "prefab": "tiles/platform",
59
+ "position": [
60
+ 5,
61
+ -2.5
62
+ ],
63
+ "overrides": {
64
+ "Sprite": {
65
+ "width": 4
66
+ },
67
+ "Solid": {
68
+ "width": 4
69
+ }
70
+ }
71
+ },
72
+ {
73
+ "name": "Platform-2",
74
+ "prefab": "tiles/platform",
75
+ "position": [
76
+ 9.5,
77
+ -0.5
78
+ ]
79
+ },
80
+ {
81
+ "name": "Platform-3",
82
+ "prefab": "tiles/platform",
83
+ "position": [
84
+ -5.5,
85
+ -1.5
86
+ ]
87
+ },
88
+ {
89
+ "name": "Platform-4",
90
+ "prefab": "tiles/block",
91
+ "position": [
92
+ 14,
93
+ 1.5
94
+ ],
95
+ "overrides": {
96
+ "Sprite": {
97
+ "width": 3,
98
+ "height": 0.5
99
+ },
100
+ "Solid": {
101
+ "width": 3,
102
+ "height": 0.5
103
+ }
104
+ }
105
+ },
106
+ {
107
+ "name": "Wall-Left",
108
+ "prefab": "tiles/block",
109
+ "position": [
110
+ -15.5,
111
+ 0
112
+ ],
113
+ "overrides": {
114
+ "Sprite": {
115
+ "height": 12
116
+ },
117
+ "Solid": {
118
+ "height": 12
119
+ }
120
+ }
121
+ },
122
+ {
123
+ "name": "Wall-Right",
124
+ "prefab": "tiles/block",
125
+ "position": [
126
+ 25.5,
127
+ 0
128
+ ],
129
+ "overrides": {
130
+ "Sprite": {
131
+ "height": 12
132
+ },
133
+ "Solid": {
134
+ "height": 12
135
+ }
136
+ }
137
+ },
138
+ {
139
+ "name": "Coin-1",
140
+ "prefab": "objects/coin",
141
+ "position": [
142
+ -5.5,
143
+ -0.5
144
+ ]
145
+ },
146
+ {
147
+ "name": "Coin-2",
148
+ "prefab": "objects/coin",
149
+ "position": [
150
+ -2,
151
+ -3.2
152
+ ]
153
+ },
154
+ {
155
+ "name": "Coin-3",
156
+ "prefab": "objects/coin",
157
+ "position": [
158
+ 5,
159
+ -1.7
160
+ ]
161
+ },
162
+ {
163
+ "name": "Coin-4",
164
+ "prefab": "objects/coin",
165
+ "position": [
166
+ 9.5,
167
+ 0.3
168
+ ]
169
+ },
170
+ {
171
+ "name": "Coin-5",
172
+ "prefab": "objects/coin",
173
+ "position": [
174
+ 14,
175
+ 2.3
176
+ ]
177
+ },
178
+ {
179
+ "name": "Coin-6",
180
+ "prefab": "objects/coin",
181
+ "position": [
182
+ 19,
183
+ -3.2
184
+ ]
185
+ },
186
+ {
187
+ "name": "Slime-1",
188
+ "prefab": "characters/slime",
189
+ "position": [
190
+ -9,
191
+ -3.55
192
+ ],
193
+ "overrides": {
194
+ "Patrol": {
195
+ "speed": 1.5
196
+ }
197
+ }
198
+ },
199
+ {
200
+ "name": "Slime-2",
201
+ "prefab": "characters/slime",
202
+ "position": [
203
+ 17,
204
+ -3.55
205
+ ],
206
+ "overrides": {
207
+ "Patrol": {
208
+ "distance": 2.5,
209
+ "speed": 2.5
210
+ }
211
+ }
212
+ }
213
+ ],
214
+ "ui": [
215
+ "coin-counter"
216
+ ]
217
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "waicaStats": 1,
3
+ "stats": {
4
+ "points": 0,
5
+ "lives": 3
6
+ }
7
+ }