Live data from Hacker News

Game devs explain the tricks involved with letting you pause a game

kotaku.com

111–120 of 273 posts

Re: Game devs explain the tricks involved with letting you pause a game

#111
post #57
post #10

I quite like when games keep playing some visual-only animations when paused. Like torch flames and trees swaying in the wind.

I find it confusing: for me a clear indicator the game is paused is all animations also pausing. Some games do not pause in menu’s, for example. And some do, but not when in a multiplayer session

I think it really just depends on the game and what purposes “pausing” serves in that game. Take a game like solitaire, for example: there is no meaningful “pause” feature you could add, since the game state only advances in response to a user action.

Other pause some underlying simulation while still letting you modify the game state, as an expected part of gameplay, like a city builder. As the user might spend a significant amount of time in a paused state building things, it would be pretty visually unappealing to have the entire world completely frozen the whole time.

Others might pause all gameplay entirely, such as for displaying a menu, in which case pausing even environmental animations might make more sense since the user isn’t actively playing.

For the second type, I would much prefer some GUI element to indicate the simulation is paused rather than freezing the whole game world, such as a border around the screen or maybe a change of color theme of the GUI or similar.

Re: Game devs explain the tricks involved with letting you pause a game

#112

I was suspicious of those random game developers getting quoted, and this is the pinned post of the one giving this cute silly story about slowing down game speed time: "Announcing TORMENT HEXUS, a match-3 roguelike about putting technofascist CEOs on the wrong side of skyscraper windows! [...] And remember: they SHOULD be afraid of us. #indiedev #indiegame" Weird times.

Bluesky has a lot of left-wing extremists where things like murdering CEOs is cool because they are allegedly "technofascist".

Re: Game devs explain the tricks involved with letting you pause a game

#113
post #4

Earlier quoted context omitted.

It depends on how your timers are implemented. If they are implemented as a "rendez-vous" absolute date (as in UTC for instance - not in local time unless you want to add "eastern eggs" related to daylight saving time...), this will cause bugs. If you implement your own in-game monotonic clock that you can stop, it should be ok.

>If they are implemented as a "rendez-vous" absolute date Do people actually do that? What's the plan for when the user sleeps their machine? All the events just inexplicably happen all at once when they wake it?

That's sort of the point TFA. You make implementation choices that feel OK and then the time comes to implement the "trivial" pause function...

In other domains, adding the delta time of your main loop to your timers can cause (logical) clock drifts in the long term because of resolution errors.

Re: Game devs explain the tricks involved with letting you pause a game

#114
post #32

Earlier quoted context omitted.

Interesting you mention StarCraft. The replay feature could diverge off due to the non deterministic nature of the game. https://news.ycombinator.com/item?id=21920508

The way I remember it was that replay playback would only break if you played a replay with a different game version than it was recorded with.

There was definitely sync bugs with replays at various points.

There was even desync bugs even in live multiplayer games; there was detection that it desynced which would end the game, which in turn meant exploits that would intentionally cause a desync (which would typically involve cancelled zerg buildings for some reason).

Re: Game devs explain the tricks involved with letting you pause a game

#115
post #32

One of the things that impressed me in Quake (the first one) was the demo recording system. The system was deterministic enough that it could record your inputs/the game state and just play them back to get a gameplay video. Especially given that Quake had state of the art graphics at the time, and video playback on computers otherwise was a low-res, resource intensive affair at the time, it was way cool. It always s…

Interesting you mention StarCraft. The replay feature could diverge off due to the non deterministic nature of the game. https://news.ycombinator.com/item?id=21920508

You misinterpreted the comment you are citing.

This non-determinism would not and did not cause replays to diverge (the PRNG seed was most likely stored and would reproduce exactly the same results).

Re: Game devs explain the tricks involved with letting you pause a game

#116
I’d love to hear about the 2020 release of Microsoft Flight Simulator, which had an “active pause” feature that they hyped as a big innovation for that release. You could pause and switch camera angles and see what was going on, then quickly resume. Pretty much the whole game was still interact-able, but with your plane’s position paused. It was supposed to be a nice user-friendly way to pause while you checked gauges or fiddled with cockpit settings or whatever.

It never worked. You’d pause, and the plane was frozen in place yes, but the instrument cluster would still animate and show your altitude/speed changing as if you never paused. But you couldn’t control anything until unpaused. So you’d resume, and your momentum would suddenly leap to where the accumulated deltas ended up. So if you active-paused at full throttle, you’d unpause and start going way too fast… if you active paused while stalling, you’d unpause and your speed would be near zero… you’d even consume fuel while paused.

It’s like they literally just froze the plane’s position and left every other aspect of the physics engine untouched, never tested it, shipped it, and even did a bunch of marketing at how great the feature was. When it was so obviously broken.

I came back to the game after a year or so of updates, and not a thing had improved, it was every bit as broken as when they shipped it.

The 2024 release seems to have largely fixed it though from what I can see. It’s just nuts they had such a clearly broken feature for that long.

Re: Game devs explain the tricks involved with letting you pause a game

#117
post #76
post #61

So the simple case is using some sort of state variable: switch(game_state): case(paused): case(gameplay) You still have to be careful about how you implement "gameplay", though. For example if at any point you read the 'system clock' to do time-based stuff like animations or physics, then when you unpause you suddenly will have a couple minutes of advance in a place where you expect fractions of a second.

This is why delta time accumulator is preferred over using clocks, something like this would be best: float accum = 0; while (running) { poll_input(); poll_network(); accum += delta_time; while (accum >= tick_time) { accum -= tick_time; update_ui(tick_time); update_anims(tick_time); if (!paused) { update_entities(tick_time); } } render(); }

That's exactly how I do it. Makes the most sense to me.

Re: Game devs explain the tricks involved with letting you pause a game

#118
Like a lot of issues in gamedev, pausing the game is a surprisingly difficult problem to solve. It's especially difficult to provide a one size fits all solution which would obviously be desirable for the popular modern engines that try to be a general solution.

I see a lot of comments here saying something along the lines of "isn't it just a state in the state machine?" which isn't wrong, but is an extremely simplistic way of thinking about it. In, say, 1983, you could get away with something like that:

- pause the game: write "PAUSED" to the tilemap

- paused main loop: check input to unpause

- unpause the game: erase the "PAUSED" / restore the previous tiles

But at that time you could already see the same sort of issues as today. Something somewhat common in Famicom/NES games is the sprites disappearing when the game is paused. Perhaps deliberate/desirable in some cases (e.g. Tetris) but a lot of the time, probably just a result of the 'is paused' conditional branch in the main loop skipping the sprite building code[0].

There's an extremely large problem space and ultimately, each game has its own way to define what "paused" actually means.

You might be interested in the features Godot provides[1] for this. Particularly, the thing that makes it interesting is the 'process mode' that each node in the scene tree has. This gives the developer quite a lot of control over what pausing actually means for a given game. It's not a complete solution, but a useful tool to help solve the various problems.

[0] Simplified description of course. Also, the sprite building code often ended up distributed throughout the various gameplay logic routines, which you don't want to run in the paused state.

[1] https://docs.godotengine.org/en/stable/tutorials/scripting/p...

[ed] Just adding that Tetris is only an example of a game where you might want that behaviour, not a comment about how any of the Tetris games were actually made.

Re: Game devs explain the tricks involved with letting you pause a game

#119

I was suspicious of those random game developers getting quoted, and this is the pinned post of the one giving this cute silly story about slowing down game speed time: "Announcing TORMENT HEXUS, a match-3 roguelike about putting technofascist CEOs on the wrong side of skyscraper windows! [...] And remember: they SHOULD be afraid of us. #indiedev #indiegame" Weird times.

Bluesky has a lot of left-wing extremists where things like murdering CEOs is cool because they are allegedly "technofascist".

"Evil megacorp" media is hardly new.

Re: Game devs explain the tricks involved with letting you pause a game

#120

I’d love to hear about the 2020 release of Microsoft Flight Simulator, which had an “active pause” feature that they hyped as a big innovation for that release. You could pause and switch camera angles and see what was going on, then quickly resume. Pretty much the whole game was still interact-able, but with your plane’s position paused. It was supposed to be a nice user-friendly way to pause while you checked gauge…

[deleted]
Post reply on HN