Page 1 of 1

Allow the OS to sleep/hibernate when the (singleplayer) game is paused

Posted: Fri Dec 24, 2021 8:49 pm
by nir.hershko
I'm currently on Factorio 1.1.50 from Steam on Windows 10, single player (with mods but I don't think it matters).

While factorio is running, Windows doesn't turn off the screen even when idle (which makes sense). I'd like it to allow Windows to turn off the screen and sleep if the game is paused.

More words below, but not much new information so don't read the rest if you don't want to.
My setup is that I often pause the game to do something else without knowing when I will return - could be 1 minute, could be the next day (I have kids you see..). Today I just found that even though I `WinKey-D`-ed to the desktop (while the game is paused), it just stayed like that for many hours without turning off the screen and computer (wasting computer and screen power, and possibly burning the pixels a bit, though that's negligible compared to the factorio UI that's burned there :P ). Now, I already knew that it doesn't allow Windows to sleep, and didn't expect it, but still it would've been real nice if it did anyway and i didn't have to know in advance for how long i'll be gone. After all, that's what the automatic sleep feature is for in the first place.

Related post: viewtopic.php?p=453123#p453123 (for headless, Aug 2019, got no answer as of now). It _feels_ like this one (single player case) is simpler to implement, and probably useful to more people.
Related thread: viewtopic.php?f=49&t=71018 (has a suggested fix which i didn't try because it ignores whether the game is paused; my powercfg btw: https://pastebin.com/raw/3B6Ggm3N)

Re: Allow the OS to sleep/hibernate when the (singleplayer) game is paused

Posted: Fri Dec 24, 2021 11:46 pm
by Rseding91
Letting the OS automatically go to sleep while a high-CPU high GPU application is running makes no sense. Additionally letting the OS sleep while the game is running messes up the GPU resources the game is using on some systems and so we won't be allowing it automatically.

You can still manually force the OS to sleep by clicking the start menu, power, and clicking "sleep".

Re: Allow the OS to sleep/hibernate when the (singleplayer) game is paused

Posted: Sun Dec 26, 2021 2:13 pm
by ssilk
Hm, I think the question is not, if, but why Factorio eats so much CPU/GPU, when paused.

For example: When I let my notebook run with Factorio in background it eats the batteries empty within 1-2 hours, but effectively does nothing, but steadily displaying drawing a static picture.

Would be simple to make a screenshot and do the same with my screensaver. :)

Re: Allow the OS to sleep/hibernate when the (singleplayer) game is paused

Posted: Mon Jan 03, 2022 2:04 pm
by nir.hershko
For me (AMD 2600X) it takes <2% CPU when paused (and <3% cpu when running what I'm currently playing), and it's using <1% GPU resources (both paused and not). It can go to sleep and come back with no problem, so I'd definitely turn on such an option if it was available.

Re: Allow the OS to sleep/hibernate when the (singleplayer) game is paused

Posted: Mon Jan 03, 2022 2:52 pm
by FuryoftheStars
Afaik, sleep & hibernation are not perfect. The more complex the application running, the greater the chance of issues. As Factorio lives largely in memory and is very complex, I'd expect the chances of issues to be high.

As Rseding91 mentioned, though, you can still manually put your PC to sleep if you desire (many computers have a dedicated button for this on the keyboard, and Windows has it in the Start menu -> Power options) and see what happens after repeated sleep/wake cycles. I would advise also saving before each one, and maybe occasionally doing a test load to make sure that something didn't get corrupted that was only detectable during load. (Actually makes me wonder if some of these folks with magical save file corruptions are actually doing this....)

Ultimately, if the devs do include it, I'd half expect them to have the option disabled by default and located in the hidden "the rest" settings section with the "won't support" disclaimer.