ValveSoftware / SteamOS

SteamOS community tracker
1.48k stars 69 forks source link

[Feature suggestion] Save states for regular pc games. #1470

Open DuckersMcQuack opened 1 month ago

DuckersMcQuack commented 1 month ago

No specs needed as it'd affect every switch in a positive way.

Emulators/retroarch is able to do "dump the entire emulation" of the memory to a savestate file, which you can overwrite and load an older state from to undo a failed action in a game instantaneously.

I want to request the same for steamOS for regular games. Where the game is put in a "virtual environment", or not virtual, but in a closed environment where said "game box" in memory can be dumped as one large memory dump for that game, and have a hotkey to save it, then also load it back in at full nvme speeds to instantaneous resume exactly where you left. No basic game loading with splash screens or menus needed, as it'll load the game already mid game as it was when you saved. Pretty much how steamOS goes to sleep. Dumps it's entire memory to storage, puts in sleep mode, then resumes once turned on again. But on a contained stage for games. Where only the game's memory state gets dumped.

Have a setting if you just desire current playing game to be stored, or if you desire per game savestates for us who has enough storage for multiple savestates. And if you'd end up low on space, have a storage manager addon to choose to delete certain savestates of games that already has a regular save.

TiagoTiago commented 1 month ago

Is this something that can be done without running a whole virtual machine? When you put the system to sleep, it's the whole OS, so there's nothing changed from the perspective of the game when you wake the system again (except the clock, which I imagine might causes issue on rare edge cases); but if you had just the game's memory "put to sleep", I'm not sure how much the rest of the system would also need to be saved with it, perhaps some driver stuff, or maybe memory addresses could need to rearranged because other stuff got where the game used to be in RAM etc. But this is all speculation, I'm no where near being an expert on how theses kind thing works.

Oh, also, how would this interact with the whole "recompiling all shaders on reboot" issue? And what if you played the game on another computer in the mean time and stuff like cloud-saves got updated?

And if all else is solved; it would probably still be a good idea to ensure you have the option to just dump/skip the save-state and load the game normally just in case some game ends up getting in a bad state when coming back and leave you unable to play it.

And I suspect many DRM and anticheat systems might not like such unusual behavior.....

DuckersMcQuack commented 1 month ago

First paragraph:

I'm not anywhere near of knowing how code works, but it'll function like an emulator does. A container of sorts which windows/linux sees "as a game" that only has the bare minimum "OS", and redistributables to function, along with the core functions to take a snapshot of it as it is now and store it's memory to disk, and load it. For instance have steam barebones with necessary files with only that game to adhere to it's DRM.

second paragraph:

The recompilation wouldn't be needed as it's dumping the compiled game's current state as an entirety to a file on the drive, being 6010GB large, or however much ram the game would take. Pretty much "freezing it in time". Just like how emulators are able to. If you want to load the game on another pc, then you would save as you would normally, and quit the game the traditional way, or take the save state with you. Same way as retroarch iirc asks of you to save your game normally before you update it, as the newer version would not be able to read the snapshot from an older version. I've encountered that a few times.

Anticheasts will indeed not. And if you play on linux, steam deck for instance, you can't play kernel level ones anyways. (at least from last i checked). So this will only be for games without anticheat/kernel level/singleplayer only.

TiagoTiago commented 1 month ago

Console emulators usually have a whole second machine being simulated, their save-states don't depend on the base OS that is running the emulator; maybe with some older games the Deck might be able to double-Deck without unplayable performance, but otherwise, I would expect it would be very tricky to surgically extract key parts of the system state to save and the override while the machine is running; you're not working on a car in the back of a lorry, you're trying to swap engine and steering parts of the lorry itself while the lorry is speeding down the highway.

But who knows, maybe Valve has the geniuses required to pull this off.

Though, I don't think you would be able to transfer the save-states between the Deck and another non-Deck computer; with emulator or VM route it's easier, but running natively, way too many things change from one machine to another, it would be extremely tricky.