How does the save file time increase while the internal battery is dry??

Yes I know about clock based events not working with an internal dry battery but I was booting up my emerald save and it just hit me, how does the game know how long I'm playing if it's not keeping time???

Posted Feb 20, 2023, 1:43 PM UTC

55
mori_no_ando•

Not a programmer, but it’s probably just a counter that increments in set intervals, using the fact that the game runs at a fixed framerate (60fps iirc) to “keep time”

16
gen3archive•

Programmer here. Youre correct.

8
Dangus-Nublet•

The play time is just based on how many frames have passed while you're playing. But time based events like berry growing and shoal cave are supposed to work even when the game is not running, so counting frames wouldn't work.

7
xPurplepatchxOP•

Ah see my next thought was going to be whatever system they used for the save time they should’ve used for the events, but I forgot that the time based events work when the game isn’t running.

3
Ethanator0810•

There is a frame based timer constantly running, and when the game is saved, that timestamp is saved along with the game's other data.

2