|
1 | 1 | # Implementation Plan |
2 | 2 |
|
3 | | -- [ ] 1. Extend WaterPuddle with unique identifier |
| 3 | +- [x] 1. Extend WaterPuddle with unique identifier |
| 4 | + |
4 | 5 | - Add UUID-based ID field to WaterPuddle class |
5 | 6 | - Generate unique ID in reset() method when puddle spawns |
6 | 7 | - Add getId() getter method |
7 | 8 | - _Requirements: 3.1, 4.1_ |
8 | 9 |
|
9 | | -- [ ] 2. Create PuddleCollisionSystem class |
10 | | - - [ ] 2.1 Implement core collision detection logic |
| 10 | +- [x] 2. Create PuddleCollisionSystem class |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + - [x] 2.1 Implement core collision detection logic |
| 17 | + |
| 18 | + |
11 | 19 | - Create PuddleCollisionSystem class with collision checking |
12 | 20 | - Implement calculateDistance() method using Euclidean distance |
13 | 21 | - Implement checkCollision() method with 12-pixel radius check |
14 | 22 | - Create PuddleCollisionResult data class |
15 | 23 | - _Requirements: 1.1, 3.2, 3.3_ |
16 | 24 |
|
17 | | - - [ ] 2.2 Write property test for collision detection |
| 25 | + - [x] 2.2 Write property test for collision detection |
| 26 | + |
| 27 | + |
18 | 28 | - **Property 1: Collision triggers fall** |
19 | 29 | - **Validates: Requirements 1.1, 3.2** |
20 | 30 |
|
21 | | - - [ ] 2.3 Implement triggered state tracking |
| 31 | + - [x] 2.3 Implement triggered state tracking |
| 32 | + |
22 | 33 | - Add Set<String> for triggered puddle IDs |
23 | 34 | - Implement markPuddleTriggered() method |
24 | 35 | - Implement isTriggered() check in collision detection |
25 | 36 | - _Requirements: 4.1, 4.2_ |
26 | 37 |
|
27 | | - - [ ] 2.4 Write property test for triggered state prevention |
| 38 | + - [x] 2.4 Write property test for triggered state prevention |
| 39 | + |
| 40 | + |
28 | 41 | - **Property 9: Triggered state prevents re-trigger** |
29 | 42 | - **Validates: Requirements 4.1, 4.2** |
30 | 43 |
|
31 | | - - [ ] 2.5 Implement triggered state reset logic |
| 44 | + - [x] 2.5 Implement triggered state reset logic |
| 45 | + |
32 | 46 | - Add Map<String, Boolean> for player-in-zone tracking |
33 | 47 | - Implement updateTriggeredStates() method |
34 | 48 | - Reset triggered state when player exits zone (distance > 12) |
35 | 49 | - _Requirements: 4.3_ |
36 | 50 |
|
37 | | - - [ ] 2.6 Write property test for triggered state reset |
| 51 | + - [x] 2.6 Write property test for triggered state reset |
| 52 | + |
| 53 | + |
38 | 54 | - **Property 10: Triggered state reset on exit** |
39 | 55 | - **Validates: Requirements 4.3** |
40 | 56 |
|
41 | | - - [ ] 2.7 Implement cleanup methods |
| 57 | + - [x] 2.7 Implement cleanup methods |
| 58 | + |
42 | 59 | - Implement clearAllTriggeredStates() method |
43 | 60 | - Clear both triggered set and in-zone map |
44 | 61 | - _Requirements: 1.5, 3.4, 3.5, 4.4_ |
45 | 62 |
|
46 | | - - [ ] 2.8 Write property test for cleanup |
| 63 | + - [x] 2.8 Write property test for cleanup |
| 64 | + |
| 65 | + |
47 | 66 | - **Property 5: Cleanup on puddle despawn** |
48 | 67 | - **Validates: Requirements 1.5, 3.4, 3.5, 4.4** |
49 | 68 |
|
50 | | -- [ ] 3. Create FallAnimationSystem class |
51 | | - - [ ] 3.1 Implement animation state management |
| 69 | +- [x] 3. Create FallAnimationSystem class |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + - [x] 3.1 Implement animation state management |
| 74 | + |
52 | 75 | - Create FallAnimationState enum (NONE, FALL, STANDUP_1-4, COMPLETE) |
53 | 76 | - Create FallAnimationFrame data class with coordinates and duration |
54 | 77 | - Initialize frame sequence with correct sprite coordinates |
55 | 78 | - Add animation state tracking fields |
56 | 79 | - _Requirements: 2.1, 2.2, 2.3, 2.4, 2.5_ |
57 | 80 |
|
58 | | - - [ ] 3.2 Implement animation timing logic |
| 81 | + - [x] 3.2 Implement animation timing logic |
| 82 | + |
59 | 83 | - Implement startFallSequence() method |
60 | 84 | - Implement update() method with delta time accumulation |
61 | 85 | - Advance frames every 0.8 seconds |
62 | 86 | - Preserve remainder time for smooth transitions |
63 | 87 | - _Requirements: 2.2, 2.3, 2.4, 2.5_ |
64 | 88 |
|
65 | | - - [ ] 3.3 Write property test for animation timing |
| 89 | + - [x] 3.3 Write property test for animation timing |
| 90 | + |
66 | 91 | - **Property 6: Animation sequence timing** |
67 | 92 | - **Validates: Requirements 2.2, 2.3, 2.4, 2.5** |
68 | 93 |
|
69 | | - - [ ] 3.4 Implement frame extraction from sprite sheet |
| 94 | + - [x] 3.4 Implement frame extraction from sprite sheet |
| 95 | + |
| 96 | + |
70 | 97 | - Implement getCurrentFallFrame() method |
71 | 98 | - Extract 64x64 TextureRegion from sprite sheet |
72 | 99 | - Use coordinates based on current animation state |
73 | 100 | - Handle sprite sheet from PlayerConfig |
74 | 101 | - _Requirements: 2.1, 2.7, 5.1, 5.2_ |
75 | 102 |
|
76 | | - - [ ] 3.5 Write property test for sprite sheet consistency |
| 103 | + - [x] 3.5 Write property test for sprite sheet consistency |
| 104 | + |
77 | 105 | - **Property 7: Sprite sheet consistency** |
78 | 106 | - **Validates: Requirements 2.7, 5.3** |
79 | 107 |
|
80 | | - - [ ] 3.6 Write property test for frame dimensions |
| 108 | + - [x] 3.6 Write property test for frame dimensions |
| 109 | + |
81 | 110 | - **Property 12: Frame dimensions are correct** |
82 | 111 | - **Validates: Requirements 5.1** |
83 | 112 |
|
84 | | - - [ ] 3.7 Implement state query methods |
| 113 | + - [x] 3.7 Implement state query methods |
| 114 | + |
85 | 115 | - Implement isFallSequenceActive() method |
86 | 116 | - Implement isFallSequenceComplete() method |
87 | 117 | - Implement reset() method |
88 | 118 | - _Requirements: 1.3, 1.4_ |
89 | 119 |
|
90 | | -- [ ] 4. Integrate collision and animation systems into Player class |
91 | | - - [ ] 4.1 Add new fields to Player class |
| 120 | +- [x] 4. Integrate collision and animation systems into Player class |
| 121 | + |
| 122 | + - [x] 4.1 Add new fields to Player class |
| 123 | + |
92 | 124 | - Add PuddleCollisionSystem field |
93 | 125 | - Add FallAnimationSystem field |
94 | 126 | - Add boolean isFalling flag |
95 | 127 | - Initialize systems in constructor |
96 | 128 | - _Requirements: 1.1, 1.3_ |
97 | 129 |
|
98 | | - - [ ] 4.2 Modify Player.update() for collision detection |
| 130 | + - [x] 4.2 Modify Player.update() for collision detection |
| 131 | + |
99 | 132 | - Check puddle collision only when not falling |
100 | 133 | - Get active puddles from PuddleManager |
101 | 134 | - Call checkCollision() on collision system |
102 | 135 | - Trigger fall if collision detected |
103 | 136 | - _Requirements: 1.1, 3.2_ |
104 | 137 |
|
105 | | - - [ ] 4.3 Implement triggerFall() method |
| 138 | + - [x] 4.3 Implement triggerFall() method |
| 139 | + |
106 | 140 | - Set isFalling flag to true |
107 | 141 | - Start fall animation sequence |
108 | 142 | - Mark puddle as triggered |
|
111 | 145 | - Send health update in multiplayer |
112 | 146 | - _Requirements: 1.2, 4.1_ |
113 | 147 |
|
114 | | - - [ ] 4.4 Write property test for fall damage |
| 148 | + - [x] 4.4 Write property test for fall damage |
| 149 | + |
115 | 150 | - **Property 2: Fall damage is consistent** |
116 | 151 | - **Validates: Requirements 1.2** |
117 | 152 |
|
118 | | - - [ ] 4.5 Modify Player.update() for fall animation |
| 153 | + - [x] 4.5 Modify Player.update() for fall animation |
| 154 | + |
119 | 155 | - Update fall animation system with delta time |
120 | 156 | - Check if sequence complete and call completeFall() |
121 | 157 | - Skip normal movement processing while falling |
122 | 158 | - Update triggered states after normal movement |
123 | 159 | - _Requirements: 1.3, 1.4, 2.2-2.5_ |
124 | 160 |
|
125 | | - - [ ] 4.6 Write property test for movement blocking |
| 161 | + - [x] 4.6 Write property test for movement blocking |
| 162 | + |
126 | 163 | - **Property 3: Movement blocked during fall** |
127 | 164 | - **Validates: Requirements 1.3** |
128 | 165 |
|
129 | | - - [ ] 4.7 Write property test for fall sequence interruption prevention |
| 166 | + - [x] 4.7 Write property test for fall sequence interruption prevention |
| 167 | + |
130 | 168 | - **Property 11: Fall sequence prevents interruption** |
131 | 169 | - **Validates: Requirements 4.5** |
132 | 170 |
|
133 | | - - [ ] 4.8 Implement completeFall() method |
| 171 | + - [x] 4.8 Implement completeFall() method |
| 172 | + |
134 | 173 | - Set isFalling flag to false |
135 | 174 | - Reset fall animation system |
136 | 175 | - _Requirements: 1.4, 2.6_ |
137 | 176 |
|
138 | | - - [ ] 4.9 Write property test for state restoration |
| 177 | + - [x] 4.9 Write property test for state restoration |
| 178 | + |
139 | 179 | - **Property 4: State restoration after fall** |
140 | 180 | - **Validates: Requirements 1.4, 2.6** |
141 | 181 |
|
142 | | - - [ ] 4.10 Modify Player.getCurrentFrame() for fall rendering |
| 182 | + - [x] 4.10 Modify Player.getCurrentFrame() for fall rendering |
| 183 | + |
143 | 184 | - Check if falling and return fall animation frame |
144 | 185 | - Otherwise return normal animation frame |
145 | 186 | - _Requirements: 2.1, 5.4, 5.5_ |
146 | 187 |
|
147 | | - - [ ] 4.11 Write property test for rendering position consistency |
| 188 | + - [x] 4.11 Write property test for rendering position consistency |
| 189 | + |
148 | 190 | - **Property 13: Rendering position consistency** |
149 | 191 | - **Validates: Requirements 5.4** |
150 | 192 |
|
151 | | - - [ ] 4.12 Write property test for exclusive fall rendering |
| 193 | + - [x] 4.12 Write property test for exclusive fall rendering |
| 194 | + |
152 | 195 | - **Property 14: Exclusive fall rendering** |
153 | 196 | - **Validates: Requirements 5.5** |
154 | 197 |
|
155 | | -- [ ] 5. Extend PuddleManager to expose active puddles |
156 | | - - [ ] 5.1 Add getActivePuddles() method to PuddleManager |
| 198 | +- [x] 5. Extend PuddleManager to expose active puddles |
| 199 | + |
| 200 | + - [x] 5.1 Add getActivePuddles() method to PuddleManager |
| 201 | + |
157 | 202 | - Iterate through puddle pool |
158 | 203 | - Collect active puddles into list |
159 | 204 | - Return list for collision detection |
160 | 205 | - _Requirements: 1.1, 3.1_ |
161 | 206 |
|
162 | | - - [ ] 5.2 Write property test for puddle coordinates |
| 207 | + - [x] 5.2 Write property test for puddle coordinates |
| 208 | + |
163 | 209 | - **Property 8: Puddle coordinates recorded** |
164 | 210 | - **Validates: Requirements 3.1** |
165 | 211 |
|
166 | | - - [ ] 5.3 Modify PuddleManager cleanup to notify collision system |
| 212 | + - [x] 5.3 Modify PuddleManager cleanup to notify collision system |
| 213 | + |
167 | 214 | - Call clearAllTriggeredStates() when clearing puddles |
168 | 215 | - Call clearAllTriggeredStates() on state transition to NONE |
169 | 216 | - Pass collision system reference to manager |
170 | 217 | - _Requirements: 1.5, 3.4, 3.5, 4.4_ |
171 | 218 |
|
172 | | -- [ ] 6. Add error handling and validation |
173 | | - - [ ] 6.1 Add position validation in collision detection |
| 219 | +- [x] 6. Add error handling and validation |
| 220 | + |
| 221 | + - [x] 6.1 Add position validation in collision detection |
| 222 | + |
174 | 223 | - Check for NaN and Infinity in player/puddle positions |
175 | 224 | - Log warning and skip invalid positions |
176 | 225 | - Return no collision for invalid data |
177 | 226 | - _Error Handling: Collision Detection Errors_ |
178 | 227 |
|
179 | | - - [ ] 6.2 Add null checks for puddle list |
| 228 | + - [x] 6.2 Add null checks for puddle list |
| 229 | + |
180 | 230 | - Check for null/empty puddle list before iteration |
181 | 231 | - Return no collision result for null list |
182 | 232 | - _Error Handling: Collision Detection Errors_ |
183 | 233 |
|
184 | | - - [ ] 6.3 Add sprite sheet error handling |
| 234 | + - [x] 6.3 Add sprite sheet error handling |
| 235 | + |
185 | 236 | - Catch texture loading exceptions in FallAnimationSystem |
186 | 237 | - Fall back to default sprite sheet on error |
187 | 238 | - Log error for debugging |
188 | 239 | - _Error Handling: Animation System Errors_ |
189 | 240 |
|
190 | | - - [ ] 6.4 Add animation timeout protection |
| 241 | + - [x] 6.4 Add animation timeout protection |
| 242 | + |
191 | 243 | - Implement 5-second maximum duration for fall sequence |
192 | 244 | - Force completion if timeout reached |
193 | 245 | - Reset fall state to prevent stuck player |
194 | 246 | - Log warning for debugging |
195 | 247 | - _Error Handling: State Management Errors_ |
196 | 248 |
|
197 | | - - [ ] 6.5 Add triggered set size limit |
| 249 | + - [x] 6.5 Add triggered set size limit |
| 250 | + |
198 | 251 | - Implement maximum size limit for triggered puddle set |
199 | 252 | - Remove oldest entries if limit exceeded |
200 | 253 | - Clear on puddle count changes |
201 | 254 | - _Error Handling: State Management Errors_ |
202 | 255 |
|
203 | | -- [ ] 7. Checkpoint - Ensure all tests pass |
| 256 | +- [x] 7. Checkpoint - Ensure all tests pass |
| 257 | + |
204 | 258 | - Ensure all tests pass, ask the user if questions arise. |
205 | 259 |
|
206 | | -- [ ] 8. Add multiplayer synchronization |
207 | | - - [ ] 8.1 Create PlayerFallMessage network message |
| 260 | +- [x] 8. Add multiplayer synchronization |
| 261 | + |
| 262 | + - [x] 8.1 Create PlayerFallMessage network message |
| 263 | + |
| 264 | + |
208 | 265 | - Add message class with player ID and puddle ID |
209 | 266 | - Register message type in network system |
210 | 267 | - _Multiplayer Considerations_ |
211 | 268 |
|
212 | | - - [ ] 8.2 Implement client-side fall event sending |
| 269 | + - [x] 8.2 Implement client-side fall event sending |
| 270 | + |
| 271 | + |
213 | 272 | - Send PlayerFallMessage to server on fall trigger |
214 | 273 | - Include puddle ID for validation |
215 | 274 | - _Multiplayer Considerations_ |
216 | 275 |
|
217 | | - - [ ] 8.3 Implement server-side fall validation |
| 276 | + - [x] 8.3 Implement server-side fall validation |
| 277 | + |
| 278 | + |
218 | 279 | - Validate puddle exists and player position |
219 | 280 | - Broadcast fall event to all clients |
220 | 281 | - _Multiplayer Considerations_ |
221 | 282 |
|
222 | | - - [ ] 8.4 Implement remote player fall animation |
| 283 | + - [x] 8.4 Implement remote player fall animation |
| 284 | + |
| 285 | + |
223 | 286 | - Receive fall event for remote players |
224 | 287 | - Trigger fall animation on remote player instances |
225 | 288 | - _Multiplayer Considerations_ |
226 | 289 |
|
227 | | -- [ ] 9. Add integration tests |
228 | | - - [ ] 9.1 Write puddle-player integration test |
| 290 | +- [x] 9. Add integration tests |
| 291 | + |
| 292 | + - [x] 9.1 Write puddle-player integration test |
| 293 | + |
229 | 294 | - Spawn puddles in test environment |
230 | 295 | - Move player through puddles |
231 | 296 | - Verify fall triggers and damage applies |
232 | 297 | - Verify animation plays and completes |
233 | 298 | - _Integration Testing_ |
234 | 299 |
|
235 | | - - [ ] 9.2 Write animation-rendering integration test |
| 300 | + - [x] 9.2 Write animation-rendering integration test |
| 301 | + |
| 302 | + |
236 | 303 | - Trigger fall sequence |
237 | 304 | - Capture rendered frames at each time step |
238 | 305 | - Verify correct sprite coordinates |
239 | 306 | - Verify timing between frames |
240 | 307 | - _Integration Testing_ |
241 | 308 |
|
242 | | - - [ ] 9.3 Write cleanup integration test |
| 309 | + - [x] 9.3 Write cleanup integration test |
| 310 | + |
243 | 311 | - Create puddles and trigger falls |
244 | 312 | - Transition puddle system to NONE |
245 | 313 | - Verify all collision data cleared |
246 | 314 | - Check for memory leaks |
247 | 315 | - _Integration Testing_ |
248 | 316 |
|
249 | | -- [ ] 10. Add performance tests |
250 | | - - [ ] 10.1 Write collision detection performance test |
| 317 | +- [x] 10. Add performance tests |
| 318 | + |
| 319 | + - [x] 10.1 Write collision detection performance test |
| 320 | + |
251 | 321 | - Test with maximum puddle count (8) |
252 | 322 | - Measure collision check time per frame |
253 | 323 | - Verify < 1ms per frame target |
254 | 324 | - _Performance Testing_ |
255 | 325 |
|
256 | | - - [ ] 10.2 Write animation system performance test |
| 326 | + - [x] 10.2 Write animation system performance test |
| 327 | + |
257 | 328 | - Test fall sequence with multiple players |
258 | 329 | - Measure frame extraction and rendering time |
259 | 330 | - Verify no frame rate impact |
260 | 331 | - _Performance Testing_ |
261 | 332 |
|
262 | | - - [ ] 10.3 Write memory usage test |
| 333 | + - [x] 10.3 Write memory usage test |
| 334 | + |
263 | 335 | - Monitor triggered puddle set size over time |
264 | 336 | - Verify cleanup occurs properly |
265 | 337 | - Verify no memory growth |
|
0 commit comments