API to access public galaxy data

And now it works ! THANKS @Qwerty ! :slight_smile:

@Qwerty Cool! I first tougth this was Jay’s api too, but glad I found it out already… :wink:

I am using your api to track the 1v1 tournaments that are running requlary. Just tought I’d say thanks, it’s working like a charm!

http://np2stats.dysp.info/decembertournament.php

3 Likes

Wow :heart_eyes:, what an honor! I never thought people would be still using it.

I haven’t logged into that server since the last fix. Let me find my ftp client and do some statistics on the logs :slight_smile:

I’ve just checked your site and it’s awesome! Turns out I did have an account there already. My browser was kind enough to remind me :slight_smile:

2 Likes

So, I managed to find an old ftp client on my backups with my credentials and checked the server. I no longer understand the language it is written in :dizzy_face: (PHP). I have no idea what the scripts do any more :sweat_smile:

Anyway, there are 323447 hits on my api and the log is 22 MB. Some 9 games are being checked every 15 minutes :slight_smile:. Those seem to be the tournaments as there are only two players in those games. Seems like only you @Dysp are using it :slight_smile:

There wass also a database of some 700 in-game-player nicks in a database, but the database is no longer used as I stopped the API 2.0 project.

I am glad to see the main api still works though, wow!

And I have also noticed it is possible to provide own credentials to go around the public data limitation.

Welcome Back @Qwerty glad to see you again. Now get into a game. I think I owe you, or you owe me.

1 Like

In the end I spent more time hacking than playing… So, here it goes :slight_smile:

Thank you for doing it and letting it run! It’s awesome!

Yes, that’s me. :wink: @Qwerty does it cost extra for you if I ramp the update speed up? I wanted to go soft and only do updates between 15minutes. We can keep it at that or go as fast as you think is ok. I might also expand it to all games that are added to NP2Stats. NP2Stats is currently tracking 26 other games in addition of the current 8 tournament games.

Honestly, I have no idea :slight_smile:, I am not using that old PHP hosting for ages now and it only hosts few other projects that are used sparingly.

But why even more often anyway? Whatever can happen during that time that you would like to collect the data more often? Though I think you can try it.

I wonder, If you do all the 26 games at once, how long does it take?
BTW: The hosting only has 8 php processes with 30s timeout.

I would like to learn more about your tool, where do I start?
- I read some mentions here in forum, but not many
- I added a game, updated it after a tick and I can see the map. AMAZING!
But I would like to learn more - how does it work? What other features it has?
How is the API Code working . what does it allow you to do with the game?

Just to get more precision on when the turns run. I dont mind it at 15mins, but for example 5 minutes would be more 2021, I think… :wink: I have some experimental features like sending message to mobile when the new tick is available etc, they would slightly benefit from more up to date info. Ticks in turn based games run as soon as last player hits submit, so it can happen any time during the current 15 minutes.

One question back though. How often are you updating data from NP2? Obviously it doesn’t make any sense for me to use 5 minutes, if you update every 30 minutes or so.

I am fetching only one game a at time from your server. And it usually takes a lot less than 1 second for your server to deliver all the data for one game. I can also add “busy loop” to fetch next game only after at least 1000 milliseconds have passed from the start of last query. So it should not stress your resources at all as I wait for the previous query to finish and add some extra delay before fetching the next game.

Thanks. I’m sorry I don’t have an tutorial or manual for it, but using the old interface you use “see stats” to compare the game statistics between any tick against any other tick. Who built what at what tick etc. “See map” you already tested, once you have more ticks in database you will be able to replay the map development. “Set teams” will let you set teams in larger games and see the stats of your own team vs your predicted opposing alliance. You can also create links to share data with your allies etc.

I recommend that you add the game trough the new interface, which is still under work. But adding it from there you will get your game ticks updated automatically. The old system required you to push the “Update data” button each tick you wanted to follow. It’s a bit confusing as it’s mixed old and new UI, but ask if any confusion. :wink:

Parsing data about the tournament pages is pretty much what I use it for now.

You can try shorter intervals, and thank you for doing one at a time with the busy loop.
My API is just a proxy to triton’s server, so you’ll always get fresh data. I mimic the requests the game does on its own. The challenge was just that it needs an authentication cookie with every request, so doing it manually every time was not an option.

Haha, I figured the “Update data”. It indeed was confusing when I was just adding the game for the first time, but no other button did anything, so I pressed it to see what happens next :smiley:. I also did an early version analysis for teams, which my team used during the king of the hill game (it also had an overlay UI on top of the game), but I never finished it and ultimately abandoned it and stopped the API 2.0 project with database altogether.

I wonder, if you’ve done the hard work and you are storing the tick data, would you make your data accessible via API? I would like to build something with it.

Are you sure you wanted to show me this? :grin:
I wonder if I could simplify my code a bit with this, or provide users more data, since the public report of any game is limited.

Although quite the impressive goal, Dysp probably wanted to link one of these :smiley:

Thanks for the great work you two are doing!

@Qwerty Ooh, ok. It was easier to setup the tournament games with your api, which has no auth required. But I already have the “normal” games updated straight from the NP2 servers every 30minutes. I figured out the authentication cookie trick also, so I can use it directly. I was just concerned about the NP2 servers which are at times under heavy traffic and wanted to share the load with your api. But if it’s passthrough, I’ll just leave tournament updates for 15mins and others at 30mins.

Yes, all games which are added to NP2Stats are using Jay’s API and I am storing all the star data etc on my database. I don’t even know how many years of data is there, but DB is getting quite huge. Been meaning to write clean up code for anything older than 2-3 years. :wink:

I could do the API, but I’m kinda slow getting things done at the moment.

@Trucriot Thanks. Got my hobbies mixed a bit. Nothing secret there, but correcting the link. Thanks for the correct link. :wink:

Jay’s API? You mean something official/documented or just the endpoints taken straight from the game?

And as for the link, by what does it allow you to do I meant more like how to use it and what I can get from it. I couldn’t find much about it here in forum. I would like to use the API Code over having to authenticate with a cookie - if that’s for example what it allows one to do?

@Qwerty did you take it down on purpose? :frowning:

Nope, didn’t do anything. What is happening? Let me investigate.

/edit
Yeah OK, the whole page seems to be down. Weird AF.

/edit 2
I will fix that tomorrow. Hosting got updated to new version and everything stopped working. I was postponing the update and eventually I forgot about it until it was mandatory and automatically updated. dang

Thanks :slight_smile: I’ve been using it to collect end-of-game data for statistics, so was sad when it stopped working!

yeah i need this to start working again for uhhh… reasons

Forgive me the delay, but I have zero recollection of ever writing PHP so it was a challenge. I am now using new hosting and a domain due to issues with the old one.
If you find anything that doesn’t work, let me know. I will try my best.

new api url: NP API

old website https://cqproject.net/
new website https://qwerty.xyz/

BTW, I have improved the code and documentation a bit and I also added SSL (https) certificates for security. Now you can safely use your own login credentials to query your own fleet and star data!

Just keep in mind that I could read your password, so use a unique one!

thanks @Qwerty! I just tested my old code to connect changing the URL and all worked fine. Much appreciated.

1 Like

Just a heads up folks,

The NP servers started getting hammered around February this year and my hosting costs have skyrocketed.

I’m going to shutdown the API endpoint for scanning data, and will probably be breaking any existing automated game requests features in the coming weeks.

Jay.