Are sprite batches the solution to my low FPS?
Posted: Sun Dec 08, 2019 4:30 pm
Hi! I am making a simple tiled, pixel art 2D isometric game and getting fairly low FPS (~10 FPS at 320x240) because of all the overdrawing I end up doing. Profiling my code revealed that the biggest culprit is also the biggest cause of overdrawing (which btw is the player's shadow, currently causing redraws of a lot of tiles around it), and indeed removing that single cause gets me back to mostly solid 60 FPS. (still not solid 60 FPS because I have a few other things causing lots of redraws. Stopping those too gives rock solid 60 FPS)
Not doing so much overdrawing would be the obvious solution to all my problems, but I am completely out of ideas on how to further reduce it by now (and that would probably deserve a whole different thread), and the golden answer to most Löve graphics performance problems seems to be sprite batches, so I thought I'd try to learn a little more about them before reworking all my code to use them.
Considering I am drawing each tile individually (because the player can get behind most), should I expect considerable performance boost from switching to sprite batches? I am currently drawing everything to a buffer canvas before drawing that to the screen.
Also, from what I've read, performance-wise there seems to be no reason to not simply put EVERY SINGLE THING that ever goes on screen in one single gargantuan sprite atlas (well, other than the absolute hell that would be to manage. Speaking from a strictly performance only point of view). Is that what all the cool kids do, or am I missing something?
Thanks in advance!
Not doing so much overdrawing would be the obvious solution to all my problems, but I am completely out of ideas on how to further reduce it by now (and that would probably deserve a whole different thread), and the golden answer to most Löve graphics performance problems seems to be sprite batches, so I thought I'd try to learn a little more about them before reworking all my code to use them.
Considering I am drawing each tile individually (because the player can get behind most), should I expect considerable performance boost from switching to sprite batches? I am currently drawing everything to a buffer canvas before drawing that to the screen.
Also, from what I've read, performance-wise there seems to be no reason to not simply put EVERY SINGLE THING that ever goes on screen in one single gargantuan sprite atlas (well, other than the absolute hell that would be to manage. Speaking from a strictly performance only point of view). Is that what all the cool kids do, or am I missing something?
Thanks in advance!