Page 1 of 1

Jump destinations?

Posted: Fri Nov 14, 2008 9:41 am
by Commander McLane
I recall that we debated the possibility of making the systems which are in 7LY reach from the current system available in JavaScript (as a system property, presumably).

Don't find anything like that in the wiki. So I take it this doesn't exist yet? :?:

Posted: Sat Nov 15, 2008 11:51 pm
by Dr Beeb
I am not aware if this had been done, all I can offer is some work I did in that direction, at
http://wiki.alioth.net/index.php/Oolite ... t/Galaxy_1

I listed those within 7 LY within { } , e.g
# 7. Lave (20,173), {39,46,55,129,147,255} within 7.0 LY.
If a javascript has access to the galactic coordinates , e.g. (20,173) for Lave, then distances could be calculated independently, sqrt(Delta_x^2 + Delta_y^2)*4/10 where the Delta_y has to use the difference in y coordinates divided by 2 and rounded towards zero. Rounding errors can be a pain, see
http://wiki.alioth.net/index.php/Talk:O ... lanet_list

The Oolite code itself has

Code: Select all

OOINLINE double distanceBetweenPlanetPositions ( int x1, int y1, int x2, int y2)
{
	int dx = x1 - x2;
	int dy = (y1 - y2)/2;
	int dist = sqrtf(dx*dx + dy*dy); // here's where the rounding errors come in!
	return 0.4 * dist;
}
in legacy_random.h which I believe is what the game actually uses.

As an aside, another topic is talking about nav arrray not calculating fastest journey time, I think that could be fixed by changing the cost function to the square of the trial distances?