Implement Strike and Hold challenge types #243

Open
opened 2026-03-16 01:41:45 +00:00 by freemo · 0 comments
Owner

Metadata

Field Value
Parent Epic Epic: Crafting Minigame Engine (#211)
Legendary Crafting & Resource Economy (#200)
Type Feature
Priority High
MoSCoW Must Have
Points 8
Branch feature/m4-strike-hold-challenges
Commit Message Implement Strike and Hold challenge types (#243)

Background and Context

The crafting minigame engine uses a variety of challenge types to create an engaging and varied crafting experience. Strike and Hold are two of the four core challenge types that test different aspects of player timing.

Strike challenges simulate the precise moment of action — like striking an anvil at the right moment or adding a reagent at the perfect time. The player must press a key within a narrow timing window. Scoring is based on how close to the center of the window they press.

Hold challenges simulate sustained effort — like maintaining bellows pressure or stirring a mixture. The player must hold a key down for a target duration. Scoring is based on how close to the target duration they hold.

Both challenges inherit from CraftingChallenge and integrate with the CraftingMinigame step sequencing system.

Expected Behavior

Strike Challenge

  1. The player is presented with a timing indicator (text-based, e.g., a moving marker across a bar).
  2. A timing window is defined (e.g., 200ms-500ms after the indicator starts).
  3. The player must press a designated key within the window.
  4. Score calculation:
    • Perfect (within center 20% of window): 100% of max_score.
    • Good (within center 50% of window): 75% of max_score.
    • OK (within the window): 50% of max_score.
    • Miss (outside the window): 0.
  5. If the player does not press within the timeout, the step scores 0.

Hold Challenge

  1. The player is told to hold a key for a target duration (e.g., 3 seconds).
  2. The player presses and holds the key, then releases.
  3. Score calculation:
    • The score is based on how close the held duration is to the target: max_score * (1 - abs(held - target) / target), minimum 0.
    • Perfect (within 5% of target): 100% of max_score.
  4. If the player does not press within the timeout, the step scores 0.

Acceptance Criteria

  • StrikeChallenge class inherits from CraftingChallenge and implements present, evaluate, max_score, and timeout.
  • Strike scoring correctly implements the Perfect/Good/OK/Miss tiers based on timing.
  • HoldChallenge class inherits from CraftingChallenge and implements present, evaluate, max_score, and timeout.
  • Hold scoring correctly calculates based on duration accuracy.
  • Both challenges integrate seamlessly with CraftingMinigame step sequencing.
  • Both challenges handle timeout gracefully (score 0, advance to next step).
  • Both challenges provide descriptive text feedback to the player indicating their performance.
  • Challenge parameters (timing window, target duration, max score) are configurable.

Subtasks

  • Implement StrikeChallenge class inheriting from CraftingChallenge.
  • Implement Strike timing window presentation (text-based indicator).
  • Implement Strike scoring: Perfect/Good/OK/Miss tiers.
  • Implement HoldChallenge class inheriting from CraftingChallenge.
  • Implement Hold duration tracking and presentation.
  • Implement Hold scoring based on duration accuracy.
  • Implement configurable parameters for both challenge types.
  • Write descriptive text feedback for each performance level.
  • Docs: Update YARD comments on affected classes and methods. Update relevant Docusaurus documentation pages if applicable.
  • Tests (Cucumber): Add tests/unit/strike_hold_challenges.feature covering Strike timing tiers, Hold duration accuracy, timeout handling, score boundaries, parameter configuration.
  • Tests (Cucumber Integration): Add integration feature in tests/integration/ for a minigame run using Strike and Hold challenges.
  • Tests (Profiling): Run bundle exec rake unit_profile and verify no performance regressions.
  • Quality: Verify coverage >=97% via bundle exec rake unit. If coverage is <97% then review the current unit test coverage report at build/tests/unit/coverage/ and use it to write new Cucumber based unit tests to improve code coverage. Specifically, write Cucumber/Gherkin style unit tests that are descriptively named and specifically improve coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun bundle exec rake unit to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%.
  • Quality: Run bundle exec rake (default task: unit tests with coverage) and bundle exec rake integration, fix any errors if needed ensuring both pass across entire code base, do not ignore any failure even if it seems unrelated to this commit, fix it.

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
## Metadata | Field | Value | |---|---| | **Parent Epic** | Epic: Crafting Minigame Engine (#211) | | **Legendary** | Crafting & Resource Economy (#200) | | **Type** | Feature | | **Priority** | High | | **MoSCoW** | Must Have | | **Points** | 8 | | **Branch** | `feature/m4-strike-hold-challenges` | | **Commit Message** | `Implement Strike and Hold challenge types (#243)` | ## Background and Context The crafting minigame engine uses a variety of challenge types to create an engaging and varied crafting experience. Strike and Hold are two of the four core challenge types that test different aspects of player timing. **Strike** challenges simulate the precise moment of action — like striking an anvil at the right moment or adding a reagent at the perfect time. The player must press a key within a narrow timing window. Scoring is based on how close to the center of the window they press. **Hold** challenges simulate sustained effort — like maintaining bellows pressure or stirring a mixture. The player must hold a key down for a target duration. Scoring is based on how close to the target duration they hold. Both challenges inherit from `CraftingChallenge` and integrate with the `CraftingMinigame` step sequencing system. ## Expected Behavior ### Strike Challenge 1. The player is presented with a timing indicator (text-based, e.g., a moving marker across a bar). 2. A timing window is defined (e.g., 200ms-500ms after the indicator starts). 3. The player must press a designated key within the window. 4. Score calculation: - Perfect (within center 20% of window): 100% of `max_score`. - Good (within center 50% of window): 75% of `max_score`. - OK (within the window): 50% of `max_score`. - Miss (outside the window): 0. 5. If the player does not press within the timeout, the step scores 0. ### Hold Challenge 1. The player is told to hold a key for a target duration (e.g., 3 seconds). 2. The player presses and holds the key, then releases. 3. Score calculation: - The score is based on how close the held duration is to the target: `max_score * (1 - abs(held - target) / target)`, minimum 0. - Perfect (within 5% of target): 100% of `max_score`. 4. If the player does not press within the timeout, the step scores 0. ## Acceptance Criteria - [ ] `StrikeChallenge` class inherits from `CraftingChallenge` and implements `present`, `evaluate`, `max_score`, and `timeout`. - [ ] Strike scoring correctly implements the Perfect/Good/OK/Miss tiers based on timing. - [ ] `HoldChallenge` class inherits from `CraftingChallenge` and implements `present`, `evaluate`, `max_score`, and `timeout`. - [ ] Hold scoring correctly calculates based on duration accuracy. - [ ] Both challenges integrate seamlessly with `CraftingMinigame` step sequencing. - [ ] Both challenges handle timeout gracefully (score 0, advance to next step). - [ ] Both challenges provide descriptive text feedback to the player indicating their performance. - [ ] Challenge parameters (timing window, target duration, max score) are configurable. ## Subtasks - [ ] Implement `StrikeChallenge` class inheriting from `CraftingChallenge`. - [ ] Implement Strike timing window presentation (text-based indicator). - [ ] Implement Strike scoring: Perfect/Good/OK/Miss tiers. - [ ] Implement `HoldChallenge` class inheriting from `CraftingChallenge`. - [ ] Implement Hold duration tracking and presentation. - [ ] Implement Hold scoring based on duration accuracy. - [ ] Implement configurable parameters for both challenge types. - [ ] Write descriptive text feedback for each performance level. - [ ] Docs: Update YARD comments on affected classes and methods. Update relevant Docusaurus documentation pages if applicable. - [ ] Tests (Cucumber): Add `tests/unit/strike_hold_challenges.feature` covering Strike timing tiers, Hold duration accuracy, timeout handling, score boundaries, parameter configuration. - [ ] Tests (Cucumber Integration): Add integration feature in `tests/integration/` for a minigame run using Strike and Hold challenges. - [ ] Tests (Profiling): Run `bundle exec rake unit_profile` and verify no performance regressions. - [ ] Quality: Verify coverage >=97% via `bundle exec rake unit`. If coverage is <97% then review the current unit test coverage report at `build/tests/unit/coverage/` and use it to write new Cucumber based unit tests to improve code coverage. Specifically, write Cucumber/Gherkin style unit tests that are descriptively named and specifically improve coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun `bundle exec rake unit` to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%. - [ ] Quality: Run `bundle exec rake` (default task: unit tests with coverage) and `bundle exec rake integration`, fix any errors if needed ensuring both pass across **entire** code base, do not ignore any failure even if it seems unrelated to this commit, fix it. ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done.
freemo added this to the v1.3.0 milestone 2026-03-16 01:41:45 +00:00
freemo self-assigned this 2026-03-16 01:41:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: aethyr/Aethyr#243
No description provided.