Skip to content

Implement Save State Serialization to Binary Format #38

Description

@Mkalbani

Description

Upgrade the persistence module from JSON serialization to a compact binary format using bincode or postcard. As the game state grows to include inventory, streaks, replay events, and versioned puzzle references, JSON becomes verbose and slow to parse. Binary serialization dramatically reduces file size and deserialization time, which matters especially for players with large session histories. The module should maintain a migration path so existing JSON saves can be converted on first load.

Acceptance Criteria

  • bincode or postcard is added as a dependency in Cargo.toml
  • save() writes game state in binary format to a configurable file path
  • load() deserializes binary saves and returns a validated GameState
  • On load, if a JSON save file is detected, it is automatically migrated to binary and the old file is archived
  • A SaveVersion field is embedded in every save to enable future migration handling
  • Corrupted binary files return a descriptive PersistenceError variant rather than a panic
  • A CLI flag --export-save dumps the current binary save as human-readable JSON for debugging
  • Unit tests cover binary save/load roundtrip, JSON migration, version mismatch, and corruption handling

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions