@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.
- package/LICENSE +21 -0
- package/README.md +64 -0
- package/dist/cli.js +184 -0
- package/dist/editor/assets/abap-08VXUWAP.js +1 -0
- package/dist/editor/assets/apex-BWPQTe0t.js +1 -0
- package/dist/editor/assets/azcli-Bc_sGQ0U.js +1 -0
- package/dist/editor/assets/bat-i0X4ZdIN.js +1 -0
- package/dist/editor/assets/bicep-B5-_aFwp.js +2 -0
- package/dist/editor/assets/cameligo-DMUM7wLl.js +1 -0
- package/dist/editor/assets/clojure-Cm7r79vr.js +1 -0
- package/dist/editor/assets/codicon-DCmgc-ay.ttf +0 -0
- package/dist/editor/assets/coffee-Ba7i2nA0.js +1 -0
- package/dist/editor/assets/cpp-C7h46wYY.js +1 -0
- package/dist/editor/assets/csharp-BKxtCVv1.js +1 -0
- package/dist/editor/assets/csp-bTuwJoIa.js +1 -0
- package/dist/editor/assets/css-DIMkf-bt.js +3 -0
- package/dist/editor/assets/css.worker-Fwwr_HdT.js +88 -0
- package/dist/editor/assets/cssMode-CQE-WdwL.js +4 -0
- package/dist/editor/assets/cypher-CVaqCwHa.js +1 -0
- package/dist/editor/assets/dart-onAF5SnQ.js +1 -0
- package/dist/editor/assets/dockerfile-DZFCIeNp.js +1 -0
- package/dist/editor/assets/ecl-D05T4iGw.js +1 -0
- package/dist/editor/assets/editor.worker-DsBDrWS5.js +12 -0
- package/dist/editor/assets/elixir-6RTg0lbw.js +1 -0
- package/dist/editor/assets/flow9-C5_-GSwl.js +1 -0
- package/dist/editor/assets/freemarker2-CYgdVabn.js +3 -0
- package/dist/editor/assets/fsharp-C8Ef5oNN.js +1 -0
- package/dist/editor/assets/go-C-y9NEjX.js +1 -0
- package/dist/editor/assets/graphql-fmXr3nnJ.js +1 -0
- package/dist/editor/assets/handlebars-DdeORCJD.js +1 -0
- package/dist/editor/assets/hcl-CpzslTdj.js +1 -0
- package/dist/editor/assets/html-DTIAGV84.js +1 -0
- package/dist/editor/assets/html.worker-B3Ztmmz2.js +495 -0
- package/dist/editor/assets/htmlMode-CRV3iBih.js +4 -0
- package/dist/editor/assets/index-Btzc6zxr.css +1 -0
- package/dist/editor/assets/index-Dhkqk31v.js +11016 -0
- package/dist/editor/assets/ini-sBoK_t0W.js +1 -0
- package/dist/editor/assets/java-BEtHBSE6.js +1 -0
- package/dist/editor/assets/javascript-dxBW86cl.js +1 -0
- package/dist/editor/assets/json.worker-PWQxM7ZO.js +51 -0
- package/dist/editor/assets/jsonMode-DFA5-FFK.js +10 -0
- package/dist/editor/assets/julia-Bri6UV-V.js +1 -0
- package/dist/editor/assets/kotlin-B0qVs-E9.js +1 -0
- package/dist/editor/assets/less-B9JPFI3C.js +2 -0
- package/dist/editor/assets/lexon-CfSJPG6W.js +1 -0
- package/dist/editor/assets/liquid-CScWaXYV.js +1 -0
- package/dist/editor/assets/lua-CsQS60Ue.js +1 -0
- package/dist/editor/assets/m3-D-oSqn_W.js +1 -0
- package/dist/editor/assets/markdown-Cimd5fb3.js +1 -0
- package/dist/editor/assets/mdx-Bvp84SqA.js +1 -0
- package/dist/editor/assets/mips-CIPQ_RoX.js +1 -0
- package/dist/editor/assets/msdax-DauUninz.js +1 -0
- package/dist/editor/assets/mysql-SOo6toE5.js +1 -0
- package/dist/editor/assets/objective-c-FvmIjYaQ.js +1 -0
- package/dist/editor/assets/pascal-DrH0SRf2.js +1 -0
- package/dist/editor/assets/pascaligo-D-ptJ9y-.js +1 -0
- package/dist/editor/assets/perl-oz_6vUea.js +1 -0
- package/dist/editor/assets/pgsql-DTj74zXo.js +1 -0
- package/dist/editor/assets/php-nr791fC2.js +1 -0
- package/dist/editor/assets/pla-CopQ2nXW.js +1 -0
- package/dist/editor/assets/postiats-43DmfD33.js +1 -0
- package/dist/editor/assets/powerquery-D3hlyOfw.js +1 -0
- package/dist/editor/assets/powershell-DmHpPYUd.js +1 -0
- package/dist/editor/assets/protobuf-C531GsRP.js +2 -0
- package/dist/editor/assets/pug-Z5eAx3Zn.js +1 -0
- package/dist/editor/assets/python-CG-OtvFa.js +1 -0
- package/dist/editor/assets/qsharp-DkqhCAOL.js +1 -0
- package/dist/editor/assets/r-BwWrilGY.js +1 -0
- package/dist/editor/assets/razor-r-iUEZPj.js +1 -0
- package/dist/editor/assets/redis-ClamHrr6.js +1 -0
- package/dist/editor/assets/redshift-DT7zqm-g.js +1 -0
- package/dist/editor/assets/restructuredtext-BYgofb2h.js +1 -0
- package/dist/editor/assets/ruby-DezsRK8O.js +1 -0
- package/dist/editor/assets/rust-DdL9SqIa.js +1 -0
- package/dist/editor/assets/sb-CcwsVR0C.js +1 -0
- package/dist/editor/assets/scala-DHpiXF5c.js +1 -0
- package/dist/editor/assets/scheme-BeGwcela.js +1 -0
- package/dist/editor/assets/scss-gp-XZpBa.js +3 -0
- package/dist/editor/assets/shell-CC2rA5mh.js +1 -0
- package/dist/editor/assets/solidity-BEEn4gHE.js +1 -0
- package/dist/editor/assets/sophia-CRfGWb83.js +1 -0
- package/dist/editor/assets/sparql-D_Lu-MrJ.js +1 -0
- package/dist/editor/assets/sql-NEE52Syq.js +1 -0
- package/dist/editor/assets/st-DbInun42.js +1 -0
- package/dist/editor/assets/swift-Bxkupp3x.js +1 -0
- package/dist/editor/assets/systemverilog-Bz4Y3fRF.js +1 -0
- package/dist/editor/assets/tcl-DISqw1ZD.js +1 -0
- package/dist/editor/assets/ts.worker-0mEyHVru.js +51339 -0
- package/dist/editor/assets/tsMode-Bth1rJwM.js +11 -0
- package/dist/editor/assets/twig-De2hgUGE.js +1 -0
- package/dist/editor/assets/typescript-tNRuHsoe.js +1 -0
- package/dist/editor/assets/typespec-B8J7ngcE.js +1 -0
- package/dist/editor/assets/vb-DV3o63ZY.js +1 -0
- package/dist/editor/assets/wgsl-DpFanUEy.js +298 -0
- package/dist/editor/assets/xml-BCx9e6CK.js +1 -0
- package/dist/editor/assets/yaml-Bb-peGP_.js +1 -0
- package/dist/editor/index.html +14 -0
- package/dist/mcp/archetypes.js +103 -0
- package/dist/mcp/cli.js +6 -0
- package/dist/mcp/create-project.js +151 -0
- package/dist/mcp/introspection.js +201 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/assets/waica-coin.png +0 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/assets/waica-dog.png +0 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/assets/waica-slime.png +0 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/art.d.ts +10 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/art.js +13 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/bundle.d.ts +3 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/bundle.js +10 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/controls.d.ts +5 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/controls.js +12 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/index.d.ts +38 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/index.js +34 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/manifest.d.ts +15 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/manifest.js +26 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/prefabs.d.ts +7 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/prefabs.js +97 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/registry-data.d.ts +5 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/registry-data.js +45 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/registry.d.ts +6 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/registry.js +15 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/scene-default.d.ts +40 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/scene-default.js +93 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/ui.d.ts +10 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/dist/ui.js +24 -0
- package/dist/mcp/node_modules/@waica/archetype-platformer/package.json +30 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/chaser.d.ts +59 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/chaser.js +127 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/collectible.d.ts +25 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/collectible.js +27 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/hazard.d.ts +29 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/hazard.js +42 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/index.d.ts +9 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/index.js +9 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/lifetime.d.ts +16 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/lifetime.js +19 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/npc.d.ts +4 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/npc.js +14 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/patrol.d.ts +43 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/patrol.js +68 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/platformer-motor.d.ts +124 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/platformer-motor.js +146 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/player-identity.d.ts +3 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/player-identity.js +5 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/player-states.d.ts +18 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/player-states.js +95 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/respawnable.d.ts +23 -0
- package/dist/mcp/node_modules/@waica/behaviors/dist/respawnable.js +27 -0
- package/dist/mcp/node_modules/@waica/behaviors/package.json +24 -0
- package/dist/mcp/node_modules/@waica/engine/dist/aabb.d.ts +2 -0
- package/dist/mcp/node_modules/@waica/engine/dist/aabb.js +4 -0
- package/dist/mcp/node_modules/@waica/engine/dist/animation/clip-player.d.ts +20 -0
- package/dist/mcp/node_modules/@waica/engine/dist/animation/clip-player.js +24 -0
- package/dist/mcp/node_modules/@waica/engine/dist/animation/contract.d.ts +21 -0
- package/dist/mcp/node_modules/@waica/engine/dist/animation/contract.js +23 -0
- package/dist/mcp/node_modules/@waica/engine/dist/animation/sheet.d.ts +65 -0
- package/dist/mcp/node_modules/@waica/engine/dist/animation/sheet.js +44 -0
- package/dist/mcp/node_modules/@waica/engine/dist/archetype.d.ts +37 -0
- package/dist/mcp/node_modules/@waica/engine/dist/archetype.js +1 -0
- package/dist/mcp/node_modules/@waica/engine/dist/camera.d.ts +71 -0
- package/dist/mcp/node_modules/@waica/engine/dist/camera.js +59 -0
- package/dist/mcp/node_modules/@waica/engine/dist/collision-shape.d.ts +26 -0
- package/dist/mcp/node_modules/@waica/engine/dist/collision-shape.js +136 -0
- package/dist/mcp/node_modules/@waica/engine/dist/component-registry.d.ts +16 -0
- package/dist/mcp/node_modules/@waica/engine/dist/component-registry.js +44 -0
- package/dist/mcp/node_modules/@waica/engine/dist/component.d.ts +58 -0
- package/dist/mcp/node_modules/@waica/engine/dist/component.js +11 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/animated-sprite.d.ts +80 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/animated-sprite.js +210 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/dynamic-body.d.ts +68 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/dynamic-body.js +189 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/hitbox.d.ts +25 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/hitbox.js +21 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/solid.d.ts +32 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/solid.js +45 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/sprite.d.ts +51 -0
- package/dist/mcp/node_modules/@waica/engine/dist/components/sprite.js +112 -0
- package/dist/mcp/node_modules/@waica/engine/dist/entity.d.ts +22 -0
- package/dist/mcp/node_modules/@waica/engine/dist/entity.js +52 -0
- package/dist/mcp/node_modules/@waica/engine/dist/events.d.ts +8 -0
- package/dist/mcp/node_modules/@waica/engine/dist/events.js +20 -0
- package/dist/mcp/node_modules/@waica/engine/dist/game.d.ts +95 -0
- package/dist/mcp/node_modules/@waica/engine/dist/game.js +263 -0
- package/dist/mcp/node_modules/@waica/engine/dist/index.d.ts +39 -0
- package/dist/mcp/node_modules/@waica/engine/dist/index.js +26 -0
- package/dist/mcp/node_modules/@waica/engine/dist/input.d.ts +40 -0
- package/dist/mcp/node_modules/@waica/engine/dist/input.js +84 -0
- package/dist/mcp/node_modules/@waica/engine/dist/scene.d.ts +80 -0
- package/dist/mcp/node_modules/@waica/engine/dist/scene.js +93 -0
- package/dist/mcp/node_modules/@waica/engine/dist/solid-axis.d.ts +21 -0
- package/dist/mcp/node_modules/@waica/engine/dist/solid-axis.js +77 -0
- package/dist/mcp/node_modules/@waica/engine/dist/state/hooks.d.ts +90 -0
- package/dist/mcp/node_modules/@waica/engine/dist/state/hooks.js +81 -0
- package/dist/mcp/node_modules/@waica/engine/dist/state/state-machine.d.ts +83 -0
- package/dist/mcp/node_modules/@waica/engine/dist/state/state-machine.js +173 -0
- package/dist/mcp/node_modules/@waica/engine/dist/stats.d.ts +27 -0
- package/dist/mcp/node_modules/@waica/engine/dist/stats.js +54 -0
- package/dist/mcp/node_modules/@waica/engine/dist/ui.d.ts +47 -0
- package/dist/mcp/node_modules/@waica/engine/dist/ui.js +175 -0
- package/dist/mcp/node_modules/@waica/engine/package.json +25 -0
- package/dist/mcp/package-resolver.js +240 -0
- package/dist/mcp/project-path.js +86 -0
- package/dist/mcp/scaffolds.js +153 -0
- package/dist/mcp/server.js +217 -0
- package/dist/mcp/stdio.js +13 -0
- package/dist/mcp/template/README.md +22 -0
- package/dist/mcp/template/_gitignore +5 -0
- package/dist/mcp/template/index.html +25 -0
- package/dist/mcp/template/package.json.tpl +20 -0
- package/dist/mcp/template/public/waica.params.json +1 -0
- package/dist/mcp/template/src/art/waica-coin.png +0 -0
- package/dist/mcp/template/src/art/waica-dog.png +0 -0
- package/dist/mcp/template/src/art/waica-slime.png +0 -0
- package/dist/mcp/template/src/characters/player.character.json +133 -0
- package/dist/mcp/template/src/characters/slime.character.json +61 -0
- package/dist/mcp/template/src/controls.json +8 -0
- package/dist/mcp/template/src/game.json +10 -0
- package/dist/mcp/template/src/main.ts +105 -0
- package/dist/mcp/template/src/objects/coin.object.json +41 -0
- package/dist/mcp/template/src/scenes/main.scene.json +217 -0
- package/dist/mcp/template/src/stats.json +7 -0
- package/dist/mcp/template/src/tiles/block.tile.json +21 -0
- package/dist/mcp/template/src/tiles/decor.tile.json +14 -0
- package/dist/mcp/template/src/tiles/platform.tile.json +21 -0
- package/dist/mcp/template/src/ui/coin-counter.html +12 -0
- package/dist/mcp/template/tsconfig.json +15 -0
- package/dist/mcp/template/vite.config.ts +3 -0
- package/dist/mcp/validation.js +323 -0
- package/dist/mcp/workspace-loader.js +14 -0
- package/dist/mcp/workspace-runtime.js +109 -0
- package/dist/server.js +210 -0
- 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,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 @@
|
|
|
1
|
+
{}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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,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
|
+
}
|