HeroicGamesLauncher icon indicating copy to clipboard operation
HeroicGamesLauncher copied to clipboard

Sync playtime with Epic/GOG

Open imLinguin opened this issue 3 years ago • 11 comments

Problem description

Currently playtime is only saved locally, it's not synced between launchers on user devices.

Feature description

After a ended game session let Epic/GOG backends know about time spent in game. If some people wish to not send data like that I think it should be a opt-in or opt-out feature.

Alternatives

No response

Additional information

For gog it's as simple as making a following request.

POST https://gameplay.gog.com/games/GameID/users/UserId/sessions

{"session_date":1641978480,"time":2}

where session_date is a timestamp of game started. time is a number of minutes of the session. I assume there is similar endpoint for Epic.

imLinguin avatar Apr 25 '22 15:04 imLinguin

For legendary I belive Rodney would need to develop it, and I don't know if that would be possible.

flavioislima avatar Apr 25 '22 15:04 flavioislima

For Epic, we have really similar request

PUT https://library-service.live.use1a.on.epicgames.com/library/api/public/playtime/account/<ACCOUNT>/bulk

{
    "playtimeAddList": [{
        "machineId": "X",
        "artifactId": "Macaw",
        "startTime": "2022-04-25T15:54:20.805Z",
        "endTime":   "2022-04-25T15:55:29.972Z"
    }]
}

imLinguin avatar Apr 25 '22 17:04 imLinguin

Hmm, interesting. So then we can open a PR on Legendary or implement this in Heroic directly.

flavioislima avatar Apr 25 '22 19:04 flavioislima

And the counterpart to know how far we have come is:

https://launcher.store.epicgames.com/graphql?operationName=playtimeTracking&variables={"accountId":"ACCOUNTID","artifactId":"Macaw"}&extensions={"persistedQuery":{"version":1,"sha256Hash":"HASH"}}

which returns a json object

{
    "data": {
        "PlaytimeTracking": {
            "artifact": {
                "artifactId": "Macaw",
                "totalTime": 2440
            }
        }
    },
    "extensions": {}
}

Lariaa avatar Jun 04 '22 16:06 Lariaa

I am not sure what is happening above, but I hope you can make it :)

I am just waiting for THIS to install Heroic and don't bother with EGS clunkiness anymore ^^

JFMugen avatar Jun 04 '22 22:06 JFMugen

And the counterpart to know how far we have come is:

https://launcher.store.epicgames.com/graphql?operationName=playtimeTracking&variables={"accountId":"ACCOUNTID","artifactId":"Macaw"}&extensions={"persistedQuery":{"version":1,"sha256Hash":"HASH"}}

which returns a json object

{
    "data": {
        "PlaytimeTracking": {
            "artifact": {
                "artifactId": "Macaw",
                "totalTime": 2440
            }
        }
    },
    "extensions": {}
}

No progress? :/

JFMugen avatar Jul 30 '22 10:07 JFMugen

Done

flavioislima avatar Jul 03 '23 22:07 flavioislima

Epic's still not done yet 👀

imLinguin avatar Jul 03 '23 22:07 imLinguin

Oops

flavioislima avatar Jul 03 '23 23:07 flavioislima

I would love to see this done in a way that accounts for time the device is asleep, specifically for Steam Deck. Steam Deck users often suspend their machine in the middle of play sessions for a long time, so that one hour of play in an evening, then suspending the deck until the following evening gets counted as 24ish hours of playtime instead of one.

I think Steam on Steam Deck tracks game launch and close times, then also the times of sleep and wake events, subtracting the time asleep from playtime after a game is closed. Epic and GOG have no plans to do this natively with their launchers, so you could win over a ton of Steam Deck users if you implement this.

Is this the right place to put this or should I open a new issue as a Feature Request (or do something else)?

JpTiger avatar Jan 07 '24 21:01 JpTiger