Space and scales

The most appropriate place for Questions, Queries, and Quandaries regarding the nature of the Vega Strike universe and its past, present, or future history. Home to the occasional unfortunate RetCon.
Post Reply
KayT
Just a tourist with a frag'd nav console
Just a tourist with a frag'd nav console
Posts: 3
Joined: Tue Jan 02, 2007 11:08 am
Contact:

Space and scales

Post by KayT »

Hi Vega!

As from programming point of view I would like to enquire about how does vegastrike deals with the coordinates of objects in spece? I mean if I calculate everything in "km" it will take a lot of cpu time. If I calculate everything in a.u. it wount be precise. Still I need to be precise near some objects (orbital bases, for ex.) so I sould use even meters, but I do not need them far away in space.

What tricks do you use to make orientation precise and less cpu-hungry?

P.S. Happy new year!
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

Welcome KayT check any of the .system files they are XML i believe that the units used are meters.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
KayT
Just a tourist with a frag'd nav console
Just a tourist with a frag'd nav console
Posts: 3
Joined: Tue Jan 02, 2007 11:08 am
Contact:

Post by KayT »

hmmm... seems like it's even cm! (because, for example, Z="93318536.000000" has 6 digits below point, so if left side of the number is km, then minimum of the right side is 1 cm)

Strange.. I always thought that calculatins a square of that Z will hang my cpu :) seems that it will not :)
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Post by jackS »

double precision IEEE754 floating point values are used for positions relative to the center of a system. Meters are the internal unit. Relative distance calculations tend to use single precision IEEE754 floating point numbers, where possible, for performance reasons.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

jackS wrote:Relative distance calculations tend to use single precision IEEE754 floating point numbers, where possible, for performance reasons.
Ya, the main trick is noticing that only unit positions need high precision, orientations, local coordinates (like mountpoints and stuff), need not be like that. In fact, even collision detection ends up working on single precision since the most intensive part is object-against-object, which is done in the local coordinate space of one of the objects, which no longer needs the full precision.

But... there has been the occasional occurrence of someone mistaking a place that needed double precision for one that didn't, resulting in rounding errors - the code in that way optimized (singles when possible, doubles when needed) is very hard to mantain, as you have to carefully anlyze any change - nightmarish.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Post Reply