Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Precision and object jiggles

Author
Message
GrumpyOne
18
Years of Service
User Offline
Joined: 27th Nov 2007
Location: London, UK
Posted: 4th Mar 2011 14:23
Dear All,

I've got a problem with the jiggles, and it isn't because I've been drinking too much coffee.

I'm doing a 3D space RTS, and I want the user to be able to scroll all the way in to an individual ship, and all the way out to see the whole galaxy. This involves changing the camera range a few times, but works well.

The problem is when I zoom in to my ship, it jiggles if it moves, and its component parts jiggle relative to each other (they are limbs added in code). My code sets the camera position to the ship and then moves the camera back, so it is always pointing at the object, so it shouldn't jiggle, and its component parts shouldn't jiggle.

I have a strong suspicion that I have hit up against DBPRo precision limit for object positions. My ship object is 0.05 DB units in size, and I guess the jiggles I guess related to motions of 0.001 DB units or less. My world covers 30000.0 DBPro units. So we are up to 7 digits, which I guess is DBPro's floating point precision.

My question is, how does the engine decide on the range of precision, does it look at all existing object positions and set the number of significant figures from that? I've tried resetting the camera range to 0.0001 to 30.0 when I get close to my object, but the jiggles continue.

Of course, the simple solution is to move all my objects and scale when I get close to them. Expanding part of my game world so precision is no longer an issue, but I am interested in knowing the answer so I can choose the optimum zoom to rescale.

Best,
Mr Grumpy

GrumpyOne - the natural state of the programmer
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 4th Mar 2011 14:53
I think your right, the range might be a bit much for DBPro's floating point precision. I'm guessing that it's fine when the ship is close to the center of the game world?

If that is the case, then I would shift everything according to the camera or ship position. so when your ship goes beyond 10,000 units for example, reset your ship to 0,0,0 and offset everything according to that. Personally, I would consider making the closest solar system 0,0,0 - nice and convenient for rotation, gravity etc - but that would certainly make it easy to keep track. You could keep a record of solar system positions, then when you get closer to the next system, set all the offsets to that. If the player goes for miles with no solar systems nearby, it could just reset and track the position, offsetting it like my original suggestion - as positioning might not need to be vitally accurate in the middle of space, just near planets and other ships.

Health, Ammo, and bacon and eggs!
sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 4th Mar 2011 20:35
You also can use more than on camera.

Life is not fair, so deal with it.
http://www.gusroundtable.com/

Login to post a reply

Server time is: 2026-07-16 18:25:18
Your offset time is: 2026-07-16 18:25:18