64bit integer vectors?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
tstuefe
Posts: 40
Joined: Wed Jan 07, 2004 12:53 pm
Location: Heidelberg, Germany
Contact:

64bit integer vectors?

Post by tstuefe »

Did anyone ever try to use 64bit integer vectors with irrlicht? I tryto simulate a solar system, and 32bit integers don't cut it. floats/doubles are too unprecise...
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

32 bit integers gives you a range of 4294967296 numbers.

i think this should be more than enough to describe a world of any size. you merely need to plan your scale.

instead of letting a space ship's world coordinates be 200x300x100 or something, make it 2x3x1. similarly, scale down everything else, and you'll have plenty of room in your 4294967296 for a whole solar system.

if you want more than a solar system, merely consider chopping your space into sectors, each with a range of 4294967296x4294967296x4294967296.

if something is at 5000000000, merely change it to sector A02 at 705032704

then when drawing, take the current center of camera as the 'origin' and shift everything into a sector's range from that origin. so, if your camera was on the border between A00 and A02, the point A00 250000000 would be passed to the renderer as -250000000 and the point A02 705032704 would be passed as 705032704.

otherwise, if you dont want to deal with drawing from multiple sectors at the same time, you can simply say that one sector holds all of the interesting things in that area of space-- and to get to the next interesting sector, you'll have to "warp" to it. thus, you are bound within a sector, and "warping" will simply load a different sector-- but you will only ever be rendering one sector of space. if the player's ship goes too close to the edge, simply ingage autopilot to turn it around.
a screen cap is worth 0x100000 DWORDS
tstuefe
Posts: 40
Joined: Wed Jan 07, 2004 12:53 pm
Location: Heidelberg, Germany
Contact:

Post by tstuefe »

keless, thanks! I have to think about this a bit more...
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

for reference: just saw that pluto is about 5 bilion km away from the sun, that means(if I'm right) a scale of +/- 2km per number ( (sun_dist*2)/4294967296)= +/- 2) in case youre not planning to land on anything, there sould be no problem. only your minimal speed would be something like 100km/sec to keep the flying smooth. but then it would take 994 days to fly acros the solar system in real time at 50fps
Post Reply