Post new topic Reply to topic  [ 11 posts ] 
Author Message
Team: Neon Syndicate
Rank: Councilor
Main: Piedoom
Level: 383

Joined: Sat Feb 18, 2012 1:01 pm
Posts: 5
Post SS API?
First forum post, I think.
I've been playing off and on for what's probably 6 or 7 years. I've noticed I've been using the wiki a ton, but it's difficult to parse through (especially with just about everything being on the same page).

I found your universe endpoint here, and started making a windows app. Super proof-of-concept, but I'm able to draw Earthforce, always-up-to-date :)

Image

I would like to make a handbook application that I can refer to while playing. However, the wiki is a little outdated and there doesn't seem to be an easy way to access the wikimedia API. Scraping is an option, but I'd love to avoid that headache if possible. I'm wondering if perhaps there is an endpoint that lists all ingame items (like when adding a trade good to a base) or any other cool hidden stuff like an API for teams, etc?

If anyone has info on this I'd love to hear about it.


Sun Jun 05, 2016 4:05 am
Profile
Content Dev
User avatar
Team: JMC
Rank: Director
Main: Blue Dwarf
Level: 2067

Joined: Fri Apr 29, 2011 5:39 pm
Posts: 3336
Post Re: SS API?
Currently there's only the uni map, which is documented on the wiki: http://wiki2.starsonata.com/index.php/A ... end_points

Note that currently the script which updates the json file doesn't run automatically, so that map may be outdated.

An item end point is planned along with an item viewer to go on the website, but it's a pretty hefty project that's gone on hiatus for a bit (as I've wanted to get other things done).

_________________
"What you mean you killed him cha cha cha?!"

Support


Sun Jun 05, 2016 11:32 am
Profile
Team: Neon Syndicate
Rank: Councilor
Main: Piedoom
Level: 383

Joined: Sat Feb 18, 2012 1:01 pm
Posts: 5
Post Re: SS API?
Thanks for the API doc, didn't see that before. That makes deciphering the JSON so much easier, haha.

You're not looking for anyone to help create the item API, are you?


Sun Jun 05, 2016 1:03 pm
Profile
Content Dev
User avatar
Team: JMC
Rank: Director
Main: Blue Dwarf
Level: 2067

Joined: Fri Apr 29, 2011 5:39 pm
Posts: 3336
Post Re: SS API?
senntenial wrote:
You're not looking for anyone to help create the item API, are you?

Not really, we have a pretty good plan for how things are going to work but then Jey said words to the effect of "I want to know what data you want in the db"... I was then writing a script to put together all the item data we'd want (and it'd data type), but it's not complete, probably missing something or got bits incorrect and needs careful checking over. That's pretty much where I stopped working on it.

_________________
"What you mean you killed him cha cha cha?!"

Support


Sun Jun 05, 2016 1:13 pm
Profile
Team: Neon Syndicate
Rank: Councilor
Main: Piedoom
Level: 383

Joined: Sat Feb 18, 2012 1:01 pm
Posts: 5
Post Re: SS API?
Alright. Good luck to you :) I'm curious as to what your technology stack looks like. Would it be easier to provide read access to the database of items, rather than create a generation script?

PS, I'm making the C# wrapper I'm writing available on Github if anyone would like to use it.

https://github.com/piedoom/SonataKit

I'll add a readme soon.


Sun Jun 05, 2016 1:34 pm
Profile
Content Dev
User avatar
Team: JMC
Rank: Director
Main: Blue Dwarf
Level: 2067

Joined: Fri Apr 29, 2011 5:39 pm
Posts: 3336
Post Re: SS API?
I wouldn't put too much effort into your wrapper, particularly for items as you'll probably end up getting stuff wrong.

An example would be that you've put damage, recoil and range as doubles. These are all ints (recoil is expressed as time between shots in ms).

_________________
"What you mean you killed him cha cha cha?!"

Support


Sun Jun 05, 2016 1:58 pm
Profile
Team: Neon Syndicate
Rank: Councilor
Main: Piedoom
Level: 383

Joined: Sat Feb 18, 2012 1:01 pm
Posts: 5
Post Re: SS API?
For scraping and displaying data, it's all fine. If the actual API comes out, it's not a difficult switch. I'm not looking for something to actually interface/control the game at the moment, just a sort of guide handbook since items tend to be listed in a huge conglomerate of difficult to read data on the wiki.

e.g., actually changed damage to a string since it sometimes appears as "78x3", and I don't feel like parsing a special case :lol:


Sun Jun 05, 2016 9:25 pm
Profile
Team: Deep Space Federation
Rank: Operator
Main: Brugle
Level: 4111

Joined: Sun Feb 17, 2013 5:24 am
Posts: 362
Location: Norway
Post Re: SS API?
Could use this google sheet for data on most items:
https://docs.google.com/spreadsheets/d/ ... UXvBrpnR4/

I use it as a "database" for the calculator I created: http://www.andsimo.com/StarSonata
The major reason is that everyone interested can add / correct items in a spreadsheet format, making it easier for people which is not tech savvy.

I believe I created it late last year and the calculator is being used daily, and the google spreadsheet is update around once a week by someone. So it should be quite complete and correct by now.

To import the data I just use the CSV access method.
It's not perfect, but was easy to implement.


Mon Jun 06, 2016 7:43 am
Profile
Team: Deep Space Federation
Rank: Operator
Main: Brugle
Level: 4111

Joined: Sun Feb 17, 2013 5:24 am
Posts: 362
Location: Norway
Post Re: SS API?
Could also use the calculator as a web-service to get DPS, Shieldbank and all other relevant data outputted. So item IDs from the gsheet in, build data out. Could create some documentation for it if you are interested.


Mon Jun 06, 2016 7:53 am
Profile
Team: Neon Syndicate
Rank: Councilor
Main: Piedoom
Level: 383

Joined: Sat Feb 18, 2012 1:01 pm
Posts: 5
Post Re: SS API?
This is awesome! Thanks for sharing. Much easier and consistent to implement than scraping.

I'll have to research on whether google allows for unauthenticated doc API access as I don't want to distribute my own credentials. If not, I can probably just set up a cron to refresh the data into some static json on a personal webpage.


Mon Jun 06, 2016 11:23 pm
Profile
Team: Deep Space Federation
Rank: Operator
Main: Brugle
Level: 4111

Joined: Sun Feb 17, 2013 5:24 am
Posts: 362
Location: Norway
Post Re: SS API?
You can access the file as a CSV file without credentials.

I use the following:
Code:
$spreadsheet_url = "https://docs.google.com/spreadsheets/d/13MB1ymbuKxgRL4fEoo5-wClpAiYNmqFCYsUXvBrpnR4/pub?output=csv&gid=";


and then finish of the link with which sheet I want to retrieve...
Code:
$GID['Modifications'] = 251496243;
$GID['Skills'] = 1208208884;
$GID['Overloaders'] = 1775319891;
$GID['Augmenters'] = 1158805401;
$GID['Shields'] = 744230800;
$GID['Ships'] = 2117238253;
$GID['Energies'] = 1141471262;
$GID['Weapons'] = 1333455837;
$GID['Solar_Panels'] = 1217050268;
$GID['Capacitors'] = 1535628674;
$GID['Diffusers'] = 881774419;
$GID['Hull_Expanders'] = 4075512;
$GID['Radars'] = 238480722;
$GID['Scoops'] = 1479716950;
$GID['Cloaks'] = 2012909520;
$GID['Item_Modifications'] = 197861099;
$GID['Shield_Chargers'] = 332468550;
$GID['Engines'] = 474082480;
$GID['Tractors'] = 541918024;
$GID['Controlbots'] = 2143372701;
$GID['Aura_Generators'] = 1760127730;
$GID['Exterminators'] = 103923532;
$GID['Homing_Beacons'] = 501287872;
$GID['Neurotweaks'] = 1955690791;
$GID['NT_Effects'] = 1052375952;

$GID['Bases'] = 816634533;
$GID['Base_Weapons'] = 865014419;
$GID['Base_Shields'] = 1322666401;
$GID['Base_Energies'] = 1914920427;
$GID['Base_Radars'] = 851064713;
$GID['Base_Shield_Chargers'] = 1196610656;
$GID['Base_Capacitors'] = 1114098460;
$GID['Base_Solar_Panels'] = 1763200637;
$GID['Base_Overloaders'] = 1251261452;
$GID['Base_Aura_Generators'] = 1326620911;
$GID['Base_Diffusers'] = 1136172443;
$GID['Base_Augmenters'] = 1327647102;
$GID['Base_Hull_Expanders'] = 1053577046;
$GID['Base_Extractors'] = 297766484;
$GID['Base_Overchargers'] = 550209243;



Code:
if (($handle = fopen($spreadsheet_url . $GID['Modifications'], "r")) !== FALSE) {
         while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $spreadsheet_data[]=$data;
         }
        fclose($handle);
      }


I hope this makes it easier.


Tue Jun 07, 2016 2:37 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 


Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © phpBB Group.