Using tilemap and horizontal camera movement

,

Hello, apologies in advance for length, this is literally my first post asking for help. Just trying to be thorough. I have a lot of performance questions overall, but this one's been on my mind a lot lately.

I'm working on a game in the SDK and I'm using the tilemap to set tiles down for the player to walk on. It's a 18 x 6 grid so the screen follows the player when they move horizontally until the reach a side.

The borders on the top, bottom and sides are set as individual sprites because I was concerned about having too large of a sprite.

I'm worried about framerate issues though, as the screen has to redraw each frame with horizontal movement. I can already see signs of it on my friend's playdate and I'm worried about playability as people sideload it on their different devices.

The Question(s):

  • Is it better on performance to have one large sprite or multiple smaller sprites?
  • Does the answer change if they don't have collision boxes?
  • Does that change further if they don't have the collisions enabled?

Every border sprite is 36x12, it makes for a total of 42 sprites.

Screenshots:
playdate-walkin

** Note: I found this previous blog post that was on spot, but I cannot read the responses for some reason.

Using 1 large sprite is faster than using multiple smaller sprites (even without collisions enabled).

You usually don't need the SDK collision system to check for collisions in a tile map. Using a simple true/false array (or bit flags if you feel adventurous) is faster.

rpg

Take a look at playdate.graphics.sprite.addWallSprites(...) in the docset, plus there's an example of its use in "..\PlaydateSDK\Examples\Level 1-1\Source" (level.lua).

Hey, much appreciated! That helps clarify things so that I can start improving performance.
I'm thinking about the collision boxes as well. With enemy projectiles that will run into walls, etc. I'll have to get creative :upside_down_face: