stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

7h 2m 59s logged

save system

i wanted this to be pretty generic instead of the engine having some hardcoded idea of what a “player save” or whatever is, so the actual save data is ba sically just key/value storage that scripts can use for whatever they want!!!

save data

there’s now a SaveGameManager which keeps one active save in memory.

save values can currently be:

  • booleans
  • numbers
  • strings

the file format is versioned and also stores a display name + created / updated timestamps.

the actual save data itself doesn’t really care what the values mean. it is any key value pair that persists.

there’s also locking around the active save since scripts can be running across multiple workers…..

project UUIDs

projects also have their own UUID now.

it’s generated when the project is created or when a project that does not already have one is opened
right now it’s mainly used to give each project its own save-data directory without name collisions but im sure its good to have outside that!!!

save files

the basic save file operations too

  • create a new save
  • write the current active save
  • load a save
  • delete a save
  • list existing saves
  • start a fresh unsaved “game”

save filenames are generated from timestamps. the human-readable name stays inside the file, display names don’t need to also be valid / unique filenames.

save_list() also gives creation + update timestamps, and saves are sorted by most recently updated.

writes are atomic too, so it writes through a temporary file before replacing the real save instead of directly nuking the existing one and hoping for the best

per-project save directories

save data is stored outside the project itself in the normal OS application data home

each project gets its own directory based on its UUID

<data home>/obliberry/<project uuid>/saves/

projects with the same name don’t fight over the same saves.. (i have several projects just called “UntitledProject” lol)

this is LocalAppData on Windows, Application Support on macOS, and XDG_DATA_HOME / ~/.local/share on Linux.

both the editor and runtime configure the save manager when the project is loaded, and it gets reset again when the editor closes the project !

ObSL

ObSL savedata enginelib intergration:

basic data stuff:

  • save_set(key, value)
  • save_get(key)
  • save_has(key)
  • save_remove(key)
  • save_clear()
  • save_new()

save file management:

  • save_create(name)
  • save_write()
  • save_load(filename)
  • save_delete(filename)
  • save_list()

save_list() returns an array with the filename, display name, creation time and last update time

some cleanup

also pulled the atomic file writing stuff into a shared OS file utility, so assets.json can use the same code instead of having its own implementation.

bunch of formatting stuff too


i still have to document this and do some more testingf but yeahhh

0
99

Comments 2

@indcader

Bro this is so cool! I’ve always been fascinated by isometric games and this just makes me want to make one!!!!! Good job!!

@torkel

@indcader ty <3