Dealing with huge open spaces (universes)?

Started by
14 comments, last by James Kilton 16 years, 8 months ago
The relevance of the Dungeon Siege system is in the idea of doing everything in a local coordinate system to avoid the floating point accuracy problems.

For example, you could make your universe out of, say, 1000km cubical sectors so your physics engine would only need to maintain accuracy with coordinates in the range between 0-1000km (each moving object runs physics within its local coordinate system). The size of the cube and how these cubes are arranged (e.g. as octree leaves) depends on the exact needs of the application.

When rendering, you render the sector the camera is in, then any neighboring sectors etc etc until you reach your maximum view distance. Float accuracy will affect the rendering of sectors far away from the camera, but the errors will not be visible due to the distance.

This doesn't scale to interstellar distances, but it doesn't need to. When traveling through interstellar space, you don't need much precision so using coarse "galactic coordinates" outside planetary space should be fine. Traveling to a (very) nearby star mere ten trillion km (~1 ly) away, taking (boring) half an hour of game time, running at 100fps... You're moving over 55 million km each frame! Even using integer kilometers would be total overkill for accuracy, while a resolution in the hundreds of thousands of km would be perfectly adequate.

In conclusion; a clever local coordinate system based space partitioning around stars/planets will allow "islands" of high precision where it matters (to allow slow-speed accurate maneuvering within star systems), while a much more coarse global grid should be good enough to allow traveling between them.
Advertisement
Quote:Original post by l0calh05t
Slightly more on-topic: It actually is possible to create a whole universe on a quite detailed scale, as long as it's done procedurally. for example look at this game: http://www.fl-tw.com/Infinity/

Yes, of course, I forgot to mention Infinity as an example closest to what I'm trying to achieve here. Some time ago I read through I believe entire journal of Infinity's developer here on Gamedev but do not remember to read anything on this issue. Now, motivated by your post, I visited the Infinity's homepage again and found this :). Answers the question in bigger part. Oh well, I should have looked harder in the first place.


Quote:Original post by Orcalib
Quote:Original post by l0calh05t
Slightly more on-topic: It actually is possible to create a whole universe on a quite detailed scale, as long as it's done procedurally. for example look at this game: http://www.fl-tw.com/Infinity/

Yes, of course, I forgot to mention Infinity as an example closest to what I'm trying to achieve here. Some time ago I read through I believe entire journal of Infinity's developer here on Gamedev but do not remember to read anything on this issue. Now, motivated by your post, I visited the Infinity's homepage again and found this :). Answers the question in bigger part. Oh well, I should have looked harder in the first place.


I believe this is a similar problem to the one faced and dealt with here A Real-Time Procedural Universe, Part Three: Matters of Scale By Sean O'Neil.

You'll need to create an account on gamasutra to read it but it's well worth it there's always good solid articles on there. Several are linked too from GameDev itself. I don't have time now to find his personal website as am about to run out of the office but he's got lots of samples (including source code on the gamasutra article) that's worth taking a look at for reference purposes.

Andy

"Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile"

"Life is short, [the] craft long, opportunity fleeting, experiment treacherous, judgement difficult."

(If you haven't already) you should check out how Freelancer and Eve Online handle space with a similar jump gate system. Eve Online has a 10 day free trial.

Also, I hear Battlecruiser has planets you can land on with seamless transitions from space. I believe it is the only relatively mainstream game to have implemented such a system? Never heard of any others personally.

Sounds like an interesting project though. Here's what I would do to keep it simple:

- I assume you want moving planets, stars, galaxies
- When drawing stars I assume you want to account for speed of light? (i.e. you see a star 7 light years away in the position it was 7 years ago)
- I think rendering all galaxies in the universe is doable if you do some simple LOD

Objects:

- all of space is the "Universe"
- a cluster of stars is a "Galaxy"
- a single star with orbiting planets is a "Solar System"
- a single planet with orbiting moons is "Planetary System"
- asteroid belts can optionally orbit any star or planet
- rings can optionally orbit any planet

Trajectories:

- define all trajectories by a) an elliptical orbit equation and, b) an axis, and c) an orbital period. You need all so you can know exactly where a given galaxy, star, planet, moon is at any time.

Movement of bodies (everything has an elliptical path):

- Moons/rings/asteroids orbit Planets
- Planets/asteroids orbit stars
- Stars orbit the center of a galaxy
- Galaxies orbit the center of the Universe

Time:

- When in a solar system time is "real time"
- When warping through freespace in light-years per second time is sped up.

Partitioning

- multiple-grid based scheme
- Universe divided by grid measured in light years
- each grid of the Universe divided into sub-grid measured in something smaller than light-years
- etc...

Updates:

- do a LOD-based update scheme
- In a "Universe Time Step" all Galaxies will be updated. When moving through freespace only Universe Time Steps occur.
- When in proximity of a Galaxy, "Galactic Time Steps" occur, in which stars are rotated around their galaxy center
- When in proximity of a star, "Solar System Time Steps" occurs
- etc...
- Thus, you only update objects that are near you adjusted for performance.

Drawing:

- Based on the same LOD system
- Galaxies >X light years away are represented as a single dot. When drawing them, subtract X years from their elliptical orbit calculation to show where they were X years ago from the viewers point.
- For Galaxies within X light years away draw each star, subtracting X from their elliptical
- Draw planets only within the local solar system
- Draw moons only when close to a planet

Using multiple grid resolutions solves your "extremely large number" issues. You can render far away galaxies using Universe Grid coordinates and render nearby object using finer grid coordinates.

The seamless transition from space to planetary atmosphere will be an extremely tough problem, I wouldn't worry about it until the end.
Quote:Original post by FippyDarkpaw
Also, I hear Battlecruiser has planets you can land on with seamless transitions from space. I believe it is the only relatively mainstream game to have implemented such a system? Never heard of any others personally.


This was also done by David Braben in Frontier: Elite II in 1993. Although a hyperspace system was in place there as well (as well as a method of speeding up time). I guess most players aren't all that interested in games that only get interesting when their great-grandchildren play it. ;)
I only really see two main issues with space-based games:

1. Rendering and precisions. Easily solvable by floating-origin systems so that the objects being rendered are never sent to the graphics cards outside of 10k units or so. Planetary rendering and dynamic LOD has been covered many, many times just on this site alone.

2. Distances. Space is big. Really big. You just can't believe how mind-bogglingly big it is... and so on. This is a disaster waiting to happen in terms of gameplay. Most people do not like traveling for hours at a time and it really does not make a fun game, so you've got to keep a sense of scale. Freelancer basically threw away scaling and realistic positioning completely in order to make a fun game. As Freelancer is much more arcade shooter than space simulation, such a decision worked really, really well.

This is one issue I will be watching with Infinity pretty closely: how to keep the player occupied and not bore them to death with traveling massive distances. Freelancer did a good job, the X series did a good job, Eve Online maybe went a bit too far, but it is successful.

Good luck on your project!

This topic is closed to new replies.

Advertisement