feat: Implement game and server persistence using Redis and file storage, and add a collapsible, resizable card preview sidebar to the game view.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
|
||||
# 2024-12-18 17:35:00 - Strict Rules Engine Implementation
|
||||
|
||||
## Description
|
||||
Implemented a comprehensive Magic: The Gathering rules engine (Core Logic) to replace the sandbox mode with strict rules enforcement. This includes a State Machine for Turn Structure, Priority System, Stack, and State-Based Actions.
|
||||
|
||||
## Key Changes
|
||||
1. **Core Types**: Created `src/server/game/types.ts` defining `Phase`, `Step`, `StrictGameState`, `StackObject`, etc.
|
||||
2. **Rules Engine**: Created `src/server/game/RulesEngine.ts` implementing:
|
||||
- **Turn Structure**: Untap, Upkeep, Draw, Main, Combat (Steps), End.
|
||||
- **Priority System**: Passing priority, stack resolution, phase transition.
|
||||
- **Actions**: `playLand`, `castSpell` with validation.
|
||||
- **State-Based Actions**: Lethal damage, Zero toughness, Player loss checks.
|
||||
3. **Game Manager Refactor**:
|
||||
- Updated `GameManager.ts` to use `StrictGameState`.
|
||||
- Implemented `handleStrictAction` to delegate to `RulesEngine`.
|
||||
- Retained `handleAction` for legacy/sandbox/admin support.
|
||||
4. **Socket Handling**:
|
||||
- Added `game_strict_action` event listener in `server/index.ts`.
|
||||
|
||||
## Next Steps
|
||||
- Client-side integration: The frontend needs to be updated to visualize the Phases, Stack, and Priority (Pass Button).
|
||||
- Move from "Sandbox" UI to "Rules Enforcement" UI.
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
# 2024-12-18 18:00:00 - High-Velocity UX Implementation (Part 1)
|
||||
|
||||
## Description
|
||||
Started implementing the Frontend components for the High-Velocity UX Specification. Focused on the "Smart Priority Interface" components first to enable strict rules interaction.
|
||||
|
||||
## Key Changes
|
||||
1. **Frontend Plan**: Created `docs/development/plans/high-velocity-ux.md` detailing the gesture engine and UI components.
|
||||
2. **Strict Types**: Updated `src/client/types/game.ts` to include `Phase`, `Step`, `StackObject`, and `StrictGameState` extensions.
|
||||
3. **Smart Button**: Created `SmartButton.tsx` which derives state (Pass/Resolve/Wait) from the `StrictGameState`.
|
||||
- Green: Pass/Advance Phase.
|
||||
- Orange: Resolve Stack.
|
||||
- Grey: Wait (Not Priority).
|
||||
4. **Phase Strip**: Created `PhaseStrip.tsx` to visualize the linear turn structure and highlight the current step.
|
||||
5. **GameView Integration**: Updated `GameView.tsx` to house these new controls in the bottom area. Wire up `SmartButton` to emit `game_strict_action`.
|
||||
|
||||
## Next Steps
|
||||
- Implement `GestureManager` context for Swipe-to-Tap and Swipe-to-Combat.
|
||||
- Implement `StackVisualizer` to show objects on the stack.
|
||||
- Connect `ContextMenu` to strict actions (Activate Ability).
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
# 2024-12-18 18:25:00 - High-Velocity UX Implementation (Part 2: Gestures & Backend Polish)
|
||||
|
||||
## Description
|
||||
Advanced the High-Velocity UX implementation by introducing the Gesture Engine and refining the backend Rules Engine to support card movement during resolution.
|
||||
|
||||
## Key Changes
|
||||
1. **Gesture Manager**: Implemented `GestureManager.tsx` and integrated it into the Battlefield.
|
||||
- Provides Swipe-to-Tap functionality via pointer tracking and intersection checking.
|
||||
- Draws a visual SVG path trail for user feedback.
|
||||
- Integrated with `CardComponent` via `useGesture` hook to register card DOM elements.
|
||||
2. **Stack Visualizer**: Implemented `StackVisualizer.tsx` to render the stack on the right side of the screen, showing strict object ordering.
|
||||
3. **Backend Rules Engine**:
|
||||
- Updated `RulesEngine.ts` to fully implement `resolveTopStack` and `drawCard`.
|
||||
- Added `moveCardToZone` helper to manage state transitions (untapping, resetting position).
|
||||
- Fixed typings and logic flow for resolving spells to graveyard vs battlefield.
|
||||
|
||||
## Next Steps
|
||||
- Implement Radial Menu context for activating abilities.
|
||||
- Add sound effects for gestures.
|
||||
- Polish visual transitions for stack resolution.
|
||||
Reference in New Issue
Block a user