Play Sessions
Play sessions will lay the framework for detailed game analytics, play counts, and a potential "galaxy rewind" (name TBD) at the end of '24.
Logic flow
on heartbeat (regardless of main playtime counter)
├ is there a play session for this game/user that has an end time within the past 30 minutes?
│ ├ yes
│ │ ╰ has it been at least 58 seconds since the last play session time bump?
│ │ ├ yes
│ │ │ ╰ increment minute count by one, update end time
│ │ │ ├ increment game play count if exactly 3 minutes in this session
│ │ │ ╰ increment game daily play count if exactly 3 minutes in this session
│ │ ╰ no
│ │ ╰ ignore it
│ ╰ no
│ ╰ create new play session document
╰ increase game's daily playtime by one minute
Design decisions
30 minutes is picked as the cutoff time because it provides a nice buffer between pausing & picking up the game vs. distinct sessions
Playtime is incremented for a game regardless of if another game has received a recent heartbeat or not.