Answered the UI/game-feel question with implementation, not just advice. The previous hit feedback was two or three channels scattered across BattleScene and BattleHud, with no tiering and no central accessibility handling. FeedbackService (autoload `Feedback`) now turns committed authoritative events into presentation-only feedback: decaying trauma shake on a visual-only pivot (sine-sum, never per-frame randf), a centralized hit-stop that extends one deadline across concurrent hits and restores the pre-effect time_scale, and a replaceable UI pop tween. Events are tiered small/medium/large so routine clicks stay quieter than shield breaks and ultimates. Authority boundary: feedback is requested only after the sim commits; the service never touches economy, combat, save, reward or timing truth. Reduced motion fully suppresses shake/hit-stop, low power scales them down, and clear_all returns every effect to rest on scene change or settings change. Shake targets BattleHud's visual stage container, never a simulated unit. feedback_test proves tier mapping, exact shake rest position, reduced-motion suppression, pop rest, and time_scale restore from 0.08 to 1.0. Crucially the 300-result parity, 1x/2x/3x equivalence and five-profile pacing all still pass: hit-stop changes presentation time, not tick progression. The log audit is clean, and a real Godot window with a boss battle rendered without errors or a stuck time_scale. tools/run_p2_checks.sh now runs 25 gates; all pass. PRODUCTION/43 records the design, the authority boundary, and the honest limits: feel, comfort and timing still need real input and human review.
3.6 KiB
3.6 KiB
43 · 战斗反馈系统(FeedbackService)
状态:集中反馈服务已实现并纳入闸门。可复跑:
run_feedback_test.sh;tools/run_p2_checks.sh现 25 项全过(含 parity / 速度等价 / 日志审查)。
1. 为什么做
在补 UI/动效方法论时对照 game-feel 框架发现:之前命中的反馈只有飘字 + 一个 VFX + 一个音效,且散落在 BattleScene 和 BattleHud 里,没有分级、没有 hit-stop/shake/pop,可访问性变形也各做各的。框架的原则是:一次有分量的命中是 5–8 个微小响应在 ~100ms 内叠加,且必须回到静止态、按事件重要性缩放。
2. 设计(scripts/feedback_service.gd,autoload 为 Feedback)
集中管理三类 previously 缺失的反馈通道:
- camera shake:衰减式 trauma(
trauma²缩放),用多个不同频率正弦叠加,绝不每帧randf()(那是蜂鸣不是震动)。shake 施加在BattleHud的_stage_inner—— 一个纯视觉容器,不是模拟单位、不是碰撞体、不是布局根节点。缓存并精确恢复 base position。 - hit-stop:集中管理
Engine.time_scale,并发命中只延长一个 deadline,恢复前值。等待用ignore_time_scale=true的 timer,避免被自身减速拉长。 - UI pop:升级按钮用
TRANS_BACK/EASE_OUT弹一下;先 kill 上个 tween,只动 scale 不动 Container 管理的 position。
事件分级(来自权威 event_log,不猜按钮):
| 级别 | 事件 | trauma | hit-stop |
|---|---|---|---|
| small | click_enemy |
0.06 | 无 |
| medium | offboard_burst / shield_break / enemy_defeated / shield_rebuild |
0.30 | 0.04s |
| large | cast_ultimate / first_clear |
0.72 | 0.09s |
3. 权威边界(game-feel 第一条)
- 反馈只在战斗状态已经提交后由
_scan_battle_events按事件请求;被拒绝的购买、重复领取、非法目标不会收到成功反馈。 - 服务不碰经济、战斗数值、存档、奖励、计时真值。
- 结算完全不受影响:全闸门的 300 条 parity、速度等价(1x/2x/3x)、五档节奏都仍通过——hit-stop 改的是呈现时间轴,不是 tick 推进(
advance_ticks直接调step_state,不走 delta)。
4. 可访问性与资源模式
reduced_motion:完全压制 shake 与 hit-stop(视觉状态确认由 VFX 末帧、飘字、关闭的闪白承担),事件本身仍被计数。low_power:trauma 振幅 ×0.4、hit-stop 时长 ×0.5、shake 幅度 ×0.5。clear_all():场景切换、设置变更、暂停、错误恢复时一次性把所有效果拉回静止态(position / scale / time_scale)。- 静音由 SfxPlayer 独立处理;反馈服务不依赖音频回调。
5. 验证边界(诚实)
feedback_test 在 headless 里证明了:分级映射、shake 精确回位、reduced motion 压制、pop 回 ONE、clear_all 把 time_scale 从 0.08 恢复到 1.0、日志无错。
它证明不了:手感、震动舒适度、节奏是否漂亮、真实设备的 hit-stop 体感。这些需要真实输入 + 正常渲染下反复/并发触发并人工观察,属于 runtime_verified 之上的 human 闸门,仍开放。真实窗口截图确认渲染无错、无卡死(hit-stop 若未恢复会让进程表现为卡住)。
6. 下一步(仍未做)
- reduced flashes 独立开关(当前 reduced_motion 一并压制闪白,但没有单独维度)
- 命中时的 knockback、蓄力/收势(动画层)、large 事件的短暂 zoom
- 15–30 秒真实交互录屏,做 before/after 的
agent_visual_reviewed