Instead of the 8 sectors, we were generating before (a 2×2 cube), we now need to generate a whopping 27 (3×3 cube) to form a full sphere with a radius of 150ly. Given an average of 4000 stars per sector, that’s over 100,000 star systems to manage. Efficiency is the name of the game here, so I’ve been carefully juggling just how much data to generate at set points in the process so as not to overload everything. For example, do I convert each star’s Kelvin temperature to RGB colour at the time of generation, or do I perform that task after the data has been filtered? The jury is still out on that one, but that’s an example of how carefully this needs to be managed.
Generating a full 3×3 cube of sectors means I only have to regenerate that data afresh when the ship moves into a whole new sector, and given that each sector is 100ly wide, it’s not something that will be happening very often at all. As such, I can generate the data fairly slowly over a period of say 20 seconds so as not to cause any performance impact. All the real-time systems then simply reference the stored data and filter it as needed.
In case you were wondering (because surely you were), this is what 300x300x300 lightyears looks like when trimmed to a sphere:
The next step was harder though because the galaxy is now represented at a literal cm scale and we need to translate the location of the ship within a given cubic lightyear from centimetres to more reasonable galactic coordinates. As you can see here, the local coordinates are massive:
With the power of math however I was eventually able to get my head around it, and I’m happy to say we now have a fully working system for traversing the entire 1:1 scale galaxy per centimetre. Don’t just take my word for it though, here’s a video of the ship moving at a very real 200,000,000 times the speed of light:
The flickering you see is where it’s taking the 27 stored sector data and discarding anything further away than 50ly to render the holo-display. It’s having to do that a couple of times per second, which is a mad amount of data processing, but the ship is never going to be moving anywhere near that quickly during normal gameplay, so it should be fine.
As a stress test though I wondered if it could handle moving at 1 billion times the speed of light. The answer is yes, yes it can:
It’s a lot more glitchy and the galaxy gen couldn’t keep up with generating new data, but it handled it like a boss and didn’t crash so I’m counting it as a win
During normal gameplay the ship will have a max speed of around 2,000,000C, so the speeds shown above are way, way faster than needed. What this does mean however is that we have a huge margin to play with in terms of ship upgrades etc. Even a tenfold increase in ship capability is still significantly slower than the speeds tested, so we can look forward to a wide array of alien bolt-ons and interesting new minerals to make getting around the galaxy a bit quicker