Top
Best
New

Posted by speckx 3 days ago

Game devs explain the tricks involved with letting you pause a game(kotaku.com)
404 points | 223 commentspage 2
gobdovan 18 hours ago|
When I present TLA+ [0], I am referencing game pauses (pause buffer / item duplication Legend of Zelda exploit, Dark Souls menuing to cancel animations) and deliberate crashes as mechanics to exploit games, as those are still valid actions that can be modeled, and not doing that allows such exploits to happen.

A system is only correct relative to the transition system you wrote down. If the real system admits extra transitions that you care about (pause, crash, re-entry, partial commits), and you didn't model them, then you proved correctness of the wrong system.

[0] https://lamport.azurewebsites.net/video/videos.html

pmarreck 6 hours ago||
I would prefer to understand why a paused or backgrounded game still manages to consume a ton of CPU or GPU

Like, you're still just churning away at the main game loop while literally nothing else is happening except for you waiting for me to unpause it?

Because THAT would be an actual achievement. Hell, I can suspend any process from the Unixy side of things by sending a SIGSTOP signal, for a far more perfect "pause".

If I was a game dev, I would not settle for "looks like paused, but still burning down the environment and heating up my home as a side effect"

GuB-42 4 hours ago||
Because the engine is still running, even in a paused state, the game still has to show something and process input. Sometimes there is a menu too, sometimes the game is not completely frozen: flames may flicker for instance.

In the article, there is a case where the game takes a screenshot and disable costly rendering, presumably to deal with this problem. But the thing is that most games are designed to to be actively played, not paused for extended periods of time and having an active pause for a couple of minutes isn't going to destroy the environment.

For backgrounding, is is common for games to run at a much slower framerate to save resources.

MrGilbert 4 hours ago||
But if you were a game dev, you would understand why it‘s not as easy as it seems to outsiders. :)
umvi 11 hours ago||
Seems like a solved problem for consoles, at least. On the Nintendo switch you can "pause" any game regardless of if the devs implemented it by pressing the home button which suspends the entire game at the OS level
jayd16 8 hours ago||
If by solved you mean it's a feature you're required to support... It can never be truly seamless when things like wall clock or device state (SD card is missing suddenly) or network connections disappear.
glenneroo 5 hours ago|||
Nintendo, like all other platform-owners (e.g. Meta/Quest, Sony, Microsoft) is VERY strict about games released on their platform and have very strict requirements before anything is allowed to be sold with the Nintendo label. I very highly doubt they let devs NOT implement the pause ability. AFAIK you can't just OS-pause a game and expect it to run fine when it resumes, there are soooo many systems at play: animation, physics, sound, input, etc. that need to be cleanly stopped/resumed that I doubt it's as easy as just OS-pausing.
stanko 10 hours ago||
That is different, because you can't interact with the game anymore. In game pause can let you change your settings or map for example. Menus and map are still running in the game loop, so then you need to make they get the input events but not the gameplay part.
sombragris 7 hours ago||
The ability to pause is extremely important in games (at least single player ones).

I hate when games are into multiplayer modes even when played in single-player campaign (e.g.: Generation Zero) and thus cannot be paused.

Another thing that I hate in this regard are unpausable cutscenes. I remember when I was playing The Witcher 3, that at last there was some cutscene advancing some plot point, and right into the middle of it The Wife™ would barge in telling me something important that would require my attention... but I cannot pause that scene so I had to miss it while I listened to her. Why, oh why, devs hate pausing cutscenes so much??

xhevahir 18 hours ago||
When I first played the NES the pause feature impressed me even more than did the graphics. Apparently Atari already had the feature on the 5200 console, but even as late as 1988 it felt like magic to hit a button, go and eat dinner, and an hour later resume my game with another press of the button.
torginus 16 hours ago||
One of the things I was thinking about with regards to pause and or save games, is the need to control all aspects of real time logic, with possibly stopping/resuming, and saving it to disk is how our current ways of doing async is incredibly lacking.

Unity has introduced the idea of coroutines (which were essentially yield based generators), and people started using them, and immediately encountered problems with pausing/saves.

Internally these coroutines compile down to state machines with opaque internals which are not necessarily consistent across compilers/code changes, and its very difficult to accomodate needs like pausing when using them.

From what I've seen, the usual answer is that people go back to hand-written state machines, and go through the pain of essentially goto programming to fix these issues.

edflsafoiewq 6 hours ago|
I understand why coroutines are an issue for saving, but why are they an issue for pausing? Don't you just not resume the coroutines while paused?
glenneroo 5 hours ago||
It depends. If you are using `yield return new WaitForSecondsRealtime(x)` then the coroutine keeps running when you set TimeScale to 0, but that's usually a feature and not a bug, since it lets you potentially use them when paused (since async/task C# stuff was usually been a bit sketchy, though it's definitely better now).

Some more info here (and in general about pausing in Unity): https://gamedevbeginner.com/the-right-way-to-pause-the-game-...

SyzygyRhythm 18 hours ago||
Early versions of Unreal Engine had these animated procedural textures that would produce sparks, fire effects, etc. The odd part is that when you paused the game, the animated textures would still animate. Presumably, the game would pause its physics engine or set the timestep to 0, but the texture updater didn't pause. I suspect it was part of the core render loop and each new iteration of the texture was some sort of filtered version of the previous frame's texture. Arguably a very early version of GPU physics.

Modern games can have the same issue. Even taking a capture of the exact graphics commands and repeating them, you'll sometimes see animated physics effects like smoke and raindrops. They're doing the work on the GPU where it's not necessarily tied to any traditional physics timestep.

jFriedensreich 17 hours ago||
I only know pausing games is funky because the highest my playstation fans ever go is pausing some games. Quite weird pausing is not just a feature of the game engine or runtime, especially as the menu and settings system seem to be totally separate in most cases anyways.
teamonkey 16 hours ago|
It is a feature of most game engines. Unreal has a standard SetGamePaused function, for example.

But like most things in game development there is no solution that fits every use case.

RobRivera 10 hours ago||
Total self brag, one of the key foundations of my game engine is that every single instance of any object has an anchor to a timing system, and pausing can be propogated on the same cycle as the input-capture at the most granular level as desired.

I really need to start blogging my notebook

intsunny 11 hours ago|
Suddenly I realize why so many games didn't have a real pause feature, but a view maps feature that did the same.
More comments...