Save and restore a basic board
What this teaches
This scene shows the smallest useful persistence cycle. It captures a GridBoardStateSnapshot, changes the live board, and restores the captured state atomically.
Open and run
Menu path: Tools > Lost Lily > Grid Toolkit > Samples > Open > Tutorials > Save and Restore.
Enter Play Mode. Use the mouse to select and move, Save and Restore for the snapshot cycle, and Reset to rebuild the authored setup.
Try it
- Press Save while the token is at its starting coordinate.
- Select the token and move it to another open cell.
- Press Restore.
- Move the token again, then press Save to replace the remembered state.
- Move once more and restore the newer snapshot.
Checkpoint
Restore returns the token to the coordinate captured by the most recent Save operation. Restoring before saving reports that no snapshot exists and leaves the board unchanged. Reset rebuilds the authored state and clears the tutorial's saved value.
How it works
| Scene part | Public system | Responsibility |
|---|---|---|
| Save button | Snapshot creation | Captures the current cells, structures, and revision-bearing state. |
| Token move | GridActionRunner | Commits a visible mutation after preview. |
| Restore button | Atomic snapshot application | Validates and replaces the live contents as one operation. |
| Board view | GridBoardView | Reconciles the restored state into visible nodes. |
Try another variation
In a duplicated scene, save at different token positions and test Restore before Save.
Related
- Snapshots and restoration
- Save and restore state
- GridBoardStateSnapshot
- GridActionRunner
- GridBoardView
Next sample
Continue with Move a pawn on a hex board.