Overhaul savegame.json format #86

Закрыто
открыта 2023-02-19 02:04:03 +00:00 kirsle · 1 комментарий
kirsle прокомментировал(а) 2023-02-19 02:04:03 +00:00
Владелец

The current savegame.json format (example below) is jank:

  • It is too verbose.
  • It depends on the file names of LevelPacks + the names of the levels inside.
  • It will cause issues if levelpacks or levels ever get renamed.

How the savegame.json currently looks:

{
  "levelPacks": {
    "001000-TUTORIAL.levelpack": {
      "levels": {
        "Tutorial 3.level": {
          "completed": true,
          "bestTime": null,
          "perfectTime": 81905972479
        },
        "Tutorial 4.level": {
          "completed": true,
          "bestTime": null,
          "perfectTime": 31348084356
        }
      }
    },
    "AzulianTag.levelpack": {
      "levels": {
        "AzulianTag-Forest.level": {
          "completed": true,
          "bestTime": 74136000489,
          "perfectTime": 87249081310
        },
        "AzulianTag-Night.level": {
          "completed": true,
          "bestTime": 37335603926,
          "perfectTime": 111194718913
        }
      }
    }
  }
}

It could be improved by:

  • Giving every level a unique UUID identifier.
  • Only storing scores by level UUID instead of by levelpack/file name.

Then if built-in levels are rearranged and put into different levelpacks, the player still retains their high score data. Makes it less brittle to levelpack file names too.

The transition as always can be done gracefully:

  • Create new json keys for the new syntax.
  • On next save, convert old format into the new format.
The current savegame.json format (example below) is jank: * It is too verbose. * It depends on the file names of LevelPacks + the names of the levels inside. * It will cause issues if levelpacks or levels ever get renamed. How the savegame.json currently looks: ```json { "levelPacks": { "001000-TUTORIAL.levelpack": { "levels": { "Tutorial 3.level": { "completed": true, "bestTime": null, "perfectTime": 81905972479 }, "Tutorial 4.level": { "completed": true, "bestTime": null, "perfectTime": 31348084356 } } }, "AzulianTag.levelpack": { "levels": { "AzulianTag-Forest.level": { "completed": true, "bestTime": 74136000489, "perfectTime": 87249081310 }, "AzulianTag-Night.level": { "completed": true, "bestTime": 37335603926, "perfectTime": 111194718913 } } } } } ``` It could be improved by: * Giving every level a unique UUID identifier. * Only storing scores by level UUID instead of by levelpack/file name. Then if built-in levels are rearranged and put into different levelpacks, the player still retains their high score data. Makes it less brittle to levelpack file names too. The transition as always can be done gracefully: * Create new json keys for the new syntax. * On next save, convert old format into the new format.
kirsle добавил(а) метку
enhancement
2023-02-19 02:04:10 +00:00
kirsle прокомментировал(а) 2023-03-08 06:11:04 +00:00
Автор
Владелец

Implemented in cf1bc81f25 - see commit for notes.

Implemented in cf1bc81f2544bc8ec693bdafb777b2a3b6590113 - see commit for notes.
kirsle закрыл(а) эту задачу 2023-03-08 06:11:15 +00:00
Войдите, чтобы присоединиться к обсуждению.
Нет этапа
Нет назначенных лиц
1 участников
Уведомления
Срок выполнения
Срок действия недействителен или находится за пределами допустимого диапазона. Пожалуйста, используйте формат 'гггг-мм-дд'.

Срок выполнения не установлен.

Зависимости

Зависимостей нет.

Ссылка: SketchyMaze/doodle#86
Описание отсутствует.