This is The Mechanic, where Alex Wiltshire invites developers to discuss the difficult journeys they’ve taken to make their games. This time, Outer Wilds [official site].

Brittle Hollow is a doomed planet. For a start, in about 22 minutes’ time, it’s going to be destroyed, along with the rest of Outer Wilds’ solar system. And also, up until that apocalypse, Brittle Hollow will also endure constant bombardment by meteors, which will smash away great crystalline chunks of its frigid surface, so that they fall away into the black hole at the planet’s centre.

“That place is ridiculous,” Outer Wilds creative director Alex Beachum tells me. “Brittle Hollow was the last place we finalised, for what are probably obvious reasons.” He and his team had to get an entire planet to fall apart, perhaps while players are standing on it, and perhaps if they’re tearing through space on the the other side of the system. Outer Wilds is a game in which epic-scale events happen on a minute-by-minute basis, and Brittle Hollow was its greatest test.

If you’ve played Outer Wilds, you’ll remember that at the Observatory there’s an exhibit consisting of a low table and three gently rolling metallic balls. “What do you think causes their spooky motion?” asks a placard before revealing the answer: the moon. “As it orbits our planet, the Attlerock’s gravity pulls on objects from different directions. In fact, it’s pulling on you right now!”

“The balls are being affected by the moon’s gravity!” says Beachum. “And you drift slightly when you jump.”

“Actually, if you jump while the moon is above, and you’ll jump quite a bit higher,” adds designer and producer Loan Verneau.

I have to admit, I didn’t believe it when I first saw these balls. We’re used to games cheating everything, so why on Earth would Outer Wilds bother to actually physically simulate planetary gravity, especially since it’s designed to run on a mere Xbox?

But this exhibit is one of Outer Wilds’ attempts to show the physics realism of its solar system, a design decision which, of course, led to many challenges for its developer, Mobius Digital.

“The game is such a tangled mess of things we duct-taped together,” says Beachum. “Every planet, because they’re so different, has its own thing we had to work around, but Brittle Hollow probably had the most things all at once.”

Brittle Hollow was the first concept Beachum had for a game which first emerged as his Masters thesis at USC. He imagined a planet which would break up after being hit with procedurally generated meteors. “And that precipitated the idea of having a solar system where everything changed aggressively over time, and then the time loop was there so we could punch a reset button every 20-some minutes.”

Brittle Hollow still breaks up procedurally. It’s not scripted. Those meteors really are spawned by its moon, and they really are pulled by its gravity, and they do impact its surface, and it never falls apart in exactly the same way.

“The volcanic moon is orbiting and spinning, and the meteors are thrown out at random intervals,” says Beachum.

“The moon rotates on a specifically designed but non-conventional axis which makes the volcano twist in different ways,” says Verneau. “So the slight random aspect of it firing five seconds later or eight seconds later changes the trajectory completely. We get something pretty random out of that.”

“The meteors get captured by gravity, and whichever fragment of the planet they hit, there’s a slight random dice roll for how much damage it does,” continues Beachum. ”Then, each crust piece has a different amount of health, and when it reaches zero, we detach that fragment and turn it into a physics object, and have it start to fall towards the black hole.”

The challenge was to ensure the simulation makes Brittle Hollow fall apart in a uniform manner, so that you don’t get half the planet falling apart while the other remains untouched.

This became a priority after the team accidentally made the moon rotate the wrong way, sending the meteors on a trajectory that saw them skipping the planet’s equator. In response, they created a heat map of meteor hit locations and ran the game over and over, tweaking probabilities and health values to achieve random-seeming destruction.

Only a couple of parts of the planet are cheated. Without wanting to spoil things, one landmark is prevented from falling until later in the loop, so players get a chance to figure out its secret, and there are ruins with an important mural that can only fall once the fragments around it have gone. “Everything else is pretty straight,” says Beachum.

These cheats reflect the fact that Outer Wilds isn’t just a space physics sim. It’s also a mystery game in which the player explores the solar system in order to discover the secrets of its past and an explanation for what’s happening in its present.

“Design-wise, that was the big problem to solve, especially given that the world is open enough that you can land anywhere you want,” says Beachum. “Trying to figure out how to control the flow of information and the player’s experience a little, even though it’s this chaotic system.”

So, even while Brittle Hollow is falling apart, it has to also be explorable. Its interior, where you’ll find the evocatively named Hanging City and Tower of Quantum Knowledge, is reached from four access points arranged around the equator. Once inside, you get around by following trails, with most routes doubled up so that even after pieces of the planet start falling away, there’s a chance you can still reach your destination.

Mobius also had to design the fragments’ shapes and tweak their centres of gravity so that as they fall into the black hole, they don’t clip through a walkway you might blithely be running along, sending you to your unwitting doom.

All this raises an important question. Why didn’t the team just cheat everything?

“It’s a great question,” says Beachum.

“It’s fun?” offers Verneau.

“Honestly, yes,” agrees Beachum.

Also, they explain, it’d be difficult to find a configuration for the planet’s destruction which feels as even and natural as the way it procedurally collapses. Beachum remembers the “fairly aggravating process” the team had to go through to find a layout for the solar system that meant a comet called The Interloper could take a striking elliptical orbit around the sun.

“Eventually we found a configuration, and of course you want the stupid thing to get as close to all the other planets as possible so players can stand there and say, ‘Oh wow, there goes the comet!’ but without it actually hitting things. It’s nice not to have to do that with Brittle Hollow, which has far more moving parts.”

“And there’s something about the fact that each player’s play through is unique to some extent,” adds Verneau. “Plus, say you wanted to prevent a certain piece from falling, you could technically intercept meteors before they hit the piece. It seems far-fetched, but I love the fact that we created systems that are actual physics systems that you can kind of play with, if you want to.”

Oh wow.

Beachum concedes that many players have no idea that such a thing is possible, but, along with the exhibit in the Observatory, the game does as much as it can to reinforce the notion that you’re on a rock hurtling through space, and that every phenomenon is worth exploring and studying.

The burden of making all this work, of course, was on Outer Wilds’ engineers. ”None of the design stuff we did made anything easier on us from a tech perspective,” says Beachum.

As an illustration of this, he and Verneau tell me about an achievement they wanted to put in the game but were told they couldn’t have (for extremely understandable reasons), called Critical Performance Hit. You’d get it by, a) Leaving on one planet your scout, a little remote camera which sends images to your HUD; b) Landing your ship on another planet and leaving it there; c) Using a Nomai shuttle to go to another planet.

This will completely tank your framerate.

Like most games, Outer Wilds switches off physics objects and reduces the complexity of its simulation when you’re not near. “But the fact that you can leave your ship anywhere and it’s a physics object, that was a technical nightmare,” says Beachum. “We have no choice: if you leave your ship somewhere, we have to leave its physics collisions volumes on. It’s the thing that affects performance.”

So if you also have the scout, which is also a physics object and allows you to see from its camera, somewhere else in the system, the game has to run three planets at the same time.

In more ordinary circumstances, when you’re not there, Brittle Hollow is still being procedurally destroyed. Meteors are being spawned and fragments are being detached, but graphics engineer Logan ver Hoef worked out a greatly simplified collision-checking system that ensures the game knows exactly which fragments are being hit.

“That, among many others, is a reason why we call Logan a wizard,” says Verneau.

Ver Hoef also created the shader that draws Brittle Hollow’s black hole (“It’s not Interstellar levels of modelling a black hole, but it’s pretty good!” says Beachum), and also the game’s streaming system, which allows you to teleport across the solar system without encountering a loading screen.

“It’s a nightmare, because we have all of these things that instantly teleport you places, or instantly let you see halfway across the world,” says Beachum, who was determined that Outer Wilds would provide a seamless play experience. “A lot of this speaks to the value of jumping into and designing a project with absolutely no regard for what it’ll take to run.”

He knows he was lucky that the final game lives up to his wildly ambitious student vision, complete with a planet which is destroyed by physically simulated meteors. He managed to gather a team with talent and enough financial support to buy the time to realise it.

“But,” he adds, “there’s also something to be said for just doing things with very little regard for how you’re going to get it to work in any sensible manner.”