Live data from Hacker News

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

kotaku.com

191–200 of 273 posts

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

#192

Earlier quoted context omitted.

Look into dead reckoning vs lock step for networking. Lockstep requires determinism at the simulation layer, dead reckoning can be much more tolerant of differences and latency. Quake and most action games tend to be dead reckoning (with more modern ones including time rewind and some other neat tricks). Very common that replay/demo uses the network stack of it's present in a game.

An interesting thing about the a lockstep solution which only considers inputs is that any RNG required in the game must be generated from the input history somehow. This could lead to players being able to manipulate their luck with extremely precise inputs.

https://news.ycombinator.com/item?id=30359560

DonHopkins on Feb 16, 2022 | parent | context | favorite | on: Don't use text pixelation to redact sensitive info...

When I implemented the pixelation censorship effect in The Sims 1, I actually injected some random noise every frame, so it made the pixels shimmer, even when time was paused. That helped make it less obvious that it wasn't actually censoring penises, boobs, vaginas, and assholes, because the Sims were actually more like smooth Barbie dolls or GI-Joes with no actual naughty bits to censor, and the players knowing that would have embarrassed the poor Sims.

The pixelized naughty bits censorship effect was more intended to cover up the humiliating fact that The Sims were not anatomically correct, for the benefit of The Sims own feelings and modesty, by implying that they were "fully functional" and had something to hide, not to prevent actual players from being shocked and offended and having heart attacks by being exposed to racy obscene visuals, because their actual junk that was censored was quite G-rated. (Or rather caste-rated.)

But when we later developed The Sims Online based on the original The Sims 1 code, its use of pseudo random numbers initially caused the parallel simulations that were running in lockstep on the client and headless server to diverge (causing terribly subtle hard-to-track-down bugs), because the headless server wasn't rendering the randomized pixelization effect but the client was, so we had to fix the client to use a separate user interface pseudo random number generator that didn't have any effect on the simulation's deterministic pseudo random number generator.

[4/6] The Sims 1 Beta clip ♦ "Dana takes a shower, Michael seeks relief" ♦ March 1999:

https://www.youtube.com/watch?v=ma5SYacJ7pQ

(You can see the shimmering while Michael holds still while taking a dump. This is an early pre-release so he doesn't actually take his pants off, so he's really just sitting down on the toilet and pooping his pants. Thank God that's censored! I think we may have actually shipped with that "bug", since there was no separate texture or mesh for the pants to swap out, and they could only be fully nude or fully clothed, so that bug was too hard to fix, closed as "works as designed", and they just had to crap in their pants.)

Will Wright on Sex at The Sims & Expansion Packs:

https://www.youtube.com/watch?v=DVtduPX5e-8

The other nasty bug involving pixelization that we did manage to fix before shipping, but that I unfortunately didn't save any video of, involved the maid NPC, who was originally programmed by a really brilliant summer intern, but had a few quirks:

A Sim would need to go potty, and walk into the bathroom, pixelate their body, and sit down on the toilet, then proceed to have a nice leisurely bowel movement in their trousers. In the process, the toilet would suddenly become dirty and clogged, which attracted the maid into the bathroom (this was before "privacy" was implemented).

She would then stroll over to toilet, whip out a plunger from "hammerspace" [1], and thrust it into the toilet between the pooping Sim's legs, and proceed to move it up and down vigorously by its wooden handle. The "Unnecessary Censorship" [2] strongly implied that the maid was performing a manual act of digital sex work. That little bug required quite a lot of SimAntics [3] programming to fix!

[1] Hammerspace: https://tvtropes.org/pmwiki/pmwiki.php/Main/Hammerspace

[2] Unnecessary Censorship: https://www.youtube.com/watch?v=6axflEqZbWU

[3] SimAntics: https://news.ycombinator.com/item?id=22987435 and https://simstek.fandom.com/wiki/SimAntics

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

#193

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…

In some games - most famously Doom - entire multiplayer is based on exchanging just the inputs and the games on all connected computers are deterministic enough to provide same outcome on all of them. I am one of the authors of Fire Fight game (1996-ish) and we pulled the same stunt. It was actually easy, we just had to build our own "random number generator" and fix all bugs with uninitialized memory :-)

I love Fire Fight! I got the demo on a PC Gamer disc when I was a kid and played it forever. And couple of years ago when I built a retro PC, it was one of the first games I loaded up :)

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

#194
post #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 simplis…

I read your comment and the article and I’m still not really clear on why this isn’t as simple as saving the current state or pausing the render or time loop.

Saving the current state? What does that even mean? You don't save transient things like visual particle positions but it's something you expect to persist between pauses.

Pausing the render? But not the physics so you keep falling? You need to pause many systems. At the very least you'd want to pause gameplay, and sound and physics. You'd want to keep input and some of the UI unpaused. If you have a fancy UI with VFX, you need to make sure those are not using the paused game time. etc etc

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

#195

Earlier quoted context omitted.

There's probably something eloquent by Hannah Arendt about how 190,000 Americans killed by health insurance companies goes unnoticed while one person killing a CEO becomes a spectre of "left wing extremism" held up as an example. Or was it by The Joker from Batman? Or was it when protesters in Latin America sat down blocking a road to protest environmental destruction and an American driver was so angry that he was m…

> There's probably something eloquent by Hannah Arendt about how 190,000 Americans killed by health insurance companies Health insurance companies don't kill people, quite the opposite. If it weren't for health insurance, a lot more people would die. Murdering their CEOs is crazy extremism.

Physicians For A National Health Program put the figure at 200,000 people annually[1]. What's your source for saying the number is zero? When they deny claims, people die. When they override medical doctor recommendations and insist on cheaper treatments, people die. When they tangle up customers with paperwork and bureaucracy, that some people can't access the health insurance they pay for. When they take money out of the system as profit, that money isn't helping the sick. When United Healthcare spends $12M/year on lobbying[1] it isn't doing that to improve patient care.

> Murdering their CEOs is crazy extremism.

When a system doesn't have a pressure release valve, the pressure doesn't go away. When a system blocks or ignores peaceful protest, the pressure doesn't go away. The thread running through my comment is that harming humans is wrong, yes murder is wrong - but sticking a label on it and saying "leftist extremism" and then denying real issues is not helping. The system needs ways to hear people saying "things aren't fine" before those people go crazy extremist, not after.

[1] https://pnhp.org/news/estimated-us-deaths-associated-with-he...

[2] https://www.opensecrets.org/federal-lobbying/industries/summ...

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

#196
post #154

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

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.

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

#197

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…

I always wondered how NES games, which were notoriously low memory, could have game simulation on the start screens. Think Super Mario Bros, but there are many others. If no input is received at the start menu, the game starts playing a demo run. You always see videos and posts about how developers were dissecting sprites and swapping color pallets to work around the small memory, so how in the heck did they manage h…

The demo playback on 8-bit games was rarely more than a few seconds long, and it's just a capture of input data.

Here's Super Mario Bros's demo replay data: https://gist.github.com/1wErt3r/4048722#file-smbdis-asm-L108...

21 bytes of joypad input and 21 bytes of input timings

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

#198
post #26

Earlier quoted context omitted.

Quake needs a FPU; if that was true it would run on a 486 SX.

You're right, I must have gotten that mixed up. Sorry. I guess floats are still mostly deterministic if you use the exact same machine code on every PC.

> I guess floats are still mostly deterministic if you use the exact same machine code on every PC.

Nope, they are not. Part of the problem is that "mostly deterministic" is a synonym for "non-deterministic".

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

#199
post #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 simplis…

I read your comment and the article and I’m still not really clear on why this isn’t as simple as saving the current state or pausing the render or time loop.

It’s only simple if your state machine has zero implicit state and all transitions are perfectly and precisely articulated. Good luck with that!

P.s. And once you are done achieving the above, you can then make sure you haven’t caused performance issues :)

But yes, conceptually, it’s a relatively simple idea. The devil is always in the details.

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

#200

One of the fun features that I developed for Warcraft (the RTS) was to fade the screen to grayscale when the game is paused. Since the game uses a 256 color palette, it was only necessary to update a few bytes of data (3x256) instead of redrawing the whole screen, so the effect was quick. I also used this trick when the game stalled due to missing network packets from other players. Initially the game would still be…

Omg I love this! I have been finding excuses to do little animation engine features that arent on the critical path of development for the sake of creative self-indulgence. Such features shipped was alpha channel based fading using the fundamental opengl fade parameter (under the hood its a linear interpolation of alpha values over 256, pieced together over a provided pair of timestamps). I tell you what I'll do toda…

While I don't have the original code, it's something along the lines of this:

    // for each palette entry:
    pal.r = pal.b = pal.g = (byte) (0.299 * pal.r + 0.587 * pal.b + 0.114 * pal.b)
Post reply on HN