While developing a game, I noticed some weird behavior with sprites, specifically how the center point of a sprite is calculated. The dev documentation says that sprite position is the center of the image. Because of this, I created my player sprite as 13x13, so that the center wouldn't be offset from the circular image. When I finally added some debug drawing to fix some issues, I noticed that the center wasn't actually in the center of the image. After some more testing, I made some X sprites to help pinpoint the issue.
A 12x12 sprite, with the center point drawn in red:
(Apparently I can only include 1 image, and the 13x13 is more relevant)
A 13x13 sprite, with the center point drawn in red:
This is absolutely not what I was expecting from the documentation. My expectation was that, because of integer math, the 12x12 sprite center would be shifted to the top left of the center 4 pixels. I expected the 13x13 to be on the exact center. If there was an offset, I would have expected it to be offset to the top left, since a truncated integer would move towards 0 and the playdate screen origin is in the top left.
This isn't a big issue for me. I was already able to fix all the bugs this created in my code. But I am very curious if this is the intended behavior for sprite centers. With this behavior, I expect I will have to debug and set the center for each sprite I make individually.
There was a theory on the discord that it had to do with a mismatch between C and Lua code in the SDK. (Apparently I can't link to discord here)