Using Large Space Maps

First, apologies for bringing up this topic, but I’m still not sure where to go next.

The Project

  • A 4x type space exploration, combat, and trading game.
  • I’d like the game to have the kind of scope felt in Egosoft’s X3.
  • LAN based (non-authoritative) multiplayer anticipated.

The Problem

You guessed it, I’m not sure what’s the best approach to handle very large map areas. I know that precision becomes a problem due to single precision floats. What I don’t know is what to do about it. Here’s some questions that I’m hoping some of the smart folks in the community can help with (BTW - I am a licensee so I have Pro if that makes a difference).

Possible Approaches

  • I could try to alter the scale, but I’m concerned that this will make things seem to move slow when they shouldn’t. There is going to be some “twitch based” combat elements, so projectiles need to be able to impact other objects and ships need to fly near each other and other objects at a believable pace.
  • I could just live with the largest useful map size and divide things into sectors the player has to “warp” into. But, how big is that? What’s the largest size I can get away with using? Perhaps 99,999 m? That leaves 2 digits for precision, but is this big enough for a couple of planets, stations, capital ships, and other cosmological artifacts? Does the level technically have to have a boundary? maybe I can let people go as far as they want, but change the scale once they get beyond 100K, and make sure there’s little to no interactive material outside that range.
  • Maybe I could just stitch a whole bunch of “areas” together, so the coordinates stay in a reasonable scope, but won’t that make it really difficult to handle projectiles traversing from one into another? I suppose I could render a block of nine “levels” and just make sure nothing “shoots” or is “shown” beyond that horizon, but how hard is it going to be to manage the objects and such in this approach?

This last approach seems like a good way to go but I’m a bit confused about it. I’m so used to making terrain maps, but with a space sim there is no terrain map. So, Instead of having a block of 9 terrain maps, what do I have? Do people typically just make terrain maps and then delete the actual terrain? I’ve seen that if I make two maps, that Unity will render objects from one from to an FP player in the other.

So again, apologies for the “noobness” level of the question. Please know that any help will be greatly appreciated.
Maulkye :smile:

How far do you actually need to see at a time?

If you break up all of the objects into groups based on location (think 3d grid), you could stick all of the objects in that group into a parent dummy-object. Then enable/load them if you’re close enough and disable/unload them when you’re out of range. If precision is a problem, move the game world around the player and leave the player at the origin. As long as you don’t actually have to render things that are significantly far away, you won’t have any precision issues.

  • To answer your question: “…As far away as I can manage.” It depends really. Planets, as far as I can. Man made or small objects, those could have lower viewing distances.

Since I want to make this LAN multiplyer, I don’t think I can move the world around the player.

I was thinking of something like making a 3d “grid”, where I could have the coordinates reset for each cube, to keep them low. I just don’t know if that can be done in Unity. Players would need to be able to see approximately one full cube away at all times (so dipping into the neighboring cube but never going beyond it). However, can Unity handle something like this?

How do other engines handle this?

Hmmm, I can’t see why you couldn’t. There aren’t any hardcoded values (that I know of, still a nub) that restricts you into a X by Y area.
In the inspector, I made a quick movement script and got this far before getting board. I’m not sure if this is the true value, or just the value shown in inspector.
55555.68

Procedurally loading levels around the player isn’t new to unity either, so your block idea (with work) will be fine.

There are, since 32-bit floating point numbers have a limited precision. You can use something like 999999, but then you only have a couple of digits of precision after the decimal, which makes movement jittery and not really acceptable.

–Eric