Models Shakey Problem

Blitz3D Forums/Blitz3D Programming/Models Shakey Problem

BODYPRINT(Posted 2003) [#1]
I'm making a game and am trying to simulate our solar system in it, hence it is BIG.

My camera is located about 40-50 blitz units away from the back of my ship.

When i start heading out about 700,000-1,000,000 blitz units though my ship start to shake in the camera view.

If I move the camera out further it still shakes, but is not quite as noticable as it is further away :-D

I tried having the ship at the centre of the scene and move everything else around it, but the co-ordinate system was a major headache when it came to moving other ships about.

Am I just pushing the coordinate system too far, and need to shrink everything, or is there a way of solving this?

Or should I go back to my old plan of having the ship in the centre and nut out the co-ordinate code.

Thanks,
Phil


Andy(Posted 2003) [#2]
Take a look at this:

http://www.blitzcoder.com/cgi-bin/ubb-cgi/postdisplay.cgi?forum=Forum4&topic=000352

One solution is to reset the camera to 0,0,0 every once in a while and then move everything else as well...

Andy


Ross C(Posted 2003) [#3]
Shrinking everything won't help i'm afraid. It's to do with Z-buffer inaccuracy. Not enough precision.


BODYPRINT(Posted 2003) [#4]
Thanks Andy,

Makes alot more sence now.

I thought it had to do with the floating point stuff.

So I think I'll try my old plan of having the ship in the centre and moving everything else. Eek... :-D

If my planets end up 1,000,000 units away, will they start to lose position accuracy then?
Because this is a multiplayer game, every object must stay the same on each computer.

I may have to have the server send planet position updates every minute or so I guess. Ships get updated every 150ms anyway so they should stay accurate, and like what was mentioned in the Blitzcoder forum, the closer to the centre of orogin , the more accurate anyhow.

Thanks again.

Phil.


jfk EO-11110(Posted 2003) [#5]
I hardly can believe that their Positions would chanche, because they're stored in 32 Bit Variables. But I guess you can easily test it, simply position them, move the camera some hue Distances nad then check if their Positions are still the same.

That said, keep in mind that floating Point Accuracy goes up to about 124 Millions, where the exponentional Expression starts (or something like that :) ), which means loss of Accuracy. You know, those strange Numbers with an "e" inside.


morduun(Posted 2003) [#6]
Just occured to me that if you don't mind spending 8 bytes per axis coordinate, you could store locations as both a float and an int, using the int values to store entity locations outside the camera range and then switching over to using the float once things get inside the visible area. That'd give you lots of galaxy space to play with and a lot less overall inaccuracy. Apparent downside is that you'd probably need to do a bunch of workarounds to get it to work smoothly (ie, not using EntityDistance on two objects both using Intspace and that sort of thing).

You'll still want to keep your starship at the origin and move the universe around it, though.


BODYPRINT(Posted 2003) [#7]
Bring on Blitz3d 64bit :-D

I think it's called BlitzMax...LOL

Thanks morduun, but the program would have to keep converting the built in float variables to my own integers. That would slow things down I think. I'm not quite sure how storing the values as Integers would help.