Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

C Coder

A Huge Real Size 3D Universe

This topic is 5472 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ideas or help or sugestions needed! I am currently making a 3d universe game and am struggling with the stupidly huge numbers a little bit. my universe consists of a 3d array of (20,20,20 = 8000) Galaxys which each contain a 3d array of (20,20,20 = 8000) Solar System, and each Solar sytem containing 20 planets max and being in the order of 1*10pow64 metres in size!! ish!! this equals (8000*8000*20) 1.2 billion planets in theory anyway! Everything is going well except now I am trying to put in the NPC ships flying around in each solar system and I just wanted any ideas on this (bearing inmind that the size of each solar system is 1*10pow64 (eg 100,000,000,000,000,000,000,000,000,000,000 this is 1*10pow32) Would everyone agree it is best to split the ship coords into yet anouther 3d array of coords ( ie 10,10,10 ) or somthing so that I only have to work out the relative grid coords of other ships to the canera! and only if within the same grid sector as the player take any other action. This would allow me to use word coords in all calculations (ie the screen coords of the targeting system etc etc ) Does this make sense or am I just babbling on and on !!!!! I know what I mean, I think!! Anyway any Ideas on a 3d Universe would be nice weather on this topic or any other!! Thanks :-)

Share this post


Link to post
Share on other sites
Advertisement
Thanks but I have already been there! And disagreed with alot of what mr oneal said and found his demo rather naff! (Sorry!) any other sites you guys know of that might be helpfull to me!

Share this post


Link to post
Share on other sites
Hi C Coder,

I understand the issues that you''re facing and like you I did not find the solution that Mr. O''Neil (A Real-Time Procedural Universe) describes in his article on Gamasutra.

Some of my thoughts on this subject relate back to tile based games or the new breed of tile based games, 3D Tile engines - like the one used in Dungeon Siege. Basically, you would sectors that have Universe Coordinates (UC) and then within these sectors you would have Sector Coordinates (SC). These size or scale of the sectors should be small enough to fit within your chosen type (floats or doubles).

The UC, depending on the number of sectors you want to have in the universe, could be an 32 bit long or as small as a 8 bit short (not using unsigned would allow for negatives - or you may want to use unsigned to keep everything simple *shrug*) and the SC could be either floats or doubles – keeping in mind that we are in 3D we’ll need some way of keeping the coordinates for objects… maybe something like:


// not using typedef’s for clarity//
struct sUniverseCoordinate
{
short x;
short y;
short z;
};

struct sSectorCoordinate
{
// this is familiar to any 3D application – could use floats in place of doubles
double x;
double y;
double z;
};

struct sUniverseSectorCoordinates
{
struct sUniverseCoordinate uc;
struct sSectorCoordinate sc;
};


So when an object, say a players ship, is in UC 1,1,1 and at some position within that UC, say, 10001.0, 887.98, 333.5, these values would be maintained within our sUniverseSectorCoordinates.

Getting back to a procedural universe you could during the initialization of the game feed the random number generation routine a seed number, then using a series of numbers from the random routine seed the sectors with those random numbers. Once you enter a sector the procedural routines would use that number to seed the random number generation – this would give you the same results for these routines -every time, which is what you want.

I welcome further discussion on this topic too.



--DISCLAIMER--
I have not attempted this and do not know if it will work it only seems feasible to me given the work that I have done.


Dave "Dak Lozar" Loeser

Share this post


Link to post
Share on other sites
If it is going to be a space game, why bother with a 3d-array? Most of the universe is empty space, so instead of recording information for every point, make a list of the things that do exist (array or linked list). Then each object would have the information on its position as 3 floats/doubles. On the scales of solar systems, the exponent part of the float could be small or negative, while on a larger scale you will just up the exponent a bit.

And I suggest that instead of making 8000 galaxies you make 1. You probably don''t need travel between them.

Share this post


Link to post
Share on other sites
quote:
Platinum314 : If it is going to be a space game, why bother with a 3d-array?


I agree with you... The thing to note is that rarely do these types of games let the player fly from system to system without going through some sort of jumpgate or wormhole or warp process. So, having the universe in memory at once is overkill.

Using a system like I describe above the engine could stream a sector into memory as a ship approaches a sector boundary but again, I’m not sure that this would be desired and there are simple ways to explain away why a player cannot do such a thing.


Dave "Dak Lozar" Loeser

Share this post


Link to post
Share on other sites
Sorry if I've misunderstood, but are you going to make your solar systems 1e64 m across? AFAIR a lightyear = approx 1e16 m, and estimates for the size of our universe is on the order of 1e10 ly, or 1e26 m. Now this is gamedesign, so throw realism to the wind if it means a gain in playability, but wouldn't it be more sensible to make the solar system smaller than in reality, not larger. You could have a zillion NPC's flying around in your universe without any ever meeting the player.

Also read what the linked article said about accuracy in floats and doubles. Thats a problem you will run into with your current design.

[edited by - deformed rabbit on September 24, 2003 5:08:00 PM]

Share this post


Link to post
Share on other sites
Thanks for all the responce.

I am currently using a grid type system of a solar system within a galaxy within a universe etc and this seems to work well.
I have though reduced the scale of the project down abit to the following...


const double UNIT_SCALE 3; // ie *1000mm per meter
const double SOL_SIZE 5.91f*2 * pow(10,14+UNIT_SCALE);

where UNIT_SCALE is just an acuracy constant so I can easly change the size of everything by changing this value from 3(ie*1000).

So my Solar sytem size is SOL_SIZE which is the distance of pluto from our sun * 2 (=diameter not radius!).

Also the number of solar system is currently reduced to 10,10,10 (1000 solarsystem per galaxy) with 10,10,10 galaxys (1000 galaxys each containing 1000 solar sytems * 10 Planets per solar system == MAX PLANETS IN UNIVERSE = 10,000,000).

This does take alot of memory, but not TOO much for most home computers (I THINK!) but I could always store the data on disc and just load up each solar system as needed!

I want my game to be a free as possible for the player so by using a 3D grid (array) I give the player true control to do what ever they might want to do!

I have limited everything at the moment to try and resolve some of the problems.

My Test Planet has a radius of

double radius = 1.496f * (pow(10,12 + UNIT_SCALE));

which I have just noticed is WRONGE!!!! this is the distance of Earth from our Sun!! It should be

6.37f * pow(10,6+UNIT_SCALE);

My test planet has a radius of more that 100,000 times that of Jupitor! no wonder Im having trouble!!!

Will get back to you guys after I fix that stupid mistake.

But before I go Any Ideas why my STUPIDLY OVER SIZED planet STILL looks quite small when you fly close to it! What do you lot think I should set the perspective transform to? (ie angle of view etc etc..)

Share this post


Link to post
Share on other sites
Just to update things seem abit more in proportion now I have spotted my error and set the planets to the correct scale.

I now have an Earth sized planet, with a Moon sized planet at a distance equal to our moon from our planet! (accurate to 1mm).

I have altered the Perspective transform to use a view angle of 0.4f and this seems to make thing look real sized (ish!).

Any more ideas very welcome! (about any aspect of this topic!)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!