Problems of time and space

As I have mentioned in previous post, I am creating large scale space trading game. I do not plan to recreate realistic distances between planets, as this does not add anything to gameplay, but this does not mean, that space is small. Large space, requires large coordinate system, but float has limited precision.  Off course I knew that, just didn’t know it will hit me so fast.

So, let’s look at float. In theory it can represent very large or very small numbers, and it really can. Just not all at once. We can safely make calculations within 7 powers of 10. This looks like a very large number. Coordinates from -10 000 000 to 10 000 000 on paper look like something we can do without lose of precision. For most games one unit of mesure is 1 meter. It is simpler this way. For space game with large ships (up to dreadnought) 1 meter is a bit to low. We can use 10 or even 100m as one unit. As I will use very large ships, I will be using 100m as unit. But this means, that 0.01 is one meter, and to be honest, we have to be able to accelerate slower than by 1 meter in 1/50th of second (which is standard Unity “fixedTime”). We will walk fine line with 0.001 as our reference point of precision. There is one more bit. Apart from movement calculations, there are some visual calculations, that require precision, for example shadow calculations. So, let us take this precision and see what we have left from our 20Mx20M square.

10 000 000 moved by 3 spaces gives us 10 000. 000. Yeah, we have only 10k left. That is still about 1M meters (100 x 10k), so around 1000km. 1000km in space is not that far. It may be enough to simulate single point in space like space station and it’s surroundings, but It will not allow to make whole solar system, where you can fly around. Range from sun to earth is about 150M km, and we can simulate 1K km.


Go double

This will make all calculations slower, may still not be enough for larger systems, and what is most important, Unity does not support it.  – REJECTED

Create own coordinate system

This will make calculations slower, may require, to write some math operations for it, and Unity will still not support it.- REJECTED

Teleport player to special map

Well, many games do it, I wanted this world to be whole, not just a lot of maps player can visit. That  was general assumption. – REJECTED

Fake it!

Well, if you can not make it, fake it. And so I did. Whole game is layered. There is “Local Space”, there is “System Space” and there is galaxy. Local space is always located somewhere in global space. If you get to local space boundary it will move in global space, and will move some objects, and unload other. Player operates in relatively limited space, and this 1k km space is enough for local play, but if player want’s to fly further, it will be possible. It will be even possible to fly from one planet to another without fast travel.  As we have player in local space, all we have to do, is add objects from global space. For that we will render them using separate camera and make them look, like they are there. If object gets close enough it will be moved from global space to local space. This way it will be possible to die burned by sun, or crushed on planet. Planet landings are not part of this game.  There is one catch. Even if we say, that 1 unit is not 100m, but 100km, we get maximum of +-1M km. I could change it to larger scale, but this creates synchronization problems between local and global space. I could add another layer of illusion, and instead of 2 layers have 3, but this would add unnecessary complexity. Instead, I have decided, that for the purpose of this game it is enough. It looks good, feels right from viewer perspective, it does not really matter as far as game goes.


There is one more little detail. When we move from one system to another, and get back some time later, it would be nice if planets in this system moved just right amount. But it means, that keeping planet position as Vector3 will give us nothing. Instead of that, we will be keeping rotation Axis, orbit range from center, position of center or center object handle, start orbit position (in degrees), and orbit speed (deg/min). This way, we will be able to tell where exactly object should be located, and we will still be able to use relatively easy method of updating position in current solar system.

Astra Nova

Astra Nova is working title for game we are working on. Right now project is in it’s infancy stage. I have created rough design document, and started implementation of most basic framework features, that I am sure, will be needed. My current goal is creation of working prototype. At the same time I am learning 3d graphics, to create models. What I’m trying to crate is a space game, where you, as a ship captain, create your own empire by trading, doing missions and fighting bad (or good) guys. There were many games like that, but what I want to make it in RTS style, not a simulator, and this changes whole gameplay.

Right now I have implemented basic combat and movement, and am In the middle of creating routines to move between star systems, which involves good object management. Desing of this part is done, just have to finish implementing it.

Next part involves trading. For now I just want to create market mechanics, that may not be accessible to player, but I have to test my idea of market, production and trade.

Here is first model that I have created. This is small transport ship that will be used in the game.