Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats tracking #19

Open
stfwn opened this issue Aug 13, 2022 · 0 comments
Open

Stats tracking #19

stfwn opened this issue Aug 13, 2022 · 0 comments

Comments

@stfwn
Copy link
Owner

stfwn commented Aug 13, 2022

I'm thinking the following:

  1. A game server calls POST /v1/match/create without any additional info. This creates a Match row in the database with a globally unique id and an autofilled property started. The game server receives, in response: {'id': <some_int>, 'token': <some_secret_token>}.
  2. Whenever it wants, the game server calls POST /v1/match/update with the id, secret token and the info about the match we want to track (TBD). These updates will be stored in a separate table MatchUpdate, which Match has a one-to-many relationship with. The final call to /v1/match/update will include something like {'ended': True}.
    • The ended event allows the Metaserver to process awards, and closes the Match to further MatchUpdates. There will be a cronjob that periodically cleans up old matches that were never marked as closed.
    • The separation between a Match and a MatchUpdate allows a reconstruction of each match. The granularity of the reconstruction depends on the frequency of updates.
    • Updates that are submitted to this route should contain the complete numbers up to that point in the match, not the difference since the last update. E.g. a field 'team_1_resources_mined' should be monotonically increasing with each next update -- the game server doesn't report how many resources were mined since the last update, but since the beginning of the match.
  3. A route GET /v1/match/by-id returns the Match object and all of its MatchUpdates (in chronological order).
  4. A route GET /v1/match/by-server-id returns all Match objects with their MatchUpdates in pages of 50 matches or so.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant