@waica/cli 0.7.0 → 0.8.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 (100) hide show
  1. package/README.md +1 -1
  2. package/dist/editor/assets/{cssMode-eS4pAOyh.js → cssMode-DwPoqXFO.js} +1 -1
  3. package/dist/editor/assets/{freemarker2-FMQjZKQk.js → freemarker2-gl5y25bH.js} +1 -1
  4. package/dist/editor/assets/{handlebars-dDYOnqat.js → handlebars-DHUb8mb3.js} +1 -1
  5. package/dist/editor/assets/{html-Ba6xZh4T.js → html-C8W-psr4.js} +1 -1
  6. package/dist/editor/assets/{htmlMode-DC9qJr2p.js → htmlMode-BiF5TH2_.js} +1 -1
  7. package/dist/editor/assets/{index-Cy5pmBhN.css → index-CzarIYLW.css} +1 -1
  8. package/dist/editor/assets/{index-CoyeInOT.js → index-DtMwWp8R.js} +2732 -608
  9. package/dist/editor/assets/{javascript-DOwFvmvM.js → javascript-D_t2jyWi.js} +1 -1
  10. package/dist/editor/assets/{jsonMode-CcG7zlSf.js → jsonMode-CZ0SltDj.js} +1 -1
  11. package/dist/editor/assets/{liquid-Dfp71r7J.js → liquid-DUxURZui.js} +1 -1
  12. package/dist/editor/assets/{mdx-Ci7vVeht.js → mdx-CDIQ7hmo.js} +1 -1
  13. package/dist/editor/assets/{python-Bluv3Y9Q.js → python-Cra2N916.js} +1 -1
  14. package/dist/editor/assets/{razor-BtwTXMaK.js → razor-B3qV-mNp.js} +1 -1
  15. package/dist/editor/assets/{tsMode-D3_D-H85.js → tsMode-Ci457z4v.js} +1 -1
  16. package/dist/editor/assets/{typescript-Ch_PS5f7.js → typescript-BXjh3GLT.js} +1 -1
  17. package/dist/editor/assets/{xml-CI_bH_MX.js → xml-DQuEpqk5.js} +1 -1
  18. package/dist/editor/assets/{yaml-LD9GTZyy.js → yaml-CQA7WIT-.js} +1 -1
  19. package/dist/editor/index.html +2 -2
  20. package/dist/mcp/known-archetypes.js +5 -0
  21. package/dist/mcp/node_modules/@waica/archetype-isometric/assets/ATTRIBUTION.md +72 -0
  22. package/dist/mcp/node_modules/@waica/archetype-isometric/assets/waica-iso-crate.png +0 -0
  23. package/dist/mcp/node_modules/@waica/archetype-isometric/assets/waica-iso-ground.png +0 -0
  24. package/dist/mcp/node_modules/@waica/archetype-isometric/assets/waica-iso-hero.png +0 -0
  25. package/dist/mcp/node_modules/@waica/archetype-isometric/assets/waica-iso-orc.png +0 -0
  26. package/dist/mcp/node_modules/@waica/archetype-isometric/assets/waica-iso-rock.png +0 -0
  27. package/dist/mcp/node_modules/@waica/archetype-isometric/assets/waica-iso-tree.png +0 -0
  28. package/dist/mcp/node_modules/@waica/archetype-isometric/assets/waica-iso-villager.png +0 -0
  29. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/animation.d.ts +3 -0
  30. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/animation.js +10 -0
  31. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/art.d.ts +3 -0
  32. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/art.js +10 -0
  33. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/bundle.d.ts +2 -0
  34. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/bundle.js +9 -0
  35. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/controls.d.ts +3 -0
  36. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/controls.js +14 -0
  37. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/index.d.ts +24 -0
  38. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/index.js +15 -0
  39. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/manifest.d.ts +16 -0
  40. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/manifest.js +29 -0
  41. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/prefabs.d.ts +18 -0
  42. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/prefabs.js +196 -0
  43. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/registry-data.d.ts +3 -0
  44. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/registry-data.js +46 -0
  45. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/registry.d.ts +4 -0
  46. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/registry.js +17 -0
  47. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/scene-default.d.ts +5 -0
  48. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/scene-default.js +49 -0
  49. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/ui.d.ts +1 -0
  50. package/dist/mcp/node_modules/@waica/archetype-isometric/dist/ui.js +17 -0
  51. package/dist/mcp/node_modules/@waica/archetype-isometric/package.json +30 -0
  52. package/dist/mcp/node_modules/@waica/archetype-platformer/package.json +3 -3
  53. package/dist/mcp/node_modules/@waica/archetype-topdown/dist/registry-data.js +2 -1
  54. package/dist/mcp/node_modules/@waica/archetype-topdown/dist/ui.js +2 -19
  55. package/dist/mcp/node_modules/@waica/archetype-topdown/package.json +3 -3
  56. package/dist/mcp/node_modules/@waica/behaviors/dist/grid-motor.d.ts +56 -0
  57. package/dist/mcp/node_modules/@waica/behaviors/dist/grid-motor.js +74 -0
  58. package/dist/mcp/node_modules/@waica/behaviors/dist/grid-player-role.d.ts +15 -0
  59. package/dist/mcp/node_modules/@waica/behaviors/dist/grid-player-role.js +71 -0
  60. package/dist/mcp/node_modules/@waica/behaviors/dist/index.d.ts +3 -1
  61. package/dist/mcp/node_modules/@waica/behaviors/dist/index.js +3 -1
  62. package/dist/mcp/node_modules/@waica/behaviors/dist/interactable.d.ts +3 -0
  63. package/dist/mcp/node_modules/@waica/behaviors/dist/interactable.js +25 -2
  64. package/dist/mcp/node_modules/@waica/behaviors/dist/iso-motor.d.ts +14 -0
  65. package/dist/mcp/node_modules/@waica/behaviors/dist/iso-motor.js +36 -0
  66. package/dist/mcp/node_modules/@waica/behaviors/dist/iso-player-states.d.ts +5 -0
  67. package/dist/mcp/node_modules/@waica/behaviors/dist/iso-player-states.js +9 -0
  68. package/dist/mcp/node_modules/@waica/behaviors/dist/topdown-motor.d.ts +7 -61
  69. package/dist/mcp/node_modules/@waica/behaviors/dist/topdown-motor.js +8 -79
  70. package/dist/mcp/node_modules/@waica/behaviors/dist/topdown-player-states.d.ts +4 -17
  71. package/dist/mcp/node_modules/@waica/behaviors/dist/topdown-player-states.js +10 -82
  72. package/dist/mcp/node_modules/@waica/behaviors/package.json +2 -2
  73. package/dist/mcp/node_modules/@waica/engine/dist/component.d.ts +2 -0
  74. package/dist/mcp/node_modules/@waica/engine/dist/components/animated-sprite.d.ts +19 -1
  75. package/dist/mcp/node_modules/@waica/engine/dist/components/animated-sprite.js +35 -7
  76. package/dist/mcp/node_modules/@waica/engine/dist/components/dynamic-body.js +2 -4
  77. package/dist/mcp/node_modules/@waica/engine/dist/components/sprite.d.ts +19 -0
  78. package/dist/mcp/node_modules/@waica/engine/dist/components/sprite.js +44 -8
  79. package/dist/mcp/node_modules/@waica/engine/dist/components/tilemap.d.ts +113 -0
  80. package/dist/mcp/node_modules/@waica/engine/dist/components/tilemap.js +316 -0
  81. package/dist/mcp/node_modules/@waica/engine/dist/entity.d.ts +3 -0
  82. package/dist/mcp/node_modules/@waica/engine/dist/entity.js +13 -1
  83. package/dist/mcp/node_modules/@waica/engine/dist/game.d.ts +4 -0
  84. package/dist/mcp/node_modules/@waica/engine/dist/game.js +41 -9
  85. package/dist/mcp/node_modules/@waica/engine/dist/index.d.ts +9 -0
  86. package/dist/mcp/node_modules/@waica/engine/dist/index.js +5 -0
  87. package/dist/mcp/node_modules/@waica/engine/dist/projection.d.ts +14 -0
  88. package/dist/mcp/node_modules/@waica/engine/dist/projection.js +30 -0
  89. package/dist/mcp/node_modules/@waica/engine/dist/scene-solids.d.ts +16 -0
  90. package/dist/mcp/node_modules/@waica/engine/dist/scene-solids.js +28 -0
  91. package/dist/mcp/node_modules/@waica/engine/dist/scene.d.ts +3 -1
  92. package/dist/mcp/node_modules/@waica/engine/dist/solid-axis.js +2 -4
  93. package/dist/mcp/node_modules/@waica/engine/dist/sprite-placement.d.ts +22 -0
  94. package/dist/mcp/node_modules/@waica/engine/dist/sprite-placement.js +14 -0
  95. package/dist/mcp/node_modules/@waica/engine/dist/tilemap-grid.d.ts +26 -0
  96. package/dist/mcp/node_modules/@waica/engine/dist/tilemap-grid.js +41 -0
  97. package/dist/mcp/node_modules/@waica/engine/package.json +1 -1
  98. package/dist/mcp/package-resolver.js +4 -0
  99. package/dist/mcp/project-component-runner.js +1 -0
  100. package/package.json +1 -1
@@ -0,0 +1,24 @@
1
+ export { ISOMETRIC_ANIMATION } from './animation.js';
2
+ export { ISOMETRIC_ART } from './art.js';
3
+ export { ISOMETRIC_BUNDLE } from './bundle.js';
4
+ export { ISOMETRIC_ACTION_LABELS, ISOMETRIC_BINDINGS } from './controls.js';
5
+ export { ISOMETRIC_PREFABS, ISOMETRIC_HERO_SPRITE } from './prefabs.js';
6
+ export { ISOMETRIC_ART_URLS, ISOMETRIC_PALETTE, ISOMETRIC_REGISTRY, } from './registry.js';
7
+ export { ISOMETRIC_BLANK_SCENE, ISOMETRIC_SCENE } from './scene-default.js';
8
+ export { ISOMETRIC_UI } from './ui.js';
9
+ export declare const ARCHETYPE: {
10
+ id: string;
11
+ label: string;
12
+ scene: import("@waica/engine").SceneJson;
13
+ blankScene: import("@waica/engine").SceneJson;
14
+ palette: import("@waica/engine").EntityTemplate[];
15
+ prefabs: Record<string, import("@waica/engine").PrefabJson>;
16
+ art: import("@waica/engine").ArchetypeArt[];
17
+ entityIcons: Readonly<Record<string, string>>;
18
+ bindings: Readonly<import("@waica/engine").InputBindings>;
19
+ actionLabels: Readonly<Record<string, string>>;
20
+ bundle: import("@waica/engine").ArchetypeBundle;
21
+ animation: import("@waica/engine").DirectionalAnimation<string>;
22
+ registry: import("@waica/engine").SceneRegistry;
23
+ artUrls: Record<string, string>;
24
+ };
@@ -0,0 +1,15 @@
1
+ import { ARCHETYPE as DATA_ARCHETYPE } from './manifest.js';
2
+ import { ISOMETRIC_ART_URLS, ISOMETRIC_REGISTRY } from './registry.js';
3
+ export { ISOMETRIC_ANIMATION } from './animation.js';
4
+ export { ISOMETRIC_ART } from './art.js';
5
+ export { ISOMETRIC_BUNDLE } from './bundle.js';
6
+ export { ISOMETRIC_ACTION_LABELS, ISOMETRIC_BINDINGS } from './controls.js';
7
+ export { ISOMETRIC_PREFABS, ISOMETRIC_HERO_SPRITE } from './prefabs.js';
8
+ export { ISOMETRIC_ART_URLS, ISOMETRIC_PALETTE, ISOMETRIC_REGISTRY, } from './registry.js';
9
+ export { ISOMETRIC_BLANK_SCENE, ISOMETRIC_SCENE } from './scene-default.js';
10
+ export { ISOMETRIC_UI } from './ui.js';
11
+ export const ARCHETYPE = {
12
+ ...DATA_ARCHETYPE,
13
+ registry: ISOMETRIC_REGISTRY,
14
+ artUrls: ISOMETRIC_ART_URLS,
15
+ };
@@ -0,0 +1,16 @@
1
+ export declare const ISOMETRIC_ENTITY_ICONS: Readonly<Record<string, string>>;
2
+ export declare const ARCHETYPE: {
3
+ id: string;
4
+ label: string;
5
+ scene: import("@waica/engine").SceneJson;
6
+ blankScene: import("@waica/engine").SceneJson;
7
+ registry: import("@waica/engine").SceneRegistry;
8
+ palette: import("@waica/engine").EntityTemplate[];
9
+ prefabs: Record<string, import("@waica/engine").PrefabJson>;
10
+ art: import("@waica/engine").ArchetypeArt[];
11
+ entityIcons: Readonly<Record<string, string>>;
12
+ bindings: Readonly<import("@waica/engine").InputBindings>;
13
+ actionLabels: Readonly<Record<string, string>>;
14
+ bundle: import("@waica/engine").ArchetypeBundle;
15
+ animation: import("@waica/engine").DirectionalAnimation<string>;
16
+ };
@@ -0,0 +1,29 @@
1
+ import { ISOMETRIC_ANIMATION } from './animation.js';
2
+ import { ISOMETRIC_ART } from './art.js';
3
+ import { ISOMETRIC_BUNDLE } from './bundle.js';
4
+ import { ISOMETRIC_ACTION_LABELS, ISOMETRIC_BINDINGS } from './controls.js';
5
+ import { ISOMETRIC_PREFABS } from './prefabs.js';
6
+ import { ISOMETRIC_PALETTE, ISOMETRIC_REGISTRY_DATA } from './registry-data.js';
7
+ import { ISOMETRIC_BLANK_SCENE, ISOMETRIC_SCENE } from './scene-default.js';
8
+ export const ISOMETRIC_ENTITY_ICONS = {
9
+ IsoMotor: '🧭',
10
+ Tilemap: '💎',
11
+ Interactable: '💬',
12
+ Collectible: '📦',
13
+ Hazard: '👹',
14
+ };
15
+ export const ARCHETYPE = {
16
+ id: 'isometric',
17
+ label: 'Isometric',
18
+ scene: ISOMETRIC_SCENE,
19
+ blankScene: ISOMETRIC_BLANK_SCENE,
20
+ registry: ISOMETRIC_REGISTRY_DATA,
21
+ palette: ISOMETRIC_PALETTE,
22
+ prefabs: ISOMETRIC_PREFABS,
23
+ art: ISOMETRIC_ART,
24
+ entityIcons: ISOMETRIC_ENTITY_ICONS,
25
+ bindings: ISOMETRIC_BINDINGS,
26
+ actionLabels: ISOMETRIC_ACTION_LABELS,
27
+ bundle: ISOMETRIC_BUNDLE,
28
+ animation: ISOMETRIC_ANIMATION,
29
+ };
@@ -0,0 +1,18 @@
1
+ import type { PrefabJson } from '@waica/engine';
2
+ export declare const ISOMETRIC_HERO_SPRITE: {
3
+ texture: string;
4
+ cols: number;
5
+ rows: number;
6
+ spacingX: number;
7
+ spacingY: number;
8
+ pixelArt: boolean;
9
+ width: number;
10
+ height: number;
11
+ anchorY: number;
12
+ clips: Record<string, {
13
+ frames: number[];
14
+ fps: number;
15
+ }>;
16
+ initialClip: string;
17
+ };
18
+ export declare const ISOMETRIC_PREFABS: Record<string, PrefabJson>;
@@ -0,0 +1,196 @@
1
+ import { ISO_PLAYER_STATE_GRAPH, NPC_STATE_GRAPH, PATROLLER_STATE_GRAPH, } from '@waica/behaviors';
2
+ const SHIPPED_DIRECTIONS = ['n', 'ne', 'e', 'se', 's'];
3
+ function directionalClips(includePlain) {
4
+ const clips = {};
5
+ SHIPPED_DIRECTIONS.forEach((direction, row) => {
6
+ const first = row * 4;
7
+ clips[`idle-${direction}`] = { frames: [first], fps: 2 };
8
+ clips[`walk-${direction}`] = {
9
+ frames: [first + 1, first + 2, first + 3, first + 2],
10
+ fps: 8,
11
+ };
12
+ });
13
+ if (includePlain) {
14
+ clips['idle'] = { frames: [16], fps: 2 };
15
+ clips['walk'] = { frames: [17, 18, 19, 18], fps: 8 };
16
+ }
17
+ return clips;
18
+ }
19
+ function characterSprite(texture, includePlain = false) {
20
+ return {
21
+ texture,
22
+ cols: 4,
23
+ rows: 5,
24
+ spacingX: 1,
25
+ spacingY: 1,
26
+ pixelArt: true,
27
+ width: 2,
28
+ height: 2,
29
+ anchorY: 0,
30
+ clips: directionalClips(includePlain),
31
+ initialClip: includePlain ? 'idle' : 'idle-s',
32
+ };
33
+ }
34
+ export const ISOMETRIC_HERO_SPRITE = characterSprite('waica:iso-hero');
35
+ const MAP_WIDTH = 16;
36
+ const MAP_HEIGHT = 16;
37
+ const GRASS = 0;
38
+ const DIRT = 1;
39
+ const PATH = 2;
40
+ const WATER = 3;
41
+ const BORDER = 4;
42
+ function tileAt(column, row) {
43
+ if (column === 0 || row === 0 || column === MAP_WIDTH - 1 || row === MAP_HEIGHT - 1) {
44
+ return BORDER;
45
+ }
46
+ if (column >= 11 && column <= 12 && row >= 5 && row <= 6)
47
+ return WATER;
48
+ if (column === 7 || row === 7)
49
+ return PATH;
50
+ if (column >= 2 && column <= 5 && row >= 2 && row <= 4)
51
+ return DIRT;
52
+ return GRASS;
53
+ }
54
+ const GROUND_CELLS = Array.from({ length: MAP_WIDTH * MAP_HEIGHT }, (_, index) => tileAt(index % MAP_WIDTH, Math.floor(index / MAP_WIDTH)));
55
+ export const ISOMETRIC_PREFABS = {
56
+ 'characters/player': {
57
+ waicaPrefab: 1,
58
+ type: 'character',
59
+ components: [
60
+ { type: 'AnimatedSprite', props: ISOMETRIC_HERO_SPRITE },
61
+ { type: 'IsoMotor' },
62
+ {
63
+ type: 'StateMachine',
64
+ props: {
65
+ role: 'player',
66
+ initial: ISO_PLAYER_STATE_GRAPH.initial,
67
+ states: ISO_PLAYER_STATE_GRAPH.states,
68
+ },
69
+ },
70
+ { type: 'Hitbox', props: { width: 0.8, height: 0.8 } },
71
+ { type: 'Respawnable' },
72
+ { type: 'Health', props: { max: 3, invulnerability: 1 } },
73
+ ],
74
+ },
75
+ 'characters/villager': {
76
+ waicaPrefab: 1,
77
+ type: 'character',
78
+ components: [
79
+ {
80
+ type: 'AnimatedSprite',
81
+ props: characterSprite('waica:iso-villager', true),
82
+ },
83
+ {
84
+ type: 'StateMachine',
85
+ props: {
86
+ role: 'npc',
87
+ initial: NPC_STATE_GRAPH.initial,
88
+ states: NPC_STATE_GRAPH.states,
89
+ },
90
+ },
91
+ { type: 'Interactable', props: { line: 'Welcome to Diamond Meadow!', radius: 1.5 } },
92
+ { type: 'Solid', props: { width: 0.8, height: 0.6 } },
93
+ ],
94
+ },
95
+ 'characters/orc': {
96
+ waicaPrefab: 1,
97
+ type: 'character',
98
+ components: [
99
+ {
100
+ type: 'AnimatedSprite',
101
+ props: {
102
+ ...characterSprite('waica:iso-orc', true),
103
+ initialClip: 'walk',
104
+ },
105
+ },
106
+ { type: 'Patrol', props: { axis: 'horizontal', distance: 2, speed: 2 } },
107
+ {
108
+ type: 'StateMachine',
109
+ props: {
110
+ role: 'patroller',
111
+ initial: PATROLLER_STATE_GRAPH.initial,
112
+ states: PATROLLER_STATE_GRAPH.states,
113
+ },
114
+ },
115
+ { type: 'Hitbox', props: { width: 0.8, height: 0.7 } },
116
+ { type: 'Hazard', props: { stompable: false, contactDamage: 1 } },
117
+ ],
118
+ },
119
+ 'objects/crate': {
120
+ waicaPrefab: 1,
121
+ type: 'object',
122
+ components: [
123
+ {
124
+ type: 'Sprite',
125
+ props: {
126
+ texture: 'waica:iso-crate',
127
+ pixelArt: true,
128
+ width: 1,
129
+ height: 1,
130
+ anchorY: 0,
131
+ },
132
+ },
133
+ { type: 'Hitbox', props: { width: 0.6, height: 0.6 } },
134
+ { type: 'Collectible', props: { value: 1 } },
135
+ ],
136
+ },
137
+ 'objects/tree': {
138
+ waicaPrefab: 1,
139
+ type: 'object',
140
+ components: [
141
+ {
142
+ type: 'Sprite',
143
+ props: {
144
+ texture: 'waica:iso-tree',
145
+ pixelArt: true,
146
+ width: 2,
147
+ height: 47 / 16,
148
+ anchorY: 0,
149
+ },
150
+ },
151
+ { type: 'Solid', props: { width: 0.8, height: 0.6 } },
152
+ ],
153
+ },
154
+ 'objects/rock': {
155
+ waicaPrefab: 1,
156
+ type: 'object',
157
+ components: [
158
+ {
159
+ type: 'Sprite',
160
+ props: {
161
+ texture: 'waica:iso-rock',
162
+ pixelArt: true,
163
+ width: 1,
164
+ height: 1,
165
+ anchorY: 0,
166
+ },
167
+ },
168
+ { type: 'Solid', props: { width: 0.8, height: 0.6 } },
169
+ ],
170
+ },
171
+ 'tiles/ground': {
172
+ waicaPrefab: 1,
173
+ type: 'tile',
174
+ components: [
175
+ {
176
+ type: 'Tilemap',
177
+ props: {
178
+ texture: 'waica:iso-ground',
179
+ cols: 5,
180
+ rows: 1,
181
+ spacingX: 1,
182
+ spacingY: 1,
183
+ cellWidth: 64,
184
+ cellHeight: 32,
185
+ pixelArt: true,
186
+ mapWidth: MAP_WIDTH,
187
+ mapHeight: MAP_HEIGHT,
188
+ cellSize: 1,
189
+ cells: GROUND_CELLS,
190
+ solidTiles: [WATER, BORDER],
191
+ layer: -2,
192
+ },
193
+ },
194
+ ],
195
+ },
196
+ };
@@ -0,0 +1,3 @@
1
+ import { type EntityTemplate, type SceneRegistry } from '@waica/engine';
2
+ export declare const ISOMETRIC_REGISTRY_DATA: SceneRegistry;
3
+ export declare const ISOMETRIC_PALETTE: EntityTemplate[];
@@ -0,0 +1,46 @@
1
+ import { AnimatedSprite, Hitbox, Solid, Sprite, StateMachine, Tilemap, } from '@waica/engine';
2
+ import { Chaser, Collectible, Hazard, Health, Interactable, IsoMotor, Lifetime, Patrol, Respawnable, } from '@waica/behaviors';
3
+ import { ISOMETRIC_ART } from './art.js';
4
+ import { ISOMETRIC_PREFABS } from './prefabs.js';
5
+ import { ISOMETRIC_UI } from './ui.js';
6
+ const PACKAGE_ASSETS = Object.fromEntries(ISOMETRIC_ART.map((art) => [art.uri, `assets/${art.file}`]));
7
+ export const ISOMETRIC_REGISTRY_DATA = {
8
+ components: {
9
+ Sprite,
10
+ AnimatedSprite,
11
+ Tilemap,
12
+ Solid,
13
+ Hitbox,
14
+ StateMachine,
15
+ IsoMotor,
16
+ Interactable,
17
+ Collectible,
18
+ Patrol,
19
+ Chaser,
20
+ Hazard,
21
+ Health,
22
+ Respawnable,
23
+ Lifetime,
24
+ },
25
+ resolveAsset: (uri) => PACKAGE_ASSETS[uri] ?? uri,
26
+ prefabs: ISOMETRIC_PREFABS,
27
+ ui: ISOMETRIC_UI,
28
+ };
29
+ const PALETTE_ICONS = {
30
+ player: '🧭',
31
+ villager: '🧑‍🌾',
32
+ orc: '👹',
33
+ crate: '📦',
34
+ tree: '🌳',
35
+ rock: '🪨',
36
+ ground: '💎',
37
+ };
38
+ export const ISOMETRIC_PALETTE = Object.entries(ISOMETRIC_PREFABS).map(([key, prefab]) => {
39
+ const base = key.slice(key.indexOf('/') + 1);
40
+ return {
41
+ label: base,
42
+ icon: PALETTE_ICONS[base] ?? '▣',
43
+ category: prefab.type,
44
+ make: () => ({ name: base.charAt(0).toUpperCase() + base.slice(1), prefab: key }),
45
+ };
46
+ });
@@ -0,0 +1,4 @@
1
+ import type { SceneRegistry } from '@waica/engine';
2
+ export { ISOMETRIC_PALETTE } from './registry-data.js';
3
+ export declare const ISOMETRIC_ART_URLS: Record<string, string>;
4
+ export declare const ISOMETRIC_REGISTRY: SceneRegistry;
@@ -0,0 +1,17 @@
1
+ import { ISOMETRIC_ART } from './art.js';
2
+ import { ISOMETRIC_REGISTRY_DATA } from './registry-data.js';
3
+ export { ISOMETRIC_PALETTE } from './registry-data.js';
4
+ export const ISOMETRIC_ART_URLS = {
5
+ 'waica-iso-hero.png': new URL('../assets/waica-iso-hero.png', import.meta.url).href,
6
+ 'waica-iso-villager.png': new URL('../assets/waica-iso-villager.png', import.meta.url).href,
7
+ 'waica-iso-orc.png': new URL('../assets/waica-iso-orc.png', import.meta.url).href,
8
+ 'waica-iso-ground.png': new URL('../assets/waica-iso-ground.png', import.meta.url).href,
9
+ 'waica-iso-tree.png': new URL('../assets/waica-iso-tree.png', import.meta.url).href,
10
+ 'waica-iso-rock.png': new URL('../assets/waica-iso-rock.png', import.meta.url).href,
11
+ 'waica-iso-crate.png': new URL('../assets/waica-iso-crate.png', import.meta.url).href,
12
+ };
13
+ const BUILTIN_ASSETS = Object.fromEntries(ISOMETRIC_ART.map((art) => [art.uri, ISOMETRIC_ART_URLS[art.file] ?? art.uri]));
14
+ export const ISOMETRIC_REGISTRY = {
15
+ ...ISOMETRIC_REGISTRY_DATA,
16
+ resolveAsset: (uri) => BUILTIN_ASSETS[uri] ?? uri,
17
+ };
@@ -0,0 +1,5 @@
1
+ import type { SceneJson } from '@waica/engine';
2
+ /** A logical 16x16 meadow projected into a 2:1 diamond at render time. */
3
+ export declare const ISOMETRIC_SCENE: SceneJson;
4
+ /** Blank projects retain the diamond grid and full-map framing. */
5
+ export declare const ISOMETRIC_BLANK_SCENE: SceneJson;
@@ -0,0 +1,49 @@
1
+ function isometricCamera() {
2
+ return {
3
+ position: [0, -8],
4
+ zoom: 12,
5
+ limits: { minX: -16, maxX: 16, minY: -16, maxY: 0 },
6
+ };
7
+ }
8
+ /** A logical 16x16 meadow projected into a 2:1 diamond at render time. */
9
+ export const ISOMETRIC_SCENE = {
10
+ waicaScene: 3,
11
+ render: { sort: 'y', projection: 'isometric' },
12
+ camera: {
13
+ ...isometricCamera(),
14
+ follow: 'Player',
15
+ lookaheadY: 1,
16
+ },
17
+ entities: [
18
+ { name: 'Ground', prefab: 'tiles/ground', position: [0, 0] },
19
+ { name: 'Player', prefab: 'characters/player', position: [8, 8] },
20
+ {
21
+ name: 'Villager',
22
+ prefab: 'characters/villager',
23
+ position: [6, 9],
24
+ overrides: { Interactable: { line: 'The water sparkles, but it blocks the trail.' } },
25
+ },
26
+ {
27
+ name: 'Orc',
28
+ prefab: 'characters/orc',
29
+ position: [10, 10],
30
+ overrides: { Patrol: { axis: 'horizontal', distance: 2.5, speed: 1.5 } },
31
+ },
32
+ { name: 'Crate-1', prefab: 'objects/crate', position: [5, 6] },
33
+ { name: 'Crate-2', prefab: 'objects/crate', position: [10, 4] },
34
+ { name: 'Crate-3', prefab: 'objects/crate', position: [12, 10] },
35
+ { name: 'Tree-1', prefab: 'objects/tree', position: [4, 10] },
36
+ { name: 'Tree-2', prefab: 'objects/tree', position: [10, 12] },
37
+ { name: 'Tree-3', prefab: 'objects/tree', position: [12, 3] },
38
+ { name: 'Rock-1', prefab: 'objects/rock', position: [5, 11] },
39
+ { name: 'Rock-2', prefab: 'objects/rock', position: [9, 4] },
40
+ ],
41
+ ui: ['crate-counter'],
42
+ };
43
+ /** Blank projects retain the diamond grid and full-map framing. */
44
+ export const ISOMETRIC_BLANK_SCENE = {
45
+ waicaScene: 3,
46
+ render: { sort: 'y', projection: 'isometric' },
47
+ camera: isometricCamera(),
48
+ entities: [],
49
+ };
@@ -0,0 +1 @@
1
+ export declare const ISOMETRIC_UI: Record<string, string>;
@@ -0,0 +1,17 @@
1
+ import { INTERACTABLE_UI } from '@waica/behaviors';
2
+ export const ISOMETRIC_UI = {
3
+ 'crate-counter': `<style>
4
+ .crate-counter {
5
+ position: absolute;
6
+ top: 12px;
7
+ left: 12px;
8
+ font: 600 20px system-ui, sans-serif;
9
+ color: #ffd166;
10
+ text-shadow: 0 1px 3px #000a;
11
+ user-select: none;
12
+ }
13
+ </style>
14
+ <div class="crate-counter">📦 {{points}}</div>
15
+ `,
16
+ ...INTERACTABLE_UI,
17
+ };
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@waica/archetype-isometric",
3
+ "version": "0.8.0",
4
+ "description": "Waica isometric archetype — logical-grid action adventures with screen-relative movement",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/chichex/waica",
10
+ "directory": "packages/archetype-isometric"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "assets"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "./manifest": {
22
+ "types": "./dist/manifest.d.ts",
23
+ "default": "./dist/manifest.js"
24
+ }
25
+ },
26
+ "dependencies": {
27
+ "@waica/behaviors": "^0.8.0",
28
+ "@waica/engine": "^0.8.0"
29
+ }
30
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waica/archetype-platformer",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Waica platformer archetype — opinionated setup for side-scrolling platformers",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@waica/behaviors": "^0.7.0",
28
- "@waica/engine": "^0.7.0"
27
+ "@waica/behaviors": "^0.8.0",
28
+ "@waica/engine": "^0.8.0"
29
29
  }
30
30
  }
@@ -1,4 +1,4 @@
1
- import { AnimatedSprite, Hitbox, Solid, Sprite, StateMachine, } from '@waica/engine';
1
+ import { AnimatedSprite, Hitbox, Solid, Sprite, StateMachine, Tilemap, } from '@waica/engine';
2
2
  import { Chaser, Collectible, Hazard, Health, Interactable, Lifetime, Patrol, Respawnable, TopDownMotor, } from '@waica/behaviors';
3
3
  import { TOPDOWN_ART } from './art.js';
4
4
  import { TOPDOWN_PREFABS } from './prefabs.js';
@@ -13,6 +13,7 @@ export const TOPDOWN_REGISTRY_DATA = {
13
13
  components: {
14
14
  Sprite,
15
15
  AnimatedSprite,
16
+ Tilemap,
16
17
  Solid,
17
18
  Hitbox,
18
19
  StateMachine,
@@ -1,3 +1,4 @@
1
+ import { INTERACTABLE_UI } from '@waica/behaviors';
1
2
  /**
2
3
  * The archetype's default UI pieces: self-contained HTML fragments
3
4
  * (markup + <style>, {{stat}} bindings) keyed by piece name. Projects
@@ -21,23 +22,5 @@ export const TOPDOWN_UI = {
21
22
  </style>
22
23
  <div class="potion-counter">🧪 {{points}}</div>
23
24
  `,
24
- 'npc-line': `<style>
25
- .npc-line {
26
- position: absolute;
27
- left: 50%;
28
- bottom: 24px;
29
- transform: translateX(-50%);
30
- max-width: 70%;
31
- padding: 10px 18px;
32
- border-radius: 8px;
33
- background: #1a1a2ecc;
34
- border: 1px solid #ffffff2e;
35
- font: 500 18px system-ui, sans-serif;
36
- color: #f5f5f5;
37
- text-shadow: 0 1px 2px #000a;
38
- user-select: none;
39
- }
40
- </style>
41
- <div class="npc-line">{{npcLine}}</div>
42
- `,
25
+ ...INTERACTABLE_UI,
43
26
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waica/archetype-topdown",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Waica top-down archetype — opinionated setup for Zelda-like overhead adventures",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@waica/behaviors": "^0.7.0",
28
- "@waica/engine": "^0.7.0"
27
+ "@waica/behaviors": "^0.8.0",
28
+ "@waica/engine": "^0.8.0"
29
29
  }
30
30
  }
@@ -0,0 +1,56 @@
1
+ import { Component, type AnimationFacingProvider, type CameraVelocity, type CameraVelocityProvider } from '@waica/engine';
2
+ /** Shared velocity, collision and provider behavior for square-grid motors. */
3
+ export declare abstract class GridMotor<Facing extends string> extends Component implements CameraVelocityProvider, AnimationFacingProvider {
4
+ static displayName: string;
5
+ static params: {
6
+ moveSpeed: {
7
+ label: string;
8
+ min: number;
9
+ max: number;
10
+ step: number;
11
+ };
12
+ acceleration: {
13
+ label: string;
14
+ min: number;
15
+ max: number;
16
+ step: number;
17
+ };
18
+ deceleration: {
19
+ label: string;
20
+ min: number;
21
+ max: number;
22
+ step: number;
23
+ };
24
+ walkThreshold: {
25
+ label: string;
26
+ min: number;
27
+ max: number;
28
+ step: number;
29
+ };
30
+ };
31
+ static transient: string[];
32
+ moveSpeed: number;
33
+ acceleration: number;
34
+ deceleration: number;
35
+ /** Speed above this reads as walking (the idle ↔ walk edge). */
36
+ walkThreshold: number;
37
+ /** The character's AABB hitbox — a footprint, shorter than the sprite. */
38
+ hitboxWidth: number;
39
+ hitboxHeight: number;
40
+ vx: number;
41
+ vy: number;
42
+ abstract facing: Facing;
43
+ /** The scene camera reads follow velocity through this explicit seam. */
44
+ getCameraVelocity(): CameraVelocity;
45
+ /** The StateMachine resolves directional clips through this explicit seam. */
46
+ getAnimationFacing(): string;
47
+ /** Accelerates each axis toward an already-normalized logical direction. */
48
+ protected accelerateToward(x: number, y: number, dt: number): void;
49
+ /** Live speed, for the idle ↔ walk edge. */
50
+ speed(): number;
51
+ /** Integrates velocity and resolves each logical axis against Solids. */
52
+ step(dt: number): void;
53
+ halt(): void;
54
+ private resolveAxis;
55
+ private collisionBody;
56
+ }