GameData
640-byte binary save file — binary-compatible with mobile-eggbert.
Overview
GameData is a plain-data struct that holds all persistent player progress.
The 640-byte layout is identical to the original mobile-eggbert save format,
allowing interoperability with save files from that game.
Three gamer slots are supported.
Header: src/GalaxyEggbert/Game/GameData.hpp
Constants
static constexpr int kTotalLength = 640; // total file size in bytes
static constexpr int kMaxGamer = 3; // number of gamer slots
Binary Layout
All values are single bytes (uint8_t) unless noted.
| Offset | Field | Values / Notes |
|---|---|---|
| 0 | version | Format version byte |
| 1 | reserved | Padding byte |
| 2 | selectedGamer | 0–2, last active slot |
| 3 | sounds | 0 = muted, 1 = enabled |
| 4 | jumpRight | 0/1 control preference |
| 5 | autoZoom | 0/1 |
| 6 | accelActive | 0/1 (accelerometer, mobile) |
| 7 | accelSensitivity | Sensitivity level 0–9 |
| 8–9 | reserved | Alignment padding |
| 10 + g×210 | nbVies[g] | Lives remaining for gamer g (0–2) |
| 11 + g×210 | lastWorld[g] | Highest world reached (1–5) |
| 20 + g×210 | doors[g][0..199] | 200 bytes: per-door completion flags |
Note: The gamer sub-record is 210 bytes (3 × 210 = 630), plus 10 bytes of global header = 640 total.
API
struct GameData {
static constexpr int kTotalLength = 640;
static constexpr int kMaxGamer = 3;
uint8_t data[kTotalLength] = {};
void load(const std::filesystem::path& path);
void save(const std::filesystem::path& path) const;
// Convenience accessors (index into data[])
uint8_t& version() { return data[0]; }
uint8_t& selectedGamer() { return data[2]; }
uint8_t& sounds() { return data[3]; }
uint8_t& nbVies(int g) { return data[10 + g * 210]; }
uint8_t& lastWorld(int g) { return data[11 + g * 210]; }
uint8_t* doors(int g) { return &data[20 + g * 210]; }
const uint8_t& nbVies(int g) const { return data[10 + g * 210]; }
const uint8_t& lastWorld(int g) const { return data[11 + g * 210]; }
const uint8_t* doors(int g) const { return &data[20 + g * 210]; }
};
File Locations
See Save System for per-platform paths. Summary:
| Platform | Path |
|---|---|
| Linux | ~/.local/share/galaxy-eggbert/gamedata.dat |
| Windows | %APPDATA%\galaxy-eggbert\gamedata.dat |
| Web | Emscripten IDBFS (persisted in IndexedDB) |
Usage in GalaxyEggbertGame
// On startup
gameData_.load(savePath);
// When a gamer slot is selected
int slot = gameData_.selectedGamer();
lives_ = gameData_.nbVies(slot);
currentWorld_ = gameData_.lastWorld(slot);
// On world completion
gameData_.doors(slot)[doorIndex] = 1;
gameData_.lastWorld(slot) = currentWorld_;
gameData_.save(savePath);