@tora-editor/tora 0.2.0 → 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/README.md +5 -6
- package/bin/tora.mjs +255 -29
- package/crates/packer/trusted/native-3d-meta.json +3 -3
- package/crates/packer/trusted/native-3d.js +180 -180
- package/crates/packer/trusted/native-meta.json +3 -3
- package/crates/packer/trusted/native.js +5 -5
- package/crates/packer/trusted/release-manifest.json +17 -17
- package/crates/packer/trusted/review-runtime-meta.json +3 -3
- package/crates/packer/trusted/review-runtime.js +182 -182
- package/docs/MIGRATION_0_3.md +39 -0
- package/docs/NATIVE_AGENT_TOOLS.md +12 -363
- package/docs/TORA_AGENT_SETUP.md +24 -106
- package/docs/TORA_CREATION_API.md +63 -365
- package/docs/reference/CORE_AUTHORING.md +8 -2
- package/docs/reference/PLAYABLE_STARTERS.md +1 -1
- package/docs/reference/packs/3d.md +2 -0
- package/package.json +6 -6
- package/packages/creative-project/project-v21.schema.json +108 -1
- package/scripts/lean/editor/entry.js +11 -6
- package/scripts/lean/editor/project-launcher.js +116 -0
- package/scripts/lean/editor/quick-edit-panel.js +479 -0
- package/scripts/lean/editor/review-editor.css +246 -68
- package/scripts/lean/editor/review-editor.js +1731 -1099
- package/scripts/lean/editor-state.mjs +6 -0
- package/scripts/lean/editor.mjs +6 -3
- package/scripts/lean/matrix.mjs +5 -0
- package/scripts/lean/native/agent-tools.mjs +35 -58
- package/scripts/lean/native/api.mjs +148 -134
- package/scripts/lean/native/audio-assets.mjs +30 -0
- package/scripts/lean/native/browser-pool.mjs +34 -0
- package/scripts/lean/native/build-cache.mjs +36 -5
- package/scripts/lean/native/contracts.mjs +8 -6
- package/scripts/lean/native/creative-qa.mjs +66 -12
- package/scripts/lean/native/demos.mjs +11 -20
- package/scripts/lean/native/document.mjs +14 -2
- package/scripts/lean/native/local-bundle.mjs +4 -2
- package/scripts/lean/native/mcp-server.mjs +16 -35
- package/scripts/lean/native/modules/harvest-restore.mjs +3 -284
- package/scripts/lean/native/modules/sort-puzzle.mjs +51 -0
- package/scripts/lean/native/modules/star-salvage.mjs +3 -368
- package/scripts/lean/native/project-bundle.mjs +3 -2
- package/scripts/lean/native/project-index.mjs +0 -2
- package/scripts/lean/native/qa-adapters.mjs +10 -0
- package/scripts/lean/native/quick-edit.mjs +328 -0
- package/scripts/lean/native/review.mjs +203 -572
- package/scripts/lean/native/schema-vocabulary.mjs +10 -0
- package/scripts/lean/native/schema.mjs +1 -1
- package/scripts/lean/native/scope.mjs +45 -0
- package/scripts/lean/native/service.mjs +242 -70
- package/scripts/lean/native/starters.mjs +135 -8
- package/scripts/lean/native/variant-adapters.mjs +8 -0
- package/scripts/lean/native/variants-core.mjs +186 -0
- package/scripts/lean/native/variants.mjs +63 -0
- package/scripts/lean/native/win-cues.mjs +1 -1
- package/skills/tora-playables/SKILL.md +1 -1
- package/scripts/lean/editor/review-intake.js +0 -837
- package/scripts/lean/model-client.mjs +0 -119
- package/scripts/lean/native/author-expansion-proofs.mjs +0 -143
- package/scripts/lean/native/author-fps.mjs +0 -545
- package/scripts/lean/native/author-games.mjs +0 -160
- package/scripts/lean/native/author-harvest.mjs +0 -74
- package/scripts/lean/native/author-primitive-proofs.mjs +0 -875
- package/scripts/lean/native/author-salvage.mjs +0 -71
- package/scripts/lean/native/chat-compose.mjs +0 -287
- package/scripts/lean/native/check-harvest-outcome-audio.mjs +0 -190
- package/scripts/lean/native/check-salvage.mjs +0 -200
- package/scripts/lean/native/compatibility.mjs +0 -34
- package/scripts/lean/native/concept.mjs +0 -633
- package/scripts/lean/native/draw-stroke.mjs +0 -26
- package/scripts/lean/native/erase-mask.mjs +0 -18
- package/scripts/lean/native/glb-loader.mjs +0 -468
- package/scripts/lean/native/harvest-recipe.mjs +0 -21
- package/scripts/lean/native/instance-steering.mjs +0 -24
- package/scripts/lean/native/intake-creator-agent.mjs +0 -98
- package/scripts/lean/native/intake-creator-tools.mjs +0 -218
- package/scripts/lean/native/interaction-gestures.mjs +0 -45
- package/scripts/lean/native/match-board.mjs +0 -138
- package/scripts/lean/native/modules/index.mjs +0 -54
- package/scripts/lean/native/modules/tap-collect.mjs +0 -54
- package/scripts/lean/native/path-network.mjs +0 -132
- package/scripts/lean/native/physics-2d.mjs +0 -154
- package/scripts/lean/native/physics-3d.mjs +0 -259
- package/scripts/lean/native/prepare-audio-collections.mjs +0 -112
- package/scripts/lean/native/prepare-fps-assets.mjs +0 -330
- package/scripts/lean/native/prepare-game-audio.mjs +0 -372
- package/scripts/lean/native/prepare-golf-3d-assets.py +0 -177
- package/scripts/lean/native/prepare-golf-assets.py +0 -211
- package/scripts/lean/native/prepare-harvest-audio.mjs +0 -83
- package/scripts/lean/native/prepare-harvest-images.mjs +0 -31
- package/scripts/lean/native/prepare-primitive-images.py +0 -25
- package/scripts/lean/native/prepare-space-salvage-images.mjs +0 -89
- package/scripts/lean/native/prepare-traffic-assets.py +0 -329
- package/scripts/lean/native/presentation.mjs +0 -335
- package/scripts/lean/native/review-agent-tools.mjs +0 -561
- package/scripts/lean/native/review-connection.mjs +0 -303
- package/scripts/lean/native/review-fields.mjs +0 -24
- package/scripts/lean/native/review-intake.mjs +0 -385
- package/scripts/lean/native/review-intents.mjs +0 -217
- package/scripts/lean/native/review-provider.mjs +0 -580
- package/scripts/lean/native/review-receipts.mjs +0 -76
- package/scripts/lean/native/review-resolver.mjs +0 -429
- package/scripts/lean/native/review-targets.mjs +0 -35
- package/scripts/lean/native/runtime.mjs +0 -1809
- package/scripts/lean/native/salvage-recipe.mjs +0 -20
- package/scripts/lean/native/stage-3d.mjs +0 -1121
- package/scripts/lean/native/verify.mjs +0 -4
- package/scripts/lean/scene-document.mjs +0 -48
|
@@ -1,545 +0,0 @@
|
|
|
1
|
-
import {readFile} from 'node:fs/promises';
|
|
2
|
-
import {resolve} from 'node:path';
|
|
3
|
-
import {emptyProject, applyOperations} from './document.mjs';
|
|
4
|
-
import {registerSourceBytes} from './assets.mjs';
|
|
5
|
-
|
|
6
|
-
const root = resolve(import.meta.dirname, '../../..');
|
|
7
|
-
const FPS_DIR = resolve(root, 'assets/tora-fps');
|
|
8
|
-
|
|
9
|
-
const create = (id, contract, x, y, width, height, extra = {}) => ({
|
|
10
|
-
kind: 'createComponent',
|
|
11
|
-
component: {
|
|
12
|
-
id,
|
|
13
|
-
contract,
|
|
14
|
-
transform: [1, 0, 0, 1, x, y],
|
|
15
|
-
parameters: {width, height, ...(extra.parameters ?? {})},
|
|
16
|
-
...(extra.sceneId ? {sceneId: extra.sceneId} : {}),
|
|
17
|
-
...(extra.parentId ? {parentId: extra.parentId} : {}),
|
|
18
|
-
...(extra.assetSlots ? {assetSlots: extra.assetSlots} : {}),
|
|
19
|
-
...(extra.prototype ? {prototype: true} : {}),
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
const group = (id, x, y, w, h, extra = {}) => create(id, 'native.group.v1', x, y, w, h, extra);
|
|
23
|
-
const rectangle = (id, x, y, w, h, fill, extra = {}) => create(id, 'native.rectangle.v1', x, y, w, h, {...extra, parameters: {fill, ...(extra.parameters ?? {})}});
|
|
24
|
-
const image = (id, assetId, x, y, w, h, extra = {}) => create(id, 'native.image.v1', x, y, w, h, {...extra, assetSlots: [{slotId: 'source', assetId}], parameters: {fit: 'contain', ...(extra.parameters ?? {})}});
|
|
25
|
-
const text = (id, value, x, y, w, h, extra = {}) => create(id, 'native.text.v1', x, y, w, h, {...extra, parameters: {text: value, fontSize: 18, fontFamily: 'monospace', fontWeight: '700', align: 'center', color: '#f8fafc', wrap: false, autoFit: true, minFontSize: 12, padding: 2, ...(extra.parameters ?? {})}});
|
|
26
|
-
const button = (id, x, y, w, h, fill, extra = {}) => create(id, 'native.button.v1', x, y, w, h, {...extra, parameters: {fill, ...(extra.parameters ?? {})}});
|
|
27
|
-
const mesh3d = (id, parentId, parameters, extra = {}) => create(id, 'native.mesh3d.v1', 0, 0, 10, 10, {parentId, ...extra, parameters});
|
|
28
|
-
const model3d = (id, parentId, assetId, parameters, extra = {}) => create(id, 'native.mesh3d.v1', 0, 0, 10, 10, {
|
|
29
|
-
parentId,
|
|
30
|
-
...extra,
|
|
31
|
-
assetSlots: [{slotId: 'source', assetId}],
|
|
32
|
-
parameters: {primitive: 'model', materialMode: 'lambert', ...parameters},
|
|
33
|
-
});
|
|
34
|
-
const behavior = (id, componentId, kind, parameters) => ({kind: 'putBehavior', behavior: {id, componentId, kind, parameters}});
|
|
35
|
-
const binding = (id, event, actions, condition) => ({kind: 'putBinding', binding: {id, event, actions, ...(condition ? {condition} : {})}});
|
|
36
|
-
const variable = (id, initial) => ({kind: 'putVariable', variable: {id, label: id, type: typeof initial === 'boolean' ? 'boolean' : 'number', initial}});
|
|
37
|
-
const layout = (componentId, x, y, scaleX = 1, scaleY = 1, extra = {}) => behavior(`${componentId}.layout`, componentId, 'responsive-layout', {x, y, scaleX, scaleY, ...extra});
|
|
38
|
-
const press = componentId => behavior(`${componentId}.press`, componentId, 'press-feedback', {scaleDown: .88, springBackSeconds: .14, liftShadow: true});
|
|
39
|
-
|
|
40
|
-
async function loadFpsAssets() {
|
|
41
|
-
const [visualPlan, audioPlan] = await Promise.all([
|
|
42
|
-
readFile(resolve(FPS_DIR, 'plan.json'), 'utf8').then(JSON.parse),
|
|
43
|
-
readFile(resolve(FPS_DIR, 'audio-plan.json'), 'utf8').then(JSON.parse),
|
|
44
|
-
]);
|
|
45
|
-
const packMap = Object.fromEntries(visualPlan.source.packs.map(p => [p.id, p]));
|
|
46
|
-
const assets = [];
|
|
47
|
-
for (const item of visualPlan.files) {
|
|
48
|
-
if (item.id === 'fps.icon.fire' || item.id === 'fps.icon.burst') continue;
|
|
49
|
-
const bytes = await readFile(resolve(root, item.file));
|
|
50
|
-
const pack = packMap[item.sourcePack];
|
|
51
|
-
assets.push({
|
|
52
|
-
id: item.id,
|
|
53
|
-
mime: item.mime,
|
|
54
|
-
data: bytes,
|
|
55
|
-
rights: `Kenney; CC0-1.0; ${item.sourceUrl}; attribution required: no`,
|
|
56
|
-
provenance: {
|
|
57
|
-
sourceId: item.sourcePack,
|
|
58
|
-
sourceUrl: item.sourceUrl,
|
|
59
|
-
license: 'CC0-1.0',
|
|
60
|
-
licenseFile: pack?.licenseFile ?? 'assets/tora-fps/licenses/starter-kit-fps.txt',
|
|
61
|
-
archiveSha256: item.archiveSha256,
|
|
62
|
-
processing: item.processing,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
for (const cue of audioPlan.files) {
|
|
67
|
-
const bytes = await readFile(resolve(root, cue.file));
|
|
68
|
-
assets.push({
|
|
69
|
-
id: cue.id,
|
|
70
|
-
mime: cue.mime,
|
|
71
|
-
data: bytes,
|
|
72
|
-
rights: cue.rights,
|
|
73
|
-
provenance: cue.provenance,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return assets;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** Dramatic twilight-sky 3D island diorama for victory & timeout debrief screens. */
|
|
80
|
-
function twilightIslandDiorama(sceneId, prefix, {heroModel}) {
|
|
81
|
-
const stageId = `${prefix}.stage`;
|
|
82
|
-
const wrapId = `${prefix}.stage.wrap`;
|
|
83
|
-
return [
|
|
84
|
-
group(wrapId, 0, 0, 390, 700, {sceneId}),
|
|
85
|
-
layout(wrapId, 0, 0, 700 / 390, 390 / 700),
|
|
86
|
-
create(stageId, 'native.stage3d.v1', 0, 0, 390, 700, {
|
|
87
|
-
sceneId,
|
|
88
|
-
parentId: wrapId,
|
|
89
|
-
parameters: {
|
|
90
|
-
skyColor: '#241c4a',
|
|
91
|
-
hemiSkyColor: '#ffe8c2',
|
|
92
|
-
hemiGroundColor: '#5c3f8f',
|
|
93
|
-
hemiIntensity: 1.7,
|
|
94
|
-
sunColor: '#ffd485',
|
|
95
|
-
sunIntensity: 2.35,
|
|
96
|
-
sunX: -6, sunY: 14, sunZ: 10,
|
|
97
|
-
toneMapping: 'neutral',
|
|
98
|
-
shadowsEnabled: true,
|
|
99
|
-
shadowMapSize: '512',
|
|
100
|
-
renderMaxDim: 640,
|
|
101
|
-
envIntensity: 0,
|
|
102
|
-
cameraX: 0, cameraY: 3.1, cameraZ: 6.4, cameraFov: 44,
|
|
103
|
-
landscapeCameraX: 2.4, landscapeCameraY: 2.9, landscapeCameraZ: 6.6, landscapeCameraFov: 34,
|
|
104
|
-
lookAtX: 0, lookAtY: 1.45, lookAtZ: -1.4,
|
|
105
|
-
introLift: 0,
|
|
106
|
-
},
|
|
107
|
-
}),
|
|
108
|
-
// Conquered floating sky island deck (castShadow: false prevents flat-deck shadow acne!)
|
|
109
|
-
model3d(`${prefix}.island`, stageId, 'fps.model.island', {x: 0, y: -.25, z: -1.6, sx: 1.15, sy: 1, sz: 1.15, receiveShadow: true, castShadow: false}, {sceneId}),
|
|
110
|
-
model3d(`${prefix}.wall.l`, stageId, 'fps.model.wall.high', {x: -2.1, y: .28, z: -2.5, ry: .28, sx: .95, sy: .95, sz: .95, castShadow: true, receiveShadow: true}, {sceneId}),
|
|
111
|
-
model3d(`${prefix}.wall.r`, stageId, 'fps.model.wall.low', {x: 1.9, y: .28, z: -2.1, ry: -.24, sx: 1, sy: 1, sz: 1, castShadow: true, receiveShadow: true}, {sceneId}),
|
|
112
|
-
model3d(`${prefix}.grass.a`, stageId, 'fps.model.grass', {x: -1.5, y: .25, z: -.4, ry: .5, sx: 1.25, sy: 1.25, sz: 1.25, castShadow: true}, {sceneId}),
|
|
113
|
-
model3d(`${prefix}.grass.b`, stageId, 'fps.model.grass.sm', {x: 1.6, y: .25, z: -.5, ry: -.7, sx: 1.25, sy: 1.25, sz: 1.25, castShadow: true}, {sceneId}),
|
|
114
|
-
model3d(`${prefix}.cloud.1`, stageId, 'fps.model.cloud', {x: -3.2, y: 4.1, z: -5.8, rx: .2, ry: .4, rz: .18, sx: 1.35, sy: 1.35, sz: 1.35, castShadow: false}, {sceneId}),
|
|
115
|
-
model3d(`${prefix}.cloud.2`, stageId, 'fps.model.cloud', {x: 3.1, y: 3.6, z: -6.4, rx: -.15, ry: -.5, rz: .22, sx: 1.5, sy: 1.5, sz: 1.5, castShadow: false}, {sceneId}),
|
|
116
|
-
behavior(`${prefix}.cloud.osc`, `${prefix}.cloud.1`, 'oscillate-3d', {axis: 'y', amplitude: .18, angularSpeed: 1.1, phase: 0}),
|
|
117
|
-
...(heroModel === 'blaster' ? [
|
|
118
|
-
// Hero floating twin-barrel sci-fi blaster cleanly framed inside 390x844 & landscape!
|
|
119
|
-
model3d(`${prefix}.hero.gun`, stageId, 'fps.model.blaster', {x: -.18, y: 1.5, z: -1.45, rx: .08, ry: 1.12, rz: -.05, sx: 1.05, sy: 1.05, sz: 1.05, castShadow: true}, {sceneId}),
|
|
120
|
-
behavior(`${prefix}.hero.gun.osc`, `${prefix}.hero.gun`, 'oscillate-3d', {axis: 'y', amplitude: .14, angularSpeed: 2.0, phase: 0}),
|
|
121
|
-
] : [
|
|
122
|
-
// Hovering security bot close-up with clean clearance below the alert header
|
|
123
|
-
model3d(`${prefix}.hero.bot`, stageId, 'fps.model.enemy', {x: 0, y: 1.38, z: -1.25, ry: .22, sx: 1.38, sy: 1.38, sz: 1.38, castShadow: true}, {sceneId}),
|
|
124
|
-
behavior(`${prefix}.hero.bot.osc`, `${prefix}.hero.bot`, 'oscillate-3d', {axis: 'y', amplitude: .14, angularSpeed: 2.3, phase: 0}),
|
|
125
|
-
]),
|
|
126
|
-
];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/** Bespoke Sci-Fi Tactical Debrief End Card (Kenney ui-pack-sci-fi + additive plasma starbursts — zero template reuse!). */
|
|
130
|
-
function sciFiEndScene({sceneId, prefix, header, subtitle, cta, win, panelAsset, emblemAsset, accentColor, ctaFill, ctaHover, ctaPressed}) {
|
|
131
|
-
return [
|
|
132
|
-
{kind: 'createScene', scene: {id: sceneId, label: header, role: 'end-card'}},
|
|
133
|
-
...twilightIslandDiorama(sceneId, prefix, {heroModel: win ? 'blaster' : 'bot'}),
|
|
134
|
-
|
|
135
|
-
// Top Sci-Fi Blade-Header Debrief Panel (Kenney ui-pack-sci-fi, clear of ad-SDK corners in portrait & landscape)
|
|
136
|
-
group(`${prefix}.header`, 36, 48, 318, 108, {sceneId}),
|
|
137
|
-
layout(`${prefix}.header`, 58, 52, .88, .88),
|
|
138
|
-
image(`${prefix}.header.panel`, panelAsset, 0, 0, 318, 108, {sceneId, parentId: `${prefix}.header`, parameters: {fit: 'stretch'}}),
|
|
139
|
-
text(`${prefix}.header.tag`, header, 16, 7, 178, 22, {sceneId, parentId: `${prefix}.header`, parameters: {align: 'left', fontSize: 13, color: '#ffffff'}}),
|
|
140
|
-
rectangle(`${prefix}.header.screen`, 18, 42, 282, 48, '#0f172ae8', {sceneId, parentId: `${prefix}.header`, parameters: {stroke: accentColor, strokeWidth: 2, radius: 6}}),
|
|
141
|
-
text(`${prefix}.header.sub`, subtitle, 24, 46, 270, 40, {sceneId, parentId: `${prefix}.header`, parameters: {fontSize: 16, color: accentColor}}),
|
|
142
|
-
|
|
143
|
-
// Bottom Sci-Fi Octagonal Rank Badge + Metallic Beveled Store CTA (Store CTA ONLY!)
|
|
144
|
-
group(`${prefix}.action`, 42, 470, 306, 174, {sceneId}),
|
|
145
|
-
layout(`${prefix}.action`, 62, 186, .88, .88),
|
|
146
|
-
image(`${prefix}.badge.frame`, 'fps.ui.badge', 113, 0, 80, 80, {sceneId, parentId: `${prefix}.action`, parameters: {fit: 'contain'}}),
|
|
147
|
-
rectangle(`${prefix}.badge.core`, 125, 12, 56, 56, win ? '#064e3be0' : '#7f1d1de0', {sceneId, parentId: `${prefix}.action`, parameters: {stroke: accentColor, strokeWidth: 2, radius: 10}}),
|
|
148
|
-
image(`${prefix}.badge.icon`, emblemAsset, 134, 21, 38, 38, {sceneId, parentId: `${prefix}.action`}),
|
|
149
|
-
behavior(`${prefix}.badge.bob`, `${prefix}.badge.icon`, 'animation', {property: 'y', from: 24, to: 18, seconds: .9, loop: true, easing: 'ease-in-out'}),
|
|
150
|
-
|
|
151
|
-
rectangle(`${prefix}.cta.bezel`, 14, 96, 278, 72, '#0f172ae6', {sceneId, parentId: `${prefix}.action`, parameters: {stroke: accentColor, strokeWidth: 2.5, radius: 12}}),
|
|
152
|
-
button(`${prefix}.cta`, 22, 104, 262, 56, ctaFill, {sceneId, parentId: `${prefix}.action`, parameters: {presentation: 'shiny-cta', hoverFill: ctaHover, pressedFill: ctaPressed, stroke: '#f8fafc', strokeWidth: 2.5, radius: 8}}),
|
|
153
|
-
text(`${prefix}.cta.label`, cta, 0, 0, 262, 56, {sceneId, parentId: `${prefix}.cta`, parameters: {fontSize: 22, color: '#081020'}}),
|
|
154
|
-
press(`${prefix}.cta`),
|
|
155
|
-
behavior(`${prefix}.cta.pulse`, `${prefix}.cta`, 'animation', {property: 'scale', from: 1, to: 1.035, seconds: .85, loop: true, easing: 'ease-in-out'}),
|
|
156
|
-
|
|
157
|
-
...(win ? [
|
|
158
|
-
// Additive glowing cyan & gold plasma starbursts + full-screen neon cyber shards!
|
|
159
|
-
group(`${prefix}.burst.l`, 72, 230, 12, 12, {sceneId}),
|
|
160
|
-
layout(`${prefix}.burst.l`, 460, 120, 1, 1),
|
|
161
|
-
group(`${prefix}.burst.r`, 318, 230, 12, 12, {sceneId}),
|
|
162
|
-
layout(`${prefix}.burst.r`, 620, 140, 1, 1),
|
|
163
|
-
group(`${prefix}.burst.c`, 195, 180, 12, 12, {sceneId}),
|
|
164
|
-
layout(`${prefix}.burst.c`, 540, 90, 1, 1),
|
|
165
|
-
behavior(`${prefix}.sparks.l`, `${prefix}.burst.l`, 'emitter', {shape: 'circle', coverage: 'local', count: 22, color: '#38bdf8', speed: 210, lifetime: 1.05, gravity: 110, spread: 360}),
|
|
166
|
-
behavior(`${prefix}.sparks.r`, `${prefix}.burst.r`, 'emitter', {shape: 'circle', coverage: 'local', count: 22, color: '#fde047', speed: 210, lifetime: 1.05, gravity: 110, spread: 360}),
|
|
167
|
-
behavior(`${prefix}.sparks.c`, `${prefix}.burst.c`, 'emitter', {shape: 'circle', coverage: 'local', count: 18, color: '#34d399', speed: 175, lifetime: .95, gravity: 95, spread: 360}),
|
|
168
|
-
behavior(`${prefix}.sparks.screen`, `${prefix}.burst.c`, 'emitter', {shape: 'confetti', coverage: 'screen', count: 28, color: '#38bdf8', color2: '#fde047', color3: '#34d399', speed: 175, lifetime: 2.2, gravity: 150, spread: 360}),
|
|
169
|
-
] : []),
|
|
170
|
-
|
|
171
|
-
binding(`${prefix}.enter`, {kind: 'sceneEnter', sceneId}, [
|
|
172
|
-
{kind: 'animate', behaviorId: `${prefix}.badge.bob`},
|
|
173
|
-
{kind: 'animate', behaviorId: `${prefix}.cta.pulse`},
|
|
174
|
-
...(win ? [
|
|
175
|
-
{kind: 'emit', behaviorId: `${prefix}.sparks.l`},
|
|
176
|
-
{kind: 'emit', behaviorId: `${prefix}.sparks.r`},
|
|
177
|
-
{kind: 'emit', behaviorId: `${prefix}.sparks.c`},
|
|
178
|
-
{kind: 'emit', behaviorId: `${prefix}.sparks.screen`},
|
|
179
|
-
] : []),
|
|
180
|
-
{kind: 'playAudio', behaviorId: win ? 'fps.sfx.win' : 'fps.sfx.loss'},
|
|
181
|
-
]),
|
|
182
|
-
binding(`${prefix}.store`, {kind: 'click', componentId: `${prefix}.cta`}, [{kind: 'store'}]),
|
|
183
|
-
];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export async function createSkyBlasterProject(projectId = 'sky-blaster') {
|
|
187
|
-
const assets = await loadFpsAssets();
|
|
188
|
-
const audioRig = [
|
|
189
|
-
group('fps.sfx', 0, 0, 4, 4, {parameters: {visible: false}}),
|
|
190
|
-
{kind: 'replaceAsset', id: 'fps.sfx', assetId: 'fps.audio.ambient'},
|
|
191
|
-
behavior('fps.sfx.ambient', 'fps.sfx', 'audio', {bus: 'music', role: 'ambient', loop: true, volume: .09, frequency: 220, seconds: 1}),
|
|
192
|
-
...['blaster', 'hit', 'kill', 'win', 'loss'].flatMap(name => {
|
|
193
|
-
const cfg = {
|
|
194
|
-
blaster: {bus: 'sfx', role: 'tap', volume: .17, cooldownMs: 55, pitchJitter: .04},
|
|
195
|
-
hit: {bus: 'sfx', role: 'match', volume: .19, cooldownMs: 45, pitchJitter: .06},
|
|
196
|
-
kill: {bus: 'stinger', role: 'reward', volume: .25, cooldownMs: 70, pitchJitter: .03},
|
|
197
|
-
win: {bus: 'stinger', role: 'win', volume: .28, cooldownMs: 250, pitchJitter: 0},
|
|
198
|
-
loss: {bus: 'stinger', role: 'loss', volume: .22, cooldownMs: 250, pitchJitter: 0},
|
|
199
|
-
}[name];
|
|
200
|
-
const holderId = `fps.sfx.${name}.host`;
|
|
201
|
-
return [
|
|
202
|
-
group(holderId, 0, 0, 4, 4, {parameters: {visible: false}}),
|
|
203
|
-
{kind: 'replaceAsset', id: holderId, assetId: `fps.audio.${name}`},
|
|
204
|
-
behavior(`fps.sfx.${name}`, holderId, 'audio', {loop: false, frequency: 440, seconds: .4, ...cfg}),
|
|
205
|
-
];
|
|
206
|
-
}),
|
|
207
|
-
];
|
|
208
|
-
|
|
209
|
-
const assetOps = assets.map(a => ({
|
|
210
|
-
kind: 'registerAsset',
|
|
211
|
-
asset: {
|
|
212
|
-
id: a.id,
|
|
213
|
-
mime: a.mime,
|
|
214
|
-
bytes: a.data.length,
|
|
215
|
-
hash: 'sha256:' + '0'.repeat(64),
|
|
216
|
-
rights: a.rights,
|
|
217
|
-
provenance: 'imported',
|
|
218
|
-
},
|
|
219
|
-
}));
|
|
220
|
-
const ops = [
|
|
221
|
-
...assetOps,
|
|
222
|
-
...audioRig,
|
|
223
|
-
variable('fps.kills', 0),
|
|
224
|
-
variable('fps.shots', 0),
|
|
225
|
-
variable('fps.hp', 100),
|
|
226
|
-
variable('fps.wave', 1),
|
|
227
|
-
variable('fps.won', false),
|
|
228
|
-
variable('fps.win.hold', 0),
|
|
229
|
-
|
|
230
|
-
// Full-bleed responsive 3D WebGL2 stage (Twilight Synth-Sky floating island arena!)
|
|
231
|
-
group('fps.stage.wrap', 0, 0, 390, 700),
|
|
232
|
-
layout('fps.stage.wrap', 0, 0, 700 / 390, 390 / 700),
|
|
233
|
-
create('fps.stage', 'native.stage3d.v1', 0, 0, 390, 700, {
|
|
234
|
-
parentId: 'fps.stage.wrap',
|
|
235
|
-
parameters: {
|
|
236
|
-
skyColor: '#241c4a',
|
|
237
|
-
hemiSkyColor: '#ffe8c2',
|
|
238
|
-
hemiGroundColor: '#5c3f8f',
|
|
239
|
-
hemiIntensity: 1.65,
|
|
240
|
-
sunColor: '#ffd485',
|
|
241
|
-
sunIntensity: 2.25,
|
|
242
|
-
sunX: -7, sunY: 16, sunZ: 9,
|
|
243
|
-
toneMapping: 'none',
|
|
244
|
-
shadowsEnabled: false,
|
|
245
|
-
renderMaxDim: 512,
|
|
246
|
-
envIntensity: 0,
|
|
247
|
-
cameraX: 0, cameraY: 1.95, cameraZ: 5.2, cameraFov: 70,
|
|
248
|
-
landscapeCameraX: 0, landscapeCameraY: 1.95, landscapeCameraZ: 5.2, landscapeCameraFov: 50,
|
|
249
|
-
lookAtX: 0, lookAtY: 1.95, lookAtZ: -4.0,
|
|
250
|
-
introLift: 0,
|
|
251
|
-
},
|
|
252
|
-
}),
|
|
253
|
-
|
|
254
|
-
// Home floating mint-grass island beneath the player
|
|
255
|
-
model3d('fps.island.home', 'fps.stage', 'fps.model.island', {x: 0, y: -.35, z: 4.5, sx: 1.25, sy: 1.0, sz: 1.25, castShadow: false}),
|
|
256
|
-
|
|
257
|
-
// Mid-left floating mint island + tall coral cover wall
|
|
258
|
-
model3d('fps.island.left', 'fps.stage', 'fps.model.island', {x: -4.5, y: .45, z: -4.6, ry: .24, sx: 1.08, sy: 1.0, sz: 1.08, castShadow: false}),
|
|
259
|
-
model3d('fps.wall.left', 'fps.stage', 'fps.model.wall.high', {x: -5.8, y: .95, z: -4.3, ry: .24, sx: 1.0, sy: 1.0, sz: 1.0}),
|
|
260
|
-
behavior('fps.wall.left.phys', 'fps.wall.left', 'physics-3d', {mode: 'static', fitColliderFromModel: true, radius: .6, hx: .75, hz: .35, angle: .24, friction: 1, restitution: .5, maxSpeed: 1, boundsX: 12, boundsZ: 12, ramp: false, restSpeed: .1, restDelaySeconds: .25}),
|
|
261
|
-
model3d('fps.grass.left.a', 'fps.stage', 'fps.model.grass', {x: -2.8, y: .95, z: -3.1, ry: .2, sx: 1.1, sy: 1.1, sz: 1.1}),
|
|
262
|
-
|
|
263
|
-
// Mid-right floating mint island + low coral barrier
|
|
264
|
-
model3d('fps.island.right', 'fps.stage', 'fps.model.island', {x: 4.5, y: .35, z: -4.8, ry: -.22, sx: 1.08, sy: 1.0, sz: 1.08, castShadow: false}),
|
|
265
|
-
model3d('fps.wall.right', 'fps.stage', 'fps.model.wall.low', {x: 4.65, y: .85, z: -4.2, ry: -.22, sx: 1.0, sy: 1.0, sz: 1.0}),
|
|
266
|
-
behavior('fps.wall.right.phys', 'fps.wall.right', 'physics-3d', {mode: 'static', fitColliderFromModel: true, radius: .6, hx: 1.1, hz: .35, angle: -.22, friction: 1, restitution: .5, maxSpeed: 1, boundsX: 12, boundsZ: 12, ramp: false, restSpeed: .1, restDelaySeconds: .25}),
|
|
267
|
-
model3d('fps.grass.right.a', 'fps.stage', 'fps.model.grass.sm', {x: 2.75, y: .85, z: -3.4, ry: -.5, sx: 1.15, sy: 1.15, sz: 1.15}),
|
|
268
|
-
|
|
269
|
-
// Far center floating island + coral battlements
|
|
270
|
-
model3d('fps.island.far', 'fps.stage', 'fps.model.island', {x: 0, y: .6, z: -9.8, ry: .06, sx: 1.18, sy: 1.0, sz: 1.08, castShadow: false}),
|
|
271
|
-
model3d('fps.wall.far.l', 'fps.stage', 'fps.model.wall.high', {x: -2.0, y: 1.1, z: -10.5, ry: .16, sx: 1.05, sy: 1.05, sz: 1.05}),
|
|
272
|
-
|
|
273
|
-
// Floating coral jump pads
|
|
274
|
-
model3d('fps.pad.center', 'fps.stage', 'fps.model.pad', {x: 0, y: 1.35, z: -6.2, ry: .05, sx: 1.0, sy: 1.0, sz: 1.0, castShadow: false}),
|
|
275
|
-
behavior('fps.pad.center.osc', 'fps.pad.center', 'oscillate-3d', {axis: 'y', amplitude: .14, angularSpeed: 1.5, phase: 0}),
|
|
276
|
-
model3d('fps.pad.high.r', 'fps.stage', 'fps.model.pad', {x: 3.7, y: 2.6, z: -.9, ry: -.35, sx: .95, sy: .95, sz: .95, castShadow: false}),
|
|
277
|
-
model3d('fps.pad.high.l', 'fps.stage', 'fps.model.pad', {x: -3.9, y: 2.75, z: -1.1, ry: .32, sx: .92, sy: .92, sz: .92, castShadow: false}),
|
|
278
|
-
|
|
279
|
-
// Stylized floating twilight clouds
|
|
280
|
-
model3d('fps.cloud.1', 'fps.stage', 'fps.model.cloud', {x: -4.2, y: 5.4, z: -10.5, rx: .32, ry: .55, rz: .22, sx: 1.6, sy: 1.6, sz: 1.6, castShadow: false}),
|
|
281
|
-
model3d('fps.cloud.2', 'fps.stage', 'fps.model.cloud', {x: 1.1, y: 4.9, z: -12.8, rx: -.22, ry: .45, rz: .3, sx: 1.45, sy: 1.45, sz: 1.45, castShadow: false}),
|
|
282
|
-
model3d('fps.cloud.3', 'fps.stage', 'fps.model.cloud', {x: 5.8, y: 4.5, z: -9.2, rx: .2, ry: -.6, rz: -.18, sx: 1.75, sy: 1.75, sz: 1.75, castShadow: false}),
|
|
283
|
-
behavior('fps.cloud.1.osc', 'fps.cloud.1', 'oscillate-3d', {axis: 'y', amplitude: .22, angularSpeed: 1.0, phase: 0}),
|
|
284
|
-
behavior('fps.cloud.2.osc', 'fps.cloud.2', 'oscillate-3d', {axis: 'y', amplitude: .18, angularSpeed: 1.2, phase: 1.4}),
|
|
285
|
-
behavior('fps.cloud.3.osc', 'fps.cloud.3', 'oscillate-3d', {axis: 'y', amplitude: .24, angularSpeed: .9, phase: 2.6}),
|
|
286
|
-
|
|
287
|
-
// Authentic First-Person Shooter viewmodel (lower-right hip/shoulder stance angled inward toward the crosshair!)
|
|
288
|
-
mesh3d('fps.gun', 'fps.stage', {primitive: 'group', x: .44, y: -.49, z: -1.32, rx: .07, ry: .31, rz: -.05, attachToCamera: true}),
|
|
289
|
-
model3d('fps.gun.model', 'fps.gun', 'fps.model.blaster', {x: 0, y: 0, z: 0, ry: 3.14159, sx: .48, sy: .48, sz: .48, castShadow: false, receiveShadow: false}),
|
|
290
|
-
behavior('fps.gun.idle', 'fps.gun.model', 'oscillate-3d', {axis: 'y', amplitude: .012, angularSpeed: 2.1, phase: 0}),
|
|
291
|
-
|
|
292
|
-
// 2-Wave Assault (6 Flying 3D Security Bots × 4 HP = 24 shots!): Wave 1 visible on Frame 0, Wave 2 arrives at 3 kills!
|
|
293
|
-
...[
|
|
294
|
-
{idx: 1, x: 0, y: 1.95, z: -3.8, phase: 0, wave: 1},
|
|
295
|
-
{idx: 2, x: -3.1, y: 2.35, z: -4.8, phase: 1.8, wave: 1},
|
|
296
|
-
{idx: 3, x: 2.55, y: 2.65, z: -5.2, phase: 3.5, wave: 1},
|
|
297
|
-
{idx: 4, x: -2.25, y: 2.85, z: -4.4, phase: .8, wave: 2},
|
|
298
|
-
{idx: 5, x: 2.8, y: 2.15, z: -4.2, phase: 2.4, wave: 2},
|
|
299
|
-
{idx: 6, x: .15, y: 3.05, z: -7.1, phase: 4.3, wave: 2},
|
|
300
|
-
].flatMap(({idx, x, y, z, phase, wave}) => {
|
|
301
|
-
const id = `fps.drone.${idx}`;
|
|
302
|
-
return [
|
|
303
|
-
mesh3d(id, 'fps.stage', {primitive: 'group', x, y, z, ...(wave === 2 ? {visible: false} : {})}),
|
|
304
|
-
model3d(`${id}.model`, id, 'fps.model.enemy', {x: 0, y: -.36, z: 0, sx: 1.15, sy: 1.15, sz: 1.15}),
|
|
305
|
-
behavior(`${id}.state`, id, 'instance-state', {hp: 4, maxHp: 4, value: 1, tag: 'drone', team: 'enemy'}),
|
|
306
|
-
behavior(`${id}.steer`, id, 'steer-3d', {mode: 'chase-camera', speed: .28, stopDistance: 5.2, faceCamera: true, boundsX: 10.5, boundsZ: 10.5}),
|
|
307
|
-
behavior(`${id}.bob`, `${id}.model`, 'oscillate-3d', {axis: 'y', amplitude: .16, angularSpeed: 2.6, phase}),
|
|
308
|
-
];
|
|
309
|
-
}),
|
|
310
|
-
|
|
311
|
-
// Visible 3D Enemy Plasma Projectile prototype (sleek blazing white-gold laser core inside translucent crimson plasma aura!)
|
|
312
|
-
mesh3d('fps.bolt', 'fps.stage', {primitive: 'group', x: 0, y: 1.85, z: -4.4}, {prototype: true}),
|
|
313
|
-
mesh3d('fps.bolt.core', 'fps.bolt', {primitive: 'sphere', x: 0, y: 0, z: 0, sx: .13, sy: .13, sz: .46, color: '#fffbeb', unlit: true}),
|
|
314
|
-
mesh3d('fps.bolt.glow', 'fps.bolt', {primitive: 'sphere', x: 0, y: 0, z: 0, sx: .21, sy: .21, sz: .72, color: '#ff2e63', unlit: true, opacity: .42}),
|
|
315
|
-
behavior('fps.bolt.steer', 'fps.bolt', 'steer-3d', {mode: 'chase-camera', speed: 8.6, stopDistance: .2, faceCamera: true, boundsX: 14, boundsZ: 14}),
|
|
316
|
-
behavior('fps.bolt.impact', 'fps.bolt', 'timer', {seconds: 1.08, repeat: false}),
|
|
317
|
-
|
|
318
|
-
// Bespoke Sci-Fi Blade-Header Visor HUD with Target Progress + Player Shield HP bar
|
|
319
|
-
group('fps.hud', 61, 10, 268, 90),
|
|
320
|
-
layout('fps.hud', 216, 8, .88, .88),
|
|
321
|
-
image('fps.hud.panel', 'fps.ui.hud', 0, 0, 268, 90, {parentId: 'fps.hud', parameters: {fit: 'stretch'}}),
|
|
322
|
-
text('fps.title', 'SKY BLASTER', 12, 5, 146, 22, {parentId: 'fps.hud', parameters: {align: 'left', fontSize: 12, color: '#ffffff'}}),
|
|
323
|
-
text('fps.kills.label', '{{fps.kills}}/6', 190, 5, 66, 22, {parentId: 'fps.hud', parameters: {align: 'right', fontSize: 13, color: '#0f172a'}}),
|
|
324
|
-
image('fps.progress.track', 'fps.ui.bar.track', 14, 31, 240, 20, {parentId: 'fps.hud', parameters: {fit: 'stretch'}}),
|
|
325
|
-
image('fps.progress.fill', 'fps.ui.bar.fill', 18, 34, 232, 14, {parentId: 'fps.hud', parameters: {fit: 'stretch'}}),
|
|
326
|
-
behavior('fps.progress.meter', 'fps.progress.fill', 'value-meter', {variableId: 'fps.kills', min: 0, max: 6, axis: 'x', direction: 'positive', smoothingSeconds: .08}),
|
|
327
|
-
text('fps.hp.tag', 'HP', 14, 57, 26, 22, {parentId: 'fps.hud', parameters: {align: 'left', fontSize: 12, color: '#0f172a'}}),
|
|
328
|
-
rectangle('fps.hp.track', 42, 62, 152, 12, '#0f172a', {parentId: 'fps.hud', parameters: {stroke: '#38bdf8', strokeWidth: 1.5, radius: 6}}),
|
|
329
|
-
rectangle('fps.hp.fill', 44, 64, 148, 8, '#10b981', {parentId: 'fps.hud', parameters: {radius: 4}}),
|
|
330
|
-
behavior('fps.hp.meter', 'fps.hp.fill', 'value-meter', {variableId: 'fps.hp', min: 0, max: 100, axis: 'x', direction: 'positive', smoothingSeconds: .1}),
|
|
331
|
-
text('fps.hp.label', '{{fps.hp}}%', 198, 57, 56, 22, {parentId: 'fps.hud', parameters: {align: 'right', fontSize: 12, color: '#047857'}}),
|
|
332
|
-
behavior('fps.hold.timer', 'fps.hud', 'timer', {seconds: .1, repeat: true}),
|
|
333
|
-
behavior('fps.enemy.fire.timer', 'fps.hud', 'timer', {seconds: 2.2, repeat: true}),
|
|
334
|
-
behavior('fps.deadline', 'fps.hud', 'timer', {seconds: 55, repeat: false}),
|
|
335
|
-
|
|
336
|
-
// Short sci-fi micro-prompt (auto-hides on first input!)
|
|
337
|
-
group('fps.prompt.wrap', 110, 108, 170, 28),
|
|
338
|
-
layout('fps.prompt.wrap', 265, 96, .88, .88),
|
|
339
|
-
rectangle('fps.prompt.bg', 0, 0, 170, 28, '#0f172ae0', {parentId: 'fps.prompt.wrap', parameters: {stroke: '#38bdf8', strokeWidth: 2, radius: 6}}),
|
|
340
|
-
text('fps.prompt.text', 'TAP TO SHOOT', 0, 0, 170, 28, {parentId: 'fps.prompt.wrap', parameters: {fontSize: 12, color: '#38bdf8'}}),
|
|
341
|
-
|
|
342
|
-
// Center tactical sci-fi reticle + red lock-on flash + additive plasma spark trails + incoming enemy fire sparks
|
|
343
|
-
group('fps.reticle', 169, 324, 52, 52),
|
|
344
|
-
layout('fps.reticle', 324, 169, 1, 1),
|
|
345
|
-
image('fps.reticle.img', 'fps.icon.crosshair', 4, 4, 44, 44, {parentId: 'fps.reticle'}),
|
|
346
|
-
image('fps.hit.spark', 'fps.icon.hit', 0, 0, 52, 52, {parentId: 'fps.reticle', parameters: {opacity: 0}}),
|
|
347
|
-
behavior('fps.hit.spark.flash', 'fps.hit.spark', 'animation', {property: 'opacity', from: 1, to: 0, seconds: .22, loop: false, easing: 'ease-out'}),
|
|
348
|
-
behavior('fps.reticle.burst', 'fps.reticle', 'emitter', {shape: 'circle', coverage: 'local', count: 18, color: '#38bdf8', speed: 170, lifetime: .36, gravity: 90, spread: 360}),
|
|
349
|
-
behavior('fps.kill.burst.gold', 'fps.reticle', 'emitter', {shape: 'circle', coverage: 'local', count: 22, color: '#fde047', speed: 230, lifetime: .6, gravity: 130, spread: 360}),
|
|
350
|
-
behavior('fps.kill.burst.rose', 'fps.reticle', 'emitter', {shape: 'circle', coverage: 'local', count: 18, color: '#fb7185', speed: 195, lifetime: .55, gravity: 110, spread: 360}),
|
|
351
|
-
behavior('fps.incoming.burst', 'fps.reticle', 'emitter', {shape: 'circle', coverage: 'local', count: 18, color: '#fb7185', speed: 250, lifetime: .35, gravity: 40, spread: 360}),
|
|
352
|
-
|
|
353
|
-
// Bottom-left sci-fi cyan aim pad anchored to physical bottom-left edge across all screen sizes
|
|
354
|
-
group('fps.joy.wrap', 10, 518, 152, 152),
|
|
355
|
-
layout('fps.joy.wrap', 10, 208, 1, 1, {anchor: 'bottom-left', respectSafeArea: false, marginX: 10, marginY: 30}),
|
|
356
|
-
create('fps.joy', 'native.group.v1', 0, 0, 152, 152, {parentId: 'fps.joy.wrap'}),
|
|
357
|
-
behavior('fps.joy.stick', 'fps.joy', 'virtual-joystick', {mode: 'fixed', radiusPx: 66, deadZone: 0, drawControl: true, baseColor: '#0f172a7a', knobColor: '#38bdf8f0'}),
|
|
358
|
-
behavior('fps.controller', 'fps.stage', 'fps-controller-3d', {
|
|
359
|
-
x: 0, y: 1.95, z: 5.2, yaw: 0, pitch: 0,
|
|
360
|
-
minYaw: -.95, maxYaw: .95, minPitch: -.42, maxPitch: .48,
|
|
361
|
-
moveSpeed: 0, lookSensitivity: .0055, playerRadius: .5, boundsX: 11, boundsZ: 11,
|
|
362
|
-
aimJoystickBehaviorId: 'fps.joy.stick', aimMode: 'delta', lookMode: 'drag', bobAmplitude: 0,
|
|
363
|
-
}),
|
|
364
|
-
|
|
365
|
-
// Gentle beckoning tutorial hand right at the target reticle (auto-hides on first tap/drag!)
|
|
366
|
-
behavior('fps.tutorial', 'fps.hud', 'tutorial-hand', {targetId: 'fps.reticle', mode: 'tap', idleDelaySeconds: .35, hideOnFirstInput: true}),
|
|
367
|
-
|
|
368
|
-
// Gameplay bindings
|
|
369
|
-
binding('fps.start', {kind: 'sceneEnter', sceneId: 'scene.play'}, [
|
|
370
|
-
{kind: 'set', variableId: 'fps.kills', value: 0},
|
|
371
|
-
{kind: 'set', variableId: 'fps.shots', value: 0},
|
|
372
|
-
{kind: 'set', variableId: 'fps.hp', value: 100},
|
|
373
|
-
{kind: 'set', variableId: 'fps.wave', value: 1},
|
|
374
|
-
{kind: 'set', variableId: 'fps.won', value: false},
|
|
375
|
-
{kind: 'set', variableId: 'fps.win.hold', value: 0},
|
|
376
|
-
{kind: 'playAudio', behaviorId: 'fps.sfx.ambient'},
|
|
377
|
-
]),
|
|
378
|
-
binding('fps.joy.start', {kind: 'joystickStart', componentId: 'fps.joy'}, [
|
|
379
|
-
{kind: 'setComponent', componentId: 'fps.prompt.wrap', key: 'visible', value: false},
|
|
380
|
-
{kind: 'playAudio', behaviorId: 'fps.sfx.ambient'},
|
|
381
|
-
]),
|
|
382
|
-
|
|
383
|
-
// Any press anywhere on the viewport (outside the joystick) fires the twin-barrel plasma cannon!
|
|
384
|
-
binding('fps.shoot', {kind: 'click', componentId: 'fps.stage'}, [
|
|
385
|
-
{kind: 'add', variableId: 'fps.shots', value: 1},
|
|
386
|
-
{kind: 'setComponent', componentId: 'fps.prompt.wrap', key: 'visible', value: false},
|
|
387
|
-
{kind: 'raycast3d', stageId: 'fps.stage', mode: 'crosshair', maxDistance: 60, targetTeam: 'enemy'},
|
|
388
|
-
{kind: 'cameraShake', intensity: 3.5, seconds: .08},
|
|
389
|
-
{kind: 'screenFlash', color: '#38bdf8', opacity: .09, seconds: .06},
|
|
390
|
-
{kind: 'playAudio', behaviorId: 'fps.sfx.blaster'},
|
|
391
|
-
{kind: 'playAudio', behaviorId: 'fps.sfx.ambient'},
|
|
392
|
-
]),
|
|
393
|
-
|
|
394
|
-
// Weak enemy return fire: every 2.2s an alive, visible bot fires a glowing 3D crimson plasma bolt straight from its blaster barrel!
|
|
395
|
-
binding('fps.enemy.launch', {kind: 'timer', behaviorId: 'fps.enemy.fire.timer'}, [
|
|
396
|
-
{kind: 'spawnAt3d', prototypeId: 'fps.bolt', fromTeam: 'enemy', offsetX: .52, offsetY: -.02, offsetZ: .42, count: 1},
|
|
397
|
-
], {all: [{variableId: 'fps.won', op: 'eq', value: false}, {variableId: 'fps.hp', op: 'gt', value: 0}]}),
|
|
398
|
-
|
|
399
|
-
// When the visible 3D enemy bolt arrives at the player's visor (~1.08s flight), despawn it & deal a gentle -6 HP glance!
|
|
400
|
-
binding('fps.bolt.hit', {kind: 'timer', behaviorId: 'fps.bolt.impact'}, [
|
|
401
|
-
{kind: 'despawn', target: 'self'},
|
|
402
|
-
{kind: 'compute', variableId: 'fps.hp', op: 'sub', value: 6},
|
|
403
|
-
{kind: 'compute', variableId: 'fps.hp', op: 'clamp', min: 0, max: 100},
|
|
404
|
-
{kind: 'emit', behaviorId: 'fps.incoming.burst'},
|
|
405
|
-
{kind: 'screenFlash', color: '#fb7185', opacity: .15, seconds: .14},
|
|
406
|
-
{kind: 'cameraShake', intensity: 3.5, seconds: .1},
|
|
407
|
-
{kind: 'floatingText', componentId: 'fps.hud', text: '-6 HP', color: '#fb7185', fontSize: 18, risePx: 26, seconds: .55},
|
|
408
|
-
{kind: 'playAudio', behaviorId: 'fps.sfx.hit'},
|
|
409
|
-
], {all: [{variableId: 'fps.won', op: 'eq', value: false}, {variableId: 'fps.hp', op: 'gt', value: 0}]}),
|
|
410
|
-
|
|
411
|
-
// Per-bot Hit & Elimination rewards across both waves (6 bots × 4 HP = 24 shots!)
|
|
412
|
-
...[1, 2, 3, 4, 5, 6].flatMap(idx => {
|
|
413
|
-
const id = `fps.drone.${idx}`;
|
|
414
|
-
return [
|
|
415
|
-
binding(`fps.hit.${idx}`, {kind: 'raycastHit3d', componentId: id}, [
|
|
416
|
-
{kind: 'modifyInstanceState', target: 'self', componentId: id, field: 'hp', op: 'sub', value: 1},
|
|
417
|
-
{kind: 'animate', behaviorId: 'fps.hit.spark.flash'},
|
|
418
|
-
{kind: 'emit', behaviorId: 'fps.reticle.burst'},
|
|
419
|
-
{kind: 'floatingText', componentId: id, text: 'HIT!', color: '#38bdf8', fontSize: 24, risePx: 40, seconds: .42},
|
|
420
|
-
{kind: 'playAudio', behaviorId: 'fps.sfx.hit'},
|
|
421
|
-
]),
|
|
422
|
-
binding(`fps.kill.${idx}`, {kind: 'instanceDepleted', componentId: id}, [
|
|
423
|
-
{kind: 'add', variableId: 'fps.kills', value: 1},
|
|
424
|
-
{kind: 'emit', behaviorId: 'fps.kill.burst.gold'},
|
|
425
|
-
{kind: 'emit', behaviorId: 'fps.kill.burst.rose'},
|
|
426
|
-
{kind: 'floatingText', componentId: id, text: 'BOT DOWN!', color: '#fde047', fontSize: 26, risePx: 54, seconds: .68},
|
|
427
|
-
{kind: 'screenFlash', color: '#fde047', opacity: .12, seconds: .1},
|
|
428
|
-
{kind: 'playAudio', behaviorId: 'fps.sfx.kill'},
|
|
429
|
-
{kind: 'setComponent', componentId: id, key: 'visible', value: false},
|
|
430
|
-
]),
|
|
431
|
-
];
|
|
432
|
-
}),
|
|
433
|
-
|
|
434
|
-
// Wave 2 reinforcements arrive after clearing the first 3 bots!
|
|
435
|
-
binding('fps.wave2.spawn', {kind: 'variableChange', variableId: 'fps.kills'}, [
|
|
436
|
-
{kind: 'set', variableId: 'fps.wave', value: 2},
|
|
437
|
-
{kind: 'setComponent', componentId: 'fps.drone.4', key: 'visible', value: true},
|
|
438
|
-
{kind: 'setComponent', componentId: 'fps.drone.5', key: 'visible', value: true},
|
|
439
|
-
{kind: 'setComponent', componentId: 'fps.drone.6', key: 'visible', value: true},
|
|
440
|
-
{kind: 'emit', behaviorId: 'fps.reticle.burst'},
|
|
441
|
-
{kind: 'screenFlash', color: '#38bdf8', opacity: .14, seconds: .16},
|
|
442
|
-
{kind: 'floatingText', componentId: 'fps.reticle', text: 'WAVE 2!', color: '#38bdf8', fontSize: 28, risePx: 48, seconds: .9},
|
|
443
|
-
], {all: [{variableId: 'fps.kills', op: 'eq', value: 3}, {variableId: 'fps.wave', op: 'eq', value: 1}]}),
|
|
444
|
-
|
|
445
|
-
binding('fps.win.trigger', {kind: 'variableChange', variableId: 'fps.kills'}, [
|
|
446
|
-
{kind: 'set', variableId: 'fps.won', value: true},
|
|
447
|
-
{kind: 'set', variableId: 'fps.win.hold', value: 0},
|
|
448
|
-
], {variableId: 'fps.kills', op: 'gte', value: 6}),
|
|
449
|
-
binding('fps.win.tick', {kind: 'timer', behaviorId: 'fps.hold.timer'}, [
|
|
450
|
-
{kind: 'add', variableId: 'fps.win.hold', value: .1},
|
|
451
|
-
], {variableId: 'fps.won', op: 'eq', value: true}),
|
|
452
|
-
binding('fps.win.go', {kind: 'variableChange', variableId: 'fps.win.hold'}, [
|
|
453
|
-
{kind: 'changeScene', sceneId: 'scene.win'},
|
|
454
|
-
], {all: [{variableId: 'fps.won', op: 'eq', value: true}, {variableId: 'fps.win.hold', op: 'gte', value: .8}]}),
|
|
455
|
-
binding('fps.hp.zero', {kind: 'variableChange', variableId: 'fps.hp'}, [
|
|
456
|
-
{kind: 'changeScene', sceneId: 'scene.timeout'},
|
|
457
|
-
], {all: [{variableId: 'fps.hp', op: 'lte', value: 0}, {variableId: 'fps.won', op: 'eq', value: false}]}),
|
|
458
|
-
binding('fps.timeout.go', {kind: 'timer', behaviorId: 'fps.deadline'}, [
|
|
459
|
-
{kind: 'changeScene', sceneId: 'scene.timeout'},
|
|
460
|
-
], {variableId: 'fps.won', op: 'eq', value: false}),
|
|
461
|
-
|
|
462
|
-
// Unique Sci-Fi Tactical Debrief Victory & Timeout End Cards
|
|
463
|
-
...sciFiEndScene({
|
|
464
|
-
sceneId: 'scene.win',
|
|
465
|
-
prefix: 'win',
|
|
466
|
-
header: 'MISSION CLEAR',
|
|
467
|
-
subtitle: '6 / 6 BOTS CLEARED',
|
|
468
|
-
cta: 'PLAY NOW',
|
|
469
|
-
win: true,
|
|
470
|
-
panelAsset: 'fps.ui.win',
|
|
471
|
-
emblemAsset: 'fps.icon.medal',
|
|
472
|
-
accentColor: '#34d399',
|
|
473
|
-
ctaFill: '#38bdf8',
|
|
474
|
-
ctaHover: '#7dd3fc',
|
|
475
|
-
ctaPressed: '#0284c7',
|
|
476
|
-
}),
|
|
477
|
-
...sciFiEndScene({
|
|
478
|
-
sceneId: 'scene.timeout',
|
|
479
|
-
prefix: 'to',
|
|
480
|
-
header: 'SECTOR ALERT',
|
|
481
|
-
subtitle: '{{fps.kills}} / 6 BOTS CLEARED',
|
|
482
|
-
cta: 'PLAY NOW',
|
|
483
|
-
win: false,
|
|
484
|
-
panelAsset: 'fps.ui.timeout',
|
|
485
|
-
emblemAsset: 'fps.icon.warning',
|
|
486
|
-
accentColor: '#fb7185',
|
|
487
|
-
ctaFill: '#fde047',
|
|
488
|
-
ctaHover: '#fef08a',
|
|
489
|
-
ctaPressed: '#eab308',
|
|
490
|
-
}),
|
|
491
|
-
];
|
|
492
|
-
|
|
493
|
-
ops.forEach((op, idx) => { if (op.kind === 'createComponent') op.component.order = idx; });
|
|
494
|
-
const base = emptyProject({id: projectId, name: 'Sky Blaster 3D', androidUrl: 'https://play.google.com/store/apps/details?id=com.tora.skyblaster'});
|
|
495
|
-
base.base.storeUrl = 'https://play.google.com/store/apps/details?id=com.tora.skyblaster';
|
|
496
|
-
let project = base;
|
|
497
|
-
for (let start = 0; start < ops.length; start += 240) {
|
|
498
|
-
project = applyOperations(project, ops.slice(start, start + 240)).project;
|
|
499
|
-
}
|
|
500
|
-
project.creativeBrief.goal = 'Sky Blaster 3D — Twilight-sky WebGL2 first-person shooter with Kenney Starter-Kit-FPS 3D GLB models, authentic twin-barrel FPS viewmodel, icon-only circular trigger, Kenney UI Pack Sci-Fi HUD, additive plasma spark VFX, and unique Juhani Junkala & Kenney Sci-Fi audio.';
|
|
501
|
-
return {project, assets};
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
export async function authorSkyBlasterThroughService(service, projectId = 'sky-blaster') {
|
|
505
|
-
const {project: original, assets} = await createSkyBlasterProject(projectId);
|
|
506
|
-
const created = await service.create({id: projectId, name: 'Sky Blaster 3D', androidUrl: original.base.storeUrl});
|
|
507
|
-
const operations = [];
|
|
508
|
-
for (const asset of assets) {
|
|
509
|
-
const metadata = await registerSourceBytes(resolve(service.store.root, projectId), {
|
|
510
|
-
id: asset.id,
|
|
511
|
-
mime: asset.mime,
|
|
512
|
-
rights: asset.rights,
|
|
513
|
-
optimize: 'none',
|
|
514
|
-
}, asset.data, {provenance: JSON.stringify(asset.provenance)});
|
|
515
|
-
const record = {...metadata};
|
|
516
|
-
delete record.optimization;
|
|
517
|
-
operations.push({kind: 'registerAsset', asset: {...record, rights: asset.rights}});
|
|
518
|
-
}
|
|
519
|
-
const seen = new Set();
|
|
520
|
-
for (const key of ['scenes', 'components', 'variables', 'gameplay', 'events', 'eventBindings']) {
|
|
521
|
-
for (const record of original[key]) {
|
|
522
|
-
if (key === 'scenes' && record.id === 'scene.play') continue;
|
|
523
|
-
if (seen.has(record.id)) continue;
|
|
524
|
-
seen.add(record.id);
|
|
525
|
-
if (key === 'scenes') operations.push({kind: 'createScene', scene: record});
|
|
526
|
-
else if (key === 'components') operations.push({kind: 'createComponent', component: record});
|
|
527
|
-
else if (key === 'variables') operations.push({kind: 'putVariable', variable: record});
|
|
528
|
-
else if (key === 'gameplay') operations.push({kind: 'putBehavior', behavior: record});
|
|
529
|
-
else if (key === 'events') operations.push({kind: 'putEvent', event: record});
|
|
530
|
-
else {
|
|
531
|
-
const {eventId, ...bindingRecord} = record;
|
|
532
|
-
operations.push({kind: 'putBinding', binding: {...bindingRecord, event: original.events.find(ev => ev.id === eventId)}});
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
let expected = {revisionId: created.revisionId, contentHash: created.contentHash};
|
|
537
|
-
for (let start = 0; start < operations.length; start += 240) {
|
|
538
|
-
const slice = operations.slice(start, start + 240);
|
|
539
|
-
const envelope = {format: 'tora-transaction-1', expected, operations: slice};
|
|
540
|
-
const preview = await service.preview(projectId, envelope);
|
|
541
|
-
const committed = await service.transact(projectId, {...envelope, previewDigest: preview.previewDigest});
|
|
542
|
-
expected = {revisionId: committed.revisionId, contentHash: committed.contentHash};
|
|
543
|
-
}
|
|
544
|
-
return service.read(projectId);
|
|
545
|
-
}
|