@playcraft/cli 0.0.57 → 0.0.58
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 +34 -16
- package/dist/cli-root-help.js +1 -0
- package/dist/commands/build-all.js +10 -9
- package/dist/commands/build.js +13 -12
- package/dist/commands/create.js +26 -33
- package/dist/commands/platform-skills.generated.js +19 -0
- package/dist/commands/skills.js +2 -0
- package/dist/commands/tools-generation.js +1 -1
- package/dist/commands/workspace-runtime.js +54 -0
- package/dist/index.js +3 -1
- package/dist/project-skills/commands.js +72 -0
- package/dist/project-skills/lifecycle.js +28 -0
- package/dist/project-skills/local-run.js +112 -0
- package/dist/project-skills/local-store.js +149 -0
- package/dist/project-skills/messages.js +72 -0
- package/dist/project-skills/reconcile.js +62 -0
- package/dist/project-skills/remote-cache.js +51 -0
- package/dist/project-skills/validation.js +19 -0
- package/dist/remix/clone.js +2 -0
- package/dist/remix/init-template.js +2 -0
- package/dist/remix/pull.js +2 -0
- package/dist/remix/push.js +21 -1
- package/dist/utils/agent-api-client.js +54 -17
- package/dist/utils/tool-operation-journal.js +54 -0
- package/dist/workspace-runtime/codex/app-server.js +395 -0
- package/dist/workspace-runtime/codex/config-toml.js +25 -0
- package/dist/workspace-runtime/codex/jsonrpc-stdio.js +106 -0
- package/dist/workspace-runtime/codex/loopback.js +59 -0
- package/dist/workspace-runtime/codex/native-adapter.js +3 -0
- package/dist/workspace-runtime/main.js +10 -0
- package/dist/workspace-runtime/persistence/journal.js +350 -0
- package/dist/workspace-runtime/processes/managed-writes.js +69 -0
- package/dist/workspace-runtime/serve.js +111 -0
- package/dist/workspace-runtime/server/auth.js +21 -0
- package/dist/workspace-runtime/server/dispatch.js +861 -0
- package/dist/workspace-runtime/server/execution-group.js +88 -0
- package/dist/workspace-runtime/server/http.js +561 -0
- package/dist/workspace-runtime/server/lock.js +53 -0
- package/dist/workspace-runtime/server/types.js +1 -0
- package/dist/workspace-runtime/workspaces/context-error.js +2 -0
- package/dist/workspace-runtime/workspaces/file-snapshot.js +213 -0
- package/dist/workspace-runtime/workspaces/files.js +143 -0
- package/dist/workspace-runtime/workspaces/git.js +242 -0
- package/dist/workspace-runtime/workspaces/json5-edit.js +170 -0
- package/dist/workspace-runtime/workspaces/parameters.js +272 -0
- package/dist/workspace-runtime/workspaces/prepare.js +364 -0
- package/dist/workspace-runtime/workspaces/registry.js +107 -0
- package/dist/workspace-runtime/workspaces/revisions.js +31 -0
- package/package.json +4 -1
- package/project-template-v2/.claude/agents/artist.md +82 -0
- package/project-template-v2/.claude/agents/developer.md +153 -0
- package/project-template-v2/.claude/agents/game-designer.md +264 -0
- package/project-template-v2/.claude/agents/refs/artist-art-style-catalog.md +533 -0
- package/project-template-v2/.claude/agents/refs/artist-color-audio-recipes.md +153 -0
- package/project-template-v2/.claude/agents/refs/artist-dimension-axis.md +27 -0
- package/project-template-v2/.claude/agents/refs/artist-master-composite-recipes.md +208 -0
- package/project-template-v2/.claude/agents/refs/atom-skill-library.md +81 -0
- package/project-template-v2/.claude/agents/refs/developer-impl-cookbook.md +432 -0
- package/project-template-v2/.claude/agents/refs/framework-5-component-filter.md +252 -0
- package/project-template-v2/.claude/agents/refs/framework-game-feel-juice.md +266 -0
- package/project-template-v2/.claude/agents/refs/framework-mda.md +147 -0
- package/project-template-v2/.claude/agents/refs/game-designer-gameplay-sufficiency.md +123 -0
- package/project-template-v2/.claude/agents/refs/ta-3d-flip-recipe.md +88 -0
- package/project-template-v2/.claude/agents/refs/ta-atlas-deliverable-standard.md +67 -0
- package/project-template-v2/.claude/agents/refs/ta-batch-pipeline-recipes.md +120 -0
- package/project-template-v2/.claude/agents/refs/ta-image-generation-detail.md +300 -0
- package/project-template-v2/.claude/agents/refs/ta-image-ops-reference.md +495 -0
- package/project-template-v2/.claude/agents/refs/ta-pipeline-cookbook.md +1141 -0
- package/project-template-v2/.claude/agents/refs/ta-tools-reference.md +111 -0
- package/project-template-v2/.claude/agents/refs/ta-vfx-preset-catalog.md +365 -0
- package/project-template-v2/.claude/agents/refs/threejs-cannon-pitfalls.md +412 -0
- package/project-template-v2/.claude/agents/reviewer.md +75 -0
- package/project-template-v2/.claude/agents/technical-artist.md +86 -0
- package/project-template-v2/.claude/hooks/snapshot-milestone.mjs +243 -0
- package/project-template-v2/.claude/hooks/user-prompt.mjs +133 -0
- package/project-template-v2/.claude/settings.json +33 -0
- package/project-template-v2/.claude/skills/brainstorming/SKILL.md +161 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/frame-template.html +270 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/helper.js +177 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/server.cjs +354 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/start-server.sh +148 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/wait-for-selection.sh +62 -0
- package/project-template-v2/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/project-template-v2/.claude/skills/brainstorming/visual-companion.md +309 -0
- package/project-template-v2/.claude/skills/playcraft-ad-psychology/SKILL.md +182 -0
- package/project-template-v2/.claude/skills/playcraft-art-style-guide/SKILL.md +123 -0
- package/project-template-v2/.claude/skills/playcraft-asset-state-sheet/SKILL.md +205 -0
- package/project-template-v2/.claude/skills/playcraft-audio-generation/SKILL.md +280 -0
- package/project-template-v2/.claude/skills/playcraft-batch-pipeline/SKILL.md +184 -0
- package/project-template-v2/.claude/skills/playcraft-build-optimizer/SKILL.md +306 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/SKILL.md +298 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +123 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +254 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +324 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +97 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +118 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +137 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +397 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +296 -0
- package/project-template-v2/.claude/skills/playcraft-image-ops/SKILL.md +122 -0
- package/project-template-v2/.claude/skills/playcraft-image-processing/SKILL.md +219 -0
- package/project-template-v2/.claude/skills/playcraft-masking/SKILL.md +373 -0
- package/project-template-v2/.claude/skills/playcraft-playable-optimization/SKILL.md +161 -0
- package/project-template-v2/.claude/skills/playcraft-research/SKILL.md +215 -0
- package/project-template-v2/.claude/skills/playcraft-skill-recommender/SKILL.md +382 -0
- package/project-template-v2/.claude/skills/playcraft-sprite-generation/SKILL.md +423 -0
- package/project-template-v2/.claude/skills/playcraft-sprite-remix/SKILL.md +158 -0
- package/project-template-v2/.claude/skills/playcraft-sprite-sheet/SKILL.md +100 -0
- package/project-template-v2/.claude/skills/playcraft-storyboard/SKILL.md +167 -0
- package/project-template-v2/.claude/skills/playcraft-style-qa/SKILL.md +270 -0
- package/project-template-v2/.claude/skills/playcraft-text-rendering/SKILL.md +236 -0
- package/project-template-v2/.claude/skills/playcraft-vfx-animation/SKILL.md +130 -0
- package/project-template-v2/.claude/skills/playwright-cli/SKILL.md +390 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/running-code.md +240 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/session-management.md +226 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/spec-driven-testing.md +308 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/storage-state.md +275 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/test-generation.md +134 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/tracing.md +142 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/video-recording.md +153 -0
- package/project-template-v2/.claude/skills/session-analyzer/SKILL.md +386 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/execution-breakdown.mjs +182 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/find-turns.mjs +72 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/heavy-output.mjs +121 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/resolve-session.mjs +102 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-stats.mjs +127 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-tool-timeline.mjs +106 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/time-gaps.mjs +128 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/turn-timeline.mjs +67 -0
- package/project-template-v2/.claude/snapshot.mjs +263 -0
- package/project-template-v2/.playcraft/skills.lock.json +152 -0
- package/project-template-v2/CLAUDE.md +146 -0
- package/project-template-v2/assets/audio/bgm/.gitkeep +0 -0
- package/project-template-v2/assets/audio/sfx/.gitkeep +0 -0
- package/project-template-v2/assets/bundles/.gitkeep +0 -0
- package/project-template-v2/assets/images/bg/.gitkeep +0 -0
- package/project-template-v2/assets/images/reference/.gitkeep +0 -0
- package/project-template-v2/assets/images/storyboard/.gitkeep +0 -0
- package/project-template-v2/assets/images/tiles/.gitkeep +0 -0
- package/project-template-v2/assets/images/ui/.gitkeep +0 -0
- package/project-template-v2/assets/images/vfx/.gitkeep +0 -0
- package/project-template-v2/assets/models/.gitkeep +0 -0
- package/project-template-v2/docs/harness/iteration-1/context-flow.md +254 -0
- package/project-template-v2/docs/harness/iteration-1/generate-flow.md +91 -0
- package/project-template-v2/docs/harness/iteration-1/ideate-flow.md +214 -0
- package/project-template-v2/docs/harness/iteration-1/optimize-flow.md +75 -0
- package/project-template-v2/docs/harness/iteration-1/wrapup-flow.md +63 -0
- package/project-template-v2/docs/harness/iteration-2/context-flow.md +223 -0
- package/project-template-v2/docs/harness/iteration-2/generate-flow.md +129 -0
- package/project-template-v2/docs/harness/iteration-2/ideate-flow.md +267 -0
- package/project-template-v2/docs/harness/iteration-2/optimize-flow.md +164 -0
- package/project-template-v2/docs/harness/iteration-2/wrapup-flow.md +115 -0
- package/project-template-v2/docs/harness/orchestrator-flow.md +364 -0
- package/project-template-v2/docs/project-state.json +60 -0
- package/project-template-v2/docs/project-state.md +72 -0
- package/project-template-v2/docs/standards/README.md +225 -0
- package/project-template-v2/docs/standards/agent-behavior-standards.md +174 -0
- package/project-template-v2/docs/standards/artifacts/design-brief.md +19 -0
- package/project-template-v2/docs/standards/artifacts/design.md +22 -0
- package/project-template-v2/docs/standards/artifacts/game-code.md +41 -0
- package/project-template-v2/docs/standards/artifacts/todo-list.md +41 -0
- package/project-template-v2/docs/standards/iter1-agent-behavior-standards.md +343 -0
- package/project-template-v2/game/index.ts +18 -0
- package/project-template-v2/globals.d.ts +51 -0
- package/project-template-v2/index.css +34 -0
- package/project-template-v2/index.html +18 -0
- package/project-template-v2/main.ts +9 -0
- package/project-template-v2/package.json +46 -0
- package/project-template-v2/skills/_shared/scripts/dispatch-clear.mjs +31 -0
- package/project-template-v2/skills/_shared/scripts/dispatch-set.mjs +86 -0
- package/project-template-v2/skills/_shared/scripts/dod-check.mjs +153 -0
- package/project-template-v2/skills/_shared/scripts/handoff-append.mjs +70 -0
- package/project-template-v2/skills/_shared/scripts/lib/validator-artifacts.mjs +91 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/dod-config.mjs +131 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/index.mjs +80 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/iteration-1-core.mjs +90 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/iteration-2-wrap.mjs +93 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/iteration-3-visual.mjs +23 -0
- package/project-template-v2/skills/_shared/scripts/render-project-state.mjs +230 -0
- package/project-template-v2/skills/_shared/scripts/state-advance-stage.mjs +58 -0
- package/project-template-v2/skills/_shared/scripts/state-get.mjs +339 -0
- package/project-template-v2/skills/_shared/scripts/state-handoff.mjs +39 -0
- package/project-template-v2/skills/_shared/scripts/state-set.mjs +94 -0
- package/project-template-v2/skills/_shared/scripts/state-store.mjs +783 -0
- package/project-template-v2/skills/_shared/scripts/todo-add.mjs +88 -0
- package/project-template-v2/skills/_shared/scripts/todo-get.mjs +130 -0
- package/project-template-v2/skills/_shared/scripts/todo-remove.mjs +33 -0
- package/project-template-v2/skills/_shared/scripts/todo-set.mjs +47 -0
- package/project-template-v2/skills/_shared/scripts/verify-asset-code-sync.mjs +268 -0
- package/project-template-v2/skills/_shared/scripts/verify-env.mjs +285 -0
- package/project-template-v2/skills/_shared/scripts/verify-placeholders.mjs +161 -0
- package/project-template-v2/skills/playable-autoplay/SKILL.md +176 -0
- package/project-template-v2/skills/playable-autoplay/agents/openai.yaml +4 -0
- package/project-template-v2/skills/playable-debug/SKILL.md +116 -0
- package/project-template-v2/skills/playable-debug/agents/openai.yaml +4 -0
- package/project-template-v2/skills/playable-debug/references/debug-config.md +40 -0
- package/project-template-v2/skills/playable-record/SKILL.md +140 -0
- package/project-template-v2/skills/playable-record/scripts/lib/dev-server.mjs +104 -0
- package/project-template-v2/skills/playable-record/scripts/lib/record-audio-bridge.js +141 -0
- package/project-template-v2/skills/playable-record/scripts/record-playable.mjs +425 -0
- package/project-template-v2/skills/playable-record/scripts/verify-contract.mjs +261 -0
- package/project-template-v2/skills/playable-record/scripts/verify-firstwin.mjs +398 -0
- package/project-template-v2/skills/playable-record/scripts/verify-fusion.mjs +322 -0
- package/project-template-v2/skills/playable-record/scripts/verify-lifecycle.mjs +105 -0
- package/project-template-v2/skills/playable-record/scripts/verify-vlm-video.mjs +230 -0
- package/project-template-v2/skills/playable-validate/SKILL.md +61 -0
- package/project-template-v2/skills/playable-validate/validation-rules.md +14 -0
- package/project-template-v2/skills/playable-verify-ui/SKILL.md +63 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/__init__.py +1 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/config_expr.js +218 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/node_utils.js +51 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/profile_loader.py +59 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/report.py +106 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/runtime_contract.js +116 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_fetch_antipatterns.py +59 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_hardcoded_layout.js +64 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_runtime_contract.js +58 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_text_overlap.py +333 -0
- package/project-template-v2/ta-workspace/scripts/.gitkeep +0 -0
- package/project-template-v2/tsconfig.json +20 -0
- package/project-template-v2/vite.config.ts +27 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playcraft-asset-state-sheet
|
|
3
|
+
description: PlayCraft 资产状态参考精灵图板(ASR / Asset State Reference Sheet)生成指南。Artist 在 ring 3 Ring Gate(MC 选定)后输出两张 4K 参考精灵图:UI 组件状态板 + 玩法元素状态板,供 TA crop 量产。
|
|
4
|
+
triggers: ASR,asset state reference,state reference sheet,UI state sheet,element state sheet,组件状态图,状态精灵图,精灵图板,参考精灵图,authoring sprite sheet,design handoff sheet,TA参考图,状态参考板,playcraft-asset-state-sheet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PlayCraft 资产状态参考精灵图板(ASR)
|
|
8
|
+
|
|
9
|
+
> **ASR** = **Asset State Reference Sheet**(资产状态参考精灵图板)
|
|
10
|
+
> **Authoring sprite sheet**(制作期精灵图板):单张 PNG、规则网格、每格一种状态;与 TA 产出的 **runtime atlas**(`.webp` + `.json`)不同。
|
|
11
|
+
|
|
12
|
+
## 0. 前置条件(硬门禁)
|
|
13
|
+
|
|
14
|
+
- **仅在 ring 3 Ring Gate 通过、`selectedMcOption` 已写入 `project-state.md` 之后** 才能生成 ASR
|
|
15
|
+
- **禁止**为未选中的 MC 方案生成 ASR
|
|
16
|
+
- 两张板均使用已确认 MC 作 `--reference-image`,且 `--image-model` 与 MC 一致
|
|
17
|
+
- **生成 ASR 前必读** `playcraft-image-generation` Skill §3(色幕矩阵)— 格内元素须可抠
|
|
18
|
+
|
|
19
|
+
## 0.1 Sheet 底色 + 格内抠图(必读)
|
|
20
|
+
|
|
21
|
+
> **整图 opaque 是预期行为** — ASR PNG 本身**不需要**也**不应**交付透明 PNG。TA 负责 `crop → remove-background → WebP atlas`。
|
|
22
|
+
> Artist 的职责是:让 **每个格内的单元素** 在 crop 后能被 TA 可靠抠图。
|
|
23
|
+
|
|
24
|
+
| 层级 | 规则 |
|
|
25
|
+
| --------------------- | --------------------------------------------------------------------------------- |
|
|
26
|
+
| **Sheet canvas** | 不透明;默认 **中性灰 `#808080` flat background**(整板统一,禁止渐变/场景/纹理) |
|
|
27
|
+
| **Sheet 备选** | 若全板元素均非金/橙/绿,可用 **统一绿幕 `#00FF00`** 整板底色 |
|
|
28
|
+
| **Cell 内容** | **单元素 isolated、居中**;禁止格内地面/阴影/白盒/场景/context |
|
|
29
|
+
| **金/橙/黄/绿元素格** | 该格背景用 **蓝幕 `#0000FF`**(见 `playcraft-image-generation` 色幕矩阵) |
|
|
30
|
+
| **蓝/紫元素格** | 该格背景用 **绿幕 `#00FF00`** |
|
|
31
|
+
| **Artist 禁止** | 对 ASR 做 `remove-background` 量产;那是 TA 在 `production` 的工作 |
|
|
32
|
+
|
|
33
|
+
**错误示例(必须重生成)**:格内白底方块、渐变底、整屏 HUD 截屏、两元素叠在同一格、元素带地面阴影。
|
|
34
|
+
|
|
35
|
+
## 1. 交付物:两张状态参考板
|
|
36
|
+
|
|
37
|
+
| 交付物 | 文件 | 内容 |
|
|
38
|
+
| --------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- |
|
|
39
|
+
| **UI State Reference Sheet** | `assets/images/reference/ui_state_sheet_[X].png` | 各 **UI/HUD 组件** 在所需交互态下的外观(非玩法棋子) |
|
|
40
|
+
| **Element State Reference Sheet** | `assets/images/reference/element_state_sheet_[X].png` | 各 **玩法视觉元素** 在特殊/事件态下的外观 |
|
|
41
|
+
|
|
42
|
+
`[X]` = `selectedMcOption`(A/B/C)。
|
|
43
|
+
|
|
44
|
+
**多板扩展**(`unique element types > 12` 或 Layer1 槽位 > 12):允许追加 `element_state_sheet_[X]_2.png`;Coverage Matrix 的 `sheet` 列填 `element_2`。详见 `docs/team/atom-tree-format.md` § `asrSlot`.
|
|
45
|
+
|
|
46
|
+
### UI State Reference Sheet — 放什么
|
|
47
|
+
|
|
48
|
+
- CTA 按钮、安装条、HUD 条、进度/分数框、手指引导、高亮框、徽章、弹窗底板等
|
|
49
|
+
- 每个组件占 **一个或多个相邻槽位**,每槽 **一种状态**,例如:
|
|
50
|
+
- `cta_install`: default | pressed | disabled
|
|
51
|
+
- `finger_guide`: idle | tap-down
|
|
52
|
+
- `highlight_frame`: off | on
|
|
53
|
+
|
|
54
|
+
### Element State Reference Sheet — 放什么
|
|
55
|
+
|
|
56
|
+
- 棋子、牌面、角色、道具、匹配特效关键帧等(MC 概念面板里出现的玩法元素)
|
|
57
|
+
- 每个元素 **type** 至少 **1 个代表态** 占物理槽位;同 type 的 color 变体可标 `CoverageLayer: ta-extends`(见 `artist-deliverable-spec.md`)
|
|
58
|
+
- 每 type **2–3 个代表状态** 优先(完整全集由 TA 在 `production` 扩展),例如:
|
|
59
|
+
- `tile_gold`: idle | selected | matched
|
|
60
|
+
- `panda_char`: idle | happy | win
|
|
61
|
+
|
|
62
|
+
**物理槽位预算**:每张板 **8–12 个状态槽**(宁可少槽、加大间距,也不要重叠)。
|
|
63
|
+
**Coverage Matrix 100% 行** ≠ 每行都有物理槽位 — 见 §1.1 三层覆盖。
|
|
64
|
+
|
|
65
|
+
### 1.1 三层覆盖(与 Coverage Matrix 对齐)
|
|
66
|
+
|
|
67
|
+
| CoverageLayer | 含义 | Matrix 填写 |
|
|
68
|
+
| -------------- | ------------------------------------------- | ---------------------------------------- |
|
|
69
|
+
| **on-asr** | 该 contract id 在 ASR PNG 有物理槽位 `R#C#` | `ASR sheet` + `Grid` |
|
|
70
|
+
| **mc-crop** | MC Panel 1 可见、ASR 无槽位 | `ASR sheet` = `MC-crop` + Panel 区域说明 |
|
|
71
|
+
| **ta-extends** | 颜色变体 / 额外状态,TA 从 ASR 或 MC 扩展 | `TA extends? = yes` + Style Intent 一句 |
|
|
72
|
+
|
|
73
|
+
**硬规则**:每种 **element type** 至少在 **on-asr** 或 **mc-crop** 有一处代表态;禁止全部 `ta-extends` 且 MC/ASR 均无参考。
|
|
74
|
+
|
|
75
|
+
## 2. 布局策略 — 规则网格、零重叠
|
|
76
|
+
|
|
77
|
+
1. **零重叠**:任意两格 bounding box 不得相交
|
|
78
|
+
2. **网格化**:每行 3–4 槽;每槽固定矩形空白区;元素居中;四周 **≥80px** 边距
|
|
79
|
+
3. **行间距 ≥120px**,**列间距 ≥100px**
|
|
80
|
+
4. 禁止层叠、散落堆叠、透视干扰
|
|
81
|
+
|
|
82
|
+
### UI 板示例布局
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Row 1: [CTA default] [CTA pressed] [CTA disabled] [HUD bar]
|
|
86
|
+
Row 2: [finger idle] [finger tap] [badge] [highlight on]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 元素板示例布局
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Row 1: [tile A idle] [tile A selected] [tile A matched] [tile B idle]
|
|
93
|
+
Row 2: [char idle] [char happy] [char win] (empty)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 3. Prompt 模板
|
|
97
|
+
|
|
98
|
+
**生成前**:按 `playcraft-image-generation` §3 为每格元素选定 cell 背景色(灰/绿/蓝幕)。
|
|
99
|
+
|
|
100
|
+
**UI 板** — 在 prompt 中显式写 `UI component state reference sprite sheet`:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
UI component state reference sprite sheet for [GAME_TYPE] playable ad.
|
|
104
|
+
3840x2160 canvas, solid flat #808080 gray background on entire sheet. NO gradient, NO scene.
|
|
105
|
+
|
|
106
|
+
STRICT LAYOUT: orthographic grid, fixed non-overlapping cells. Each UI widget state in exactly one cell, 80px margin, 100px column gap, 120px row gap. NO overlapping.
|
|
107
|
+
|
|
108
|
+
Each cell: ONE isolated UI widget, centered, no drop shadow on floor, no white box behind widget, no scene context.
|
|
109
|
+
|
|
110
|
+
Row 1 — CTA / HUD:
|
|
111
|
+
- Cell 1: CTA install button, default state, isolated, centered ...
|
|
112
|
+
- Cell 2: CTA install button, pressed state, isolated, centered ...
|
|
113
|
+
...
|
|
114
|
+
|
|
115
|
+
Art style: [SAME as Master Composite]. Front-facing UI, crisp edges, consistent lighting.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**元素板** — 写 `gameplay element state reference sprite sheet`:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
Gameplay element state reference sprite sheet for [GAME_TYPE].
|
|
122
|
+
3840x2160 canvas, solid flat #808080 gray background on entire sheet. NO gradient, NO scene.
|
|
123
|
+
|
|
124
|
+
STRICT LAYOUT: [same as UI sheet]
|
|
125
|
+
|
|
126
|
+
Each cell: ONE isolated game element, centered. Gold/orange/yellow elements: cell background solid bright blue #0000FF. Blue/purple elements: cell background solid bright green #00FF00. NO white box, NO ground shadow, NO scene.
|
|
127
|
+
|
|
128
|
+
Row 1 — Core tiles/items:
|
|
129
|
+
- Cell 1: [Element type A] idle, isolated, centered ...
|
|
130
|
+
- Cell 2: [Element type A] selected, isolated, centered ...
|
|
131
|
+
...
|
|
132
|
+
|
|
133
|
+
Art style: [SAME as Master Composite].
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**元素板额外约束(test11 B10/B12)**:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
UNIFORM SILHOUETTE: All gameplay elements of the same category (e.g. all match-3 gems) MUST share the
|
|
140
|
+
identical outer silhouette and occupy the same visual scale in every cell. NO mixing hex/diamond/square/drop shapes.
|
|
141
|
+
|
|
142
|
+
REGULAR GRID: Equal cell width and height, equal spacing — TA re-measures from pixels after generation;
|
|
143
|
+
do NOT trust API-reported grid metadata without calibration.
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Prompt 必须包含**:`sprite sheet` 或 `state reference sheet`、`STRICT LAYOUT`、`non-overlapping cells`、具体 gap 像素、`isolated`、`NO white box`、`NO scene`、**`UNIFORM SILHOUETTE`**(元素板)。
|
|
147
|
+
|
|
148
|
+
## 4. 生成命令
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# UI 组件状态板
|
|
152
|
+
playcraft tools generate-image \
|
|
153
|
+
--prompt "<UI sheet prompt>" \
|
|
154
|
+
--output assets/images/reference/ui_state_sheet_[X].png \
|
|
155
|
+
--reference-image assets/images/storyboard/master_composite_option_[X].png \
|
|
156
|
+
--image-model <与 MC 相同> \
|
|
157
|
+
--aspect-ratio 16:9 \
|
|
158
|
+
--image-size 4K
|
|
159
|
+
|
|
160
|
+
# 玩法元素状态板
|
|
161
|
+
playcraft tools generate-image \
|
|
162
|
+
--prompt "<Element sheet prompt>" \
|
|
163
|
+
--output assets/images/reference/element_state_sheet_[X].png \
|
|
164
|
+
--reference-image assets/images/storyboard/master_composite_option_[X].png \
|
|
165
|
+
--image-model <与 MC 相同> \
|
|
166
|
+
--aspect-ratio 16:9 \
|
|
167
|
+
--image-size 4K
|
|
168
|
+
|
|
169
|
+
# 元素板溢出时(可选第二张)
|
|
170
|
+
playcraft tools generate-image \
|
|
171
|
+
--prompt "<Element sheet part 2 prompt>" \
|
|
172
|
+
--output assets/images/reference/element_state_sheet_[X]_2.png \
|
|
173
|
+
--reference-image assets/images/storyboard/master_composite_option_[X].png \
|
|
174
|
+
--image-model <与 MC 相同> \
|
|
175
|
+
--aspect-ratio 16:9 \
|
|
176
|
+
--image-size 4K
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## 5. 核查清单
|
|
180
|
+
|
|
181
|
+
| # | 核查项 | 标准 |
|
|
182
|
+
| --- | ------------ | ---------------------------------------------------------------------------- |
|
|
183
|
+
| 1 | 时机 | `selectedMcOption` 已设置 |
|
|
184
|
+
| 2 | 数量 | UI 板 + 元素板各至少一张 |
|
|
185
|
+
| 3 | 视觉 | 两板均无重叠;有重叠则重生成 |
|
|
186
|
+
| 4 | 语义 | UI 板无玩法棋子;元素板无整屏 HUD 截屏 |
|
|
187
|
+
| 5 | 格内可抠 | 目视:无白盒/场景底/格内渐变;金橙元素格用蓝幕 |
|
|
188
|
+
| 6 | 整图 opaque | 预期行为 — 不要求透明 PNG |
|
|
189
|
+
| 7 | 清单 | `artist-log` § **ASR Coverage Matrix** 100% contract 行 + `CoverageLayer` 列 |
|
|
190
|
+
| 8 | 网格元数据 | Sheet grid 表:rows × cols + cell W×H + padding(非 `{{placeholder}}`) |
|
|
191
|
+
| 9 | type 代表态 | 每种 element type 至少在 on-asr 或 mc-crop 有一处 |
|
|
192
|
+
| 10 | asrSlot 镜像 | on-asr 行已写入 `atom-tree.json` → `meta.selectedAtoms.asrSlot` |
|
|
193
|
+
|
|
194
|
+
## 6. 与 TA 的协作协议
|
|
195
|
+
|
|
196
|
+
Artist:风格与 MC 一致;在 `artist-log.md` § **ASR Coverage Matrix** 标注 **CoverageLayer** 与 **TA 需扩展的状态**。
|
|
197
|
+
|
|
198
|
+
TA 提取(详见 `playcraft-masking`):
|
|
199
|
+
|
|
200
|
+
| 来源图 | 推荐方式 | 说明 |
|
|
201
|
+
| -------------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
202
|
+
| **ASR**(规则网格) | `playcraft image crop` | 槽位坐标来自 `artist-log` § **ASR Coverage Matrix**(含 Sheet grid 元数据)或 `atom-tree.json` → `asrSlot`;**禁止**对 ASR 用纯 text `segment` |
|
|
203
|
+
| **Master Composite** | `decompose-layers` 或 crop | `mc-crop` 层从此补提取 |
|
|
204
|
+
|
|
205
|
+
**若 TA crop 后仍不可抠**(白边/色幕残留/元素被截断)→ `routeTo: artist` 重生成 ASR 格,**非** TA 自行重画 ASR。
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playcraft-audio-generation
|
|
3
|
+
description: PlayCraft AI 音频生成完整指南。涵盖 SFX 音效生成、BGM 背景音乐生成(prompt 套路、时长、风格参数)、本地音频后处理(compress/fade/loop/normalize/mix),以及完整的音频管线。Artist 和 TA 在生成音频资产前必读。
|
|
4
|
+
triggers: 生成音效,生成bgm,生成背景音乐,generate sfx,generate bgm,generate audio,音频,音效,背景音乐,sfx,bgm,loop音频,音频压缩,音频处理,audio,compress audio,fade,normalize,音频后处理,音频管线
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PlayCraft AI 音频生成指南
|
|
8
|
+
|
|
9
|
+
## 0. 开始前必读
|
|
10
|
+
|
|
11
|
+
音频资产分两类,使用不同工具:
|
|
12
|
+
|
|
13
|
+
| 类型 | 工具 | 是否需要后端 |
|
|
14
|
+
| ------------------ | ------------------------------ | ------------ |
|
|
15
|
+
| AI 生成音效(SFX) | `playcraft tools generate-sfx` | 是 |
|
|
16
|
+
| AI 生成 BGM | `playcraft tools generate-bgm` | 是 |
|
|
17
|
+
| 本地音频处理 | `playcraft audio <子命令>` | 否 |
|
|
18
|
+
|
|
19
|
+
> ⚠️ **重要**:`generate-sfx` 的 `--prompt` **只支持英文**。BGM 的 prompt 可以用中文描述风格,但英文效果更稳定。
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 1. SFX 音效生成
|
|
24
|
+
|
|
25
|
+
### 基本用法
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
playcraft tools generate-sfx \
|
|
29
|
+
--prompt "short coin collect chime, game UI, bright and crisp" \
|
|
30
|
+
--output assets/audio/sfx/coin.mp3 \
|
|
31
|
+
--duration 1.0
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 常用参数
|
|
35
|
+
|
|
36
|
+
| 参数 | 说明 | 建议值 |
|
|
37
|
+
| ------------ | --------------------------- | -------------------------- |
|
|
38
|
+
| `--prompt` | 音效描述(**必须英文**) | 见下方 prompt 套路 |
|
|
39
|
+
| `--output` | 保存路径(`.mp3` / `.wav`) | — |
|
|
40
|
+
| `--duration` | 时长(秒) | SFX:0.3–3.0;环境音:3–10 |
|
|
41
|
+
| `--loop` | 是否循环友好 | 环境音、引擎声用 `--loop` |
|
|
42
|
+
|
|
43
|
+
### SFX Prompt 套路
|
|
44
|
+
|
|
45
|
+
**结构**:`[音效描述], [场景/用途], [音色特征], [可选:情绪/风格]`
|
|
46
|
+
|
|
47
|
+
| 用途 | Prompt 示例 |
|
|
48
|
+
| -------------- | -------------------------------------------------------------------------- |
|
|
49
|
+
| UI 点击 | `"button click, game UI, soft and satisfying, short"` |
|
|
50
|
+
| 金币收集 | `"coin collect chime, arcade game, bright metallic, 0.5 seconds"` |
|
|
51
|
+
| 爆炸 | `"explosion impact, action game, deep bass rumble with debris scatter"` |
|
|
52
|
+
| 卡牌翻转 | `"card flip whoosh, card game, crisp paper sound"` |
|
|
53
|
+
| 胜利提示 | `"victory fanfare, casual mobile game, cheerful and upbeat, short jingle"` |
|
|
54
|
+
| 失败提示 | `"fail sound, game over, descending tone, simple"` |
|
|
55
|
+
| 跳跃 | `"jump sound, platform game, light spring bounce"` |
|
|
56
|
+
| 魔法施放 | `"magic spell cast, fantasy game, sparkling shimmer with whoosh"` |
|
|
57
|
+
| 麻将碰牌 | `"mahjong tile click, ceramic tap sound, sharp and clear"` |
|
|
58
|
+
| 环境音(循环) | `"forest ambient, birds chirping, peaceful, seamless loop"` |
|
|
59
|
+
|
|
60
|
+
**质量修饰词**(加在末尾):
|
|
61
|
+
|
|
62
|
+
- 追求干净:`"clean, no reverb, game-ready"`
|
|
63
|
+
- 追求丰富:`"rich, layered, cinematic"`
|
|
64
|
+
- 追求复古:`"8-bit, chiptune, retro game"`
|
|
65
|
+
|
|
66
|
+
### 批量 SFX 生成脚本
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
// ta-workspace/scripts/gen-sfx.mjs
|
|
70
|
+
import { execSync } from 'child_process';
|
|
71
|
+
import { existsSync } from 'fs';
|
|
72
|
+
|
|
73
|
+
const OUTPUT_DIR = 'assets/audio/sfx';
|
|
74
|
+
const SFX_LIST = [
|
|
75
|
+
{
|
|
76
|
+
name: 'coin',
|
|
77
|
+
prompt: 'coin collect chime, arcade game, bright metallic, 0.5 seconds',
|
|
78
|
+
duration: 0.5,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'click',
|
|
82
|
+
prompt: 'button click, game UI, soft satisfying, short',
|
|
83
|
+
duration: 0.3,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'win',
|
|
87
|
+
prompt: 'victory fanfare, casual mobile game, cheerful upbeat jingle',
|
|
88
|
+
duration: 2.0,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'fail',
|
|
92
|
+
prompt: 'fail sound, game over, descending tone, simple',
|
|
93
|
+
duration: 1.5,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'jump',
|
|
97
|
+
prompt: 'jump sound, platform game, light spring bounce',
|
|
98
|
+
duration: 0.4,
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
for (const sfx of SFX_LIST) {
|
|
103
|
+
const output = `${OUTPUT_DIR}/${sfx.name}.mp3`;
|
|
104
|
+
if (existsSync(output)) {
|
|
105
|
+
console.log(`[SKIP] ${sfx.name}`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
console.log(`[GEN] ${sfx.name}...`);
|
|
109
|
+
execSync(
|
|
110
|
+
`playcraft tools generate-sfx --prompt "${sfx.prompt}" --output "${output}" --duration ${sfx.duration}`,
|
|
111
|
+
{ stdio: 'inherit' },
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 2. BGM 背景音乐生成
|
|
119
|
+
|
|
120
|
+
### 基本用法
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
playcraft tools generate-bgm \
|
|
124
|
+
--prompt "upbeat casual mobile game, playful and energetic, suitable for a card matching game" \
|
|
125
|
+
--output assets/audio/bgm/main_theme.mp3 \
|
|
126
|
+
--bpm 120
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 常用参数
|
|
130
|
+
|
|
131
|
+
| 参数 | 说明 | 建议值 |
|
|
132
|
+
| ---------- | ------------ | ---------------------------------------------- |
|
|
133
|
+
| `--prompt` | 音乐风格描述 | 见下方 prompt 套路 |
|
|
134
|
+
| `--output` | 保存路径 | — |
|
|
135
|
+
| `--bpm` | 节拍速度 | 轻松:90–110;激烈:130–160 |
|
|
136
|
+
| `--style` | 附加风格标签 | `"electronic"` / `"orchestral"` / `"chiptune"` |
|
|
137
|
+
|
|
138
|
+
### BGM Prompt 套路
|
|
139
|
+
|
|
140
|
+
**结构**:`[游戏类型], [情绪基调], [乐器风格], [可选:特定场景]`
|
|
141
|
+
|
|
142
|
+
| 场景 | Prompt 示例 | BPM |
|
|
143
|
+
| ------------ | ------------------------------------------------------------------- | --- |
|
|
144
|
+
| 休闲手游主题 | `"casual mobile game, cheerful and bouncy, ukulele and marimba"` | 110 |
|
|
145
|
+
| 扑克牌游戏 | `"card game background, smooth jazz lounge, elegant and relaxed"` | 95 |
|
|
146
|
+
| 麻将游戏 | `"mahjong game, traditional Chinese instruments, calm and focused"` | 85 |
|
|
147
|
+
| 动作游戏 | `"action arcade game, intense and driving, electronic synth drums"` | 145 |
|
|
148
|
+
| 像素风冒险 | `"8-bit adventure game, chiptune style, heroic and nostalgic"` | 130 |
|
|
149
|
+
| 益智解谜 | `"puzzle game, gentle and thoughtful, soft piano and ambient pad"` | 90 |
|
|
150
|
+
| 胜利画面 | `"victory celebration, triumphant fanfare, short and energetic"` | 140 |
|
|
151
|
+
| 菜单/大厅 | `"game lobby menu, welcoming and pleasant, light and airy"` | 100 |
|
|
152
|
+
|
|
153
|
+
### BGM 循环处理(必做!)
|
|
154
|
+
|
|
155
|
+
AI 生成的 BGM 首尾通常不能无缝循环,需要后处理:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# 生成后检查时长
|
|
159
|
+
playcraft audio info --input assets/audio/bgm/main_theme.mp3
|
|
160
|
+
|
|
161
|
+
# 无缝循环处理(交叉淡化 1 秒)
|
|
162
|
+
playcraft audio loop \
|
|
163
|
+
--input assets/audio/bgm/main_theme.mp3 \
|
|
164
|
+
--output assets/audio/bgm/main_theme_loop.mp3 \
|
|
165
|
+
--crossfade 1.0
|
|
166
|
+
|
|
167
|
+
# 验证循环点
|
|
168
|
+
playcraft audio info --input assets/audio/bgm/main_theme_loop.mp3
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 3. 本地音频后处理
|
|
174
|
+
|
|
175
|
+
所有 `playcraft audio` 子命令**完全本地运行**,无需网络。
|
|
176
|
+
|
|
177
|
+
### 3.1 常用处理命令
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# 查看音频信息(时长、体积、比特率、采样率)
|
|
181
|
+
playcraft audio info --input audio.mp3
|
|
182
|
+
|
|
183
|
+
# 压缩(减小文件体积)
|
|
184
|
+
playcraft audio compress \
|
|
185
|
+
--input audio.mp3 \
|
|
186
|
+
--output audio_small.mp3 \
|
|
187
|
+
--target-size 50KB # 或指定比特率 --bitrate 64k
|
|
188
|
+
|
|
189
|
+
# 裁剪(取片段)
|
|
190
|
+
playcraft audio trim \
|
|
191
|
+
--input audio.mp3 \
|
|
192
|
+
--output trimmed.mp3 \
|
|
193
|
+
--start 0 --end 5.0 # 取前 5 秒
|
|
194
|
+
|
|
195
|
+
# 淡入淡出
|
|
196
|
+
playcraft audio fade \
|
|
197
|
+
--input audio.mp3 \
|
|
198
|
+
--output audio_fade.mp3 \
|
|
199
|
+
--fade-in 0.3 \
|
|
200
|
+
--fade-out 0.5
|
|
201
|
+
|
|
202
|
+
# 无缝循环
|
|
203
|
+
playcraft audio loop \
|
|
204
|
+
--input audio.mp3 \
|
|
205
|
+
--output audio_loop.mp3 \
|
|
206
|
+
--crossfade 1.0
|
|
207
|
+
|
|
208
|
+
# 响度标准化(游戏音频建议 -16 LUFS)
|
|
209
|
+
playcraft audio normalize \
|
|
210
|
+
--input audio.mp3 \
|
|
211
|
+
--output audio_norm.mp3 \
|
|
212
|
+
--target-loudness -16
|
|
213
|
+
|
|
214
|
+
# 格式转换(WAV → MP3,或 MP3 → OGG)
|
|
215
|
+
playcraft audio convert \
|
|
216
|
+
--input audio.wav \
|
|
217
|
+
--output audio.mp3
|
|
218
|
+
|
|
219
|
+
# 多轨混音
|
|
220
|
+
playcraft audio mix \
|
|
221
|
+
--inputs bgm.mp3,sfx.mp3 \
|
|
222
|
+
--output mixed.mp3 \
|
|
223
|
+
--volumes 0.7,1.0 # BGM 70%,SFX 100%
|
|
224
|
+
--offsets 0,2.5 # SFX 在 2.5 秒处开始
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### 3.2 标准音频处理管线
|
|
228
|
+
|
|
229
|
+
AI 生成后的**必做处理步骤**:
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
SFX 管线:
|
|
233
|
+
generate-sfx → normalize (-16 LUFS) → compress (目标 <100KB) → convert (.mp3)
|
|
234
|
+
|
|
235
|
+
BGM 管线:
|
|
236
|
+
generate-bgm → normalize (-16 LUFS) → loop (--crossfade 1.0) → compress (目标 <500KB) → convert (.mp3)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## 4. 错误恢复策略
|
|
242
|
+
|
|
243
|
+
| 错误现象 | 原因 | 行动 |
|
|
244
|
+
| ------------------------------ | ----------------- | -------------------------------------------- |
|
|
245
|
+
| `generate-sfx` prompt 返回错误 | Prompt 包含中文 | **改为英文** |
|
|
246
|
+
| SFX 时长不准 | AI 生成时长近似值 | 用 `audio trim` 裁剪到精确时长 |
|
|
247
|
+
| BGM 首尾断裂 | AI 未做循环 | **必须跑 `audio loop --crossfade 1.0`** |
|
|
248
|
+
| 音量太小/太大 | 生成音量随机 | `audio normalize --target-loudness -16` |
|
|
249
|
+
| 文件体积太大(>1MB) | 无压缩 | `audio compress --target-size 200KB` |
|
|
250
|
+
| 格式不对 | 项目要求特定格式 | `audio convert --input x.wav --output x.mp3` |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 5. 常用命令速查
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# AI 生成 SFX(prompt 必须英文)
|
|
258
|
+
playcraft tools generate-sfx \
|
|
259
|
+
--prompt "coin collect, bright chime, 0.5 seconds" \
|
|
260
|
+
--output sfx/coin.mp3 \
|
|
261
|
+
--duration 0.5
|
|
262
|
+
|
|
263
|
+
# AI 生成 BGM
|
|
264
|
+
playcraft tools generate-bgm \
|
|
265
|
+
--prompt "casual card game, upbeat jazz, relaxed" \
|
|
266
|
+
--output bgm/theme.mp3 \
|
|
267
|
+
--bpm 110
|
|
268
|
+
|
|
269
|
+
# 无缝循环处理(BGM 必做)
|
|
270
|
+
playcraft audio loop --input bgm/theme.mp3 --output bgm/theme_loop.mp3 --crossfade 1.0
|
|
271
|
+
|
|
272
|
+
# 响度标准化(SFX/BGM 推荐)
|
|
273
|
+
playcraft audio normalize --input audio.mp3 --output audio_norm.mp3 --target-loudness -16
|
|
274
|
+
|
|
275
|
+
# 压缩减体积
|
|
276
|
+
playcraft audio compress --input audio.mp3 --output audio_small.mp3 --target-size 100KB
|
|
277
|
+
|
|
278
|
+
# 查看音频信息
|
|
279
|
+
playcraft audio info --input audio.mp3
|
|
280
|
+
```
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playcraft-batch-pipeline
|
|
3
|
+
description: PlayCraft 批处理管线选型与语法指南。涵盖三种批处理方式的选型决策树(Node.js 脚本 / CLI batch / CLI pipeline)、playcraft image batch 的 steps 语法与已知限制、playcraft image pipeline 的 YAML 配置结构与 assemble 精灵图组装。实用配方见 refs 文件。
|
|
4
|
+
triggers: 批处理,batch,pipeline,批量操作,多文件处理,声明式管线,YAML配置,批量resize,批量转换,批量去背,assemble,精灵图组装,image batch,image pipeline,批量处理,parallel,skip-existing,断点续传
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PlayCraft 批处理管线指南
|
|
8
|
+
|
|
9
|
+
## 0. 三种批处理方式选型
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
需要批量处理多张图片?
|
|
13
|
+
│
|
|
14
|
+
├─ 涉及 AI 生成(generate-image)或复杂分支逻辑?
|
|
15
|
+
│ └─ → Node.js .mjs 脚本(ta-workspace/scripts/)
|
|
16
|
+
│ 参考:playcraft-image-generation Skill 的 reference/ 模板
|
|
17
|
+
│
|
|
18
|
+
├─ 纯本地图像处理(resize/convert/tint 等),需要并发加速?
|
|
19
|
+
│ └─ → playcraft image batch(本节 §1)
|
|
20
|
+
│
|
|
21
|
+
└─ 需要最终自动打包成精灵图,或用配置文件管理管线?
|
|
22
|
+
└─ → playcraft image pipeline(本节 §2)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**三种方式对比**:
|
|
26
|
+
|
|
27
|
+
| 特性 | Node.js 脚本 | image batch | image pipeline |
|
|
28
|
+
| -------------- | ------------ | ----------------- | ----------------------- |
|
|
29
|
+
| AI 生成 | 支持 | 不支持 | 不支持 |
|
|
30
|
+
| 并发控制 | 自定义 | `--parallel N` | 顺序 |
|
|
31
|
+
| 断点续传 | 自实现 | `--skip-existing` | 不支持 |
|
|
32
|
+
| 配置复用 | JS 文件 | 命令行 | YAML/JSON 文件 |
|
|
33
|
+
| 自动组装精灵图 | 自实现 | 不支持 | `assemble.sprite-sheet` |
|
|
34
|
+
| 学习成本 | 中 | 低 | 低 |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 1. playcraft image batch — 声明式多步批处理
|
|
39
|
+
|
|
40
|
+
对一个目录(或多个文件)中的所有图片,按顺序执行多个处理步骤。
|
|
41
|
+
|
|
42
|
+
### 基础用法
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
playcraft image batch \
|
|
46
|
+
--input-dir assets/images/raw/ \
|
|
47
|
+
--output-dir assets/images/processed/ \
|
|
48
|
+
--steps "resize --width 256 --height 256, tint --color #FFD700" \
|
|
49
|
+
--parallel 4 --skip-existing
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
| 参数 | 类型 | 说明 |
|
|
53
|
+
| -------------------- | ------ | ---------------------------------------------- |
|
|
54
|
+
| `--input-dir <dir>` | string | 输入目录(与 `--inputs` 二选一) |
|
|
55
|
+
| `--inputs <paths>` | string | 逗号分隔的文件列表(与 `--input-dir` 二选一) |
|
|
56
|
+
| `--glob <pattern>` | string | 文件匹配模式,默认 `*.png,*.jpg,*.jpeg,*.webp` |
|
|
57
|
+
| `--output-dir <dir>` | string | 输出目录(必填)**输出统一为 .png** |
|
|
58
|
+
| `--steps <pipeline>` | string | 处理步骤(必填,见下方语法) |
|
|
59
|
+
| `--parallel <N>` | number | 并发数,默认 4 |
|
|
60
|
+
| `--skip-existing` | flag | 跳过输出目录中已存在的文件(断点续传) |
|
|
61
|
+
|
|
62
|
+
### Steps 语法
|
|
63
|
+
|
|
64
|
+
`--steps` 接受逗号分隔的步骤列表,每步格式为 `子命令名 [参数...]`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
--steps "resize --width 128 --height 128, grayscale, tint --color #4488FF"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 支持的步骤命令
|
|
71
|
+
|
|
72
|
+
| 可用命令 | 示例 |
|
|
73
|
+
| ------------------- | --------------------------------------------------------- |
|
|
74
|
+
| `resize` | `resize --width 128 --height 128` 或 `resize --scale 0.5` |
|
|
75
|
+
| `convert` | `convert --format webp --quality 85` |
|
|
76
|
+
| `grayscale` | `grayscale` |
|
|
77
|
+
| `blur` | `blur --sigma 5` |
|
|
78
|
+
| `tint` | `tint --color #FFD700` |
|
|
79
|
+
| `trim` | `trim --threshold 20` |
|
|
80
|
+
| `negate` | `negate` |
|
|
81
|
+
| `rotate` | `rotate --angle 90` |
|
|
82
|
+
| `flip` | `flip --direction horizontal` |
|
|
83
|
+
| `pad` | `pad --all 8` |
|
|
84
|
+
| `pixelate` | `pixelate --pixel-size 8` |
|
|
85
|
+
| `remove-background` | `remove-background --method floodfill --tolerance 40` |
|
|
86
|
+
|
|
87
|
+
> **已知限制**:`crop`、`overlay`、`sprite-split`、`sprite-sheet`、`animate`、`use-vfx`、`segment`、`decompose-layers` 不能在 `--steps` 中使用(`segment` / `decompose-layers` 走后端 API)。需要 `crop` 或分层的批量操作请用 for 循环或 Node.js 脚本。
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 2. playcraft image pipeline — YAML/JSON 声明式管线
|
|
92
|
+
|
|
93
|
+
比 `batch` 更强大:支持配置文件复用、可选自动组装精灵图。
|
|
94
|
+
|
|
95
|
+
### YAML 配置结构
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
# ta-workspace/pipeline_config.yaml
|
|
99
|
+
input:
|
|
100
|
+
dir: assets/images/raw_tiles/
|
|
101
|
+
glob: '*.png'
|
|
102
|
+
|
|
103
|
+
steps:
|
|
104
|
+
- command: resize
|
|
105
|
+
width: 128
|
|
106
|
+
height: 128
|
|
107
|
+
- command: trim
|
|
108
|
+
threshold: 15
|
|
109
|
+
|
|
110
|
+
output:
|
|
111
|
+
dir: assets/images/tiles/
|
|
112
|
+
|
|
113
|
+
assemble: # 可选:处理完后自动组装精灵图
|
|
114
|
+
sprite-sheet:
|
|
115
|
+
output: assets/images/tiles_sprite.png
|
|
116
|
+
columns: 4
|
|
117
|
+
padding: 2
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
执行:`playcraft image pipeline --config ta-workspace/pipeline_config.yaml`(加 `--dry-run` 可预览步骤)
|
|
121
|
+
|
|
122
|
+
### assemble.sprite-sheet 说明
|
|
123
|
+
|
|
124
|
+
配置 `assemble.sprite-sheet` 后,pipeline 完成所有文件处理后,会自动将 `output.dir` 下的所有 `*.png` 合并为一张精灵图(同时生成 `.json` 元数据):
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
assemble:
|
|
128
|
+
sprite-sheet:
|
|
129
|
+
output: assets/images/sprite_atlas.png
|
|
130
|
+
columns: 4 # 每行帧数
|
|
131
|
+
padding: 2 # 帧间距(像素)
|
|
132
|
+
sort: name # 排序方式:name(默认)/ modified / none
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 3. 何时用哪种方式(完整决策树)
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
需要批量处理?
|
|
141
|
+
│
|
|
142
|
+
├─ 需要 AI 生成(generate-image/generate-3d)?
|
|
143
|
+
│ └─ 用 Node.js 脚本(ta-workspace/scripts/*.mjs)
|
|
144
|
+
│ 参考:playcraft-image-generation SKILL 的 reference/gen-batch.template.mjs
|
|
145
|
+
│
|
|
146
|
+
├─ 只需要本地图像变换(resize/tint/trim/convert/去背等)?
|
|
147
|
+
│ │
|
|
148
|
+
│ ├─ 需要最终合并成精灵图?
|
|
149
|
+
│ │ └─ 用 pipeline(YAML/JSON 配置 + assemble)
|
|
150
|
+
│ │
|
|
151
|
+
│ ├─ 需要并发加速?
|
|
152
|
+
│ │ └─ 用 batch(--parallel N)
|
|
153
|
+
│ │
|
|
154
|
+
│ ├─ 需要断点续传?
|
|
155
|
+
│ │ └─ 用 batch(--skip-existing)
|
|
156
|
+
│ │
|
|
157
|
+
│ └─ 配置需要复用/版本管理?
|
|
158
|
+
│ └─ 用 pipeline(YAML 文件)
|
|
159
|
+
│
|
|
160
|
+
└─ 需要 crop 作为批处理步骤?
|
|
161
|
+
└─ 用 for 循环(batch 不支持 crop):
|
|
162
|
+
for f in dir/*.png; do
|
|
163
|
+
playcraft image crop --input "$f" --output "out/$(basename $f)" \
|
|
164
|
+
--x 0 --y 0 --width 128 --height 128
|
|
165
|
+
done
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 4. 已知限制汇总
|
|
171
|
+
|
|
172
|
+
| 限制 | 影响 | 绕过方法 |
|
|
173
|
+
| -------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------- |
|
|
174
|
+
| `batch` 的 `--steps` 不支持 `crop` | 无法在批处理管线中裁切 | 改用 for 循环或 Node.js 脚本 |
|
|
175
|
+
| `batch` 不支持 `overlay`(需要两个输入) | 无法批量合成 | 改用 Node.js 脚本 |
|
|
176
|
+
| `pipeline` 不支持并发(顺序处理) | 大批量时较慢 | 改用 `batch --parallel` |
|
|
177
|
+
| `batch` 输出统一为 `.png`(忽略 convert 步骤后缀) | 即使 steps 中有 `convert --format webp`,文件名仍是 `.png` | pipeline 中用 convert 步骤 + 修改 output 路径 |
|
|
178
|
+
| `remove-background --method ai` 在 batch 中不支持 | 批量 AI 去背报错 | 改用 floodfill,或用 Node.js 脚本 |
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 5. 配方参考
|
|
183
|
+
|
|
184
|
+
完整的 batch/pipeline 实用配方(批量 resize、批量去背、主题色变体、精灵图组装管线等)见 `refs/ta-batch-pipeline-recipes.md`。
|