maximum coordinate distance from center origin

Posted By: Matt_Aufderheide

maximum coordinate distance from center origin - 12/19/10 21:00

It seems that there is a hard maximum limit that a coordinate like camera position can be set. When i hit about +2097000 on an axis I get wrapped around to -2097000 ...then you cant go beyond that...

What is this behavior for? I think the user should be able to exceed this limit, even though there might be a floating point precision problem.

I am hitting this limit with my planet renderer and it is very annoying..I suppose there is a work around possible; just set the camera to be always at the origin and offset everything else.
Posted By: Slin

Re: maximum coordinate distance from center origin - 12/19/10 21:08

It could be the range of var, which I think is fixed point... And then, this behaviour is common. It is the same with char and int.
Posted By: Matt_Aufderheide

Re: maximum coordinate distance from center origin - 12/20/10 02:45

Yeah but the limit of var is something like 999999.999 +-

So why can it go higher?
Posted By: Nowherebrain

Re: maximum coordinate distance from center origin - 12/20/10 04:17

I had the same problem with my RPG and had to set up 3 different levels for it just because of that...I don't remember the exact range but it was similar.
Posted By: ventilator

Re: maximum coordinate distance from center origin - 12/20/10 10:53

var limit is 2^21 = 2097152. 1 bit sign, 21 bits for integer part, 10 bits for fractional part.

i don't know why the manual says 999999.999. there was some reason about it but i don't remember.
Posted By: Matt_Aufderheide

Re: maximum coordinate distance from center origin - 12/20/10 11:13

oh ok that makes sense..

it would be nice if you could define position as a double.
Posted By: Saturnus

Re: maximum coordinate distance from center origin - 12/20/10 11:20

Originally Posted By: ventilator
i don't know why the manual says 999999.999. there was some reason about it but i don't remember.

Because it's "easier to memorize" - according to a footnote on this page: http://www.conitec.net/beta/aarray.htm.
I guess it was basically intended for beginners.
Posted By: Nowherebrain

Re: maximum coordinate distance from center origin - 12/20/10 18:28

especialy for newer games, I myself generate most things on the fly from text files and loading zones defined by a multidimensional array...I don't see why it is not a double...even if it were 9999999.999+- that would be better...
© 2024 lite-C Forums