Skip to content

feat(game): introduce GameMode enum and mode-aware session/orchestrator #167

Description

@TheMeinerLP

Description

The GameOrchestrator and GameSession currently have no concept of a game mode. Both Race Mode and Practice Mode require branching behavior across phases, scoring, HUD, and persistence. This epic introduces a `GameMode` enum (`RACE`, `PRACTICE`), threads it through `GameSession`, `GameOrchestrator`, `GamePhaseFactory`, and `GameResultPersistenceService`, and adds a `gameMode` column to `game_results` via DB migration. No user-visible behavior changes — purely structural scaffolding.

Blocks all other game mode epics.

Acceptance Criteria

  • `GameMode` enum with `RACE` and `PRACTICE` values exists in `shared/common`
  • `GameSession` carries a `GameMode` field (non-null, set at session creation)
  • `GameOrchestrator` selects phase chains and scoring strategy based on `GameMode`
  • `GamePhaseFactory` creates mode-appropriate phases
  • `GameResultPersistenceService` records `gameMode` on every result
  • DB migration adds `gameMode` column to `game_results` table (non-null, default `RACE`)
  • No user-visible behavior change — all existing behavior maps to `RACE`
  • ArchUnit tests pass (no cross-module boundary violations)
  • Unit tests cover `GameMode` routing in orchestrator and phase factory

Technical Details

  • `GameMode` belongs in `shared/common` (or `shared/api`) — zero platform imports
  • Follow the Enum DSL pattern (cached `VALUES`, `byName()`/`byId()` lookup, `@Nullable` return)
  • `GameSession` uses the Interface+Impl pattern; add `gameMode()` to the interface
  • DB migration must be Hibernate-compatible (add column, not recreate table)
  • `GamePhaseFactory` should use a sealed interface hierarchy per ManisGame pattern

Dependencies

None — this is the prerequisite epic for all other game mode work.

Estimate

L

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestepicLarge multi-issue feature or initiativereleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions