Playing with Triton Data

I was inspired by @Qwerty’s api so I started down the road of playing with Triton’s Data. These are the fruits of the last 24 hours.

First thing I did was to write a PHP wrapper for the server’s data API…

phpTriton: a PHP wrapper

Get the client on GitHub: GitHub - wrenoud/phpTriton: A PHP client for the unpublished API for Neptune's Pride II: Triton

It’s really easy to work with:

require "phpTriton/client.php";

$client = new TritonClient($alias, $password);
if($client->authenticate()){
    $game = $client->GetGame($game_id);
    $universe = $game->GetFullUniverse();
}

Another API endpoint

With a client written, I made my own endpoint for getting public game data. The format is subtly different, I wanted it to be compatible with Ember RESTAdapter.

Endpoint: http://triton.theducky.com/api/games/<game number>
i.e. http://triton.theducky.com/api/games/4985364317995008

{
  games: {
    id: "4985364317995008",
    name: "Phi Achernar",
    tick: 92,
    ...
    stars: [...],
    players: [...]
  }
}

Making Charts

With my own api in place I then got to making some Google Charts.

The results of my playing can be seen at http://triton.theducky.com/. A game number can be dynamically enter in the interface, or include it in the url to auto load.

i.e. http://triton.theducky.com/#4985364317995008

I was lacking creativity though. If anyone can think of plots they’d like to see I’ll add them to the interface.

1 Like

This is on so higher level!
[size=12]W[/size][size=16]O[/size][size=20]O[/size][size=24]O[/size][size=28]O[/size][size=32]O[/size][size=36]OOOOOOT![/size]

Now I have this star-to-player@tick relation table, which looks like this

{"42":{
       "1":{"suid":"1","puid":"12","tick":"42"},
       "2":{"suid":"2","puid":"8","tick":"42"},
       "3":{"suid":"3","puid":"4","tick":"42"},
       ...
       },
 "43":{
       "1":{...},
       ...
       },
 ...

it is called like this
http://nptriton.cqproject.net/ticks/42-43/4610412414763008/stars

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

where <range> can be
/x/     shows relation data for tick x
/x-/    shows for tick x and later
/-x/    prior to x, inclusive
/x-y/   from x to y
//      all ticks from database

<game_number> is game number, like
/4610412414763008/

<type> can be 
/stars
/players
/full      (not yet working)

The question is, can you draw it?


More info, such as number of games stored, here.

Here you go :slight_smile: http://triton.theducky.com/tick.html#4610412414763008

1 Like

Neat!! You are awesome! Now can you make it mobile compatible and add alliance support? :stuck_out_tongue:

See “Usage” how I am doing it. Map tweaks (alliances, hide personal info,...)