Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
799 stars 90 forks source link

Save system: Temp scene states don't get "reset" on "loading saved game" #228

Open Phazorknight opened 1 month ago

Phazorknight commented 1 month ago

Cogito and Godot Engine Version: Godot 4.2.1stable

Description: Temp scene states don't get "reset" after loading a game, which cause undesired scene states.

Reproduction steps:

  1. Delete all saves or start game on a new save slot.
  2. Start in Lobby scene.
  3. Save game.
  4. Move over to Laboratory scene, pick up some items.
  5. Move back to Lobby scene.
  6. Load saved game.
  7. Move over to Laboratory scene, note how the temp scene state got loaded, so the items picked up after saving but before loading are gone.

Expected behavior: The temp scene state of the other scene should also "reset". This is not very straight forward.

One idea would be to do the following: On loading a save slot:

The last point might not really work or might deleted temp scene states we expect to stick around. Another workaround would be: on saving a save slot, convert all existing temp scene states to save slot scene states.

This would have to be tested and explored a bit.

OvercastInteractive commented 1 month ago

This behavior also affects starting a new game, which also uses the temp scene state from the previous unrelated saved/played game.

I would suggest deleting the temp scene state files when starting a new game and when quitting the application.

Phazorknight commented 5 days ago

Hey everyone, I've just pushed an update, reworking the save system a bit that should resolve this issue, please see https://github.com/Phazorknight/Cogito/commit/0a3e062f126fdfd948de22ae962ccc992f0da861

@OvercastInteractive : I've made it that the temp save files gets deleted on quit (more precisely when cogito_save_manager exits the tree, which so far seems to work, even when returning to the menu and starting a new game)

Please note: Your previous save files will no longer be detected with this update! New save files will be created. This should make testing scene transitions easier/better.