@auraindustry/aurajs 0.1.1 → 0.1.5

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 (144) hide show
  1. package/README.md +7 -0
  2. package/benchmarks/perf-thresholds.json +27 -0
  3. package/package.json +6 -1
  4. package/src/ai-guidance.mjs +302 -0
  5. package/src/asset-pack.mjs +2 -1
  6. package/src/authored-project.mjs +498 -2
  7. package/src/authored-runtime.mjs +14 -0
  8. package/src/bin-integrity.mjs +33 -26
  9. package/src/build-contract/capabilities.mjs +87 -1
  10. package/src/build-contract/constants.mjs +1 -0
  11. package/src/build-contract.mjs +2 -0
  12. package/src/bundler.mjs +143 -13
  13. package/src/cli.mjs +681 -13
  14. package/src/commands/packs.mjs +741 -0
  15. package/src/commands/project-authoring.mjs +128 -1
  16. package/src/conformance/cases/app-and-ui-runtime-cases.mjs +1 -2
  17. package/src/conformance/cases/core-runtime-cases.mjs +6 -2
  18. package/src/conformance/cases/scene3d-and-media-cases.mjs +238 -0
  19. package/src/conformance/cases/systems-and-gameplay-cases.mjs +1126 -10
  20. package/src/conformance-mobile.mjs +166 -0
  21. package/src/conformance.mjs +89 -30
  22. package/src/evidence-bundle.mjs +242 -0
  23. package/src/external-package-surface.mjs +1 -1
  24. package/src/headless-test/runtime-coordinator.mjs +186 -33
  25. package/src/headless-test.mjs +2 -0
  26. package/src/helpers/2d/index.mjs +183 -0
  27. package/src/helpers/index.mjs +26 -0
  28. package/src/helpers/starter-utils/adventure-objectives.js +102 -0
  29. package/src/helpers/starter-utils/adventure-world-2d.js +221 -0
  30. package/src/helpers/starter-utils/animation-2d.js +337 -0
  31. package/src/helpers/starter-utils/animation-packaging-2d.js +203 -0
  32. package/src/helpers/starter-utils/atlas-assets-2d.js +111 -0
  33. package/src/helpers/starter-utils/autoplay-debug-2d.js +215 -0
  34. package/src/helpers/starter-utils/avatar-3d.js +404 -0
  35. package/src/helpers/starter-utils/combat-feedback-2d.js +320 -0
  36. package/src/helpers/starter-utils/combat-runtime-2d.js +290 -0
  37. package/src/helpers/starter-utils/core.js +150 -0
  38. package/src/helpers/starter-utils/dialogue-2d.js +351 -0
  39. package/src/helpers/starter-utils/enemy-archetypes-2d.js +68 -0
  40. package/src/helpers/starter-utils/index.js +26 -0
  41. package/src/helpers/starter-utils/inventory-2d.js +268 -0
  42. package/src/helpers/starter-utils/journal-2d.js +267 -0
  43. package/src/helpers/starter-utils/platformer-3d.js +132 -0
  44. package/src/helpers/starter-utils/scene-audio-2d.js +236 -0
  45. package/src/helpers/starter-utils/streamed-world-2d.js +378 -0
  46. package/src/helpers/starter-utils/tilemap-nav-2d.js +499 -0
  47. package/src/helpers/starter-utils/tilemap-world-2d.js +205 -0
  48. package/src/helpers/starter-utils/triggers.js +662 -0
  49. package/src/helpers/starter-utils/tween-2d.js +615 -0
  50. package/src/helpers/starter-utils/wave-director.js +101 -0
  51. package/src/helpers/starter-utils/world-compositor-2d.js +253 -0
  52. package/src/helpers/starter-utils/world-persistence-2d.js +180 -0
  53. package/src/mobile/android/build.mjs +606 -0
  54. package/src/mobile/android/host-artifact.mjs +280 -0
  55. package/src/mobile/ios/build.mjs +1323 -0
  56. package/src/mobile/ios/host-artifact.mjs +819 -0
  57. package/src/mobile/shared/capabilities.mjs +174 -0
  58. package/src/package-integrity.mjs +18 -4
  59. package/src/packs/catalog.mjs +259 -0
  60. package/src/perf-benchmark-runner.mjs +17 -12
  61. package/src/perf-benchmark.mjs +408 -4
  62. package/src/publish-command.mjs +434 -17
  63. package/src/publish-validation.mjs +22 -11
  64. package/src/replay-runtime.mjs +257 -0
  65. package/src/scaffold/config.mjs +2 -0
  66. package/src/scaffold/fs.mjs +8 -1
  67. package/src/scaffold/project-docs.mjs +101 -41
  68. package/src/scaffold.mjs +4 -0
  69. package/src/session-runtime.mjs +4 -3
  70. package/src/web-conformance.mjs +0 -36
  71. package/templates/create/2d/src/runtime/app.js +4 -0
  72. package/templates/create/2d-adventure/config/gameplay/adventure.config.js +9 -6
  73. package/templates/create/2d-adventure/content/gameplay/dialogue.js +85 -0
  74. package/templates/create/2d-adventure/content/gameplay/world.js +32 -36
  75. package/templates/create/2d-adventure/content/gameplay/world.tilemap.json +273 -0
  76. package/templates/create/2d-adventure/docs/design/loop.md +4 -3
  77. package/templates/create/2d-adventure/prefabs/relic.prefab.js +10 -10
  78. package/templates/create/2d-adventure/prefabs/world.prefab.js +127 -74
  79. package/templates/create/2d-adventure/scenes/gameplay.scene.js +603 -112
  80. package/templates/create/2d-adventure/src/runtime/capabilities.js +16 -0
  81. package/templates/create/2d-adventure/ui/hud.screen.js +187 -4
  82. package/templates/create/2d-adventure/ui/journal.screen.js +183 -0
  83. package/templates/create/2d-survivor/src/runtime/app.js +4 -0
  84. package/templates/create/3d/scenes/gameplay.scene.js +30 -3
  85. package/templates/create/3d/src/runtime/app.js +4 -0
  86. package/templates/create/3d/src/runtime/capabilities.js +5 -0
  87. package/templates/create/3d/src/runtime/materials.js +10 -0
  88. package/templates/create/3d-adventure/scenes/gameplay.scene.js +30 -3
  89. package/templates/create/3d-adventure/src/runtime/capabilities.js +5 -0
  90. package/templates/create/3d-adventure/src/runtime/materials.js +11 -0
  91. package/templates/create/3d-collectathon/scenes/gameplay.scene.js +30 -3
  92. package/templates/create/3d-collectathon/src/runtime/app.js +4 -0
  93. package/templates/create/3d-collectathon/src/runtime/capabilities.js +5 -0
  94. package/templates/create/3d-collectathon/src/runtime/materials.js +10 -0
  95. package/templates/create/blank/assets/splash/aurajs-gg-wordmark.webp +0 -0
  96. package/templates/create/blank/assets/splash/bg.webp +0 -0
  97. package/templates/create/blank/assets/splash/boot-loop.wav +0 -0
  98. package/templates/create/blank/assets/splash/boot-sting.wav +0 -0
  99. package/templates/create/blank/assets/splash/logo-mascot-sheet.webp +0 -0
  100. package/templates/create/blank/assets/splash/logoholo.webp +0 -0
  101. package/templates/create/blank/src/main.js +5 -1
  102. package/templates/create/blank/src/runtime/splash.js +305 -0
  103. package/templates/create/local-multiplayer/scenes/gameplay.scene.js +186 -12
  104. package/templates/create/local-multiplayer/src/runtime/capabilities.js +8 -1
  105. package/templates/create/shared/assets/splash/aurajs-gg-wordmark.webp +0 -0
  106. package/templates/create/shared/assets/splash/bg.webp +0 -0
  107. package/templates/create/shared/assets/splash/boot-loop.wav +0 -0
  108. package/templates/create/shared/assets/splash/boot-sting.wav +0 -0
  109. package/templates/create/shared/assets/splash/logo-mascot-sheet.webp +0 -0
  110. package/templates/create/shared/assets/splash/logoholo.webp +0 -0
  111. package/templates/create/shared/src/runtime/splash.js +305 -0
  112. package/templates/create/shared/src/runtime/ui-forms.js +552 -0
  113. package/templates/create/shared/src/starter-utils/adventure-world-2d.js +221 -0
  114. package/templates/create/shared/src/starter-utils/animation-packaging-2d.js +203 -0
  115. package/templates/create/shared/src/starter-utils/atlas-assets-2d.js +111 -0
  116. package/templates/create/shared/src/starter-utils/autoplay-debug-2d.js +215 -0
  117. package/templates/create/shared/src/starter-utils/combat-runtime-2d.js +290 -0
  118. package/templates/create/shared/src/starter-utils/dialogue-2d.js +351 -0
  119. package/templates/create/shared/src/starter-utils/index.js +15 -1
  120. package/templates/create/shared/src/starter-utils/inventory-2d.js +268 -0
  121. package/templates/create/shared/src/starter-utils/journal-2d.js +267 -0
  122. package/templates/create/shared/src/starter-utils/scene-audio-2d.js +236 -0
  123. package/templates/create/shared/src/starter-utils/streamed-world-2d.js +378 -0
  124. package/templates/create/shared/src/starter-utils/tilemap-nav-2d.js +499 -0
  125. package/templates/create/shared/src/starter-utils/tilemap-world-2d.js +205 -0
  126. package/templates/create/shared/src/starter-utils/world-compositor-2d.js +253 -0
  127. package/templates/create/shared/src/starter-utils/world-persistence-2d.js +180 -0
  128. package/templates/create/video-cutscene/src/runtime/app.js +4 -0
  129. package/templates/create-bin/play.js +148 -7
  130. package/templates/skills/auramaxx/SKILL.md +46 -0
  131. package/templates/skills/auramaxx/project-requirements.md +68 -0
  132. package/templates/skills/auramaxx/starter-recipes.md +104 -0
  133. package/templates/skills/auramaxx/validation-checklist.md +49 -0
  134. package/templates/starter/assets/splash/aurajs-gg-wordmark.webp +0 -0
  135. package/templates/starter/assets/splash/bg.webp +0 -0
  136. package/templates/starter/assets/splash/boot-loop.wav +0 -0
  137. package/templates/starter/assets/splash/boot-sting.wav +0 -0
  138. package/templates/starter/assets/splash/logo-mascot-sheet.webp +0 -0
  139. package/templates/starter/assets/splash/logoholo.webp +0 -0
  140. package/templates/starter/src/main.js +4 -0
  141. package/templates/starter/src/runtime/splash.js +305 -0
  142. package/templates/skills/aurajs/SKILL.md +0 -96
  143. package/templates/skills/aurajs/api-contract-3d.md +0 -7
  144. package/templates/skills/aurajs/api-contract.md +0 -7
@@ -1,4 +1,12 @@
1
- import { BEACON_SITES, EXIT_GATE, WORLD_BOUNDS, WORLD_OBSTACLES } from '../content/gameplay/world.js';
1
+ import {
2
+ createTilemapWorld2D,
3
+ drawTilemapWorld2D,
4
+ ensureTilemapWorldLoaded2D,
5
+ listTilemapWorldObjects2D,
6
+ moveActorThroughTilemapWorld2D,
7
+ resolveTilemapSpawn2D,
8
+ } from '../src/starter-utils/index.js';
9
+ import { WORLD_OBJECT_LAYERS, WORLD_ORIGIN, WORLD_TILEMAP } from '../content/gameplay/world.js';
2
10
 
3
11
  const worldPrefab = {
4
12
  id: 'world',
@@ -8,118 +16,163 @@ const worldPrefab = {
8
16
  kind: 'environment2d',
9
17
  },
10
18
  hooks: {},
11
- notes: ['Keep authored room layout in content/ and world rendering or collision affordances here.'],
19
+ notes: ['Keep authored room layout in content/ and tilemap-backed world rendering or collision affordances here.'],
12
20
  };
13
21
 
14
- function centeredRect(x, y, size) {
22
+ function worldBounds(world) {
23
+ const info = world?.info || null;
24
+ const width = Number(info?.width || 0) * Number(info?.tilewidth || 0);
25
+ const height = Number(info?.height || 0) * Number(info?.tileheight || 0);
15
26
  return {
16
- x: x - (size * 0.5),
17
- y: y - (size * 0.5),
18
- w: size,
19
- h: size,
27
+ x: Number(world?.offsetX || 0),
28
+ y: Number(world?.offsetY || 0),
29
+ width,
30
+ height,
20
31
  };
21
32
  }
22
33
 
23
- function rectsOverlap(left, right) {
24
- return left.x < right.x + right.w
25
- && left.x + left.w > right.x
26
- && left.y < right.y + right.h
27
- && left.y + left.h > right.y;
34
+ function objectProperty(object, name, fallback = null) {
35
+ if (!object || typeof object !== 'object') return fallback;
36
+ const properties = object.properties;
37
+ if (Array.isArray(properties)) {
38
+ const entry = properties.find((candidate) => candidate && candidate.name === name) || null;
39
+ return entry && Object.prototype.hasOwnProperty.call(entry, 'value') ? entry.value : fallback;
40
+ }
41
+ if (properties && typeof properties === 'object' && Object.prototype.hasOwnProperty.call(properties, name)) {
42
+ return properties[name];
43
+ }
44
+ return fallback;
28
45
  }
29
46
 
30
- function clampActorRect(rect) {
31
- rect.x = Math.max(WORLD_BOUNDS.x, Math.min(WORLD_BOUNDS.x + WORLD_BOUNDS.width - rect.w, rect.x));
32
- rect.y = Math.max(WORLD_BOUNDS.y, Math.min(WORLD_BOUNDS.y + WORLD_BOUNDS.height - rect.h, rect.y));
33
- return rect;
47
+ function ensureScenery(world) {
48
+ if (!world || world.loaded !== true) return [];
49
+ if (!Array.isArray(world.sceneryObjects)) {
50
+ world.sceneryObjects = listTilemapWorldObjects2D(world, globalThis.aura, {
51
+ layer: WORLD_OBJECT_LAYERS.scenery,
52
+ includeHidden: true,
53
+ });
54
+ }
55
+ return world.sceneryObjects;
34
56
  }
35
57
 
36
- function collidesWithObstacle(rect) {
37
- return WORLD_OBSTACLES.some((obstacle) => rectsOverlap(rect, obstacle));
58
+ function interactablesByKind(interactables = [], kind) {
59
+ return interactables.filter((entry) => entry && entry.kind === kind);
38
60
  }
39
61
 
40
- function applyActorRect(actor, rect, size) {
41
- actor.x = rect.x + (size * 0.5);
42
- actor.y = rect.y + (size * 0.5);
62
+ export function createAdventureWorldState() {
63
+ return createTilemapWorld2D({
64
+ mapSource: WORLD_TILEMAP,
65
+ offsetX: WORLD_ORIGIN.x,
66
+ offsetY: WORLD_ORIGIN.y,
67
+ cull: false,
68
+ });
43
69
  }
44
70
 
45
71
  export function createWorldPrefab() {
46
72
  return {
47
73
  ...worldPrefab,
48
- obstacleCount: WORLD_OBSTACLES.length,
74
+ worldKind: 'tilemap-backed-adventure',
49
75
  };
50
76
  }
51
77
 
52
- export function moveActorThroughAdventureWorld(actor, deltaX, deltaY, size) {
53
- const baseRect = centeredRect(actor.x, actor.y, size);
54
-
55
- if (deltaX !== 0) {
56
- const candidate = clampActorRect({
57
- x: baseRect.x + deltaX,
58
- y: baseRect.y,
59
- w: baseRect.w,
60
- h: baseRect.h,
78
+ export function ensureAdventureWorldLoaded(world) {
79
+ const loaded = ensureTilemapWorldLoaded2D(world, globalThis.aura);
80
+ if (!loaded) return false;
81
+ if (!Array.isArray(world.sceneryObjects)) {
82
+ world.sceneryObjects = listTilemapWorldObjects2D(world, globalThis.aura, {
83
+ layer: WORLD_OBJECT_LAYERS.scenery,
84
+ includeHidden: true,
61
85
  });
62
- if (!collidesWithObstacle(candidate)) {
63
- baseRect.x = candidate.x;
64
- }
65
86
  }
87
+ return true;
88
+ }
66
89
 
67
- if (deltaY !== 0) {
68
- const candidate = clampActorRect({
69
- x: baseRect.x,
70
- y: baseRect.y + deltaY,
71
- w: baseRect.w,
72
- h: baseRect.h,
73
- });
74
- if (!collidesWithObstacle(candidate)) {
75
- baseRect.y = candidate.y;
76
- }
77
- }
90
+ export function resolveAdventurePlayerSpawn(world, markerName = 'player-start') {
91
+ ensureAdventureWorldLoaded(world);
92
+ return resolveTilemapSpawn2D(world, globalThis.aura, {
93
+ layer: WORLD_OBJECT_LAYERS.markers,
94
+ name: markerName,
95
+ centered: true,
96
+ }) || {
97
+ x: WORLD_ORIGIN.x + 96,
98
+ y: WORLD_ORIGIN.y + 96,
99
+ };
100
+ }
78
101
 
79
- applyActorRect(actor, baseRect, size);
102
+ export function listAdventureWorldObjects(world, options = {}) {
103
+ ensureAdventureWorldLoaded(world);
104
+ return listTilemapWorldObjects2D(world, globalThis.aura, options);
80
105
  }
81
106
 
82
- export function drawAdventureWorld({ beacons = [], gateReady = false, elapsed = 0 }) {
107
+ export function moveActorThroughAdventureWorld(world, actor, deltaX, deltaY, size) {
108
+ return moveActorThroughTilemapWorld2D(world, globalThis.aura, actor, deltaX, deltaY, size, size);
109
+ }
110
+
111
+ export function drawAdventureWorld({
112
+ world,
113
+ interactables = [],
114
+ elapsed = 0,
115
+ activeCheckpointId = null,
116
+ runComplete = false,
117
+ }) {
118
+ ensureAdventureWorldLoaded(world);
119
+ const bounds = worldBounds(world);
120
+
83
121
  aura.draw2d.rect(
84
- WORLD_BOUNDS.x - 24,
85
- WORLD_BOUNDS.y - 24,
86
- WORLD_BOUNDS.width + 48,
87
- WORLD_BOUNDS.height + 48,
88
- aura.rgb(0.06, 0.08, 0.11),
122
+ bounds.x - 24,
123
+ bounds.y - 24,
124
+ bounds.width + 48,
125
+ bounds.height + 48,
126
+ aura.rgb(0.05, 0.07, 0.1),
89
127
  );
90
128
  aura.draw2d.rect(
91
- WORLD_BOUNDS.x,
92
- WORLD_BOUNDS.y,
93
- WORLD_BOUNDS.width,
94
- WORLD_BOUNDS.height,
95
- aura.rgb(0.12, 0.16, 0.12),
129
+ bounds.x,
130
+ bounds.y,
131
+ bounds.width,
132
+ bounds.height,
133
+ aura.rgb(0.1, 0.14, 0.11),
96
134
  );
135
+ drawTilemapWorld2D(world, globalThis.aura, { cull: false });
97
136
 
98
- for (const obstacle of WORLD_OBSTACLES) {
99
- aura.draw2d.rect(obstacle.x, obstacle.y, obstacle.w, obstacle.h, aura.rgb(0.22, 0.26, 0.24));
137
+ for (const object of ensureScenery(world)) {
138
+ const fill = String(objectProperty(object, 'fill', '#24322a'));
139
+ const border = String(objectProperty(object, 'border', '#45534b'));
140
+ aura.draw2d.rect(object.worldX, object.worldY, object.width, object.height, fill);
141
+ aura.draw2d.rect(object.worldX + 4, object.worldY + 4, Math.max(0, object.width - 8), Math.max(0, object.height - 8), border);
100
142
  }
101
143
 
102
- const beaconById = new Map(beacons.map((beacon) => [beacon.id, beacon]));
103
- for (const site of BEACON_SITES) {
104
- const lit = beaconById.get(site.id)?.lit === true;
105
- const pulse = lit ? 1.0 : 0.9 + (Math.sin((elapsed * 2.2) + site.x) * 0.1);
106
- const size = site.size * pulse;
144
+ for (const checkpoint of interactablesByKind(interactables, 'checkpoint')) {
145
+ const active = checkpoint.checkpointId === activeCheckpointId || checkpoint.activated === true;
146
+ const pulse = 0.92 + (Math.sin((elapsed * 2.1) + checkpoint.x) * 0.08);
147
+ const size = Math.max(checkpoint.w, checkpoint.h) * pulse;
107
148
  aura.draw2d.rect(
108
- site.x - (size * 0.5),
109
- site.y - (size * 0.5),
149
+ checkpoint.x + ((checkpoint.w - size) * 0.5),
150
+ checkpoint.y + ((checkpoint.h - size) * 0.5),
110
151
  size,
111
152
  size,
112
- lit ? aura.rgb(0.58, 1.0, 0.74) : aura.rgb(0.44, 0.58, 0.74),
153
+ active ? aura.rgb(0.58, 1.0, 0.74) : aura.rgb(0.46, 0.64, 0.8),
113
154
  );
114
155
  }
115
156
 
116
- aura.draw2d.rect(
117
- EXIT_GATE.x,
118
- EXIT_GATE.y,
119
- EXIT_GATE.w,
120
- EXIT_GATE.h,
121
- gateReady ? aura.rgb(0.62, 1.0, 0.76) : aura.rgb(0.2, 0.24, 0.28),
122
- );
157
+ for (const prop of interactablesByKind(interactables, 'prop')) {
158
+ const active = prop.activated === true;
159
+ aura.draw2d.rect(prop.x, prop.y, prop.w, prop.h, active ? aura.rgb(0.72, 0.82, 0.94) : aura.rgb(0.36, 0.42, 0.5));
160
+ }
161
+
162
+ for (const gate of interactablesByKind(interactables, 'lock')) {
163
+ const pulse = gate.opened === true || runComplete === true
164
+ ? 1
165
+ : 0.92 + (Math.sin((elapsed * 2.4) + gate.x) * 0.08);
166
+ const width = gate.w * pulse;
167
+ const height = gate.h * pulse;
168
+ aura.draw2d.rect(
169
+ gate.x + ((gate.w - width) * 0.5),
170
+ gate.y + ((gate.h - height) * 0.5),
171
+ width,
172
+ height,
173
+ gate.opened === true || runComplete === true ? aura.rgb(0.64, 1.0, 0.78) : aura.rgb(0.24, 0.3, 0.36),
174
+ );
175
+ }
123
176
  }
124
177
 
125
178
  export default worldPrefab;