Discussion What is the most efficient way to crowdsource the 3D system coordinates

Keep in mind I've mentioned this only because I've spent ages debugging it, but it is a not an issue for me from now on. As I hear there is at least one other commander who had the same experience.

It caused maybe 5 minutes of confusion for me. I just chalk it up to the normal debugging/troubleshooting when trying to use a new api. There's always some quirks and what-not, especially when dealing with a web api.

Tornsoul: One thing I might suggest, would be to open source your server code. This way others could contribute if they were so inclined. For example, to implement the streaming data thing. (Not saying that I volunteer.. just that others might.. :))

I assume we'll eventually need to migrate it to a hosted service as well, although we probably don't need to worry about that for a while.
 
It would help if you said what you expected :)

It *is* working - So you probably didn't give it the correct filters to match your expectations.

Well ^^ GetDistances should give some distances and the return in JSFiddle is "distances: []".
Before i try to experiment in Python, which i haven't coded yet, it would be nice to know that the underlying API is working and that any mistake is on my side.

So what should the example look like to actually produce a list with results? I would also assume that the result is not only numbers but some 2-dimensional array/ tuple [systemName, distance].
 
If you're starting with the GetDistances example in the API docs then, yes, it will return nothing as there'll be nothing matching the 'AND' of all the filters. This one works: http://jsfiddle.net/5grjpe57/15/

- - - - - Additional Content Posted / Auto Merge - - - - -

To be honest "JSFiddle (will pull all data)" for that link is misleading, as it'll simply never pull all data. Copy/paste error from the GetSystems one/an earlier version of the docs ?
 

wolverine2710

Tutorial & Guide Writer
Added the following to list 2 of the OP. It will be added tomorrow to the OP of the "third party tools" also.

Athan
. Webbased routeplanner. Website.

Still have a hug backlog and that 3rd party tool takes a LOT of time. So currently leeching a bit here in this thread ;-(
 
Tornsoul: One thing I might suggest, would be to open source your server code. This way others could contribute if they were so inclined. For example, to implement the streaming data thing. (Not saying that I volunteer.. just that others might.. :))
Yeah - One day, probably... :p

I assume we'll eventually need to migrate it to a hosted service as well, although we probably don't need to worry about that for a while.
I got about 75mbit upload (and the server CPU isn't breaking a sweat) - So we should be good for quite some time I'd think, considering the activity I see currently (which could ofc explode come release)


To be honest "JSFiddle (will pull all data)" for that link is misleading, as it'll simply never pull all data. Copy/paste error from the GetSystems one/an earlier version of the docs ?
Splif... "pull all" is from before the cubesearch etc filters got added.
So yeah, I need to remove that bit of text.
 
If you're starting with the GetDistances example in the API docs then, yes, it will return nothing as there'll be nothing matching the 'AND' of all the filters. This one works: http://jsfiddle.net/5grjpe57/15/

- - - - - Additional Content Posted / Auto Merge - - - - -

To be honest "JSFiddle (will pull all data)" for that link is misleading, as it'll simply never pull all data. Copy/paste error from the GetSystems one/an earlier version of the docs ?

Nice, this is actually really cool!

What should i set for filter in GetDistances to get all systems around Sol in a radius of 20 LY around Sol? (That would be the main use case in my plan.)
I tried:
Code:
var query = {
        ver:2,
        test:true,
        outputmode:2, 
        filter:{
            //knownstatus:0,
            systemname: "Sol",
            //cr:5,
            //date:"2014-12-06 00:00:00",
            //coordcube: [[-10,10],[-10,10],[-10,10]],
            coordsphere: {radius: 58.45, origin: [0,0,0]}
        }
    };
which has no result.

Running GetSystems with "Sol" returns an array with Sol in the list with coords[0,0,0].
 
Nice, this is actually really cool!

What should i set for filter in GetDistances to get all systems around Sol in a radius of 20 LY around Sol? (That would be the main use case in my plan.)
Firstly: If you wan't systems, you should use GetSystems, not GetDistances (in fact very few will need GetDistances for anything)



I tried:
Code:
var query = {
        ver:2,
        test:true,
        outputmode:2, 
        filter:{
            //knownstatus:0,
            systemname: "Sol",
            //cr:5,
            //date:"2014-12-06 00:00:00",
            //coordcube: [[-10,10],[-10,10],[-10,10]],
            coordsphere: {radius: 58.45, origin: [0,0,0]}
        }
    };
which has no result.

Running GetSystems with "Sol" returns an array with Sol in the list with coords[0,0,0].

Not supplying a cr value, means it defaults to 5. So commenting it out like that has no net effect :)

Not supplying a date, means it defaults to Now-24h. So commenting it out like that, means you'll only get any changes made the last 24h.

Supplying the systemname, means you *only* want systems matching that name - So that kinda defeats the purpose in this case.


This fiddle should give you what you wan't

Code:
var query = {
        ver:2, 
        test:true,
        outputmode:2, 
        filter:{
            knownstatus:0,
            //systemname: "sol",
            cr:0,
            date:"2014-09-18 12:34:56",
            //coordcube: [[-10,10],[-10,10],[-10,10]],
            coordsphere: {radius: 20, origin: [0,0,0]}
        }
    };
 
Last edited:
Without distances, no system coords.

No system coords, no need for a "SubmitSystem()"

So it all starts with "SubmitDistances" - Which is there.
 
Ok, in test mode, i see.

There seems to be no limit for the response. It's probably clever for an app to download all records and then just check for updates, right?
 
The clever thing would be to only download the data you need by limiting with sphere/cube at the time that you need it. Or download a static dump, then do updates based on timestamps if you really need everything.
 
I'm just modelling an SQL database and wonder if this couldn't be made as a public framework since every tool will need the same more or less.
Or is there already something like that?

Code:
CREATE DATABASE edb

CREATE TABLE ships(
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(50) NOT NULL UNIQUE
)

CREATE TABLE modules(
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(50) NOT NULL UNIQUE,
    clazz INT
)

CREATE TABLE com_categories(
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(50)
)

CREATE TABLE commodities(
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ref_category INT NOT NULL,
    name VARCHAR(50) NOT NULL UNIQUE,
    average INT,
    ref_note INT
)

CREATE TABLE prices(
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ref_station INT NOT NULL,
    ref_commodity INT NOT NULL,
....

I don't need the ship model in detail but another tool could need it so why not model everything out as a collaborative work?
I'm also not quite sure how to model the 'modules' and someone might know it better.
 
FD have confirmed no wipe for release. That probably means no change to the procedural generation. Wolverine, do you want to PM Michael and see if he can confirm?
 

wolverine2710

Tutorial & Guide Writer
FD have confirmed no wipe for release. That probably means no change to the procedural generation. Wolverine, do you want to PM Michael and see if he can confirm?

The wipe info came from Community Manager Edward Lewis so it should be correct. But I think you meant to the Stellar Forge stuff. Will PM Michael brookes to get official confirmation/denial.

If indeed no wipe, I got burned twice. With SB2 "no planned wipe", last weekend grinded till my fingers bled to be ready for an ASP and exploration. Then they wiped. Now with Gamma "assume a wipe", didn't play at all and NOW "no wipe". They are pretty consistent in ruining my day.....

Edit: PM send.
 
Last edited:
So I think I've found a system from the FD Gamma list that doesn't exist. It certainly isn't where it is s'posed to be and the name doesn't work in the GM.

Djali -81.96875 52.3125 59.53125
 
Recap of a couple of problems found recently with how FD calculates distances ingame - and the solution.

It was spread over many posts, with unrelated posts in between.
I thought it would be useful to have it all collected for future reference, if someone drops by that needs a pointer on how to do things.

The Problem
Two distances turned up, where our calculations didn't match the ingame reported distances, and as such coords to a system involving that distance got rejected.

My first example post #1726

Distance in question was Hyades Sector MI-S C4-15->Pisaly
Ingame it was reported as 11.16 LY
But our calculations gave 11.17 LY

Later rw posted another example in post #1733 (at the bottom)

Distance in question was LHS 3093->Col 285 Sector LM-W a31-4
Ingame it was reported as 142.82 LY
But our calculations gave 142.83 LY

Later on rw made the crucial discovery in post #1738 that

given doubles a, b, c: float(a + b + c) != float(float(a + b) + c) for some cases.

And apparently that's how FD somehow do their distance calculation weirdly enough...

The Solution
rw then gave a JavaScript solution in post #1739 which was completely unreadable :D (I think he forgot to use CODE tags - and instead used QUOTE tags - or something...)

I cleaned that up (CODE tags) in post #1749 and furthermore failed at the same conversion feat in C#.

Turns out a bit more is needed in C#, as demonstrated by rw in post #1751

I've played around with that a bit, and eliminated most of all the conversions and parentheses (making it hard to read/understand)

To come up with

Code:
        static float length(float x, float y, float z){
            return 
                (float)Math.Sqrt(
                    (float)(x*x + y*y) + z*z
                );
        }        
        
        static float lengthRounded(float x, float y, float z){
            double p = 100;
            return (float)(Math.Round(length(x,y,z)*p)/p);
        }

Notice that input/output are floats - as that saves a bit on parentheses in the actual methods. The cast from double to float of the actual values can happen outside the method.

The above (slightly adjusted - as rounding precision isn't hardcoded, and length isn't a static) is what goes into TGC in a few minutes.

The above code works for both the previous troublesome distances/lengths.

Here is a full test program that can be copy/pasted to http://rextester.com/runcode if you want to muck around with it.
A/B/C is rw's example
A2/B2/C2 is my example
Code:
//Title of this code
//Rextester.Program.Main is the entry point for your code. Don't change it.

using System;


namespace Rextester
{
    public class Program
    {
        static float length(float x, float y, float z){
            return 
                (float)Math.Sqrt(
                    (float)(x*x+y*y) + (z*z)        
                );
        }        
        
        static float lengthRounded(float x, float y, float z){
            double p = 100;
            return (float)(Math.Round(length(x,y,z)*p)/p);
        }
        
        
        public static void Main(string[] args)
        {
            float A = 63.8125F;
            float B = -120.46875F;
            float C = 42.59375F;            
                        
            float A2 = -3.625F;
            float B2 = 1.96875F;
            float C2 = 10.375F;
                        
            Console.Write(length(A,B,C) );
            Console.Write(" => ");
            Console.WriteLine((double)length(A,B,C));
            
            Console.Write(lengthRounded(A,B,C));
            Console.Write(" => ");
            Console.WriteLine((double)lengthRounded(A,B,C));                    
            
                        
            Console.Write(length(A2,B2,C2));
            Console.Write(" => ");
            Console.WriteLine((double)length(A2,B2,C2));
                        
            Console.Write(lengthRounded(A2,B2,C2));
            Console.Write(" => ");
            Console.WriteLine((double)lengthRounded(A2,B2,C2));             
            
        }
    }
}

output:
142.825 => 142.824996948242
[COLOR="#FFD700"]142.82[/COLOR] => 142.820007324219
11.165 => 11.164999961853
[COLOR="#FFD700"]11.16[/COLOR] => 11.1599998474121
 
Last edited:
The above change have been pushed to TGC.

API doc have been updated:
- Now mentions that dates are UTC dates
- The "will pull all data" note after the Fiddle links have been removed. As that is no longer true and caused confusion.
 
Back
Top Bottom