Lil Puppy replied to World save July 26, 2021 @ 3:42:33 pm PDT
The best solution to this is to make you completely unaware that the game is saving.
What happens in every game is that the game state is serialized (all the variables are stored from memory to a separate memory space) then the second copy is written to disk - these contribute to the lag, especially if the disk write isn't asynchronous so it can be done without interrupting anything.
What should happen is a duplicate copy of the game state variables be stored in a separate memory space in real time - its easy... and then that copy is 'paused' and written to the disk. But, that's an extra bunch of code and the standard "Pause, copy, write, resume" is built into the engine and so it can be implemented very easily and this is what you see with most games like this.
Standard game save techniques:
1. During loading or zone transitions - console games do this one the most. "Oh, you got in an elevator! SAVE. Have to slowly crawl through a spot! SAVE. Cutscene time! SAVE!
2. Manually - using a bed to sleep, selecting a save option, quicksave, etc.
3. Automatically - these are timers or event based (30 min or before/after boss fight, level complete, etc.)
What happens in every game is that the game state is serialized (all the variables are stored from memory to a separate memory space) then the second copy is written to disk - these contribute to the lag, especially if the disk write isn't asynchronous so it can be done without interrupting anything.
What should happen is a duplicate copy of the game state variables be stored in a separate memory space in real time - its easy... and then that copy is 'paused' and written to the disk. But, that's an extra bunch of code and the standard "Pause, copy, write, resume" is built into the engine and so it can be implemented very easily and this is what you see with most games like this.
Standard game save techniques:
1. During loading or zone transitions - console games do this one the most. "Oh, you got in an elevator! SAVE. Have to slowly crawl through a spot! SAVE. Cutscene time! SAVE!
2. Manually - using a bed to sleep, selecting a save option, quicksave, etc.
3. Automatically - these are timers or event based (30 min or before/after boss fight, level complete, etc.)
11:13 pm, July 26, 2021