fix: harden gameplay state transitions

This commit is contained in:
Christophe Del Vecchio committed 2026-10-01 12:43:29 +02:00
1 parent 26a204b49c
commit 914e2d5c9b
8 files changed
+314 -68

No files matched your search

@@ -0,0 +1,112 @@
# Gameplay Blockers Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Remove the five identified gameplay deadlocks/regressions without changing the intended successful gameplay paths.
**Architecture:** Keep fixes local to the existing character and StateTree implementations. Add a fast source-level regression suite for exact control-flow invariants, then compile the complete Unreal editor target as the integration gate.
**Tech Stack:** Unreal Engine 5.8, C++20, Python 3 `unittest`, UnrealBuildTool on macOS.
**Spec:** User request in this conversation: fix the five gameplay blockers identified by the project audit.
## Global Constraints
- Fix only: synchronous StateTree completion, dash montage failure, attack montage failure, Side Scrolling base landing call, and per-trace hit deduplication.
- Preserve successful montage behavior and Blueprint hooks.
- No dependency changes, broad refactor, commit, push, or binary asset edit.
- Tests must be observed failing before production edits and passing afterward.
- Final verification requires the regression suite, a full `pogoEditor Mac Development` build, and a clean tracked diff check.
## Review Focus
- A missing dash montage must not consume dash state or change gravity/trails.
- Missing player attack montages must leave the player available for the next input.
- Missing enemy attack montages must finish the waiting StateTree task.
- One actor exposed through multiple hit results must receive one damage event per trace.
- Side Scrolling landing must retain `ACharacter` landing notifications before resetting local jump state.
---
### Task 1: Add the red regression suite
**Files:**
- Create: `Scripts/tests/test_gameplay_blockers.py`
**Interfaces:**
- Consumes: current C++ source text.
- Produces: five deterministic regression checks, one for each blocker.
- [ ] Write tests that extract exact C++ function bodies and assert the required control-flow invariants.
- [ ] Run `python3 -m unittest Scripts.tests.test_gameplay_blockers -v`.
- [ ] Confirm all five tests fail against the current implementation for the expected missing guards/calls.
### Task 2: Complete the synchronous StateTree speed task
**Files:**
- Modify: `Source/pogo/Variant_Combat/AI/CombatStateTreeUtility.cpp:235-244`
**Interfaces:**
- Consumes: StateTree task entry contract.
- Produces: `EnterState` returns `Succeeded` after applying `MaxWalkSpeed`.
- [ ] Change only the terminal status from `Running` to `Succeeded`.
- [ ] Run the focused StateTree regression test and confirm green.
### Task 3: Make montage startup transactional
**Files:**
- Modify: `Source/pogo/Variant_Platforming/PlatformingCharacter.cpp:235-265`
- Modify: `Source/pogo/Variant_Combat/CombatCharacter.cpp:191-243`
- Modify: `Source/pogo/Variant_Combat/AI/CombatEnemy.cpp:45-105`
**Interfaces:**
- Consumes: `UAnimInstance::Montage_Play`, where a value `<= 0` means startup failed.
- Produces: gameplay flags and side effects are committed only after successful montage startup; AI failure executes `OnAttackCompleted` so StateTree can advance.
- [ ] Guard null AnimInstance and montage before mutating dash/attack state.
- [ ] Guard `Montage_Play <= 0` before mutating state.
- [ ] Keep delegate installation on the successful path.
- [ ] Notify enemy StateTree completion on both failure paths.
- [ ] Run the focused dash and attack regression tests and confirm green.
### Task 4: Preserve base landing behavior
**Files:**
- Modify: `Source/pogo/Variant_SideScrolling/SideScrollingCharacter.cpp:118-122`
**Interfaces:**
- Consumes: `ACharacter::Landed` lifecycle.
- Produces: base landing notifications execute before local double-jump reset.
- [ ] Call `Super::Landed(Hit)` first.
- [ ] Run the focused landing regression test and confirm green.
### Task 5: Deduplicate melee hits per trace
**Files:**
- Modify: `Source/pogo/Variant_Combat/CombatCharacter.cpp:267-310`
- Modify: `Source/pogo/Variant_Combat/AI/CombatEnemy.cpp:126-170`
**Interfaces:**
- Consumes: `SweepMultiByObjectType` hit arrays, which may contain several components from one actor.
- Produces: a local `TSet<AActor*>` applies damage once per actor for each trace invocation.
- [ ] Resolve and null-check `HitActor` once per result.
- [ ] Skip actors already present in the per-call set.
- [ ] Add the actor before calling `ApplyDamage`.
- [ ] Run the focused deduplication regression test and confirm green.
### Task 6: Full verification and review
**Files:**
- Verify all modified source and test files.
**Interfaces:**
- Consumes: Tasks 1-5.
- Produces: green regression suite and compiled editor target.
- [ ] Run `python3 -m unittest Scripts.tests.test_gameplay_blockers -v`.
- [ ] Build `pogoEditor Mac Development` with UnrealBuildTool.
- [ ] Run `git diff --check` and inspect `git diff --stat` plus `git status`.
- [ ] Request a fresh whole-change code review; fix only Critical/Important findings with another red-green cycle.