You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Added all-tests.yml GitHub Actions workflow to run all tests in CI
- Fixed snapshot integration with save/load system
- Updated documentation for visual differential testing
- Fixed compiler warnings and errors in snapshot tests
2.**Save Compression**: Optional compression for large save files
293
293
3.**Save Verification**: Checksums or other validation of save integrity
294
294
4.**Multiple Save Formats**: Support for JSON or other human-readable formats
295
-
5.**Cloud Integration**: Syncing saves to cloud storage
295
+
5.**Cloud Integration**: Syncing saves to cloud storage
296
+
297
+
## Snapshot Integration
298
+
299
+
The save/load system has been integrated with the snapshot system to enable visual differential testing of game states. This integration consists of several components:
300
+
301
+
### Save Game Snapshots
302
+
303
+
When a game is saved, the system automatically takes a snapshot of the current game state:
304
+
305
+
1. The `take_save_game_snapshot` system responds to `SaveGameEvent` events
306
+
2. It captures the visual state using the game camera
307
+
3. It attaches a `SaveGameSnapshot` component to the camera with metadata:
308
+
- Slot name
309
+
- Turn number
310
+
- Timestamp
311
+
312
+
```rust
313
+
pubfntake_save_game_snapshot(
314
+
mutcommands:Commands,
315
+
mutsnapshot_events:EventWriter<SnapshotEvent>,
316
+
mutsave_events:EventReader<SaveGameEvent>,
317
+
game_state:Option<Res<GameState>>,
318
+
game_cameras:Query<Entity, With<GameCamera>>,
319
+
) {
320
+
// Implementation details...
321
+
}
322
+
```
323
+
324
+
### Replay Snapshots
325
+
326
+
During replay, the system takes snapshots at each step:
327
+
328
+
1. The `take_replay_snapshot` system responds to `StepReplayEvent` events
329
+
2. For each step in the replay, it captures the visual state
330
+
3. It creates timestamped and labeled snapshots to track the replay progression
331
+
332
+
```rust
333
+
pubfntake_replay_snapshot(
334
+
mutcommands:Commands,
335
+
mutsnapshot_events:EventWriter<SnapshotEvent>,
336
+
mutstep_events:EventReader<StepReplayEvent>,
337
+
replay_state:Option<Res<ReplayState>>,
338
+
game_state:Option<Res<GameState>>,
339
+
game_cameras:Query<Entity, With<GameCamera>>,
340
+
) {
341
+
// Implementation details...
342
+
}
343
+
```
344
+
345
+
### Visual Differential Testing
346
+
347
+
This integration enables visual differential testing workflows:
348
+
349
+
1.**Reference Captures**: Save specific game states as visual references
350
+
2.**Regression Testing**: Detect unintended visual changes in game rendering
351
+
3.**State Comparison**: Compare different points in game history
352
+
4.**Bug Reproduction**: Capture visual evidence of bugs for easier debugging
353
+
354
+
The integration is especially valuable for CI/CD pipelines, allowing automated visual testing of game mechanics and UI components.
## Save/Load Integration for Visual Differential Testing
465
+
466
+
The Rummage visual testing system integrates with the save/load/replay systems to enable visual differential testing of specific game states. This allows developers to:
467
+
468
+
1.**Capture Game State Snapshots**: Automatically take screenshots when games are saved
469
+
2.**Replay Visual Validation**: Capture visuals during replay for regression testing
470
+
3.**Time-Travel Debugging**: Compare visuals at different points in game history
471
+
472
+
### Using Save Game Snapshots
473
+
474
+
Snapshots are automatically captured when a game is saved:
475
+
476
+
```rust
477
+
// Save a game, which triggers a snapshot
478
+
world.send_event(SaveGameEvent {
479
+
slot_name:"test_save".to_string(),
480
+
});
481
+
```
482
+
483
+
### Using Replay Snapshots
484
+
485
+
Snapshots are taken at each step during replay:
486
+
487
+
```rust
488
+
// Step through a replay, capturing visuals at each step
489
+
world.send_event(StepReplayEvent);
490
+
```
491
+
492
+
### Testing Game State Evolution
493
+
494
+
You can use this system to test how the game state evolves visually:
0 commit comments