Crash Course in Video Game Physics

Crash Course in Video Game Physics

Step into your interstellar cruiser, fire up the hyperdrive and burn the stars into streaks of light. Then within seconds, you warp out right in front of a beautiful gas giant. This is BS.

Ok, steady on, I know we are talking about a game here. Of course it’s not going to be realistic, but they have been promising us the universe for quite some time. From the gritty, hyper-detailed systems of Star Citizen to the outstanding procedurally generated 18-quintillion-planet landscape of No Man’s Sky, virtual space has never looked so beautiful. But behind all these thrilling space battles and encounters with aliens lies a harsh truth….video games don’t actually show us the scale of the universe. And, if they did, you’d turn the game off after 5 to 10 minutes!

Why am I writing this article? There are actually complex theories and mathematics involved when making the universe inside a game more playable. So, it’s pretty interesting to look at.

Breaking The Boredom Barrier

When you get into the core problem with space games, it’s right there in the name…space. That’s exactly what it is. Look at our own solar system, the distance between Earth and Moon is 384,000 kms, which is wide enough to fit pretty much every other planet in our system side-by side, with some room to spare, mind you. If we’re talking about travelling at our standard game speed of 1,000km per hour, you’d be looking at sixteen days of game play. If you were to cross the void between Earth and Mars, you’d be staring at a black screen with a tiny red dot for six years.

To solve this boredom issue developers use two main tricks. The first being a fun-sized solar system, where they scale everything down. Like the space physics fan favourite Outer World, where you can journey between planets in under a minute. The planets themselves are tiny, barely a few kilometers in diameter, which works beautifully for the game, but it’s in fact a microscopic caricature of reality.

So, the next trick up the game developers sleeves is a fast forward super hyperdrive. Like, for example, in Elite Dangerous the Milky Way Galaxy is a perfect 1:1 scale replica, topped off with super-speed engines that travel thousands of times faster than the speed of light. But even then you are looking at 10-15 minutes of travel time to a distant outpost. It’s slightly realistic but is kind of like space trucking.

Breakdown In the Math

Making a perfectly-to-scale version of our universe would require, not only advanced math and physics calculations, BUT also a super computer. The current computers we play games on simply couldn’t handle that much raw calculations. This leads us to a very interesting topic called floating-point precision, which is how accurately computers can store and represent real numbers and fractions. What does this mean? So, computers use binary code, 0’s and 1’s, and follow a standardised format to encode the numbers. Like a sign, which is a single bit indicating if the number is positive (0) or negative (1). And exponent, this will represent the power to which the base is raised and dictates the scale or range of the number. Finally the mantissa or significand, this holds the significant digits of the number and dictates the precision.

So by bending the rules of geometry, compressing the empty voids and using some clever computational magic, the game developers have given us the best of both worlds.

You might have seen this when looking at system requirements. Single Precision is (FP32) using 32 bits of memory. This means it can offer 6-9 decimal digits of precision, which is ideal for gaming, 3d graphics and deep learning where speed outweighs accuracy. Double Precision (FP64) uses 64 bits of memory and is mainly used for scientific computing and heavy financial data analysis. Rounding errors are just unacceptable. 64 bit machines provide 15-17 significant decimal digits.

In the gaming world, especially a space driven narrative, your computer stores coordinates, where you and your ship are, as well as where the enemies are, using binary numbers. And because memory is finite a game engine can only be so precise. Let’s say you are at the centre of the game world map, that’s 0,0,0 which the game is able to track you down to the millimeter. Then if you fly 1,00,000 km away the computer has to use the digits to represent the massive distance, which leaves fewer digits to track the tiny details. So what happens if you then build a 1:1 scale solar system in a base game engine like Unreal or Unity? The moment you flew too far, like Pluto, your ship would shake and cause the physics engine to break, it would lose the ability to track your position accurately because too many digits would be used.

How we bypass this is, in games like Star Citizen, the developers use an incredibly complex technique called “nested physics grids”. What happens in this scenario is similar to the Alcubierre Drive, where instead of flying through space the game moves the universe around the player, constantly shifting the coordinated centre. This keeps the math stable. However, its a monumental programming feat just to stop your digital cup of coffee falling off your ship’s dashboard and pulsing into the fourth dimension.

An Easy Visual Illusion

If you can’t be bothered with all the rigmarole you could just do what a lot of games do, and that’s pull the planets closer together. I’m sure you’ve played one like this before where you fly through a zone with a massive planet either side of you, which in reality, as you know, would be impossible. We just have to come to terms with the fact that space is insanely huge. Incomprehensible. If you reduce the Earth to the size of a grain of sand, our nearest star, Alpha Centauri, is about 20 miles away. And playing a game with realistic scales, you’d see boredom across the galaxy.

So by bending the rules of geometry, compressing the empty voids and using some clever computational magic, the game developers have given us the best of both worlds. With a universe that feels infinite but it is also comfortably engineered to fit right inside our bedrooms.

Leave a Reply

Your email address will not be published. Required fields are marked *