There seems to be no way to twiddle the system info of interstellar spaces from JS, so it has to be done with a planetinfo file? What I would like to do, ideally, is read the system info of the current system and of the target system (GRR to recent trunk changes) and set the properties of the inter-system space to the averages of their values. But I fear that can't be done.
So let's say, hypothetically, that I wanted to write a big planetinfo file that included all interstellar destinations as well as all systems. How do I know which combinations of system IDs are real interstellar routes and which are not?
I'd like to discuss a large change to Oolite: setting the sky properties by chart co-ordinates, rather than system ID. Particularly if one could set as few as four locations (in each corner of the chart), but as many as desired, and Oolite would interpolate the values for any intermediate location. Feasible? Stupid?
Procedure to find all interstellar spaces
Moderators: winston, another_commander
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Procedure to find all interstellar spaces
Something like this should work in 1.81 (in 1.80 you can't read data for the galaxies you aren't in, so you'd need to manually handle the outermost loop)Wildeblood wrote:How do I know which combinations of system IDs are real interstellar routes and which are not?
Code: Select all
for (var g=0;g<=7;g++) {
for (var i=0;i<=255;i++) {
var s = System.infoForSystem(g,i);
for (var j=i+1;i<=255;j++) {
var e = System.infoForSystem(g,j);
if (s.distanceToSystem(e) <= 7) {
log(this.name,g+" "+i+" "+j);
log(this.name,g+" "+j+" "+i);
}
}
}
}
However, the interstellar position is "last stellar system visited", "destination system of last jump", so with fuel-adding OXPs (or a lot of patience) all others are theoretically possible - and might correspond to quite a range of coordinates depending on the route taken to get to them.
"0 7 7" is easy - misjump from Lave towards Leesti, then misjump again back to Lave, for instance.
Probably can be done, though I'd have to do some research into 2-D interpolation algorithms, but it's also probably easier just to make the interstellar space system infos writable with JS.Wildeblood wrote:I'd like to discuss a large change to Oolite: setting the sky properties by chart co-ordinates, rather than system ID. Particularly if one could set as few as four locations (in each corner of the chart), but as many as desired, and Oolite would interpolate the values for any intermediate location. Feasible? Stupid?
Re: Procedure to find all interstellar spaces
In my opinion, this code is better :
Reverse routes not duplicated
Code: Select all
for (var g=0;g<=7;g++) {
for (var i=0;i<=255;i++) {
var s = System.infoForSystem(g,i);
for (var j=i+1;i<=255;j++) {
var e = System.infoForSystem(g,j);
if (s.distanceToSystem(e) <= 7) {
log(this.name,g+" "+i+" "+j);
}
}
}
}
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Procedure to find all interstellar spaces
I'll let cim explain why that's wrong if he cares to.V12 wrote:Reverse routes not duplicated
But in practice neither will actually work at all, because 256 or more consecutive log writes will crash Oolite. I know that from experience.
Code: Select all
var message = "";
for (var g=0;g<=7;g++) {
for (var i=0;i<=255;i++) {
var s = System.infoForSystem(g,i);
for (var j=i+1;i<=255;j++) {
var e = System.infoForSystem(g,j);
if (s.distanceToSystem(e) <= 7) {
message += (g+" "+i+" "+j+"\n");
message += (g+" "+j+" "+i+"\n");
}
}
}
}
log(this.name, message);
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: Procedure to find all interstellar spaces
Just run cim's code in the console and it didn't crash under trunk. There is a typo though:Wildeblood wrote:But in practice neither will actually work at all, because 256 or more consecutive log writes will crash Oolite. I know that from experience.
Code: Select all
for (var j=i+1;i<=255;j++) {
Code: Select all
for (var j=i+1;j<=255;j++) {
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Procedure to find all interstellar spaces
I'm surprised. I used to write similar things when I was experimenting with Distant Suns. Somewhere between 100 & 200 consecutive log writes was the limit on my Win7 machine. I could never do a whole galaxy's worth. I assumed the problem was the OS keeping up with writing to the external file, rather than anything inherent to Oolite. OTOH, compiling one big multi-MB message and writing it to the log in one message never caused a problem.another_commander wrote:Just ran cim's code in the console and it didn't crash under trunk.Wildeblood wrote:But in practice neither will actually work at all, because 256 or more consecutive log writes will crash Oolite. I know that from experience.
Re: Procedure to find all interstellar spaces
The duplication is necessary, if you're asking for all locations - "0 7 55" is "interstellar space from a misjump from Lave to Leesti" while "0 55 7" is "interstellar space from a misjump from Leesti to Lave".V12 wrote:Reverse routes not duplicated
The new connection colours feature in 1.81 requires "gal low high" as the order, so for that you do only need half of them.
Re: Procedure to find all interstellar spaces
Hmmm, You are right. I was blind, I missed for (var j=i+1;j<=255;j++)