17 February 2016

Light years away

I recently noticed the CREST endpoint for getting a character's location has been enabled. As I understand it this is the first step of many towards removing the old and creaky in-game browser. In case you don't know, the in-game browser allows websites access to certain information about the character logged in. I won't go into detail but suffice to say one of the bits of information is the current location. This is particularly useful for mapping tools such as Dotlan's radar function. In wormholes we have our own mapping tools so we can have up-to-date representations of our current constellation and chains. When CCP first mooted the idea to remove the in-game browser the wormhole community was pretty adamant that we would need some other way to find pilots' current location for use in these mapping tools. I have never done anything with the authenticated CREST API. In fact, I've only ever worked with the single sign-on feature in the past, and that code is some nasty mess I threw together. This meant it was time for some learning.

It's pretty easy to move from pure SSO to requesting CREST access scopes. I just had to put the scopes I wanted into the 'scope' parameter in the redirect URL. Once I did that I could use either the one-time access token to request a piece of information from the CREST API, or be more sensible and save the 'refresh_token' as a reusable token to use against the API.  Of course, writing it here makes it all look so easy. I have a terrible history working with APIs so it was a bunch of trial and error that got me to this point. During that trial and error I started talking to the 'systems' endpoint as an easy thing to request. It was while doing that I noticed the systems are listed with x, y and z coordinates. With coordinates for all the systems in EVE I got slightly sidetracked with working out how far away my home wormhole system is from the main EVE cluster. So, to the numbers.

Firstly a calibration test.

  • Sobaseki to Pakkonen has a straight line distance of 37,446,080,319,997,000 of whatever magical units CCP used for New Eden.
  • From the Dotlan jump calculator I can see that corresponds to 3.958 light years. Dividing the large arbitrary units number by the smaller light years number gives a factor to convert between the random CCP units to light years.
  • Pakkonen to EC-P8R has a straight line distance of 80,133,438,607,125,000 which reads as 8.470 light years when divided by the calibration factor.
  • In Dotlan, Pakkonen to EC-P8R shows the same jump as 8.47 light years.
This looks pretty good to me. Time to move on to calculate the distance from my home wormhole to Amarr (because screw Jita).
  • Home to Amarr has a straight line distance of 11,958,622,357,432,000,000 mystery units.
  • Dividing that by the conversion factor yields a distance of 1,264.010 light years.
It's a pretty long single jump between my own corner of Anoikis and my preferred market hub of Amarr. To have my freighter make that jump in one go I would need my Jump Drive Calibration skill to, um, level 1,259. That's quite a long train. I think I'll stick to traveling through holes in space.

Oh yeah, and the location endpoint? Turns out my alt is in Jita...
        "id_str": "30000142",
        "href": "https://crest-tq.eveonline.com/solarsystems/30000142/",
        "id": 30000142,
        "name": "Jita"

No comments:

Post a Comment