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

Playtime Tracking #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Playtime Tracking #23

wants to merge 1 commit into from

Conversation

Atdit
Copy link
Contributor

@Atdit Atdit commented Feb 9, 2019

Tracks playtime.

Tracks playtime.
Copy link
Contributor

@lukechatton lukechatton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when the server crashes/restarts and players get kicked out without calling the endpoint?

@Atdit
Copy link
Contributor Author

Atdit commented Feb 10, 2019

What happens when the server crashes/restarts and players get kicked out without calling the endpoint?

Logging in multiple times in a row wouldn't affect the API (apart from not saving playtime of the last session), as the join timestamps are managed on TGM. I don't see a better way of implementing playtime tracking...

@lukechatton
Copy link
Contributor

  1. User logs into server at Date1.
  2. Server crashes.
  3. User joins back a week later at Date2.
  4. User logs out 30 minutes later.

This would add the total time between Date1 and Date2 to the user's play time (a full week).

What about having the server send the api a list of online players every minute or so? Then every time you just add 1 minute to all of the batched players.

@Atdit
Copy link
Contributor Author

Atdit commented Feb 11, 2019

  1. User logs into server at Date1.
  2. Server crashes.
  3. User joins back a week later at Date2.
  4. User logs out 30 minutes later.

This would add the total time between Date1 and Date2 to the user's play time (a full week).

It wouldn't add the total time between Date1 and Date2. It would however ignore the playtime between Date1 and the server crash. Join timestamps are managed by TGM, and whenever a user logs out properly (disconnect or timeout), a request is sent with the join timestamp and the API will add this playtime to the profile. If the API never gets the logout request, the player simply would lose some playtime, but it wouldn't add playtime which never was there when the player joins back.

What about having the server send the api a list of online players every minute or so? Then every time you just add 1 minute to all of the batched players.

I don't think this solution is much better than mine. All playtimes would be cut off by full minutes, and after some months this could add up to several hours in inaccuracy.

If we would add both solutions though it might work.

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

Successfully merging this pull request may close these issues.

2 participants