Ask GR Anything: What is pausing, anyway?

Save for online games, arcade games and Dark Souls, just about every game that’s ever existed has included a truly brilliant feature that we all take for granted every single day. The ability to freeze the action in place seems like a given at this point, but do most gamers actually know what’s happening when all the action in a blockbuster shooter suddenly stops and starts on command?

Last week, reader TehWise asked, “What is really the ‘pause’ in a game?” Which we’re choosing to interpret as “How does pausing work in a game?” We at GamesRadar feel a compulsory need to pay homage to this most sacred of gaming features, which has allowed us time to make countless sandwiches, and countless bathroom trips. And so we’ve selected this question as the topic for this week’s column.

To answer it, we got in touch with an indie designer and programmer in hopes he could fill us in. “Games and applications at their core level are effectively state machines,” said Martin Caine of Retroburn Game Studios, which makes games for Xbox Live Indie Games, Windows Phone, iPhone and Android platforms. “At any particular time, your game is running in a particular state. The game logic will continue executing while the game is in a certain state. When you pause the game, you are changing the state of the game and the logic behind the game can carry out other tasks.”

Caine explained that the act of pausing is about instructing the software to stop processing new information. All information flow is stopped and diverted to the menu that pops up. “Pausing is a very simple state to implement. In its most basic form, you would have a game state which shows a paused screen, and the logic on that screen waits for a user input before returning back to the previous game state,” said Caine. “When switching states, your game simply stops executing and processing input (and stops AI and other things that happen in your game's update loop) while a new screen shows on top. Resuming the game simply returns to the previous state and continues executing from the point where you stopped.”

So no matter what you’re doing, pausing will cause the game to freeze up. Even if you’re in mid-air, the computer won’t be able to process the animation of your character falling. However, some games have had more complex pause systems, which prevent players from pausing in certain situations, such as being in combat or mid-jump.

You’ll also see that in other games that would be broken by giving the player so much power over the state of the game. (Or in online games, where the ability to pause would simply be too obnoxious a tool to trust griefing 13-year-olds with. Though some online games, like StarCraft II, allow limited pausing.) Dark Souls, on the other hand, is a great example of a game that revoked the ability to pause as a gameplay tool in order to heighten fear and uneasiness.

“At the lowest level, you have your update loop, which may call functions such as HandleUserInput(), ProcessAI(), UpdateWorld() and Draw(),” said Caine. “When paused, the state is changed, and these functions do not get called, so the game will not update until you return back to the game state.”

In other words, it’s a bit like taking the chain off the gears of a bicycle. You can keep pedaling (or pressing buttons) all you want, but the game/bike isn’t going to respond to your input. It’s not a perfect example, but you get the idea.

So the next time you’ve got to take a pee break, take a moment and appreciate that somebody had to actually program the function that allows you to take a wiz.

Thanks to Martin Caine of Retroburn Game Studios for helping us out with this week's question. You can check out his upcoming Xbox Live Indie Game Positron at the studio's official website.

Submit your own questions in the comments (or Tweet them to @sciencegroen) and we may tackle them for a future Ask GR Anything.