Files
windroost/p2_godot_sample/HANDOFF.md
T
wushenghua 7a101173ea feat: add pixel VFX, event binding and visible-node caps; close P2 locally
VFX. The three feedback effects existed only as IDs in the contract. They
are now generated as low-resolution transparent sprite sheets (16/32/64px,
hard pixel clusters, nearest filtering) with their own manifest. VfxView
advances frame indices without interpolation, finishes deterministically, and
drops intermediate frames in low-power mode while keeping the final state.
The battle scene maps authoritative sim events to effects: shield_break,
cast_ultimate and hit. Feedback can no longer disagree with the simulation.

Node caps. The stage now clamps visible enemies to five and visible heroes to
five, with a test that supplies seven enemies and six heroes, checks the real
node counts and verifies stale nodes are released when content shrinks.

tools/run_p2_checks.sh now runs 13 gates; all pass. PRODUCTION/38 records
P2-VFX-01 and the node-count portion of P2-BAT-03 as PASS, so P2 local
acceptance is complete. Open gates are the real-device ones (safe-area inset,
frame time, memory, heat) plus human comprehension and willingness to
continue; no local automation can grant those.
2026-11-17 00:03:47 +08:00

6.2 KiB
Raw Blame History

P2 Godot 小样交接

已实现

  • project.godot:Godot 4.6 工程,390×844 竖屏参考尺寸、nearest 纹理过滤、像素吸附和 gl_compatibility。
  • scripts/battle_sim.gd:权威战斗实现。与纸面 runner 共用 data/mvp_battle_rules.json 的数值和同一个 SHA-256 种子派生,逐字节复现纸面结果。暴露为状态机(create_state / inject_input / step_state),可被实时场景按 tick 驱动,也可整局批跑。
  • scripts/batch_runner.gd + run_batch_sim.sh:一次跑完 3 场景 × 100 seed,输出与纸面同 schema 的 JSON。
  • scripts/frozen_fixture.gd:只读加载仓库根目录下的 data/mvp_content_fixture.json、data/mvp_p2_validation_manifest.json、data/mvp_validation_seed_pack.json、data/mvp_battle_rules.json,并校验固定 ID 与 0.1 秒 tick。
  • scripts/headless_smoke.gd + run_headless_smoke.sh:编辑器导入检查、headless 场景运行和机器可读 JSON 证据。
  • scripts/save_store.gd + scripts/save_smoke.gd + run_save_smoke.sh:最小 schema=1 user:// 存档、重复领奖抑制、重新实例化后的 load 恢复和 machine-readable save 证据。
  • scripts/battle_hud.gd + scenes/battle_hud.tscn + scripts/battle_hud_layout.gd:战斗 HUD 承载物。区域矩形来自合同表而不是容器拉伸比例,390×844 下与 BATTLE_HUD_HIGH_FIDELITY_SPEC.md 逐像素一致,360×800 / 430×932 按舞台优先规则自适应。
  • scripts/battle_scene.gd + scenes/battle_scene.tscn:实时战斗场景(当前 main scene),驱动权威 sim 并把状态映射到 HUD;处理点击目标、连续点击、风暴号令、终极覆盖、升级、1x/2x/3x 和暂停。直接启动 Godot 工程即可操作。
  • scripts/ui_text.gd + data/ui_text.zh_CN.json + data/ui_text.en_US.json:运行时文案层,81 个 key,7 语言架构第一天成立。
  • scripts/ui_theme.gd:共享主题与 NinePatch 工厂;用 SystemFont 解析系统中文字体(Godot 内置字体没有 CJK 字形)。
  • scripts/capture_runner.gd + run_capture.sh:真实渲染截图矩阵,同时输出每个视口下的实际区域矩形,供合同核对。
  • scripts/unit_view.gd:动画单位视图。从图集清单读取帧区域、FPS 和脚线,节点原点即脚线;支持 idle 循环、一次性 hit 回退和受击闪白。
  • scripts/touch_input_test.gd + run_touch_test.sh:用真实 Input.parse_input_event(InputEventScreenTouch) 触摸 TapButton、敌人卡和风暴号令,验证事件在正确 tick 进入 event_log;同时防住触摸被模拟成鼠标导致的重复触发。
  • scripts/economy_loop_test.gd + run_economy_loop_test.sh:运行时经济闭环,胜利奖励、重复领奖保护、升级扣费、DPS 变化、下一场生效和失败不发奖。
  • scripts/vfx_view.gd:一次性像素 VFX 播放器,按帧号切换(不插值),nearest 过滤;低功耗模式跳帧但保留关键状态。
  • scripts/vfx_test.gd + run_vfx_test.sh:三个效果逐帧播放到末帧、结束状态、低功耗跳帧,以及 shield_break / cast_ultimate / hit 事件各自生成对应效果。
  • scripts/visible_node_test.gd + run_visible_node_test.sh:超量内容下实际节点计数与内容缩减后的陈旧节点清理。
  • scripts/speed_equivalence_test.gd + run_speed_equivalence.sh:1x/2x/3x 与帧率无关的结算等价性测试。
  • assets/:通过 symlink 接入角色、背景、UI 板、NinePatch 帧和多帧动画图集源文件,不复制或修改冻结资产。
  • scenes/p2_sample.tscn + scripts/p2_sample.gd:原有的技术样板场景,保留用于对照;不再作为 main scene。

已验证

执行 tools/run_p2_checks.sh(13 项一次性检查):

  • 工程可由 --editor --quit 导入并退出;
  • 三个 scenario 都能被加载并生成包含 seed、scenario_id、mode、result、duration_seconds、reward_id 和 event_log 的 JSON;
  • 同 seed 重跑输出保持确定;
  • fixture ID、三个 VFX ID 和 0.1 秒逻辑 tick 校验通过;
  • manifest 中的资产路径会在 smoke 启动时做存在性校验;
  • 纸面与运行时在 300 条结果上逐字段一致,包含每条 event_log(tools/mvp_parity_gate.py),且纸面结果与冻结参考一致;
  • 存档 smoke 记录 schema=1、node/progress、reward_id、claimed,首次领取成功、第二次同 reward 返回 already_claimed 且不重复生效,重新 load 后 progress、reward 和 claimed 保持不变;
  • 1x/2x/3x 在 3 帧率 × 3 速度共 9 组下结算指纹完全相同;
  • UI 截图矩阵 8 张:390×844 / 360×800 / 430×932,zh_CN 与 en_US,战斗态、暂停弹层和胜利结算;每张都记录真实视口尺寸与区域矩形,390×844 与合同逐像素一致。
  • 战斗舞台已渲染真实角色:H01 在下方、EG01/B01 在上方,动画帧按统一脚线对齐;敌人受击会播放一次性 hit 并闪白。
  • 真实触摸通过:Input.parse_input_event(InputEventScreenTouch) 命中三个入口,在正确 tick 产生 click_enemy / offboard_burst,并防住重复触发。
  • 运行时经济闭环通过:4 胜 × 30 金币 = 120 → 升级扣费 → 旅团 DPS 65→67 → 下一场战斗实际使用 67;重复领奖与失败不发奖均通过。
  • VFX 与事件映射通过:三个 16/32/64px 像素图集逐帧播放到末帧;shield_break / cast_ultimate / hit 事件生成对应效果;低功耗按帧数跳中间帧但保留末帧。截图矩阵含 2 张 VFX 实拍帧。
  • 可视节点上限通过:7 敌人/6 英雄输入下实际敌人节点 5、英雄节点 1、铭牌 5、热区 5;内容缩减后陈旧节点被释放。

仍未验证

  • 角色动画:H01/EG01/B01 的 idle 与 hit/attack 已接入;skill/ultimate 帧虽已生成但尚未接入运行时。
  • profiler 帧时采样:本地未做;真机帧率、内存和功耗尚未测量。
  • 真机安全区 inset、低功耗降级、真机帧率和内存。
  • 人工可读性、理解与继续游玩意愿。
  • 真实 OS 后台/挂起恢复、崩溃中断、原子写入失败恢复和跨版本迁移;
  • 该 adapter 不是 P3a 正式产品战斗实现,也没有实现重建、离线收益或全量内容。