How I Improved the Battery Life in Busy Buddy v1.0.2
You know how it is. You just struggled to focus for 8 straight hours at a job where you'll never see a paycheck reflecting a reasonable fraction of the value you contribute to work, and you just want an escape. But wait! You used your Playdate to make work a little more tolerable with Busy Buddy! It helped you focus, cheered you up a little, and helped you trudge through your workday. Will it still have the battery life to help you escape into a world of fun indie games?
Yes. Yes it will.
Because when I set out to make Busy Buddy, I made a key rule for myself: you have to be able to play games after your work day. I would not release it if I couldn't accomplish "all-day" battery life. I figured, someone who commutes by train and works around eight to nine hours a day, would need up to 11 hours of battery life. That was my goal, ensure it could last at least 11 hours. There's just one problem. People report the battery life on the Playdate can be as little as 5 hours of gaming, and even Panic says it will last for 8 hours of screen-on time. If this was to work, I had to take battery life seriously.
And I did.
In my testing, you can keep Busy Buddy active for around a little between 12 and 13 hours before this update. The improvements I made were minimal, however, in my testing, I got just 10 minutes shy of the 15 hour mark. Those small improvements really add up! With nearly 15 hours of battery life in the Busy Buddy app, you can easily spend your workday with Busy Buddy open and your commute and time at home with games.
How'd we do it? The Playdate promises up to 8 hours for screen-on time for games. Getting more than that would require making Busy Buddy clever. We couldn't just treat it like any game. We had to think more like we were making a lock screen app or a watch face. Minimal updates to preserve a small battery.
One of the easiest ways to improve battery life is to reduce the frames per second (fps), the refresh rate. If the code isn't being executed as frequently, then it uses less power. For the buddy scenes, this goes as low as 3fps now, down from 4fps in the first release. Next was ensuring that I used timers to manage my sprites, and did nothing else with them. This way, the sprites for the buddy scenes were only being updated when they're created or changed. With no change to the sprites (and no animations... yet), they sip power to keep on the screen.
However, I had other problems. The timer display, focus state and session count, clock, and charging indicators all had to be responsive. That meant they couldn't go minutes without an update, like the buddy could. For this, we use a simple state check. If the state has changed, we update the sprite. If the state has not, we let the sprite stay as it is. Redrawing uses more power than keeping the same sprite visible.
We can do this by overriding the sprite's `update()` function in our classes. We extend the sprite class using the Playdate SDK's classes, and then override the underlying update method to only update the sprite on state change.
For example, my `Clock` class keeps track of the last displayed time. If the time changes since then, which only happens once a minute, then it updates itself. Otherwise, it doesn't change a thing. With screen refreshes low, and redrawing as little as possible, we can stretch battery life even further.
However, setting the fps down to 1fps would be disastrous for other reasons. Pressing the menu button may play the menu sound, but it could take as much as a second to show up on the screen. Scrolling through text would take a second _per line!_ Selecting items in a menu would as well. So, we use three different baseline refresh rates. One for when buddies are visible and you're hopefully focusing, one for responsive menus, and one for reading lines of text. We also never set the FPS below 3fps, which is the minimum threshold I found in my testing for any kind of responsiveness. Anything lower and it's frustrating to use.
This combination of only updating when timers finish, overriding sprite updates so they only update on state changes, and using a low refresh rate, makes Busy Buddy sip battery life. You can pull up the bios for your buddies and it's super smooth, and dismiss them to go back to sipping power. The app constantly feels like it's responsive, but it's just dynamically allocating slower refresh rates on the fly for when you don't need them. With no other updates going on, we can ensure you've got time to focus and time to game.
Any Playdate games or apps could benefit from this. Setting refresh rates lower on menu screens or pause screens, for example, is a great way to use just a little less power in your game. Every little bit could mean minutes of more gaming.
Oh, and I added a new buddy with this update! I can't make a hard rule of that, but I'd love to include at least one new buddy with updates. You'll just have to do a few sessions to meet them! Though perhaps you already have!
Get Busy Buddy
Busy Buddy
A better pomodoro timer, with buddies to keep you on track!
Status | Released |
Category | Tool |
Author | Ellietrick Vibes Software |
Tags | Characters, Playdate, pomodoro |
Languages | English |
Accessibility | Color-blind friendly, High-contrast |
More posts
- 1.0.3 Bug fixes and average FPS reduction34 days ago
Leave a comment
Log in with itch.io to leave a comment.