Save System
640-byte binary save format, compatible with mobile-eggbert.
Overview
Galaxy Eggbert uses the same persistent save-data binary format as the original Speedy Blupi game and the mobile-eggbert C++ port. The format is a 640-byte flat binary array. Files written by Galaxy Eggbert can be read by mobile-eggbert and vice versa.
Save File Location
| Platform | Path |
|---|---|
| Linux | ~/Documents/GalaxyEggbert/save.dat (Needs verification: exact path depends on Urho3D's GetUserDocumentsDir()) |
| Windows | %USERPROFILE%\Documents\GalaxyEggbert\save.dat |
| Web | IndexedDB at /save/.cna_isolated_storage/SpeedyBlupi (IDBFS) |
Binary Layout
Offset Size Field
[0] 1 version tag (default 1)
[1] 1 reserved (default 1)
[2] 1 selectedGamer 0..2 (default 0)
[3] 1 sounds 1=on (default 1)
[4] 1 jumpRight 1=right (default 1)
[5] 1 autoZoom 1=on (default 1)
[6] 1 accelActive 1=on (default 0)
[7] 1 accelSensitivity 0..100 (default 50)
[8-9] 2 reserved
[10 + g*210 .. +9] per-gamer header for gamer slot g (g=0,1,2):
[+0] 1 nbVies (lives remaining, default 3)
[+1] 1 lastWorld (last world reached, default 1)
[+2..9] 8 reserved
[10 + g*210 + 10 .. +209] door states for gamer g:
200 bytes: door[0..199] 0=locked, 1=opened
Total: 10 (header) + 3 × 210 (gamer slots) = 640 bytes.
GameData Class
GameData (src/GalaxyEggbert/Game/GameData.hpp) wraps the raw byte array
and provides typed accessors. The format offset constants are defined as static constexpr int
members.
GameData data;
data.Read(savePath); // load from file
data.SetNbVies(lives_); // write lives for current gamer
data.SetLastWorld(world_); // write world progress
data.Write(savePath); // flush to disk
When Save Is Written
- On world win (
UpdateWin→AdvanceToNextWorld) - On game over / Lost phase (
ResetLevel) - On gamer select (
SelectGamer) - On quit (
GalaxyEggbertGame::Stop) - On sound toggle (settings screen)
- On any respawn that deducts a life
When Save Is Read
- At startup in
GalaxyEggbertGame::Start() - If the file does not exist or is the wrong size, all defaults are used and no error is thrown
Web Save (IDBFS)
On the Web build, Emscripten's IDBFS virtual filesystem is mounted at /save.
The save file is written to the IDBFS filesystem and synced to IndexedDB on every write and on page unload.
This is configured by the cmake/web/pre.js pre-JS file.