Mitcheljager / helldiverstrainingmanual

26 stars 6 forks source link

[Feature request] API with historical total player count #8

Open danielsitnik opened 5 months ago

danielsitnik commented 5 months ago

Hello! First of all, congrats on the awesome work on this website and APIs.

I'd like to suggest an API where we can see the historical total player count. You already sum this value across all planets and display it at the bottom of the map, but it's always the latest value, there isn't a way to see how the total player count evolved over time.

I see two ways of returning this data. Simple array with timestamps and player count for each one:

[
  {
    "created_at": "2024-03-25T13:25:07.28217+00:00",
    "player_count": 30824
  },
  {
    "created_at": "2024-03-25T13:20:10.342921+00:00",
    "player_count": 30206
  }
]

Or an array with timestamps and the breakdown per planet:

[
  {
    "created_at": "2024-03-25T13:25:07.28217+00:00",
    "planets": [
      {
        "planet_index": 212,
        "player_count": 70615
      },
      {
        "planet_index": 197,
        "player_count": 30824
      }
    ]
  },
  {
    "created_at": "2024-03-25T13:20:10.342921+00:00",
    "planets": [
      {
        "planet_index": 212,
        "player_count": 69520
      },
      {
        "planet_index": 197,
        "player_count": 30206
      }
    ]
  }
]

In the second suggestion, the API consumer would need to sum across planets on each timestamp to get the total. But this is essentially the data you already have in this endpoint, it's just grouped by timestamp, might be easier to implement. 😁

What I wanna do with this data? I build apps for the Tidbyt, it's a cool retro-style display to keep track of things you care about.

I already have an app that shows the current total player count: tidbyt

But the Tidbyt has some very nice charting capabilities and it would be very cool to show how the player count evolved in the last 24 hours. This is what a chart looks like:

Mitcheljager commented 5 months ago

Neat idea! I will look into it