Player icon indicating copy to clipboard operation
Player copied to clipboard

Maniac: Global Save - Several issues

Open Mimigris opened this issue 2 years ago • 4 comments

Player platform:

Windows, 64 bits continuous build of the Player.

Describe the issue in detail and how to reproduce it:

  • [ ] When launching a Maniac patch game and that the global save file exists (Save.lgs), it should be automatically (re)loaded when starting the game, after a game reset or when loading a save, without using any Control Global Save command. Currently this behaviour is incorrect and the global save file is automatically loaded only once when starting the game for the first during a game session.
  • [ ] When Opening a Global Save without closing it or Copying to/from the Global Save without Closing the Global Save and then closing the game without resetting or loading a save, the global save file should be created or updated with the content of the global save that was in memory, but currently EasyRPG does not do that.
  • [ ] Closing the Global Save using the command in the Maniac Patch should load the content from the Save.lgs file (hence the name...) while currently EasyRPG applies this to the Open Global Save command.
  • [ ] Loading the global save using Open Global Save in EasyRPG (not the intended as mentioned above but that's not the issue here) will reload the previous global save file that used to be present instead of loading null values if the Save.lgs file is removed after loading it once.

Since understanding this command is complex, I've listed as Needs feedback. My tests were done with the latest public version of the Maniac Patch 211010.

Mimigris avatar Aug 02 '23 18:08 Mimigris

I didn't see this issue here when I worked on global save again. Some of the issues should be fixed by now... Needs testing

Ghabry avatar Nov 08 '24 15:11 Ghabry

  • I was a bit incorrect for the first point: it seems that Maniac doesn't load the global save directly on load of a game/save, but rather when the command is used -> if a global save is missing when loading the game, but is readded just before a command of this kind is called, its data will still be read. Resetting the game or closing it and reopening it on the Player seems to now reload the global save, but this still doesn't work for loading a save file.
  • For the third point, it would be more correct to say that currently, it seems that both Open Global Save and Close Global Save do the same thing on EasyRPG (aka reload the global save), unless there is a difference between those two in their current implementation (?).
  • The second and fourth points still stand.

I tested all of this on the continuous build of the Player, so unless it was tied to a specific pull request not yet applied it doesn't seem that much has moved.

Mimigris avatar Nov 09 '24 16:11 Mimigris

Honestly drawing a flow chart would make most sense for this command.

I'm still confused about all the side effects of this command and the ugly API with "Open", "Close", "Save and Close" etc.


Honestly the expected, good design would be:

When the game starts the global save file is loaded (when it exists).

Operations are:

  • Read from Global Save / Write to Global Save (when no GS exists it initialized an empty here)

Flushing to the disk is decided by the game engine (usually when the game is saved or exited).


To some up from your post (please correct me)

When the game starts it loads the Global Save once. There is no reload on Save/Load/Reset.

When the game exits the Global Save is written to the file.

Open:

  • Changes from the GS in memory are flushed to the file
  • (why is this even called Open then? What is this even doing when the global save is loaded automatically anyway?)

Close:

  • changes from the GS in memory are LOST
  • Data from Game.lgs is loaded
  • (why is this called Close? In terms of File access "Close" means that data is written to disk)

Save + Save & Close:

  • This is the same as Open ???
  • What is the difference between Save and Save & Close?

Ghabry avatar Jun 16 '25 09:06 Ghabry

Did some testing with two open instances of RPG_RT:

  • Open only works once (when it is not already opened)
    • When "Open" the gls file is saved when the engine exits (BUG: But not when Reset, imo this should be the same as a fresh start)
  • Close: Marks the global save as "Closed". When the save is "Closed" the file is not written on shutdown
  • Read From / Copy To: Automatically Open the File
  • Save flushes the change to the file (and does nothing else)
  • Save & Close also resets the "Open" state

Ghabry avatar Jun 16 '25 11:06 Ghabry