# The Cosmic Flowchart

Here’s a quickly drawn flowchart to visually represent how the cosmos work in-game as of right now without any of the “boring” math.

Advertisements

# Overcoming Float Precision

One of the first issues I’ve had to overcome in my quest to expand my digital universe was that a numeric value is limited by the size of its data type.

In Unity, a Vector contains an array of float values. Any non-float data type passed through it will ultimately be converted to float. There are ways to change this behavior, but the result wouldn’t be worth the trouble. More importantly, the behavior doesn’t need to be changed, because it is the most performance friendly of the float precision data types, and because it already grants me 99,99 x 2 km to work with, unhindered, on all axes, which is more than enough if I can just find a way to expand upon it. And I have.

But, how?

The short answer: With exponentiation.

The long answer: A solar system is basically a large cube with x*y*z amount of smaller cubes inside it. I refer to the small cubes as “Solar Bits”, and the large cube as a “Galactic Bit”, or a “Solar Byte”. The range of a Solar Bit is capped at 90 km from the center, and an object such as a player is not allowed to travel beyond this boundary. Once the player reach +90 km on the x-axis, the player’s position resets to -90 km on said axis, and a function counts that the player has moved +1 time past 90 km on that axis. To a player, it may seem like they’ve moved 53200 km from the center, but mathematically, the player is still in and around -90 and +90 km, multiplied by the amount of times they attempted to move from the center.

What can be made of this?

Similar to how Solar Bits make up a Galactic Bit, Galactic Bits make up a Cosmic Bit, and a Cosmic Bit can stretch as far as 830,103,482,543,835,709,620 km from the center. That’s 175 times larger than the Milky Way.