All scoreboard API never fail when there is no WiFi connected. This results in no callback being called.
This has a couple of consequences.
The score is not cached as the request never fails, losing the score entry, and then it doesn't get re-submitted when they connect their Playdate to the WiFi.
There is no way to pass any userdata in the callbacks. To bypass this issue, I have to chain the requests and do only one at a time. And if the request never fails, I can never trigger the next request.
I finally have a chance to look into this, apologies for the delay! The posting code first appends the score to a cache file and then attempts to sync the file to the server, only deleting the file if it's successful or the server reports an error in the file. I do see that it only tries the sync when posting a score, meaning if the post is attempted while off the network it won't try again until there's another score to post. I tested posting scores while not connected to the network and confirmed it does work that way. The scores were still saved on disk after attempting to post without wifi then when I connected back to the network and posted another score they all make it to the server. I did get a callback on the first attempt to post a score with no network, but not on the next two. I'll look into that now. It'd be nice to have the system automatically check the disk and send any cached scores when the game launches. I'll file that, and also an issue about adding boardID to the PDScore struct.
boardID in the response sounds good! It would still be good to have a void* userdata param on the request, but I understand that would change the API signature.
I'm consistently not getting the callback when offline, but it's good to know that it's reproducible.
And I agree with the sync pending scores function. I imagine it's preferable to be able to do it manually, but the current way of doing it automatically when posting would be nice to still have for older games.
I’ve seen this exact issue being reported from a player perspective on the squad discord - the game remembers its own high score, so doesn’t try and resubmit any lower scores, meaning the player’s “really high” score never gets posted, but because it was high, the player can’t beat that score locally to submit another either.
So yeah, either update the docs to tell devs not to worry about only submitting the highest score, or add a manual score sync function and tell devs to call that periodically!
Would it be a big change to have it at a system level, so the OS/library/Catalog just periodically resyncs any scores that haven’t been submitted?
I can imagine someone beating a game while offline, they’ve got an amazing score, they’ve finished the game. Their incentive to load up the game again and play to the point it submits another score are probably low, so that score remains unsubmitted
These are great points! I hadn't thought about games only posting high scores. I've filed an issue to attempt score sync both when you launch the game and in the normal lock screen background sync. I've got that targeted for 3.1, seems like a pretty straightforward fix.