API to access public galaxy data


#1

#API1.0

http://nptriton.cqproject.net/

It returns JSON object

Usage:
/game/<game_number>[/(stars|players|fleets|full|basic)]

Example: http://nptriton.cqproject.net/game/1234567890123456/stars

Unfortunaly it won’t return fleets data unless the game has ended, because they are not publicly available, BUT I may add option to log in - at your own risk. (would you want that?)


API Getting Star Information
Playing with Triton Data
User Script Extensions
Gathering and reviewing game progression
Intel: Total Research
After accepting victory
#2

#API2.0, The NP2 database
I’ve been collecting NP2 data of games I was in since 25.5.
14 games with more than 3 M items in a size of 170 MB.

If you use spread sheets reguralry for your games, have any programming skills or knowledge of plotting data to graphs, or if you are just bored or curious, contact me :wink:

“I am offering complete access to my API, if you make publicly available whatever you create.”

for example: The most desired functionality which started all this is to draw the stored data to a graph and then to switch between the ticks to provide a historical view without the need of making screenshots.

the database; sneak peak

recorded games

The data I record are

Once for every game

  1. games
  2. players
  3. stars

Every two hours

  1. stars_owners_rel
  2. players_data

These are the columns

I am storing pretty much everything except fleet moves.


So,… a script is run every two hours, which loads game numbers from my database and then one by one queries the NP2 servers (using my API) and stores the data back in a database.

It stores the immutable info once and the mutable every two hours.

  • Immutable: game info, player names, star coords, …
  • mutable: star owners, player stats

URL

http://nptriton.cqproject.net/ticks/<range>/<game_number>/<type>

Usage
If you understand regular expressions, this might be the best way to describe the possibilities:

^ticks?(?:/([-,0-9]+))?/([0-9]+)(?:/(stars|players|full)\b)?/?$

range:
/x/    number of tick to show
/x-/   from x
/-x/   to x
/x-y/  from x to y
//     empty for all
/x,y,z-a/  It will also soon accept commas. (not yet ready)

type:
stars, players
full  (not yet working)

Examples:

/ticks/1/1234567890123456/players # displays players data at tick 1
/ticks/72-/1234567890123456/stars
# displays the star data from tick 72 to the end for the game 1234..

Example: http://nptriton.cqproject.net/ticks/42/4610412414763008/stars

*You can see game numbers of stored games in a picture above.


User Script Extensions
KING OF THE HILL - don't believe?
#3

This is cool, I will be exploring it.


Playing with Triton Data
#4

Hi folks,
This seems like a super useful tool.
I try with this:
http://nptriton.cqproject.net/game/5880903038664704/full
but I get a "null"
am I doing something wrong?


#5

@Qwerty 's code has not worked in almost a year. I think Jay told me it may have something to do with his NP2 change to https, and Qwerty has been afk and not maintaining his code.


#7

thanks!
is there anything else like it around?


#8

Thanks for bumping! I fixed the issue with secured http.


#9

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